X-Git-Url: http://juplo.de/gitweb/?a=blobdiff_plain;f=jquery.openx.js;h=5029248deace1695ce6aff2db2e03865293417ef;hb=1a5c6ae43875f7a234fae919f9fd85b9574c3d8c;hp=d687dfad87cfa2a89c808c34ccfae52df7d43257;hpb=8bf0530c43be94c835d313b572da3569a4c878b8;p=openx diff --git a/jquery.openx.js b/jquery.openx.js index d687dfa..5029248 100644 --- a/jquery.openx.js +++ b/jquery.openx.js @@ -29,6 +29,14 @@ count = 0, slots = {}, + min_width = {}, + max_width = {}, + is_pagewidth = {}, + pagewidth, + rendered = {}, + visible = {}, + rendering = false, + resize_timer, queue = [], output = []; @@ -92,6 +100,18 @@ * selector: string A selector for selecting the DOM-elements, that * should display ad-banners. DEFAULT: ".oa". * See: http://api.jquery.com/category/selectors/ + * min_prefix: string Prefix for the encoding of the minmal width as + * CSS-class. DEFAULT: "min_". + * max_prefix: string Prefix for the encoding of the maximal width as + * CSS-class. DEFAULT: "max_". + * pw_marker: string CSS-class, that marks the encoded maximal and minmal + * width as page width. DEFAULT: "pw". + * resize_delay: number Number of milliseconds to wait, before a + * recalculation of the visible ads is scheduled. + * 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 ) { @@ -123,7 +143,11 @@ 'delivery': '/www/delivery', 'fl': 'fl.js', 'selector': '.oa', - 'cache': true + 'min_prefix': 'min_', + 'max_prefix': 'max_', + 'pw_marker': 'pw', + 'resize_delay': 200, + 'debug': false }, options ); @@ -135,6 +159,9 @@ 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 @@ -158,28 +185,101 @@ for(name in OA_zones) { $(settings.selector).each(function() { var - id; + id, + classes, + i, + min = new RegExp('^' + settings.min_prefix + '([0-9]+)$'), + max = new RegExp('^' + settings.max_prefix + '([0-9]+)$'), + match; if (this.id === name) { id = 'oa_' + ++count; slots[id] = this; + min_width[id] = 0; + max_width[id] = Number.MAX_VALUE; + is_pagewidth[id] = false; + classes = this.className.split(/\s+/); + for (i=0; i