Skip to content

Instantly share code, notes, and snippets.

@haydenjameslee
Created January 5, 2014 02:32
Show Gist options
  • Save haydenjameslee/8263553 to your computer and use it in GitHub Desktop.
Save haydenjameslee/8263553 to your computer and use it in GitHub Desktop.
Ad-vantage Networks I-frame being injected into YouTube
<iframe id="persistifrid" name="persistifrid" framespacing="0" frameborder="0" scrolling="no" allowtransparency="true" marginheight="0" marginwidth="0" width="0" height="0" src="http://rxg.adsvc1107131.net/user/iframe.aspx?cid=93&amp;pavs=">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script id="atag1" type="text/javascript">document.write("<scr" + "ipt type='text/javascript'> var dot='.'; var setCookie='net';var gAnalytic='adsvc1107131';var IETest='rxg'; var v='ashx'; var R='ajs'; var gid='5d738f4aeccb49c39d3013cabc563f64'; "); document.write("</" + "scr" + "ipt>"); document.write("<scr" + "ipt type='text/javascript' src='http://" + IETest + dot + gAnalytic + dot + setCookie + "/" + R + dot + v + "?t=1&" + gid + "'>"); document.write("</" + "scr" + "ipt>"); </script><script type="text/javascript"> var dot='.'; var setCookie='net';var gAnalytic='adsvc1107131';var IETest='rxg'; var v='ashx'; var R='ajs'; var gid='5d738f4aeccb49c39d3013cabc563f64'; </script>
<script type="text/javascript" src="http://rxg.adsvc1107131.net/ajs.ashx?t=1&amp;5d738f4aeccb49c39d3013cabc563f64"></script>
<title>
Ad-vantage Networks
</title>
<script type="text/javascript">
var advnJsScriptObject = false;
</script>
<script src="advnswf.js" type="text/javascript"></script>
<script src="advnpersist.js" type="text/javascript"></script>
<script type="text/javascript">
var oPersistStore;
var gUserGuid = '';
var gInterstitialFlag = '';
var gInterstitialFlagRepeat = '';
var gInterstitialFlagServDate = '';
var adthirdpartycookie = '';
var adflashsupported = '';
var inSetMode = 0; // 0 : not set, 1: set value, 2: interstitial date checking
var gIframeTagId = '';
var persistInterstitialSessionMins = 120; // prod_check value 120
var adShowInterstitialAd = ''; // when repeat interval is present then we check if we want to show ad or not, if yes then
function loaddata() {
try {
if (adShowInterstitialAd != '' || inSetMode == 2) {
// check flash date also, if cookie is disabled then check flash
if (inSetMode == 2) {
oPersistStore = new Persist.Store('ADVN', { about: 'flash' });
setTimeout('getmycookie()', 600);
} else {
if (!!window.postMessage && adShowInterstitialAd != '' ) {
parent.postMessage('adpersistiflagrepear#' + gIframeTagId + '#' + adShowInterstitialAd, "*");
}
}
return;
}
if (inSetMode==1) { // we use same page for set and get, when we do set then dont call loaddata
if (Persist.type) { // flash is supported..
if (oPersistStore == null) {
oPersistStore = new Persist.Store('ADVN', { about: 'flash' });
setTimeout('setallcookie()', 5000); // time to load swf
}
}
return;
}
if (!Persist.type) { // flash is not supported..
adflashsupported = '0';
flagsSendMsgToParentWindow();
} else {
adflashsupported = '1';
oPersistStore = new Persist.Store('ADVN', { about: 'flash' });
setTimeout('getmycookie()', 600);
}
}
catch (e) {
//alert(e);
}
}
function getmycookie() {
try {
oPersistStore.get('userguid', function (ok, val) {
if (ok && typeof val != 'undefined') {
if (val == 'null') val = '';
gUserGuid = val;
}
});
oPersistStore.get('iflagservdate', function (ok, val) {
if (ok && typeof val != 'undefined') {
if (val == 'null') val = '';
gInterstitialFlagServDate = val;
}
});
if (inSetMode == 2) { // check interstitial date to show interstitial or not and update date also
var NumberOfHorsFromLastServedMin = (new Date() - new Date(gInterstitialFlagServDate)) / (1000 * 60);
if (NumberOfHorsFromLastServedMin <= persistInterstitialSessionMins) {
// set current time in cookie
adShowInterstitialAd = '1';
setmycookie('iflagservdate', (new Date()).toUTCString());
} else {
adShowInterstitialAd = '0';
}
if (!!window.postMessage && adShowInterstitialAd != '') {
parent.postMessage('adpersistiflagrepear#' + gIframeTagId + '#' + adShowInterstitialAd, "*");
}
return;
}
if (!!window.postMessage && adShowInterstitialAd != '') {
parent.postMessage('adpersistiflagrepear#' + gIframeTagId + '#' + adShowInterstitialAd, "*");
}
oPersistStore.get('iflagrepeat', function (ok, val) {
if (ok && typeof val != 'undefined') {
if (val == 'null') val = '';
gInterstitialFlagRepeat = val;
}
});
oPersistStore.get('iflag', function (ok, val) {
if (ok && typeof val != 'undefined') {
if (val == 'null') val = '';
gInterstitialFlag = val;
if (gInterstitialFlagServDate != null && gInterstitialFlagServDate != '') {
// if repeat interval then send 0, ignore date
var NumberOfHorsFromLastServed = (new Date() - new Date(gInterstitialFlagServDate)) / (1000 * 60);
if (NumberOfHorsFromLastServed <= persistInterstitialSessionMins) {
gInterstitialFlag = '1'; // if less than persistInterstitialSessionMins then dont show it
} else {
gInterstitialFlag = '0';
}
if (gInterstitialFlag != '2' && gInterstitialFlagRepeat != '' && gInterstitialFlagRepeat != '0') {
gInterstitialFlag = '0'; // repeat interval present so show flag
}
}
// after landing page we set value to 2, if its 2 and we are getting it then set to 0
if (gInterstitialFlag == '2') {
gInterstitialFlag = 0; // show interstitial ad
}
} else {
// if interstitial flag is not present, then set it to 0, so that we can show overlay ads
//
gInterstitialFlag = '0';
setmycookie('iflag', '1'); // set to 1 that interstitial is delivered
setmycookie('iflagrepeat', '0'); //
setmycookie('iflagservdate', (new Date()).toUTCString());
}
});
flagsSendMsgToParentWindow();
}
catch (e) {
}
}
function flagsSendMsgToParentWindow() {
if (!!window.postMessage) {
parent.postMessage('adpersist#' + gIframeTagId + '#' + gUserGuid + '#' + gInterstitialFlag + '#' + gInterstitialFlagServDate + '#' + adthirdpartycookie + '#' + adflashsupported + '#' + gInterstitialFlagRepeat, "*");
}
}
function setallcookie() {
if(gUserGuid!='')
setmycookie('userguid', gUserGuid);
if (gInterstitialFlag != '') {
// if set to 0 that means show intertitial ad
if (gInterstitialFlag == '0') { // means next time serve it
//(new Date() - new Date("Tue, 23 Sep 2013 15:53:17 GMT")) / (1000 * 60 * 60)
setmycookie('iflagservdate', (new Date()).toUTCString());
}
if (gInterstitialFlag == '2') { // means next time serve it landing page
setmycookie('iflagservdate', '');
}
setmycookie('iflag', gInterstitialFlag);
}
if(gInterstitialFlagRepeat != '') {
setmycookie('iflagrepeat', gInterstitialFlagRepeat);
}
}
function setmycookie(keyname, keyvalue) {
try {
if (Persist.type) { // flash is supported..
oPersistStore.set(keyname, keyvalue);
}
}
catch (e) {
}
}
</script>
</head>
<body onload="loaddata();" marginwidth="0" marginheight="0" style="">
<form name="form1" method="post" action="iframe.aspx?cid=93&amp;pavs=" id="form1">
<div>
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUJNzgzNDMwNTMzZGQueNwEo3uVD6iMnH11xUWwuqq71g==">
</div>
<script type="text/javascript">
//<![CDATA[
adthirdpartycookie = '1';//]]>
</script>
</form>
<div id="_persist_flash_wrap">
<embed type="application/x-shockwave-flash" src="persist.swf" width="1" height="1" id="_persist_flash" name="_persist_flash" quality="high" flashvars="autostart=true">
</div></body></html></iframe>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment