Skip to content

Instantly share code, notes, and snippets.

@lamarqua
Created April 14, 2018 13:02
Show Gist options
  • Select an option

  • Save lamarqua/fe664d5f41039563147f8abfce4eff08 to your computer and use it in GitHub Desktop.

Select an option

Save lamarqua/fe664d5f41039563147f8abfce4eff08 to your computer and use it in GitHub Desktop.
javascript:(function()%7Bvar%20re%20%3D%20%2F10.%5Cd%7B4%2C9%7D%5C%2F%5B-._%3B()%2F%3AA-Z0-9%5D%2B%2Fi%3Bvar%20text%20%3D%20document.documentElement.textContent%20%7C%7C%20document.documentElement.innerText%3Bvar%20found%20%3D%20text.match(re)%3Bif%20(found)%20%7Bwindow.location.href%20%3D%20%22http%3A%2F%2Fsci-hub.tw%2F%22%2B%20found%3B%7D%7D)()
var re = /10.\d{4,9}\/[-._;()/:A-Z0-9]+/i;
var text = document.documentElement.textContent || document.documentElement.innerText;
var found = text.match(re);
if (found) {
window.location.href = "http://sci-hub.tw/"+ found;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment