projects
/
openx
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
4d83599
)
Added debugging-output (debugging can be turned on/off via options)
author
Kai Moritz
<kai@juplo.de>
Thu, 28 Feb 2013 18:36:40 +0000
(19:36 +0100)
committer
Kai Moritz
<kai@juplo.de>
Thu, 28 Feb 2013 22:40:19 +0000
(23:40 +0100)
jquery.openx.js
patch
|
blob
|
history
diff --git
a/jquery.openx.js
b/jquery.openx.js
index
889a539
..
3ccdb39
100644
(file)
--- a/
jquery.openx.js
+++ b/
jquery.openx.js
@@
-108,6
+108,7
@@
* If the value is choosen to small, a recalculation
* might be scheduled, while resizing is still in
* progress. DEFAULT: 200.
* If the value is choosen to small, a recalculation
* might be scheduled, while resizing is still in
* progress. DEFAULT: 200.
+ * debug: boolean Turn on/off console-debugging. DEFAULT: false.
*/
$.openx = function( options ) {
*/
$.openx = function( options ) {
@@
-141,7
+142,8
@@
'selector': '.oa',
'min_prefix': 'min_',
'max_prefix': 'max_',
'selector': '.oa',
'min_prefix': 'min_',
'max_prefix': 'max_',
- 'resize_delay': 200
+ 'resize_delay': 200,
+ 'debug': false
},
options
);
},
options
);
@@
-153,6
+155,9
@@
if (settings.protocol === 'https:' && settings.https_port)
domain += ':' + settings.https_port;
if (settings.protocol === 'https:' && settings.https_port)
domain += ':' + settings.https_port;
+ if (settings.debug && console.debug)
+ console.debug('Ad-Server: ' + domain);
+
/**
* Without this option, jQuery appends an timestamp to every URL, that
* is fetched via $.getScript(). This can mess up badly written
/**
* Without this option, jQuery appends an timestamp to every URL, that
* is fetched via $.getScript(). This can mess up badly written
@@
-198,6
+203,12
@@
}
rendered[id] = false;
visible[id] = false;
}
rendered[id] = false;
visible[id] = false;
+ if (settings.debug && console.debug)
+ console.debug(
+ 'Slot ' + count + ': ' + this.id + ' (' + min_width[id]
+ + (max_width[id] != Number.MAX_VALUE ? '-' + max_width[id] : '')
+ + ')'
+ );
}
});
}
}
});
}
@@
-216,6
+227,8
@@
function recalculate_visible() {
width = $(document).width();
function recalculate_visible() {
width = $(document).width();
+ if (settings.debug && console.debug)
+ console.debug('Scheduling recalculation of visible banners for width ' + width);
if (!rendering)
fetch_ads();
if (!rendering)
fetch_ads();
@@
-226,6
+239,9
@@
/** Guide rendering-process for early restarts */
rendering = true;
/** Guide rendering-process for early restarts */
rendering = true;
+ if (settings.debug && console.debug)
+ console.debug('Starting recalculation of visible banners for width ' + width);
+
var name, src = domain + settings.delivery + '/spc.php';
/** Order banners for all zones that were found on the page */
var name, src = domain + settings.delivery + '/spc.php';
/** Order banners for all zones that were found on the page */
@@
-237,14
+253,20
@@
queue.push(id);
src += escape(id + '=' + OA_zones[slots[id].id] + "|");
rendered[id] = true;
queue.push(id);
src += escape(id + '=' + OA_zones[slots[id].id] + "|");
rendered[id] = true;
+ if (settings.debug && console.debug)
+ console.debug('Fetching banner ' + slots[id].id);
}
else {
/** Unhide already fetched visible banners */
}
else {
/** Unhide already fetched visible banners */
+ if (settings.debug && console.debug)
+ console.debug('Unhiding already fetched banner ' + slots[id].id);
$(slots[id]).slideDown();
}
}
else {
/** Hide unvisible banners */
$(slots[id]).slideDown();
}
}
else {
/** Hide unvisible banners */
+ if (settings.debug && console.debug)
+ console.debug('Hiding banner ' + slots[id].id);
$(slots[id]).hide();
}
}
$(slots[id]).hide();
}
}
@@
-308,6
+330,9
@@
id = queue.shift();
node = $(slots[id]);
id = queue.shift();
node = $(slots[id]);
+ if (settings.debug && console.debug)
+ console.debug('Rendering banner ' + slots[id].id);
+
node.slideDown();
// node.append(id + ": " + node.attr('class'));
node.slideDown();
// node.append(id + ": " + node.attr('class'));
@@
-367,6
+392,9
@@
node = undefined;
rendering = false;
node = undefined;
rendering = false;
+ if (settings.debug && console.debug)
+ console.debug('Recalculation of visible banners done!');
+
/** Restart rendering, if new task was queued */
if (width)
fetch_ads();
/** Restart rendering, if new task was queued */
if (width)
fetch_ads();