-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
improve query url argument of author, add query option in preference.
- Loading branch information
Showing
14 changed files
with
254 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -87,5 +87,4 @@ typings/ | |
build/ | ||
builds/ | ||
.DS_Store | ||
package.json | ||
package-lock.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ New features: | |
> For example, if a paper titled "Explaining and Exploiting Adversarial Examples" has a year of "2013" in Zotero, the original version will produce a URL that results in an incorrect query (https://scholar.google.com/scholar?q=Explaining+and+Harnessing+Adversarial+Examples&hl=en&as_sdt=0%2C5&as_ylo=2013&as_yhi=2013), while a looser range, such as 2012 - 2014, will hit the correct query (https://scholar.google.com/scholar?q=Explaining+and+Harnessing+Adversarial+Examples&hl=en&as_sdt=0%2C5&as_ylo=2012&as_yhi=2014). | ||
|
||
## Changelog | ||
v2.0.5 | ||
- Adaptation for Zotero 6.0; | ||
|
||
|
@@ -19,6 +20,20 @@ v2.0.6 | |
- Shrinkage the count string length of ZSCC ("ZSCC: 0000001" => "ZSCC:00001"); | ||
- Remove state indicator of staleness; | ||
|
||
v2.1.0 | ||
- Add auto updating; | ||
- Improve the query url with multiple authors; | ||
- Add preference for base query url (beta); | ||
|
||
|
||
|
||
## Development | ||
1. Clone this source code. | ||
2. Create a text file in the 'extensions' directory of your Zotero profile directory named after the extension id `[email protected]`. The file contents should be the absolute path to the root of your plugin source code directory, where your install.rdf file is located. | ||
3. Open prefs.js in the Zotero profile directory in a text editor and delete the lines containing `extensions.lastAppBuildId` and `extensions.lastAppVersion`. Save the file and restart Zotero. This will force Zotero to read the extensions' directory and install your plugin from source, after which you should see it listed in Tools → Add-ons. This is only necessary once. | ||
4. Run zotero with argments `-purgecaches -ZoteroDebug`, for example: | ||
>./zotero.exe -purgecaches -ZoteroDebug | ||
|
||
--- | ||
--- | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
var Zotero = Components.classes["@zotero.org/Zotero;1"].getService( | ||
Components.interfaces.nsISupports | ||
).wrappedJSObject; | ||
|
||
function checkScholarUrl() { | ||
var boxUrl = document.getElementById("pref-zscc-scholar-url").value; | ||
if (boxUrl.length == 0) { | ||
Zotero.Prefs.set("extensions.zscc.scholarUrlVerified", false); | ||
Zotero.Prefs.set("extensions.zscc.scholarUrl", ""); | ||
} else { | ||
try { | ||
if (boxUrl.startsWith("https://") && boxUrl.endsWith("/")) { | ||
} else { | ||
throw "Url should start with 'https:// and end with '/'"; | ||
} | ||
|
||
testUrl = boxUrl + "schhp?hl=en"; | ||
|
||
let xhr = new XMLHttpRequest(); | ||
xhr.open("GET", testUrl, false); | ||
xhr.send(); | ||
|
||
if (xhr.status == 200) { | ||
if ( | ||
xhr.responseText.indexOf("Stand on the shoulders of giants") != -1 | ||
) { | ||
// a valid url | ||
alert("This site is valid and have been saved."); | ||
Zotero.Prefs.set("extensions.zscc.scholarUrlVerified", true); | ||
Zotero.Prefs.set("extensions.zscc.scholarUrl", boxUrl); | ||
} else { | ||
throw "This mirror site is not google scholar or not supports english language."; | ||
} | ||
} else { | ||
throw "Cannot open this url, plaease check your url!"; | ||
} | ||
} catch (err) { | ||
// alert user | ||
alert(err); | ||
Zotero.Prefs.set("extensions.zscc.scholarUrlVerified", false); | ||
Zotero.Prefs.set("extensions.zscc.scholarUrl", ""); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?xml version="1.0"?> | ||
<?xml-stylesheet href="chrome:https://global/skin/" type="text/css"?> | ||
<?xml-stylesheet href="chrome:https://zotero-platform/content/preferences.css"?> | ||
<?xml-stylesheet href="chrome:https://zotero-platform-version/content/style.css"?> | ||
|
||
<!DOCTYPE window SYSTEM "chrome:https://zoteroscholarcitations/locale/options.dtd"> | ||
|
||
<prefwindow id="zscc-perf" title="&zscc-preferences;" | ||
xmlns="http:https://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> | ||
|
||
<prefpane label="&zscc-prefpane;" id="zscc-perfpane"> | ||
<preferences> | ||
<preference id="pref-zscc-scholar-url" name="extensions.zscc.scholarUrl" type="string"/> | ||
</preferences> | ||
|
||
<groupbox> | ||
<separator class="thin"/> | ||
<label id="pref-zscc-scholar-url-label" value="&scholar-url-label;"/> | ||
<description>&scholar-url-desc;</description> | ||
<textbox id="pref-zscc-scholar-url" preference="pref-zscc-scholar-url"/> | ||
<button id="pref-zscc-url-verify" label="&scholar-url-verify;" oncommand="checkScholarUrl();"/> | ||
<separator class="thin"/> | ||
</groupbox> | ||
|
||
|
||
</prefpane> | ||
<script src="options.js"/> | ||
<script src="chrome:https://zotero/content/include.js"/> | ||
</prefwindow> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<!ENTITY zscc-preferences "ZSCC Preferences"> | ||
<!ENTITY zscc-prefpane "ZSCC Preferences"> | ||
<!ENTITY scholar-url-label "Scholar Mirror Site (BETA)"> | ||
<!ENTITY scholar-url-desc "The format should start with 'https://' and end with '/', e.g. https://scholar.google.com/. Leave this blank will use the official site."> | ||
<!ENTITY scholar-url-verify "Verify URL"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
<!ENTITY zotero.scholarcitations.update.label "Update citation(s)"> | ||
<!ENTITY zotero.scholarcitations.updateCol.label "Update citations"> | ||
<!ENTITY zotero.scholarcitations.updateAll.label "Update all citations"> | ||
<!ENTITY zotero.scholarcitations.options.label "ZSCC Preferences..."> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,45 @@ | ||
<?xml version="1.0"?> | ||
<RDF:RDF | ||
xmlns:em="http:https://www.mozilla.org/2004/em-rdf#" | ||
xmlns:NC="http:https://home.netscape.com/NC-rdf#" | ||
xmlns:RDF="http:https://www.w3.org/1999/02/22-rdf-syntax-ns#"> | ||
<RDF:Description | ||
RDF:about="rdf:#$x61SL3" | ||
em:id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}" | ||
em:minVersion="2.0" | ||
em:maxVersion="20.*"/> | ||
<RDF:Description | ||
RDF:about="urn:mozilla:install-manifest" | ||
em:id="[email protected]" | ||
em:name="Zotero Scholar Citations" | ||
em:version="2.0.6" | ||
em:type="2" | ||
em:creator="Anton Beloglazov, Max Kuehn, Nico" | ||
em:description="Zotero plugin for auto-fetching numbers of citations from Google Scholar" | ||
em:homepageURL="https://github.com/nico-zck/zotero-scholar-citations"> | ||
<em:type>2</em:type> | ||
<em:targetApplication RDF:resource="rdf:#$x61SL3"/> | ||
<em:targetApplication> | ||
<Description> | ||
<em:id>[email protected]</em:id> | ||
<em:minVersion>5.0.66</em:minVersion> | ||
<em:maxVersion>6.*</em:maxVersion> | ||
</Description> | ||
</em:targetApplication> | ||
<em:localized> | ||
<Description> | ||
<em:locale>ru-RU</em:locale> | ||
<em:name>Zotero Scholar Citations</em:name> | ||
<em:description>Плагин для Zotero для автоматической выборки числа цитирований из Google Scholar.</em:description> | ||
</Description> | ||
</em:localized> | ||
<em:localized> | ||
<Description> | ||
<em:locale>it-IT</em:locale> | ||
<em:name>Zotero Scholar Citations</em:name> | ||
<em:description>Plugin di Zotero per il recupero automatico del numero di citazioni in Google Scholar.</em:description> | ||
</Description> | ||
</em:localized> | ||
</RDF:Description> | ||
</RDF:RDF> | ||
<RDF xmlns="http:https://www.w3.org/1999/02/22-rdf-syntax-ns#" | ||
xmlns:em="http:https://www.mozilla.org/2004/em-rdf#"> | ||
|
||
<Description about="urn:mozilla:install-manifest"> | ||
<em:id>[email protected]</em:id> | ||
<em:name>Zotero Scholar Citations</em:name> | ||
<em:version>2.1.0</em:version> | ||
<em:type>2</em:type> | ||
<em:multiprocessCompatible>true</em:multiprocessCompatible> | ||
<em:creator>Nico</em:creator> | ||
<em:homepageURL>https://github.com/nico-zck/zotero-scholar-citations</em:homepageURL> | ||
<em:optionsURL>chrome:https://zoteroscholarcitations/content/options.xul</em:optionsURL> | ||
<em:updateURL>https://github.com/nico-zck/zotero-scholar-citations/master/update.rdf</em:updateURL> | ||
|
||
<em:targetApplication> | ||
<Description> | ||
<em:id>[email protected]</em:id> | ||
<em:minVersion>5.0.0</em:minVersion> | ||
<em:maxVersion>6.0.*</em:maxVersion> | ||
</Description> | ||
</em:targetApplication> | ||
|
||
<em:localized> | ||
<Description> | ||
<em:locale>en-US</em:locale> | ||
<em:name>Zotero Scholar Citations</em:name> | ||
<em:description>Advanced PDF management for Zotero</em:description> | ||
</Description> | ||
</em:localized> | ||
<em:localized> | ||
<Description> | ||
<em:locale>ru-RU</em:locale> | ||
<em:name>Zotero Scholar Citations</em:name> | ||
<em:description>Плагин для Zotero для автоматической выборки числа цитирований из Google Scholar.</em:description> | ||
</Description> | ||
</em:localized> | ||
<em:localized> | ||
<Description> | ||
<em:locale>it-IT</em:locale> | ||
<em:name>Zotero Scholar Citations</em:name> | ||
<em:description>Plugin di Zotero per il recupero automatico del numero di citazioni in Google Scholar.</em:description> | ||
</Description> | ||
</em:localized> | ||
</Description> | ||
</RDF> |
Oops, something went wrong.