From 686037610e83509eedfe959b8a366cae302e4147 Mon Sep 17 00:00:00 2001 From: Arwan Khoiruddin Date: Sun, 2 Jul 2017 12:01:52 +0800 Subject: [PATCH] version 1.3.1 --- README.md | 10 +++++++++- main.js | 11 ++++++++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 0282108..d6d8363 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,15 @@ Download from https://chrome.google.com/webstore/detail/find-doi-in-sci-hub/mpon 5. Click "search DOI on Sci-Hub" 6. You will be redirected to sci-hub 7. Enjoy!
- + For detail direction on how to use this extension, please refer to http://arwanpiyungan.blogspot.co.id/2016/06/how-to-use-find-doi-in-sci-hub-google.html Arwan Khoiruddin + +# Updates + +# Version 1.3.1 +* Added interaction: user can just right click on the page and click on the "Find DOI in Sci Hub" extension + +# Version 1.3 +* Added interaction: user can just click on the extension's button in Chrome bar without the need to select the DOI in the paper page. diff --git a/main.js b/main.js index 691efff..8df0a24 100644 --- a/main.js +++ b/main.js @@ -1,6 +1,11 @@ -searchSciHub = function(word){ +searchSciHub = function(word, tab){ var query = word.selectionText; - chrome.tabs.update({url: "http://sci-hub.cc/" + query}); + if (query == undefined) { + var tabURL = tab.url; + chrome.tabs.update({url: "http://sci-hub.cc/" + tabURL}); + } else { + chrome.tabs.update({url: "http://sci-hub.cc/" + query}); + } }; chrome.browserAction.onClicked.addListener(function(tab) { @@ -10,6 +15,6 @@ chrome.browserAction.onClicked.addListener(function(tab) { chrome.contextMenus.create({ title: "Search DOI in sci-hub", - contexts:["selection"], + contexts:["selection", "all"], onclick: searchSciHub });