// var thisPage = window.location.href; var thisPage = window.location.pathname; var a = 'free-floor-estimate'; var b = 'free-floor-estimate-confirmation'; var c = 'contact'; var d = '/'; // var d = ''; // alert(thisPage == '/demo81/'); console.log('this page is ' + thisPage); console.log('this page index of a ' + thisPage.indexOf(a)); console.log('this page index of b ' + thisPage.indexOf(b)); console.log('this page index of c ' + thisPage.indexOf(c)); console.log('this page d ' + (thisPage == (d))); function insertAfterC(el,referenceNode) { referenceNode.parentNode.insertBefore(el, referenceNode.nextSibling); } var newE2 = document.createElement('link'); newE2.rel = "stylesheet"; newE2.id = "phlash-css"; newE2.href = "https://www.phlashtagmanager.com/ptag/pcss/phlash-1.css"; newE2.type = "text/css"; var ref21 = document.getElementsByTagName('link'); var l2 = (ref21.length-1); var ref22 = ref21[l2]; // alert('ref22 = ' + ref22); /* var x = document.getElementById("myBtn"); var x = document.getElementsByTagName('body'); if (x.addEventListener) { // For all major browsers, except IE 8 and earlier x.addEventListener("click", myFunction); } else if (x.attachEvent) { // For IE 8 and earlier versions x.attachEvent("onclick", myFunction); } */ function myFunction() { //alert('addClass'); //var x = document.getElementsByTagName('body'); //alert(x[0]); var element, name, arr; // element = document.getElementById("myDIV"); element = document.getElementsByTagName('body'); element = element[0]; element.className = element.className.replace(/\style\b/g, ""); name = "phlash"; arr = element.className.split(" "); if (arr.indexOf(name) == -1) { element.className += " " + name; } } // myFunction(); // Cross-browser implementation of element.addEventListener() function listen(evnt, elem, func) { if (elem.addEventListener) // W3C DOM elem.addEventListener(evnt,func,false); else if (elem.attachEvent) { // IE DOM var r = elem.attachEvent("on"+evnt, func); return r; } else window.alert('I\'m sorry Dave, I\'m afraid I can\'t do that.'); } // Use: listen("event name", elem, func); // var x = document.getElementsByTagName('body'); // alert(x[0]); // listen("load", window, myFunction); // if((thisPage.indexOf(a) >= 1) || (thisPage.indexOf(b) >= 1 ) || (thisPage.indexOf(c) >= 1) || (thisPage == '/') || (thisPage == '/demo81/')) { if((thisPage.indexOf(a) >= 1) || (thisPage.indexOf(b) >= 1 ) || (thisPage == 'demo81/')) { //alert(thisPage == '/'); console.log('this page is now' + thisPage); //if((thisPage.indexOf(b)>1)||(thisPage.indexOf(c) >= 0)) { //alert((thisPage.indexOf(c)>=0)); // alert('p-12346.js'); // function myAlert(el,referenceNode) { // alert(el); // } //var newE2 = document.createElement('link'); // var ref21 = document.getElementsByTagName('link'); // var ref22 = ref21; // var l2 = (ref21.length-1); // myAlert(newE2 + ' : '+ l2); //var thisPage = window.location.href; //var thisPage = window.location.pathname; //alert(thisPage); // var fruits = ["Banana", "Orange", "Apple", "Mango"]; // var a = fruits.indexOf("Apple"); //var phlashPages = ["page-1","page-2"]; //var a = thisPage.indexOf(phlashPages); //alert(a); insertAfterC(newE2, ref22); listen("load", window, myFunction) } else { // do nothing } /* var thisPage = window.location.href; if(thisPage.indexOf('test-1')) { alert(thisPage); } else {alert('Page not Found');} */