From: Kai Moritz Date: Tue, 25 Sep 2012 10:17:54 +0000 (+0200) Subject: Fixed an error in the ordering, output added via document.write is rendered X-Git-Tag: 0.1.0~9 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=bcf3be2e38ab96a41118a23e7e96db59655de733;p=openx Fixed an error in the ordering, output added via document.write is rendered Because output added by an ad-script via document.write() was always prepended to the unrendered rest of the banner-code, the order of the markup was messed up, if an ad-script called document.write() more then once! --- diff --git a/openx.js b/openx.js index a01c775..3499345 100644 --- a/openx.js +++ b/openx.js @@ -12,7 +12,8 @@ count = 0, slots = {}, queue = [], - ads = []; + ads = [], + output = []; openx.show_ads = function(server, zones) { @@ -73,6 +74,8 @@ while (ads.length > 0) { + var result, src, inline, i; + id = ads.shift(); node = slots[id]; @@ -80,7 +83,17 @@ // 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