The selector for picking the DOM-elements is now configurable
[openx] / jquery.openx.js
index 5495538..352d0ac 100644 (file)
    *                        (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):
    *
    * 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 ) {
 
     settings = $.extend(
       {
         'protocol': document.location.protocol,
+        'delivery': '/www/delivery',
+        'fl': 'fl.js',
+        'selector': '.oa',
         'cache': true
       },
       options
     $.ajaxSetup({ 'cache': true });
 
 
-    src = domain + '/www/delivery/spc.php';
+    src = domain + settings.delivery + '/spc.php';
 
     /**
      * jQuery.openx only works with "named zones", because it does not know,
      */
     src += '?zones=';
     for(name in OA_zones) {
-      $('.oa').each(function() {
+      $(settings.selector).each(function() {
         var
         node = $(this),
         id;
     if (settings.blockcampaign === 1)
       src += '&blockcampaign=1';
     if (settings.target)
-      src += '&target' + settings.target;
+      src += '&target=' + settings.target;
     if (settings.withtext === 1)
       src += '&withtext=1';
     if (settings.charset)
 
   function load_flash() {
 
-    $.getScript(domain + '/www/delivery/fl.js', init_ads);
+    $.getScript(domain + settings.delivery + '/' + settings.fl, init_ads);
 
   }