generated from windingwind/zotero-plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add item menu callback. Execute local js or cmd.
- Loading branch information
1 parent
67157b2
commit 425be18
Showing
19 changed files
with
116 additions
and
1,188 deletions.
There are no files selected for viewing
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,36 +1,10 @@ | ||
<linkset> | ||
<html:link rel="localization" href="__addonRef__-preferences.ftl" /> | ||
</linkset> | ||
<vbox | ||
id="zotero-prefpane-__addonRef__" | ||
onload="Zotero.__addonInstance__.hooks.onPrefsEvent('load', {window})" | ||
> | ||
<vbox id="zotero-prefpane-__addonRef__" onload="Zotero.__addonInstance__.hooks.onPrefsEvent('load', {window})"> | ||
<groupbox> | ||
<label><html:h2 data-l10n-id="pref-title"></html:h2></label> | ||
<checkbox | ||
id="zotero-prefpane-__addonRef__-enable" | ||
preference="extensions.zotero.__addonRef__.enable" | ||
data-l10n-id="pref-enable" | ||
/> | ||
<hbox> | ||
<html:label | ||
for="zotero-prefpane-__addonRef__-input" | ||
data-l10n-id="pref-input" | ||
></html:label> | ||
<html:input | ||
type="text" | ||
id="zotero-prefpane-__addonRef__-input" | ||
preference="extensions.zotero.__addonRef__.input" | ||
></html:input> | ||
</hbox> | ||
<hbox class="virtualized-table-container" flex="1" height="300px"> | ||
<html:div id="__addonRef__-table-container" /> | ||
</hbox> | ||
<label> | ||
<html:h2 data-l10n-id="pref-title"></html:h2> | ||
</label> | ||
</groupbox> | ||
</vbox> | ||
<vbox> | ||
<html:label | ||
data-l10n-id="pref-help" | ||
data-l10n-args='{"time": "__buildTime__","name": "__addonName__","version":"__buildVersion__"}' | ||
></html:label> | ||
</vbox> | ||
</vbox> |
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 +0,0 @@ | ||
.makeItRed { | ||
background-color: tomato; | ||
} | ||
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 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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
pref-title = 插件模板设置示例 | ||
pref-title = 目前设置在"设置/高级/编辑器"下 | ||
pref-enable = | ||
.label = 开启 | ||
pref-input = 输入 | ||
|
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 |
---|---|---|
|
@@ -6,8 +6,8 @@ | |
"homepage_url": "__homepage__", | ||
"author": "__author__", | ||
"icons": { | ||
"48": "chrome/content/icons/[email protected].png", | ||
"96": "chrome/content/icons/favicon.png" | ||
"48": "chrome/content/icons/[email protected].svg", | ||
"96": "chrome/content/icons/favicon.svg" | ||
}, | ||
"applications": { | ||
"zotero": { | ||
|
@@ -17,4 +17,4 @@ | |
"strict_max_version": "7.0.*" | ||
} | ||
} | ||
} | ||
} |
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,5 @@ | ||
/* eslint-disable no-undef */ | ||
pref("__prefsPrefix__.enable", true); | ||
pref("__prefsPrefix__.input", "This is input"); | ||
pref('__prefsPrefix__.menu.jsOrCmd', true) | ||
pref('__prefsPrefix__.menu.jsPath', 'D:\\Project\\Python工具\\extract_pdf_image\\test.js') | ||
pref('__prefsPrefix__.menu.cmd', 'D:\\Python310\\pythonw.exe') | ||
pref('__prefsPrefix__.menu.args', '"D:\\Project\\Python工具\\extract_pdf_image\\extract_pdf_image.py"') |
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,16 @@ | ||
import { MenuTask } from "../tasks" | ||
import { config } from "../../package.json" | ||
|
||
|
||
export async function menuAction(task: MenuTask) { | ||
const jsOrCmd = Zotero.Prefs.get(`${config.addonRef}.menu.jsOrCmd`) as boolean | ||
const args = (Zotero.Prefs.get(`${config.addonRef}.menu.args`) as string).split(/\s*,\s*/).map(el => el.trim().replace(/^\"|\"$/g, "")).filter(el => el) | ||
args.push(`"${JSON.stringify(task)}"`) | ||
if (jsOrCmd) { | ||
const content = await OS.File.read(Zotero.Prefs.get(`${config.addonRef}.menu.jsPath`) as string, { encoding: "utf-8" }) as string; | ||
// new Function(content)(task) | ||
eval(content) | ||
} else { | ||
await Zotero.Utilities.Internal.exec(Zotero.Prefs.get(`${config.addonRef}.menu.cmd`) as string, args) | ||
} | ||
} |
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
Oops, something went wrong.