Join the Meeting Place for Moms!
Talk to other moms, share advice, and have fun!

(minimum 6 characters)

3 Bumps

CAFE MOM TEAM... I KEEP SEEING THIS! THOUGHT YOU SHOULD KNOW ITS ON MY MAIN PAGE!

/***
* Description: Template script to apply custom event handler to an ad via the trigger on Ad Download section of brand awareness.
* Usage: Change ebScriptFileName to the file name of this custom script
*   Append the following parameter to the query string of the call to this script:
*     css - escaped css text 
*        e.g. #topnav ul li.dropDown:hover{z-index:9000001;} should be escaped to: %23topnav%20ul%20li.dropDown%3Ahover%7Bz-index%3A9000001%3B%7D*   
*   Examples:
*   custom script which is to be applied to any ad:
*    http://ds.serving-sys.com/BurstingRes/CustomScripts/OAD_AddCSS_ScriptOnly.js?css=[escaped css text]    
*   e.g.
*	 http://ds.serving-sys.com/BurstingRes/CustomScripts/OAD_AddCSS_ScriptOnly.js?css=%23topnav%20ul%20li.dropDown%3Ahover%7Bz-index%3A9000001%3B%7D
**/

var ebScriptFileName = "OAD_AddCSS_ScriptOnly.js";

//http://snipplr.com/view/354/parse-query-string-from-script-elements-src-attribute/
/**
 * Helper object to parse the query string variables from 
 * <script> element's src attribute.
 * 
 * For example, in test.html:
 *
 *   <script src="test.js?name=value"></script>
 *
 * and in test.js, you can get query as name/value pairs:
 * 
 *   var gEbQueries = new ebScriptQuery('test.js').parse();
 *   for (var name in gEbQueries) {
 *     var values = gEbQueries[name]; // property is Array instance.
 *     ...
 *   }
 * 
 * If you would like to avoid array manipulation.
 * ebScriptQuery also provides flatten method, which returns 
 * only first value for each properties.
 * 
 *   var gEbQueries = new ebScriptQuery('test.js').flatten();
 *   for (var name in gEbQueries) {
 *     alert(gEbQueries[name]); // property is simply string
 *   }
 */

var ebScriptQuery = function(scriptPath) {
  this.scriptPath = scriptPath;
}
ebScriptQuery.prototype = {
  get: function() {	
    var srcRegex = new RegExp(this.scriptPath.replace('.', '\\.') + '(\\?.*)?$');
    var scripts = document.getElementsByTagName("script");
    for (var i = 0; i < scripts.length; i++) {
      var script = scripts[i];
      if (script.src && script.src.match(srcRegex)) {
        var query = script.src.match(/\?([^#]*)(#.*)?/);
        return !query ? '' : query[1];
      }
    }
    return '';
  },
  parse: function() {	
    var result = {};
    var query = this.get();
    var components = query.split('&');
 
    for (var i = 0; i < components.length; i++) {
      var pair = components[i].split('=');
      var name = pair[0], value = pair[1];
 
      if (!result[name]) result[name] = [];
      // decode
      if (!value) {
        value = 'true';
      } else {
        try {
          value = decodeURIComponent(value);
        } catch (e) {
          value = unescape(value);
        }
      }
 
      // MacIE way
      var values = result[name];
      values[values.length] = value;
    }
    return result;
  },
  flatten: function() {	
    var queries = this.parse();
    for (var name in queries) {
      queries[name] = queries[name][0];
    }
    return queries;
  },
  toString: function() {
    return 'ebScriptQuery [path=' + this.scriptPath + ']';
  }
}


try{
	var gEbQueries = new ebScriptQuery(ebScriptFileName).flatten();
	if(gEbQueries["css"]){
		addCss(unescape(gEbQueries["css"]));
	}
	
}catch(e){}


function addCss(cssCode) {
	var styleElement = document.createElement("style");
	styleElement.type = "text/css";
	if (styleElement.styleSheet) {
		styleElement.styleSheet.cssText = cssCode;
	} else {
		styleElement.appendChild(document.createTextNode(cssCode));
	}
	document.getElementsByTagName("head")[0].appendChild(styleElement);
}

 
LilyPondOasis

Asked by LilyPondOasis at 12:33 PM on May. 27, 2011 in About CafeMom

Level 25 (23,568 Credits)
This question is closed.
Answers (9)
  • ...hm... my computer keeps telling me it has blocked this site from downloading a file to my computer... mabe this is it?

    You should use the CONTACT button at the bottom of every CafeMom page to tell them about this!!!
    FelipesMom

    Answer by FelipesMom at 12:45 PM on May. 27, 2011

  • I have it to at the top of the page where the ad is normally....
    But_Mommie

    Answer by But_Mommie at 12:34 PM on May. 27, 2011

  • Yeah there should be an ad there!
    LilyPondOasis

    Comment by LilyPondOasis (original poster) at 12:35 PM on May. 27, 2011

  • I have an adblocker, so maybe that's why I'm not seeing it?
    lovingmy4babies

    Answer by lovingmy4babies at 12:39 PM on May. 27, 2011

  • i have it there too
    BeachMama05

    Answer by BeachMama05 at 4:19 PM on May. 27, 2011

  • me too...trying to download crap
    mkdirector2011

    Answer by mkdirector2011 at 4:47 PM on May. 27, 2011

  • Weird! Try contacting the Team directly, as well. =]
    .MommieAJ.

    Answer by .MommieAJ. at 4:59 PM on May. 27, 2011

  • This is aggravating me as well!!!! This box keeps popping up wanting me to download something. My husband says it's an ad that is not loading properly.
    CplusG

    Answer by CplusG at 7:17 PM on May. 27, 2011

  • Right CplusG....it finally loads up but on my home page it is like the above.


    They are looking into it as I let the Cafe Mom Team Admin. know.

    LilyPondOasis

    Comment by LilyPondOasis (original poster) at 7:36 PM on May. 27, 2011

close Join now to connect to
other members!
Connect with Facebook or Sign Up Using Email

Already Joined? LOG IN