openx
11 years agoAdded marker to specify, wether min/max-width references page or container 0.2.1
Kai Moritz [Thu, 28 Feb 2013 22:40:45 +0000 (23:40 +0100)]
Added marker to specify, wether min/max-width references page or container

11 years agoAdded debugging-output (debugging can be turned on/off via options)
Kai Moritz [Thu, 28 Feb 2013 18:36:40 +0000 (19:36 +0100)]
Added debugging-output (debugging can be turned on/off via options)

11 years agoFetch on resize: added resize-event that hides/shows banners accordingly 0.2.0
Kai Moritz [Thu, 28 Feb 2013 17:32:57 +0000 (18:32 +0100)]
Fetch on resize: added resize-event that hides/shows banners accordingly

11 years agoRemoved obsolet default-value "cache"
Kai Moritz [Thu, 28 Feb 2013 16:46:37 +0000 (17:46 +0100)]
Removed obsolet default-value "cache"

11 years agoFetch on resize: "rendered" keeps track of already fetched banners
Kai Moritz [Thu, 28 Feb 2013 16:08:38 +0000 (17:08 +0100)]
Fetch on resize: "rendered" keeps track of already fetched banners

11 years agoFetch on resize: initial fetch considers min/max-widths
Kai Moritz [Thu, 28 Feb 2013 15:47:04 +0000 (16:47 +0100)]
Fetch on resize: initial fetch considers min/max-widths

11 years agoFetch on resize: min/max-widths are collected from "class"
Kai Moritz [Thu, 28 Feb 2013 14:22:45 +0000 (15:22 +0100)]
Fetch on resize: min/max-widths are collected from "class"

11 years agoFetch on resize: separated zone-analysis from fetching
Kai Moritz [Thu, 28 Feb 2013 14:11:05 +0000 (15:11 +0100)]
Fetch on resize: separated zone-analysis from fetching

11 years agoReplaced doubled variable ads with queue
Kai Moritz [Thu, 28 Feb 2013 11:30:58 +0000 (12:30 +0100)]
Replaced doubled variable ads with queue

Both variables queue and ads served the same purpose. Hence, the doubled
variable was removed: queue now does the deal alone.

11 years agoThe selector for picking the DOM-elements is now configurable 0.1.3
Kai Moritz [Thu, 28 Feb 2013 00:03:53 +0000 (01:03 +0100)]
The selector for picking the DOM-elements is now configurable

11 years agoAdded special delivery-configuration-options 0.1.2
Kai Moritz [Wed, 27 Feb 2013 23:31:19 +0000 (00:31 +0100)]
Added special delivery-configuration-options

11 years agoFixed bug: missing "=" for parameter "target"
Kai Moritz [Wed, 27 Feb 2013 22:53:53 +0000 (23:53 +0100)]
Fixed bug: missing "=" for parameter "target"

11 years agoZone-Names are now read from OA_zones, just like in the OpenX-code 0.1.1
Kai Moritz [Wed, 27 Feb 2013 18:54:58 +0000 (19:54 +0100)]
Zone-Names are now read from OA_zones, just like in the OpenX-code

11 years agoThe server- and delivery-settings are now fully configurable
Kai Moritz [Wed, 27 Feb 2013 18:26:09 +0000 (19:26 +0100)]
The server- and delivery-settings are now fully configurable

11 years agoThe Plugin stops its work and logs an error, if a required option is missing
Kai Moritz [Wed, 27 Feb 2013 08:56:44 +0000 (09:56 +0100)]
The Plugin stops its work and logs an error, if a required option is missing

11 years agoAdded some more keywords in the jQuery-Manifest
Kai Moritz [Wed, 27 Feb 2013 08:40:02 +0000 (09:40 +0100)]
Added some more keywords in the jQuery-Manifest

11 years agoPlugin shows configuration from first call, when its initialized twice
Kai Moritz [Wed, 27 Feb 2013 08:38:55 +0000 (09:38 +0100)]
Plugin shows configuration from first call, when its initialized twice

11 years agoSwitched configuration to an options-object
Kai Moritz [Wed, 27 Feb 2013 00:03:11 +0000 (01:03 +0100)]
Switched configuration to an options-object

