-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathToggleLeftPane
38 lines (34 loc) · 908 Bytes
/
ToggleLeftPane
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/**
* Toggle Left Pane
* @author [MuiseDestiny](https://github.com/MuiseDestiny), windingwind
* @usage Assign a shortcut
* @link https://github.com/windingwind/zotero-actions-tags/discussions/169
*
* [Toggle Left Pane]
* Name : Toggle Left Pane
* Event : None
* Operation : Script
* Data : JS code below
* Shortcut : Shift + [
*/
const Zotero = require("Zotero");
const Zotero_Tabs = require("Zotero_Tabs");
const document = require("document");
if (item) {
return;
}
if (Zotero_Tabs.selectedType === "library") {
const splitter = document.querySelector("#zotero-collections-splitter");
if (splitter.getAttribute("state") == "collapsed") {
splitter.setAttribute("state", "");
return;
} else {
splitter.setAttribute("state", "collapsed");
return;
}
} else {
Zotero.Reader.getByTabID(
Zotero_Tabs.selectedID
)._internalReader.toggleSidebar();
return;
}