View Single Post
Old 02-27-2013, 05:16 AM   PM User | #11
njfail
Regular Coder

 
Join Date: Aug 2010
Posts: 130
Thanks: 2
Thanked 0 Times in 0 Posts
njfail is an unknown quantity at this point
Hey guys,
I played around with the JS and I got something that kind of works...
It does what I want it to do, but on some other pages, it messes things up. I've got no idea why its doing that. Everything after the favicon line is messing up other pages. I tried doing one set of replacing vars at a time and each one works, but also makes slight changes to other pages. There don't seem to be any shared ID's or classes though. So I think it might just be a syntax problem or something.. Is there a problem with the way I wrote this?

Code:
$(document).ready(function() {

$('#networkname h1').append('<img id="logo" src="http://valueviewmedia.com/valueviewmedia.png"/>');

$('#favicon').attr("href","http://valueviewmedia.com/favicon.ico");


var haystackText = document.getElementById("adcode_tabs").innerHTML;

var matchText = 'Standard';

var replacementText = 'Advanced';

var replaced = haystackText.replace(matchText, replacementText);

document.getElementById("adcode_tabs").innerHTML = replaced;


var haystackTexta = document.getElementById("adcode_tabs").innerHTML;

var matchTexta = 'Email';

var replacementTexta = 'HTML';

var replaceda = haystackTexta.replace(matchTexta, replacementTexta);

document.getElementById("adcode_tabs").innerHTML = replaceda;


var haystackTextb = document.getElementById("adcode_tabs").innerHTML;

var matchTextb = '3rd Party Ad Server';

var replacementTextb = 'JavaScript';

var replacedb = haystackTextb.replace(matchTextb, replacementTextb);

document.getElementById("adcode_tabs").innerHTML = replacedb;

var haystackTextc = document.getElementById("tabs-1").innerHTML;

var matchTextc = 'The fastest ad code in the world';

var replacementTextc = 'Advanced 2 part ad code';

var replacedc = haystackTextc.replace(matchTextc, replacementTextc);

document.getElementById("tabs-1").innerHTML = replacedc;


var haystackTextd = document.getElementById("tabs-1").innerHTML;

var matchTextd = 'Our standard ad code is 100% asychronous and loads all ad tags in a single call to the server. It is compatible with most third parties, including rich media providers. It won\'t work with some legacy rich media providers, if you need to support them use the Synchronous ad code.';

var replacementTextd = 'This code is for advanced users. We recommend normal publishers use the JavaScript code tab. This advanced 2 part code is 100% asynchronous and loads all ad tags with a single call to the server.';

var replacedd = haystackTextd.replace(matchTextd, replacementTextd);

document.getElementById("tabs-1").innerHTML = replacedd;


var haystackTexte = document.getElementById("tabs-3").innerHTML;

var matchTexte = 'Serve Ads in Email';

var replacementTexte = 'Basic HTML ad code';

var replacede = haystackTexte.replace(matchTexte, replacementTexte);

document.getElementById("tabs-3").innerHTML = replacede;


var haystackTextf = document.getElementById("tabs-3").innerHTML;

var matchTextf = 'Due to the nature of Email this ad code has limitations (including only being able to serve images and not flash or JavaScript/HTML.) It should only be used when Javascript code cannot be used.';

var replacementTextf = 'We do not recommend using the HTML code. It is best to use the JavaScript code tab. The HTML code tab should only be used for specially approved Email advertising.';

var replacedf = haystackTextf.replace(matchTextf, replacementTextf);

document.getElementById("tabs-3").innerHTML = replacedf;


var haystackTextg = document.getElementById("tabs-4").innerHTML;

var matchTextg = 'Serve ads through other ad servers';

var replacementTextg = 'Recommended - JavaScript ad code';

var replacedg = haystackTextg.replace(matchTextg, replacementTextg);

document.getElementById("tabs-4").innerHTML = replacedg;


var haystackTexth = document.getElementById("tabs-4").innerHTML;

var matchTexth = 'You can serve ads through other ad servers using this simple code. This code isn\'t 100% asychronous but can be served through a friendly iframe in another ad server to achieve 100% asychronous ad serving.';

var replacementTexth = 'This is our standard ad code. Place this code in your website\'s HTML file in the place you want the ad to display. This code is asynchronous, meaning it will delay your website\'s content from loading.';

var replacedh = haystackTexth.replace(matchTexth, replacementTexth);

document.getElementById("tabs-4").innerHTML = replacedh;

});
njfail is offline   Reply With Quote