/* Omikron CC 2008-13-11 Referer (href,src,background) for CSS, JS, IMG, A, TD change to www.qvc.de where necessary append Parameters 2009-03-12 additionalParams müssen definiert sein 2009-04-23 Übernahme in das 6.2 Projekt 2010-03-02 iqvcid als additionalParamsWithDot darstellen und weiterreichen */ $(document).ready(function(){ /* don't use global values without test! */ if(!additionalParamsWithDot){ additionalParamsWithDot=""; } additionalParamsWithDot = sidWithDot; if(!additionalParamsWithAmp){ additionalParamsWithAmp=""; } else{ /* if(additionalParamsWithAmp.match(/iqvcid/i)){ additionalParamsWithDot = "iqvcid" + "." + additionalParamsWithAmp.replace(/(.+iqvcid=)([^&]+)(.*)/i,"$2"); } */ } /* Damit im Eingabefeld der Text genau in der Mitte zentriert ist */ $("#query3").attr("style","padding-top: 1px"); /* Complete the Referers with www.qvc.de */ manipulateReferer(".ffplus","www.qvc.de",additionalParamsWithDot,additionalParamsWithAmp); }); function manipulateReferer(identifier,basicUrl,addParamsWithDot,addParamsWithAmp){ var attributes = new Object(); attributes.href=1; attributes.src=1; attributes.background=1; $("LINK").each(function(){ if(this.href.match(/\/dehtml\//)){ changeReferer(this,"href"); } } ); $("SCRIPT").each(function(){ if(this.src.match(/\/dehtml\//)){ changeReferer(this,"src"); } } ); $(identifier).each(function(){ for(var attr in attributes){ // get the keys of the array changeReferer(this,attr); } if(this.nodeName=="A"){ this.href+=addParamsWithAmp; if(addParamsWithDot!=""){ this.href = this.href.replace(/(.+)\?(.+)/,"$1" + addParamsWithDot + "?$2"); } /* if(this.href.match(/http:\/\/.+\?/)){ this.href+=addParamsWithAmp; } else{ this.href+=addParamsWithDot; } */ } } ); function changeReferer(node,attr){ for(var i=0;i< node.attributes.length;i++){ // extremely strange but necessary: IE doesn't use this.background (impossible to change value that way) if(node.attributes[i].nodeName==attr){ if(node.attributes[i].nodeValue){ if(testReferer(node.attributes[i].nodeValue)>0){ node.attributes[i].nodeValue=addHost(node.attributes[i].nodeValue,basicUrl); } } } } } function addHost(oldRef,newRef){ var test=testReferer(oldRef); var chgRef = ""; /* replace, if it's not basicUrl "www.qvc.de" */ if(test==1){ chgRef = oldRef.replace(/(^.+:\/\/)([^/]+)(.*)/,"$1"+newRef+"$3"); /* ie */ } /* add the basicUrl */ else if(test==2){ /* add the hostname */ chgRef = oldRef.replace(/(^\/)(.*)/,"http://"+newRef+"/$2"); /* ie */ } /* nothing */ else{ chgRef = oldRef; } // alert(test+oldRef+"\n"+"\n"+chgRef); return chgRef; } function testReferer(ref){ if(ref){ /* replace, if it's not basicUrl "www.qvc.de" */ if(ref.match(/http:\/\//i)&&!ref.match(RegExp(basicUrl,"i"))){ return 1; } /* add the basicUrl */ else if(ref.match(/^\/.*/i)){ // starts with backslash return 2; } /* nothing */ else{ return 0; // return " : " + ref.substring(0,25) + " (ready)"; } } return 0; } }