Appart from the server-name, one can configure the used protocol and the
port-numbers for the http- and the https-protocol now.

11 years agoAdded a jQuery-Manifest 0.1.0
Kai Moritz [Tue, 26 Feb 2013 22:51:33 +0000 (23:51 +0100)]
Added a jQuery-Manifest

11 years agoChanged the script into a jquery-plugin
Kai Moritz [Tue, 26 Feb 2013 21:31:06 +0000 (22:31 +0100)]
Changed the script into a jquery-plugin

11 years agoAdded copyright- and license-information
Kai Moritz [Tue, 26 Feb 2013 17:39:24 +0000 (18:39 +0100)]
Added copyright- and license-information

11 years agoChained loading of /delivery/spc.php and /delivery/fl.js
Kai Moritz [Tue, 26 Feb 2013 14:59:00 +0000 (15:59 +0100)]
Chained loading of /delivery/spc.php and /delivery/fl.js

Browsers, that load these two URL's scripts asynchronigly, might execute
the delivered banner-codes, before fl.js is loaded completely and, hence,
produce an error, if a banner-code referes code from fl.js.

11 years agoPrevent an error, if OA_source is not defined
Kai Moritz [Wed, 30 Jan 2013 10:32:00 +0000 (11:32 +0100)]
Prevent an error, if OA_source is not defined

11 years agoFixed for banner-codes, that does not enclose the src-attribute in quotes
Kai Moritz [Tue, 30 Oct 2012 13:47:43 +0000 (14:47 +0100)]
Fixed for banner-codes, that does not enclose the src-attribute in quotes

The HTML-standard allows, to write the attributes of an tag without
enclosing quotes. That was not considered in the regular expression, that
parses the <script>-tag.

11 years agoPolishing the code...
Kai Moritz [Tue, 25 Sep 2012 16:01:18 +0000 (18:01 +0200)]
Polishing the code...

11 years agoFixed errors with banner-codes, that assume unaltered URL's
Kai Moritz [Tue, 25 Sep 2012 15:42:56 +0000 (17:42 +0200)]
Fixed errors with banner-codes, that assume unaltered URL's

jQuery by default appends a timestamp to every URL, that is called via
jQuery.getScript(), to prevent caching.

This alteration might confuse badly written third-party-ad-scripts, that
assume an explicit format, when parsing URL's.

11 years agoAnother fix to the render-order, for from document.write() collected output
Kai Moritz [Tue, 25 Sep 2012 15:04:12 +0000 (17:04 +0200)]
Another fix to the render-order, for from document.write() collected output

If inline-code was executed directly via jQuery.globalEval(), the
collected output from calls to document.write() was not written
emidiately. Because of that, the ordering of the rendered output was
messed up.

11 years agoFixed an error in the ordering, output added via document.write is rendered
Kai Moritz [Tue, 25 Sep 2012 10:17:54 +0000 (12:17 +0200)]
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!

11 years agoAd-banners are now fetched in the given order
Kai Moritz [Mon, 24 Sep 2012 21:56:47 +0000 (23:56 +0200)]
Ad-banners are now fetched in the given order

Ad-banners are now fetched in the order, that is defined in the variable
"zones". The work-queue "ads" is now stored in an array, because it is not
guarantied, that the JavaScript-engine iterates over the attributes of an
object in the same order, they were added.

11 years agoOnly delivered ads will be shown
Kai Moritz [Mon, 24 Sep 2012 13:10:40 +0000 (15:10 +0200)]
Only delivered ads will be shown

HTML-elements marked with "oa" can now be hidden via CSS. openx.js will
unhide them only, if OpenX really delivers a suitable ad-banner

11 years agoSimplified code
Kai Moritz [Mon, 24 Sep 2012 12:19:28 +0000 (14:19 +0200)]
Simplified code

 * Improved method-naming.
 * Simplified code in function render_ads(): instead of a recursive call,
   a while-loop is used now.

11 years agoMinimized JavaScript: keyword "var" only once per scope
Kai Moritz [Mon, 24 Sep 2012 11:53:40 +0000 (13:53 +0200)]
Minimized JavaScript: keyword "var" only once per scope

