Skip to content

Instantly share code, notes, and snippets.

@danheberden
Created June 27, 2011 03:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danheberden/1048297 to your computer and use it in GitHub Desktop.
Save danheberden/1048297 to your computer and use it in GitHub Desktop.
openX generated JS improvements
<script type='text/javascript'><!--//<![CDATA[
// wrap in an IIFE to not pollute the global name space - also allows 'document', etc, to be minified
(function( window, document ) {
document.MAX_used = document.MAX_used || ',';
// omitting http or https will use whatever is currently being used.
var m3_u = '//www.domain.com/openx/www/delivery/ajs.php?',
escape = window.escape,
// place the params into an array to be joined with the & later
params = [ 'zoneid=10',
'cb=' + Math.floor( Math.random() * +new Date() ),
'charset=' + document.charset || docment.characterSet || '',
'loc=' + escape( window.location )
];
document.MAX_used != ',' && params.push( 'exclude=' + document.MAX_used );
document.referrer && params.push( 'referer=' + escape( document.referrer ) );
document.context && params.push( 'context=' + escape ( document.context ) );
document.mmm_fo && params.push( 'mmm_fo=1' );
// append the final result in ONE doc write
document.write( '<script src="' + m3_u + params.join( '&amp;' ) + '"><\/script>' );
})( window, document );
//]]>--></script><noscript><a href='http://www.domain.com/openx/www/delivery/ck.php?n=a0da2d4d&amp;cb=INSERT_RANDOM_NUMBER_HERE' target='_blank'><img src='http://www.domain.com/openx/www/delivery/avw.php?zoneid=10&amp;cb=INSERT_RANDOM_NUMBER_HERE&amp;n=a0da2d4d' border='0' alt='' /></a></noscript>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment