X-Git-Url: http://juplo.de/gitweb/?a=blobdiff_plain;f=openx.js;h=34993451a2c565b79b037c439fb8db975c658927;hb=bcf3be2e38ab96a41118a23e7e96db59655de733;hp=cba60d32733f63c85a82ab0a93e668fb933dbf9c;hpb=bebf36d20d314c5b338063dc02c58c0f5bf26933;p=openx diff --git a/openx.js b/openx.js index cba60d3..3499345 100644 --- a/openx.js +++ b/openx.js @@ -11,13 +11,16 @@ count = 0, slots = {}, - ads = []; + queue = [], + ads = [], + output = []; openx.show_ads = function(server, zones) { var domain = document.location.protocol == 'https:' ? 'https://' + server + ':8443':'http://' + server, + name, src = domain; document.write = document_write; @@ -26,18 +29,19 @@ src += "/www/delivery/spc.php?zones="; /** Only fetch banners, that are really included in this page */ - $('.oa').each(function() { - var - node = $(this), - name, id; - for(name in zones) { + for(name in zones) { + $('.oa').each(function() { + var + node = $(this), + id; if (node.hasClass(name)) { id = 'oa_' + ++count; slots[id] = node; + queue.push(id); src += escape(id + '=' + zones[name] + "|"); } - } - }); + }); + } src += "&nz=1&source=" + escape(OA_source); src += "&r=" + Math.floor(Math.random()*99999999); @@ -55,7 +59,9 @@ function init_ads() { - for (var id in slots) { + var i, id; + for (i=0; i 0) { - id = ads.pop(); + var result, src, inline, i; + + id = ads.shift(); node = slots[id]; + node.slideDown(); + // node.append(id + ": " + node.attr('class')); - var result, src, inline; + /** + * If output was added via document.write(), this output must be + * rendered before other banner-code from the OpenX-server is rendered! + */ + if (output.length > 0) { + output.push(OA_output[id]); + OA_output[id] = ""; + for (i=0; i