From: Kai Moritz Date: Mon, 24 Sep 2012 11:53:40 +0000 (+0200) Subject: Minimized JavaScript: keyword "var" only once per scope X-Git-Tag: 0.1.0~13 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=e01c7e49b34dc78efbe4a400ce1cfbfe4645c469;p=openx Minimized JavaScript: keyword "var" only once per scope --- diff --git a/openx.js b/openx.js index 94a3bb4..eb85805 100644 --- a/openx.js +++ b/openx.js @@ -4,30 +4,35 @@ (function( openx, $, undefined ) { - var id; - var node; + var - var count = 0; - var slots = {}; - var ads = []; + id, + node, + + count = 0, + slots = {}, + ads = []; openx.show_ads = function(server, zones) { + var + domain = document.location.protocol == 'https:' ? 'https://' + server + ':8443':'http://' + server, + src = domain; + document.write = render; document.writeln = render; - var domain = document.location.protocol == 'https:' ? 'https://' + server + ':8443':'http://' + server; - - var src = domain; src += "/www/delivery/spc.php?zones="; /** Only fetch banners, that are really included in this page */ $('.oa').each(function() { - var node = $(this); - for(var name in zones) { + var + node = $(this), + name, id; + for(name in zones) { if (node.hasClass(name)) { - var id = 'oa_' + ++count; + id = 'oa_' + ++count; slots[id] = node; src += escape(id + '=' + zones[name] + "|"); } @@ -72,9 +77,7 @@ // node.append(id + ": " + node.attr('class')); - var result; - var src; - var inline; + var result, src, inline; while ((result = /