From 1a5c6ae43875f7a234fae919f9fd85b9574c3d8c Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Thu, 28 Feb 2013 23:40:45 +0100 Subject: [PATCH] Added marker to specify, wether min/max-width references page or container --- jquery.openx.js | 37 ++++++++++++++++++++++++------------- openx.jquery.json | 2 +- 2 files changed, 25 insertions(+), 14 deletions(-) diff --git a/jquery.openx.js b/jquery.openx.js index 3ccdb39..5029248 100644 --- a/jquery.openx.js +++ b/jquery.openx.js @@ -31,7 +31,8 @@ slots = {}, min_width = {}, max_width = {}, - width, + is_pagewidth = {}, + pagewidth, rendered = {}, visible = {}, rendering = false, @@ -100,9 +101,11 @@ * 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_". + * CSS-class. DEFAULT: "min_". * max_prefix: string Prefix for the encoding of the maximal width as - * CSS-classname. DEFAULT: "max_". + * CSS-class. DEFAULT: "max_". + * pw_marker: string CSS-class, that marks the encoded maximal and minmal + * width as page width. DEFAULT: "pw". * resize_delay: number Number of milliseconds to wait, before a * recalculation of the visible ads is scheduled. * If the value is choosen to small, a recalculation @@ -142,6 +145,7 @@ 'selector': '.oa', 'min_prefix': 'min_', 'max_prefix': 'max_', + 'pw_marker': 'pw', 'resize_delay': 200, 'debug': false }, @@ -192,22 +196,25 @@ slots[id] = this; min_width[id] = 0; max_width[id] = Number.MAX_VALUE; + is_pagewidth[id] = false; classes = this.className.split(/\s+/); for (i=0; i= min_width[id] && width <= max_width[id]; if (visible[id]) { if (!rendered[id]) { @@ -297,7 +308,7 @@ src += "&source=" + escape(OA_source); /** Signal, that this task is done / in progress */ - width = undefined; + pagewidth = undefined; /** Fetch data from OpenX and schedule the render-preparation */ $.getScript(src, init_ads); @@ -396,7 +407,7 @@ console.debug('Recalculation of visible banners done!'); /** Restart rendering, if new task was queued */ - if (width) + if (pagewidth) fetch_ads(); } diff --git a/openx.jquery.json b/openx.jquery.json index 2e8f5b2..54fb3cf 100644 --- a/openx.jquery.json +++ b/openx.jquery.json @@ -3,7 +3,7 @@ "title": "jQuery OpenX", "description": "jQuery plugin, that loads banner-ads from an OpenX-server in an asynchronous and responsive way", "keywords": [ "openx", "adserver", "banner", "asynchrone", "responsive" ], - "version": "0.2.0", + "version": "0.2.1", "author": { "name": "Kai Moritz", "email": "kai@juplo.de" }, "licenses": [ { "type": "LGPLv3", "url": "http://www.gnu.org/licenses/lgpl-3.0.html" } ], "homepage": "http://juplo.de/openx", -- 2.20.1