From 0bd4b5987ed4aa687a554009a0c722b019bd9a79 Mon Sep 17 00:00:00 2001 From: volatile static Date: Tue, 3 Jan 2023 20:55:25 +0800 Subject: [PATCH] add style sheet --- addon/chrome/content/zoteroPane.css | 3 +++ src/views.ts | 11 ++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 addon/chrome/content/zoteroPane.css diff --git a/addon/chrome/content/zoteroPane.css b/addon/chrome/content/zoteroPane.css new file mode 100644 index 0000000..8ab857d --- /dev/null +++ b/addon/chrome/content/zoteroPane.css @@ -0,0 +1,3 @@ +.makeItRed { + background-color: tomato; +} \ No newline at end of file diff --git a/src/views.ts b/src/views.ts index dc2c757..2fb9123 100644 --- a/src/views.ts +++ b/src/views.ts @@ -19,7 +19,16 @@ class AddonViews extends AddonModule { // You can init the UI elements that // cannot be initialized with overlay.xul this._Addon.toolkit.Tool.log("Initializing UI"); - const menuIcon = "chrome://addontemplate/content/icons/favicon@0.5x.png"; + + // register style sheet + const styles = this._Addon.toolkit.UI.createElement(document, 'link', 'html') as HTMLLinkElement; + styles.type = 'text/css'; + styles.rel = 'stylesheet'; + styles.href = `chrome://${config.addonRef}/content/zoteroPane.css`; + document.documentElement.appendChild(styles); + document.getElementById('zotero-item-pane-content')?.classList.add('makeItRed'); + + const menuIcon = `chrome://${config.addonRef}/content/icons/favicon@0.5x.png`; // item menuitem with icon this._Addon.toolkit.UI.insertMenuItem("item", { tag: "menuitem",