X-Git-Url: https://juplo.de/gitweb/?a=blobdiff_plain;f=jquery.openx.js;h=a9827af68845a1f94f5218512671b27dc7d4c047;hb=8a2862a2007c8b9abe63007ddd5611e5ebd20bea;hp=3da06071da8ce89cc5474e80114cf634128abcb3;hpb=6023a2e4fce5ba44907e86077e952b2eec9f48f4;p=openx diff --git a/jquery.openx.js b/jquery.openx.js index 3da0607..a9827af 100644 --- a/jquery.openx.js +++ b/jquery.openx.js @@ -29,8 +29,10 @@ count = 0, slots = {}, + min_width = {}, + max_width = {}, + width, queue = [], - ads = [], output = []; @@ -59,6 +61,13 @@ * (only needed, when it is not the default-value 443). * * + * Seldom needed special Server-Settings (these parameters are only needed, + * if the default delivery-configration of the OpenX-Server was changed): + * + * path: string Path to delivery-scripts. DEFAULT: "/www/delivery". + * fl: string Flash-Include-Script. DEFAULT: "fl.js". + * + * * Delivery-Options (for details and explanations see the see: * http://www.openx.com/docs/2.8/userguide/single%20page%20call): * @@ -79,11 +88,20 @@ * charset: string Charset used, when delivering the banner-codes. * If empty, the charset is guessed by OpenX. Examples * for sensible values: "UTF-8", "ISO-8859-1". + * + * + * Other settings: + * + * 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-classname. DEFAULT: "min_". + * max_prefix: string Prefix for the encoding of the maximal width as + * CSS-classname. DEFAULT: "max_". */ $.openx = function( options ) { - var name, src, errors = [], i; - if (domain) { if (console.error) { console.error('jQuery.openx was already initialized!'); @@ -98,12 +116,9 @@ _options = options; - if (!options.server) - errors.push('Required option "server" is missing!'); - if (errors.length > 0) { + if (!options.server) { if (console.error) { - for (i=0; i= min_width[id] && width <= max_width[id]) { + queue.push(id); + src += escape(id + '=' + OA_zones[slots[id].id] + "|"); + } + } src += '&nz=1'; // << We want to fetch named zones! /** @@ -187,25 +237,20 @@ if (typeof OA_source !== 'undefined') src += "&source=" + escape(OA_source); - /** Chain-load the scripts (next script to load is fl.js */ - $.getScript(src, load_flash); - - } - - function load_flash() { - - $.getScript(domain + '/www/delivery/fl.js', init_ads); + /** Fetch data from OpenX and schedule the render-preparation */ + $.getScript(src, init_ads); } function init_ads() { - var i, id; + var i, id, ads = []; for (i=0; i 0) { + while (queue.length > 0) { var result, src, inline; - id = ads.shift(); - node = slots[id]; + id = queue.shift(); + node = $(slots[id]); node.slideDown(); @@ -264,7 +309,7 @@ /** script-tag with src-URL! */ if (OA_output[id].length > 0) /** The banner-code was not rendered completely yet! */ - ads.unshift(id); + queue.unshift(id); /** Load the script and halt all work until the script is loaded and executed... */ $.getScript(result[1], render_ads); // << jQuery.getScript() generates onload-Handler for _all_ browsers ;) return; @@ -291,7 +336,7 @@ for (var i=0; i