X-Git-Url: https://juplo.de/gitweb/?p=openx;a=blobdiff_plain;f=jquery.openx.js;h=d02b228bc2726ce320c391770ea851cd8a0bfefb;hp=5029248deace1695ce6aff2db2e03865293417ef;hb=HEAD;hpb=1a5c6ae43875f7a234fae919f9fd85b9574c3d8c diff --git a/jquery.openx.js b/jquery.openx.js index 5029248..d02b228 100644 --- a/jquery.openx.js +++ b/jquery.openx.js @@ -97,6 +97,15 @@ * * Other settings: * + * source: array An optional array of JavaScript-Objects, that + * define prefixes and suffixes, that should be + * added to source-tag defined in OA_source. Each + * object can (should) specify the properties "min" + * and "max". OA_source will only be altered, when + * min <= page-width <= max is true. If this is the + * case, the property "prefix" will be prepended to + * OA_source and the property "suffix" will be + * appended. * selector: string A selector for selecting the DOM-elements, that * should display ad-banners. DEFAULT: ".oa". * See: http://api.jquery.com/category/selectors/ @@ -110,7 +119,7 @@ * recalculation of the visible ads is scheduled. * If the value is choosen to small, a recalculation * might be scheduled, while resizing is still in - * progress. DEFAULT: 200. + * progress. DEFAULT: 500. * debug: boolean Turn on/off console-debugging. DEFAULT: false. */ $.openx = function( options ) { @@ -146,7 +155,7 @@ 'min_prefix': 'min_', 'max_prefix': 'max_', 'pw_marker': 'pw', - 'resize_delay': 200, + 'resize_delay': 500, 'debug': false }, options @@ -220,6 +229,14 @@ }); } + /** Cleanup data for responsive source-tag's */ + for (i=0; i= settings.source[i].min + && pagewidth <= settings.source[i].max + ) { + source_prefix = settings.source[i].prefix + source_prefix; + source_suffix = source_suffix + settings.source[i].suffix; + } + } + /** Add the source-code - if present */ - if (typeof OA_source !== 'undefined') - src += "&source=" + escape(OA_source); + if (typeof OA_source !== 'undefined' + || source_prefix != '' + || source_suffix != '' + ) { + if (settings.debug && console.debug) + console.debug('OA_source: ' + source_prefix + OA_source + source_suffix); + src += "&source=" + escape(source_prefix + OA_source + source_suffix); + } /** Signal, that this task is done / in progress */ pagewidth = undefined; @@ -378,7 +417,13 @@ /** Remove leading HTML-comments, because IE will stumble otherwise */ inline = inline.slice(result[0].length,inline.length); } - $.globalEval(inline); + try { + $.globalEval(inline); + } + catch(e) { + if (console.error) + console.error('Error while executing inline script-code: ' + e.message); + } insert_output(); // << The executed inline-code might have called document.write()! } else {