X-Git-Url: https://juplo.de/gitweb/?a=blobdiff_plain;f=jquery.openx.js;h=d49a852dbf7e0ef36c4d53f927d86a47594f5049;hb=947760891e0b0aef91a1bdb5c938583e19bcdddf;hp=582559358ee33d9ee8b31ea02bedbe0d585996c1;hpb=4691d2c97d4c3154c20020487dcd916a2b81abf2;p=openx diff --git a/jquery.openx.js b/jquery.openx.js index 5825593..d49a852 100644 --- a/jquery.openx.js +++ b/jquery.openx.js @@ -25,7 +25,7 @@ var - domain, id, node, + settings, _zones, _options, domain, id, node, count = 0, slots = {}, @@ -34,19 +34,87 @@ output = []; - $.openx = function( server, zones, options ) { + /* + * Configuration-Options for jQuery.openx + * + * + * 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). + * + * + * 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". + */ + $.openx = function( zones, options ) { + + var name, src, errors = [], i; if (domain) { - if (console.error) + if (console.error) { console.error('jQuery.openx was already initialized!'); + console.log('Configured zones: ', _zones); + console.log('Configured options: ', _options); + } return; } - domain = document.location.protocol == 'https:' ? 'https://' + server + ':8443':'http://' + server; + _zones = zones; + _options = options; - var - name, - src = domain; + if (!options.server) + errors.push('Required option "server" is missing!'); + if (errors.length > 0) { + if (console.error) { + for (i=0; i