X-Git-Url: http://juplo.de/gitweb/?a=blobdiff_plain;f=jquery.openx.js;h=352d0acf6a5c3f1ef9f71d3ffd6e3031321cab62;hb=b2876e052926a1045ac059023e51919c3f29b196;hp=66d91cb5e3717bd5cb1740706a9d60a6f93f3288;hpb=2ecb24dcf0f59b9ea7f016bc0e24b92fa2dc4d9f;p=openx diff --git a/jquery.openx.js b/jquery.openx.js index 66d91cb..352d0ac 100644 --- a/jquery.openx.js +++ b/jquery.openx.js @@ -25,7 +25,7 @@ var - settings, domain, id, node, + settings, _options, domain, id, node, count = 0, slots = {}, @@ -34,18 +34,102 @@ output = []; - $.openx = function( zones, options ) { + /* + * Configuration-Options for jQuery.openx + * + * Since the domain-name of the ad-server is the only required parameter, + * jQuery.openx for convenience can be configured with only that one + * parameter. For example: "jQuery.openx('openx.example.org');". If more + * configuration-options are needed, they must be specified as an object. + * For example: "jQuery.openx({'server': 'openx.example.org', ... });". + * + * + * Server-Settings: + * + * server: string Name of the server, without protocol or port. For + * example "openx.example.org". This option is + * REQUIRED. + * protocol: Optional parameter. + * http: All connections to the ad-server are made via HTTP. + * https: All connections to the ad-server are made via HTTPS. + * If empty, document.location.protocol will be used. + * http_port: number Port-Number for HTTP-connections to the ad-server + * (only needed, when it is not the default-value 80). + * https_port: Port-Number for HTTPS-connections to the ad-server + * (only needed, when it is not the default-value 443). + * + * + * Seldom needed special Server-Settings (these parameters are only needed, + * if the default delivery-configration of the OpenX-Server was changed): + * + * path: string Path to delivery-scripts. DEFAULT: "/www/delivery". + * fl: string Flash-Include-Script. DEFAULT: "fl.js". + * + * + * Delivery-Options (for details and explanations see the see: + * http://www.openx.com/docs/2.8/userguide/single%20page%20call): + * + * block: 1 Don't show the banner again on the same page. + * 0 A Banner might be shown multiple times on the same + * page (DEFAULT). + * blockcampaign: 1 Don't show a banner from the same campaign again on + * the same page. + * 0 A Banner from the same campaign might be shown + * muliple times on the same page (DEFAULT). + * target: string The value is addes as the HTML TARGET attribute in + * the ad code. Examples for sensible values: "_blank", + * "_top". + * withtext: 1 Show text below banner. Enter this text in the + * Banner properties page. + * 0 Ignore the text-field from the banner-properties + (DEFAULT). + * charset: string Charset used, when delivering the banner-codes. + * If empty, the charset is guessed by OpenX. Examples + * for sensible values: "UTF-8", "ISO-8859-1". + * + * + * Other settings: + * + * selector: string A selector for selecting the DOM-elements, that + * should display ad-banners. DEFAULT: ".oa". + * See: http://api.jquery.com/category/selectors/ + */ + $.openx = function( options ) { + + var name, src, errors = [], i; if (domain) { - if (console.error) + if (console.error) { console.error('jQuery.openx was already initialized!'); + console.log('Configured options: ', _options); + } + return; + } + + /** Enable convenient-configuration */ + if (typeof(options) == 'string') + options = { 'server': options }; + + _options = options; + + if (!options.server) + errors.push('Required option "server" is missing!'); + if (errors.length > 0) { + if (console.error) { + for (i=0; i