diff --git a/src/bootstrap/modules/history/misc.ts b/src/bootstrap/modules/history/misc.ts index ade5002..cda8e3e 100644 --- a/src/bootstrap/modules/history/misc.ts +++ b/src/bootstrap/modules/history/misc.ts @@ -68,7 +68,7 @@ export async function importLegacyHistory(str: string) { const total = Object.keys(json.items).length, mainItem: Zotero.Item = await addon.history.getMainItem(); Zotero.showZoteroPaneProgressMeter(addon.locale.migratingLegacy, true); - window.focus(); + Zotero.getMainWindow().focus(); let i = 0; for (const key in json.items) { const item = Zotero.Items.getByLibraryAndKey(1, key); @@ -94,7 +94,7 @@ export async function importLegacyHistory(str: string) { addon.history.loadAll(); showMessage(addon.locale.migrationFinished, 'chrome://chartero/content/icons/accept.png'); } catch (error) { - window.alert(error); + Zotero.getMainWindow().alert(error); } finally { Zotero.hideZoteroPaneOverlays(); } @@ -140,7 +140,7 @@ export async function compressHistory() { await his.note.saveTx({ skipSelect: true, skipNotifier: true }); } } - if (window.confirm(addon.locale.confirmRestart)) Zotero.Utilities.Internal.quit(true); + if (Zotero.getMainWindow().confirm(addon.locale.confirmRestart)) Zotero.Utilities.Internal.quit(true); } export function initReaderAlert(doc: Document) { diff --git a/src/bootstrap/modules/prefs.ts b/src/bootstrap/modules/prefs.ts index 06db477..62fb3db 100644 --- a/src/bootstrap/modules/prefs.ts +++ b/src/bootstrap/modules/prefs.ts @@ -77,7 +77,7 @@ function autoImportHistory() { return; } } - window.alert(addon.locale.legacyNotFound); + Zotero.getMainWindow().alert(addon.locale.legacyNotFound); } function updateHistorySize(doc: Document) { diff --git a/src/bootstrap/modules/utils.ts b/src/bootstrap/modules/utils.ts index 2b67ef7..31b7d1e 100644 --- a/src/bootstrap/modules/utils.ts +++ b/src/bootstrap/modules/utils.ts @@ -39,7 +39,8 @@ export async function saveSVG(svg: string) { } export function showMessage(msg: string, icon: string) { - new window.Notification('Chartero', { + const Notification = addon.getGlobal('Notification'); + new Notification('Chartero', { body: msg, icon, });