// ==UserScript== // @name Bypass paywalls for scientific documents // @namespace StephenP // @version 3.1.4 // @description Bypass paywalls for scientific documents by downloading them from sci-hub instead of paying something like 50 bucks for each paper. This script adds download buttons on Google Scholar, Scopus and Web Of Science, which lead to sci-hub.tw. In this way you can get free access to scientific papers even if you (or your university) can't afford their prices. // @author StephenP // @include http://scholar.google.*/scholar?* // @match http://www.scopus.com/record/display.uri?* // @match http://apps.webofknowledge.com/full_record.do?* // @match http://apps.webofknowledge.com/InterService.do?* // @match http://apps.webofknowledge.com/CitedFullRecord.do?* // @include https://scholar.google.*/scholar?* // @match https://www.scopus.com/record/display.uri?* // @match https://apps.webofknowledge.com/full_record.do?* // @match https://apps.webofknowledge.com/InterService.do?* // @match https://apps.webofknowledge.com/CitedFullRecord.do?* // @match *://*.sci-hub.tw/* // @grant none // @downloadURL none // ==/UserScript== (function() { 'use strict'; //If Sci-Hub address changes, just replace the URL below with the new one var sciHubUrl='https://sci-hub.tw/'; var documentId; var site=window.location.href.toString(); var i; if(site.includes("://www.scopus.com/")){ var fullDocument=document.querySelector('[title="Full Text(opens in a new window)"]'); //fullDocument.href=fullDocument.href.slice(54); documentId=document.getElementById("recordDOI").innerHTML; var section=document.getElementById("outwardLinks"); section.removeChild(section.lastChild); fullDocument.parentNode.insertAdjacentHTML('beforeend','Download from Sci-HubDonate to Sci-Hub project|'); fullDocument.parentNode.children[4].addEventListener("click", function(){window.open(sciHubUrl+documentId);}); fullDocument.parentNode.children[4].style.cursor="pointer"; //setAttribute('onclick','window.open(\"'+sciHubUrl+documentId+'\");'); fullDocument.parentNode.children[5].addEventListener("click", function(){donate(sciHubUrl);}); fullDocument.parentNode.children[5].style.cursor="pointer"; //setAttribute('onclick',donate(sciHubUrl)); } else if(site.includes("://apps.webofknowledge.com/")){ var mode; var genericID=document.getElementsByClassName("block-record-info block-record-info-source")[0]; for(i=4;i<=genericID.children.length;i++){ var compare=genericID.children[i].children[0].innerHTML; if((compare.localeCompare("DOI:")==0)||(compare.localeCompare("PMID:")==0)){ if(genericID.children[i].children.length<2){ documentId=genericID.children[i].lastChild.data.toString(); mode=1; } else{ documentId=genericID.children[i].children[1].innerHTML; mode=0; } break; } } if(documentId!==undefined){ addButtonWOS(sciHubUrl,documentId,mode); } } else if(site.includes("://scholar.google.")){ var resourcesList=document.getElementById('gs_res_ccl_mid'); var results=resourcesList.children.length; var gs_ggs_gs_fl; for(i=0;iDonate to Sci-Hub project'); list.lastChild.lastChild.removeAttribute("href"); list.lastChild.lastChild.addEventListener("click", function(){donate(sciHubUrl);}); list.lastChild.lastChild.style.cursor="pointer"; } else if(site.includes("CitedFullRecord.do")){ list=document.getElementsByClassName("popup-ft-list")[0]; try{ list.appendChild(list.children[0].cloneNode(true)); } catch(err){ list.appendChild(list.children[1].cloneNode(true)); } if(mode==0){ sciHubBtn=list.lastChild.children[0].children[0]; } else if(mode==1){ sciHubBtn=list.lastChild.children[1]; } sciHubBtn.removeAttribute("href"); sciHubBtn.removeAttribute("onclick"); sciHubBtn.setAttribute("alt","Break the walls and free the knowledge that publishers taken hostage\!"); sciHubBtn.setAttribute("title","Break the walls and free the knowledge that publishers taken hostage\!"); sciHubBtn.innerHTML="Full Text from Sci-Hub"; sciHubBtn.addEventListener("click", function(){window.open(sciHubUrl+documentId);}); sciHubBtn.style.cursor="pointer"; list.insertAdjacentHTML('beforeend','
  • Donate to Sci-Hub project
  • '); list.lastChild.lastChild.removeAttribute("href"); list.lastChild.lastChild.addEventListener("click", function(){donate(sciHubUrl);}); list.lastChild.lastChild.style.cursor="pointer"; } } catch(err){ console.log(err); } //setAttribute('onclick',donate(sciHubUrl)); } function addButtonScholar(sciHubUrl,linkDiv){ var link=linkDiv.parentNode.getElementsByClassName("gs_rt")[0].lastChild.href; var creatingElement; if((link!=undefined)&&(link.search("patents.google")==-1)){ creatingElement=document.createElement("div"); creatingElement.setAttribute("class","gs_ggsd"); creatingElement.innerHTML='Full Text on Sci-Hub'; linkDiv.appendChild(creatingElement); linkDiv.lastChild.addEventListener("click", function(){window.open(sciHubUrl+link);}); linkDiv.lastChild.style.cursor="pointer"; //setAttribute("onclick",'window.open(\"'+sciHubUrl+link+'\");'); } } function donate(sciHubUrl){ window.open(sciHubUrl+'#donate'); }