Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (function() {
- /**
- * Ad Debugger
- * Useful tools for debugging ad issues
- *
- * To use:
- * add '?ad_debug=true' to the end of the URL
- * or call 'ad_debug()' from the console
- *
- * For developers, you can log things by doing
- * >> FTBAds.log.push('something I am logging'); // String syntax
- * >> FTBAds.log.push(['%cstring to log', 'color: red']); // Array syntax
- */
- // A flag to log data
- var ad_debug_on = GET().ad_debug,
- debug_log = [];
- window.ad_debug = function() {
- if (FTBAds.ads && FTBAds.ads.info) {
- console.log('%c** Special Configuration **', 'Color:red; font-weight: bold;');
- _.forEach(FTBAds.ads.info, function(d, type){
- console.log('%cSetup on: ', 'font-weight: bold;', type === 'network' ? FTB.net_name : FTB.app_name);
- _.forEach(d.config, function(c, prop){
- console.log('%cProperty: ', 'font-weight: bold;', prop);
- var page_type = _.keys(c)[0];
- if (c[page_type]) {
- console.log('%cAd Units: ', 'font-weight: bold;', c[page_type].join(', '));
- }
- });
- console.log('');
- });
- console.log('');
- } else {
- console.log('%c** NO Special Configuration **', 'Color:green; font-weight: bold;');
- }
- _.forEach(debug_log, function(d){
- if (_.isArray(d)) {
- console.log.apply(console, d);
- } else {
- console.log(d);
- }
- });
- };
- // If we set the ?ad_debug=true flag, log all calls to ad_debug2 as they are called
- if (ad_debug_on) {
- // Call this immediately
- window.ad_debug();
- // Overwrite the debug_log.push method to log things too!
- debug_log.push = function(d){
- this[this.length] = d;
- if (_.isArray(d)) {
- console.log.apply(console, d);
- } else {
- console.log(d);
- }
- };
- }
- // Export the logger to FTBAds.log
- FTBAds.log = debug_log;
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement