From: Kai Moritz Date: Tue, 25 Sep 2012 16:01:18 +0000 (+0200) Subject: Polishing the code... X-Git-Tag: 0.1.0~6 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=336910f389e7cc11a37dabc5e99d87d0f7f53c87;p=openx Polishing the code... --- diff --git a/openx.js b/openx.js index ce94f71..bfd49a5 100644 --- a/openx.js +++ b/openx.js @@ -31,9 +31,6 @@ */ $.ajaxSetup({ cache: true }); - document.write = document_write; - document.writeln = document_write; - src += "/www/delivery/spc.php?zones="; /** Only fetch banners, that are really included in this page */ @@ -74,6 +71,9 @@ ads.push(id); } + document.write = document_write; + document.writeln = document_write; + render_ads(); } @@ -126,7 +126,9 @@ } else { /** script-tag with src-URL! */ - ads.unshift(id); // << The banner might not be rendered fully, or include more calls to document.write(). + if (OA_output[id].length > 0) + /** The banner-code was not rendered completely yet! */ + ads.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; @@ -147,6 +149,9 @@ /** This function is used to overwrite document.write and document.writeln */ function document_write() { + if (id == undefined) + return; + for (var i=0; i