-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
First release of ZoteroPreview for Zotero 7. This is NOT backwards-co…
…mpatible with version 6.
- Loading branch information
1 parent
b669c67
commit 0d0d4dd
Showing
9 changed files
with
519 additions
and
2 deletions.
There are no files selected for viewing
Binary file not shown.
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,75 @@ | ||
if (typeof Zotero == 'undefined') | ||
{ | ||
var Zotero; | ||
} | ||
|
||
function log(msg) { | ||
Zotero.debug("zoteropreview 0.1: " + msg); | ||
} | ||
|
||
function install() { | ||
log("Installed "); | ||
} | ||
|
||
async function startup({ id, version, rootURI }) { | ||
log("Starting " + version); | ||
Zotero.debug("Starting " + version); | ||
|
||
Zotero.debug("load sub script " + version); | ||
Services.scriptloader.loadSubScript(rootURI + 'zoteropreview.js'); | ||
|
||
Zotero.PreferencePanes.register({ | ||
pluginID: '[email protected]', | ||
src: rootURI + 'prefs.xhtml', | ||
scripts: [rootURI + 'zoteropreview_prefs.js'] | ||
}); | ||
|
||
Zotero.debug("init " + version); | ||
Zotero.zoteropreview.init({ id, version, rootURI }); | ||
|
||
Zotero.debug("Add to windows " + version); | ||
Zotero.zoteropreview.addToWindow(); | ||
await Zotero.zoteropreview.main(); | ||
} | ||
|
||
function onMainWindowLoad({ window }) { | ||
Zotero.zoteropreview.addToWindow(window); | ||
} | ||
|
||
function onMainWindowUnload({ window }) { | ||
Zotero.zoteropreview.removeFromWindow(window); | ||
} | ||
|
||
function removeFromWindow(window) { | ||
var doc = window.document; | ||
// Remove all elements added to DOM | ||
// for (let id of this.addedElementIDs) { | ||
// doc.getElementById(id)?.remove(); | ||
// } | ||
try { | ||
doc.querySelector('#zotero-preview')?.remove(); | ||
} | ||
catch(err){ | ||
this.log(err); | ||
} | ||
} | ||
|
||
function removeFromAllWindows() { | ||
var windows = Zotero.getMainWindows(); | ||
for (let win of windows) { | ||
if (!win.ZoteroPane) continue; | ||
this.removeFromWindow(win); | ||
} | ||
} | ||
|
||
function shutdown() { | ||
log("Shutting down "); | ||
Zotero.Notifier.unregisterObserver(this._notifierID); | ||
this.removeFromAllWindows(); | ||
Zotero.zoteropreview = undefined; | ||
} | ||
|
||
function uninstall() { | ||
this.shutdown(); | ||
log("Uninstalled "); | ||
} |
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,15 @@ | ||
{ | ||
"manifest_version": 2, | ||
"name": "ZoteroPreview", | ||
"version": "0.7.0", | ||
"description": "Citation preview pane for Zotero.", | ||
"homepage_url": "https://github.com/dcartertod/zotero-plugins", | ||
"applications": { | ||
"zotero": { | ||
"id": "[email protected]", | ||
"update_url": "https://raw.githubusercontent.com/dcartertod/zotero-plugins/main/ZoteroPreview7/zoteropreview7-updates.json", | ||
"strict_min_version": "6.999", | ||
"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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
pref("extensions.zoteropreview.citationstyle", ""); | ||
pref("extensions.zoteropreview.position", "zotero-item-pane-header"); |
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,31 @@ | ||
<!-- | ||
zoteropreview | ||
prefs.xhtml | ||
adapted from Wiley Yu (zotmoov) | ||
--> | ||
|
||
|
||
<vbox id="zotero-prefpane-zotero-preview" onload="Zotero.zoteropreview.Prefs.init();"> | ||
<groupbox> | ||
<vbox> | ||
<label><html:h2>Pick Preview Style</html:h2></label> | ||
<hbox> | ||
<menulist id="zotero-preview-style-menulist" native="true" | ||
preference="extensions.zoteropreview.citationstyle" | ||
oncommand="Zotero.zoteropreview.Prefs.styleChanged(this.selectedItem.value);"> | ||
<menupopup> | ||
</menupopup> | ||
</menulist> | ||
</hbox> | ||
</vbox> | ||
</groupbox> | ||
<groupbox> | ||
<label><html:h2>Position</html:h2></label> | ||
<radiogroup native="true" id="extensions-zoteropreview-position" preference="extensions.zoteropreview.position"> | ||
<radio id="extensions-zoteropreview-position-top" value="zotero-item-pane-header" label="Top" | ||
onclick="Zotero.zoteropreview.addToWindow('zotero-item-pane-header');"/> | ||
<radio id="extensions-zoteropreview-position-bottom" value="zotero-editpane-related" label="Bottom" | ||
onclick="Zotero.zoteropreview.addToWindow('zotero-editpane-related');"/> | ||
</radiogroup> | ||
</groupbox> | ||
</vbox> |
Oops, something went wrong.