Skip to content

Commit

Permalink
fix icon url in fx115
Browse files Browse the repository at this point in the history
  • Loading branch information
volatile-static committed Mar 16, 2024
1 parent a90bff6 commit a7d40f4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
15 changes: 8 additions & 7 deletions src/bootstrap/modules/debug.ts
Original file line number Diff line number Diff line change
@@ -1,48 +1,49 @@
import { config } from '../../../package.json';
import { ICON_URL } from './utils';

export function addDebugMenu() {
const Zotero_Tabs = (Zotero.getMainWindow() as unknown as MainWindow).Zotero_Tabs;
addon.menu.register('item', { tag: 'menuseparator' });
addon.menu.register('item', {
tag: 'menuitem',
label: 'log to console',
icon: `chrome://${config.addonName}/content/icons/icon.svg`,
icon: ICON_URL,
commandListener: () => addon.log(Zotero.getActiveZoteroPane().getSelectedItems()),
});

addon.menu.register('collection', { tag: 'menuseparator' });
addon.menu.register('collection', {
tag: 'menuitem',
label: 'log to console',
icon: `chrome://${config.addonName}/content/icons/icon.svg`,
icon: ICON_URL,
commandListener: () => addon.log(Zotero.getActiveZoteroPane().getCollectionTreeRow()?.ref),
});

addon.menu.register('menuHelp', { tag: 'menuseparator' });
addon.menu.register('menuHelp', {
tag: 'menuitem',
label: 'log reader to console',
icon: `chrome://${config.addonName}/content/icons/icon.svg`,
icon: ICON_URL,
commandListener: () => addon.log(Zotero.Reader.getByTabID(Zotero_Tabs.selectedID)),
});
addon.menu.register('menuHelp', {
tag: 'menuitem',
label: 'log iframe window to console',
icon: `chrome://${config.addonName}/content/icons/icon.svg`,
icon: ICON_URL,
commandListener: () => addon.log((
<_ZoteroTypes.Reader.PDFView>Zotero.Reader.getByTabID(Zotero_Tabs.selectedID)._primaryView
)._iframeWindow)
});
addon.menu.register('menuHelp', {
tag: 'menuitem',
label: 'log main items to console',
icon: `chrome://${config.addonName}/content/icons/icon.svg`,
icon: ICON_URL,
commandListener: () => addon.log((<any>addon.history)._mainItems),
});
addon.menu.register('menuHelp', {
tag: 'menuitem',
label: 'open dev tools',
icon: `chrome://${config.addonName}/content/icons/icon.svg`,
icon: ICON_URL,
commandListener: () => {
Zotero.Prefs.set('devtools.debugger.remote-enabled', true, true);
Zotero.Prefs.set('devtools.debugger.remote-port', 6100, true);
Expand Down Expand Up @@ -94,7 +95,7 @@ export function addDebugMenu() {
addon.menu.register('menuFile', {
tag: 'menuitem',
label: 'reload',
icon: `resource://chartero/icons/icon.svg`,
icon: ICON_URL,
commandListener: async () => {
Services.obs.notifyObservers(null, 'startupcache-invalidate');
const { AddonManager } = ChromeUtils.import('resource://gre/modules/AddonManager.jsm');
Expand Down
5 changes: 2 additions & 3 deletions src/bootstrap/modules/recent.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { config } from '../../../package.json';
import { isValid } from './utils';
import { ICON_URL, isValid } from './utils';

export default function (win: MainWindow) {
// 注册“最近在读”菜单
Expand All @@ -9,7 +8,7 @@ export default function (win: MainWindow) {
tag: 'menu',
id: 'chartero-open-recent',
label: addon.locale.recent,
icon: `chrome://${config.addonName}/content/icons/icon.svg`,
icon: ICON_URL,
},
'before',
win.document.getElementById('menu_close') as XUL.Element
Expand Down
2 changes: 2 additions & 0 deletions src/bootstrap/modules/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { FilePickerHelper } from 'zotero-plugin-toolkit/dist/helpers/filePicker'
import { WorkerManagerBase, WorkerRequest, WorkerResponse } from '../../worker/manager';
import { BasicTool } from 'zotero-plugin-toolkit/dist/basic';

export const ICON_URL = 'resource://chartero/icons/icon.svg';

const basicTool = new BasicTool();
export const getGlobal = basicTool.getGlobal;

Expand Down

0 comments on commit a7d40f4

Please sign in to comment.