Jump to content

User:Jsjsjs1111/common.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
mylink="dx.doi.org.ezproxy.library.uq.edu.au";
replaceLink="dx.doi.org";
var link=document.getElementsByTagName("a");
var oldLink;
var newLink;
var index;
for(var i=0;i<link.length-1;i++){
oldLink=link[i].href;
if(oldLink.indexOf(replaceLink)!=-1){
index=oldLink.split('/');
index[2]=mylink;
newLink="";
for(var j=0;j<index.length;j++){
if(j<index.length-1){
newLink+=(index[j].concat('/'));
}else{
newLink+=(index[j]);
}
}
link[i].setAttribute('href',newLink);
}
}