zotero-plugin 2.0.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/debug-log.d.ts +2 -2
- package/debug-log.js +13 -11
- package/package.json +1 -1
package/debug-log.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
export declare function unregister(plugin: string): void;
|
|
1
2
|
declare class DebugLogSender {
|
|
2
|
-
|
|
3
|
-
private plugins;
|
|
3
|
+
plugins: Record<string, string[]>;
|
|
4
4
|
register(plugin: string, preferences?: string[]): void;
|
|
5
5
|
unregister(plugin: string): void;
|
|
6
6
|
private alert;
|
package/debug-log.js
CHANGED
|
@@ -1,18 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/* eslint-disable no-magic-numbers */
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.DebugLog = void 0;
|
|
4
|
+
exports.DebugLog = exports.unregister = void 0;
|
|
5
5
|
const tslib_1 = require("tslib");
|
|
6
6
|
const tar_js_1 = tslib_1.__importDefault(require("tar-js"));
|
|
7
7
|
const pako_1 = require("pako");
|
|
8
|
+
function unregister(plugin) {
|
|
9
|
+
Zotero.debug(`debug-log-sender: unregistering ${plugin}`);
|
|
10
|
+
delete Zotero.DebugLogSender.plugins[plugin];
|
|
11
|
+
if (!Object.keys(Zotero.DebugLogSender.plugins).length) {
|
|
12
|
+
const doc = Zotero.getMainWindow().document;
|
|
13
|
+
const menuitem = doc.querySelector('menuitem#debug-log-menu');
|
|
14
|
+
if (menuitem)
|
|
15
|
+
menuitem.remove();
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.unregister = unregister;
|
|
8
19
|
class DebugLogSender {
|
|
9
20
|
constructor() {
|
|
10
|
-
this.enabled = false;
|
|
11
21
|
this.plugins = {};
|
|
12
22
|
}
|
|
13
23
|
register(plugin, preferences = []) {
|
|
14
24
|
this.plugins[plugin] = preferences;
|
|
15
|
-
this.enabled = true;
|
|
16
25
|
const doc = Zotero.getMainWindow().document;
|
|
17
26
|
Zotero.debug(`debug-log-sender: registering ${plugin}`);
|
|
18
27
|
if (!doc.querySelector('menuitem#debug-log-menu')) {
|
|
@@ -27,14 +36,7 @@ class DebugLogSender {
|
|
|
27
36
|
}
|
|
28
37
|
}
|
|
29
38
|
unregister(plugin) {
|
|
30
|
-
|
|
31
|
-
delete this.plugins[plugin];
|
|
32
|
-
if (!Object.keys(this.plugins).length) {
|
|
33
|
-
const doc = Zotero.getMainWindow().document;
|
|
34
|
-
const menuitem = doc.querySelector('menuitem#debug-log-menu');
|
|
35
|
-
if (menuitem)
|
|
36
|
-
menuitem.remove();
|
|
37
|
-
}
|
|
39
|
+
unregister(plugin);
|
|
38
40
|
}
|
|
39
41
|
alert(title, body) {
|
|
40
42
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
|