Skip to content

Commit

Permalink
fix prefs window
Browse files Browse the repository at this point in the history
  • Loading branch information
volatile-static committed Aug 13, 2024
1 parent 9914fa7 commit 2914e98
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/bootstrap/modules/history/misc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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();
}
Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/modules/prefs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ function autoImportHistory() {
return;
}
}
window.alert(addon.locale.legacyNotFound);
Zotero.getMainWindow().alert(addon.locale.legacyNotFound);
}

function updateHistorySize(doc: Document) {
Expand Down
3 changes: 2 additions & 1 deletion src/bootstrap/modules/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
Expand Down

0 comments on commit 2914e98

Please sign in to comment.