11 years agoFix for two errors, that only appear under IE 8
Kai Moritz [Thu, 20 Sep 2012 12:42:54 +0000 (14:42 +0200)]
Fix for two errors, that only appear under IE 8

 * The Internet-Explorer stumbles, when feeded with JavaScript-code that
   includes the leading "<!--", that is often used to deter older browsers
   from executing the code. Therefore this markup is filtered from the code
   before it is executed via jQuery.globalEval(). The trailing "//-->" does
   not have to be filtered, because it is a valid JavaScript-comment.
 * A global variable "OA_output" is defined, because IE 8 would complain
   loudly otherwise.

11 years agoScript-Code is now loaded and executed via $.getScript() and $.globalEval()
Kai Moritz [Wed, 19 Sep 2012 11:00:50 +0000 (13:00 +0200)]
Script-Code is now loaded and executed via $.getScript() and $.globalEval()

The script now utilizes jQuery.getScript(url,callback) and
jQuery.globalEval(code) when loading or executing the code of the detected
script-tags, because these functions work around several issues in older
browsers like IE 8 and Co.

TODO:
 * The gloabal variable OA_output, in which the OpenX-scirpt spc places the
   fetched banner-codes, is not defined under IE8, when the callback is
   called after loading the script. Does the jQuery-function getScript()
   not wait for the script, like suggested by the function-name?

11 years agoThe script overwrites document.write in order to serialize all rendering
Kai Moritz [Tue, 26 Feb 2013 12:58:33 +0000 (13:58 +0100)]
The script overwrites document.write in order to serialize all rendering

The first version of openx.js had sometimes freezed the IE 8. The cause of
this probably was a race-condition while moving the nodes with the banner
to their final destination.

Because of that, the script serializes all modifications of the DOM
strictly now. Implementation-Details:
 * The HTML delivered by OpenX is parsed, in order to detect included
   script-tags.
 * HTML-code is written to the destination-node directly.
 * script-tags, that load additional code are loaded via a script-node,
   that is appended to the end of the page. The script waits, until the
   additional code is loaded, by adding an onload-event to the appended
   script-node.
 * script-tags with inline-code are executed directly via eval().
 * Calls to document.write() in the additional scripts are catched. To
   achieve that, openx.js overwrites document.write with its own
   implementation, that simply adds the code to an execution-queue, that
   is processed, when the onload-event fires or when the eval()-call
   returns.

TODO:
 * Not tested with IE!

11 years agoInitial version of the script for asynchronous ad-fetching from OpenX
Kai Moritz [Tue, 26 Feb 2013 10:35:54 +0000 (11:35 +0100)]
Initial version of the script for asynchronous ad-fetching from OpenX

openx.js replaces the OpenX-script spcjs.php. It is modified in such a
way, that it can be called at the bottom of the HTML-page, just before the
closing </body>-tag, so that the ads are loaded, when the rendering of the
page is already completed and, thus, do not block the rendering of the
page.

Implementation-details:
 * openx.js searches via jQery for DOM-elements, that are marked with the
   CSS-class "oa". It fetches banners for all found elements (which banners
   are to fetch is encoded in a second CSS-class).
 * openx.js takes seperate steps to
   1. fetch the banners,
   2. render them in the page and
   3. show them.
   This is necessary, because most of the second-party ad-scripts work
   with document.write(), so that the created banners first become
   accessable via the DOM, when the script returns.
 * Banners are rendert first into a div-block marked with "display:none".
   They are moved to their final destination afterwards. This is necessary,
   because "document.write()" always writes to the actual position of the
   HTML-document, that is the position, where the browser found the
   openx.js-script he is just executing. Hence, all ad-scripts that call
   "document.write()" itself, would render their banner at the bottom of
   the page, albeit the script itself was appended to the right DOM
   -element. The Banners are renderd in a hidden div-block, because it has
   shown, that some ad-scripts produce errors, when they are moved, so that
   the ad was visible in two places afterwards: the div-block at the end of
   the page and at the intended position.

TODO:
 * Not tested with IE yet!