From d474ae6864c15f48ba0c1d97bcc793d153d7d292 Mon Sep 17 00:00:00 2001 From: Nico Date: Wed, 21 Jun 2023 20:00:12 +0800 Subject: [PATCH] Update Adding option panel; Adding mirror site support; Adding Chinese localization; --- .gitignore | 2 + README.md | 2 +- chrome.manifest | 3 +- chrome/content/options.js | 9 + chrome/content/options.xul | 16 +- chrome/content/zsc.js | 8 +- chrome/locale/en-US/options.dtd | 11 +- chrome/locale/en-US/overlay.dtd | 2 +- chrome/locale/it-IT/overlay.dtd | 3 - chrome/locale/it-IT/zsc.properties | 2 - chrome/locale/ru-RU/overlay.dtd | 3 - chrome/locale/ru-RU/zsc.properties | 2 - chrome/locale/zh-CN/options.dtd | 10 + chrome/locale/zh-CN/overlay.dtd | 4 + chrome/locale/zh-CN/zsc.properties | 2 + install.rdf | 16 +- test/test.js | 542 ++++++++++++++--------------- update.rdf | 6 +- 18 files changed, 332 insertions(+), 311 deletions(-) delete mode 100644 chrome/locale/it-IT/overlay.dtd delete mode 100644 chrome/locale/it-IT/zsc.properties delete mode 100644 chrome/locale/ru-RU/overlay.dtd delete mode 100644 chrome/locale/ru-RU/zsc.properties create mode 100644 chrome/locale/zh-CN/options.dtd create mode 100644 chrome/locale/zh-CN/overlay.dtd create mode 100644 chrome/locale/zh-CN/zsc.properties diff --git a/.gitignore b/.gitignore index ba95aee..38d320c 100644 --- a/.gitignore +++ b/.gitignore @@ -88,3 +88,5 @@ build/ builds/ .DS_Store package-lock.json + +.VSCodeCounter \ No newline at end of file diff --git a/README.md b/README.md index 051b364..9969d3a 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ v2.1.0 ## 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 `zoteroscholarcitations@nico.info`. The file contents should be the absolute path to the root of your plugin source code directory, where your install.rdf file is located. +2. Create a text file in the 'extensions' directory of your Zotero profile directory (refer to [this](https://www.zotero.org/support/dev/client_coding/plugin_development) for your profile path) named after the extension id `zoteroscholarcitations@nico.info`. 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 diff --git a/chrome.manifest b/chrome.manifest index 9a05bea..2d3afc1 100644 --- a/chrome.manifest +++ b/chrome.manifest @@ -1,7 +1,6 @@ content zoteroscholarcitations chrome/content/ locale zoteroscholarcitations en-US chrome/locale/en-US/ -locale zoteroscholarcitations ru-RU chrome/locale/ru-RU/ -locale zoteroscholarcitations it-IT chrome/locale/it-IT/ +locale zoteroscholarcitations zh-CN chrome/locale/zh-CN/ overlay chrome://zotero/content/zoteroPane.xul chrome://zoteroscholarcitations/content/overlay.xul diff --git a/chrome/content/options.js b/chrome/content/options.js index e0f5edb..b78fbb2 100644 --- a/chrome/content/options.js +++ b/chrome/content/options.js @@ -42,3 +42,12 @@ function checkScholarUrl() { } } } + +function saveUA() { + var boxText = document.getElementById("pref-zscc-user-agent").value; + if (boxText.length == 0) { + Zotero.Prefs.set("extensions.zscc.userAgent", ""); + } else { + Zotero.Prefs.set("extensions.zscc.userAgent", boxText); + } +} diff --git a/chrome/content/options.xul b/chrome/content/options.xul index 14c1f2e..056ca57 100644 --- a/chrome/content/options.xul +++ b/chrome/content/options.xul @@ -1,27 +1,37 @@ + + + - - + -