diff --git a/_locales/de/messages.json b/_locales/de/messages.json index c65b5b1..5aecce6 100644 --- a/_locales/de/messages.json +++ b/_locales/de/messages.json @@ -25,8 +25,12 @@ "message": "Über diese Seite können Sie die Einstellungen des Add-ons CanvasBlocker verändern.", "description": "" }, - "installedNotice": { - "message": "CanvasBlocker wurde installiert oder aktualisiert. Wenn Sie diese Seite in Zukunft erreichen wollen, erstellen Sie bitte ein Lesezeichen.", + "installNotice": { + "message": "CanvasBlocker wurde installiert. Wenn Sie diese Seite in Zukunft erreichen wollen, erstellen Sie bitte ein Lesezeichen.", + "description": "" + }, + "updateNotice": { + "message": "CanvasBlocker wurde aktualisiert. Wenn Sie diese Seite in Zukunft erreichen wollen und noch kein Lesezeichen erstellt ahben, erstellen Sie bitte eines.", "description": "" }, diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 3a503e4..15a10c6 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -25,8 +25,12 @@ "message": "This page provides a way to change the settings of the CanvasBlocker add-on.", "description": "" }, - "installedNotice": { - "message": "CanvasBlocker was installed or updated. If you want to be able to access this page in the future, please bookmark it.", + "installNotice": { + "message": "CanvasBlocker was installed. If you want to be able to access this page in the future, please bookmark it.", + "description": "" + }, + "updateNotice": { + "message": "CanvasBlocker was updated. If you want to be able to access this page in the future and have not bookmarked it, please bookmark it.", "description": "" }, diff --git a/lib/main.js b/lib/main.js index d211524..289b54e 100644 --- a/lib/main.js +++ b/lib/main.js @@ -138,8 +138,27 @@ } }); - browser.runtime.onInstalled.addListener(function(){ - message("CanvasBlocker installed"); + browser.runtime.onInstalled.addListener(function(details){ + function openOptions(reason){ + if ( + !browser.pageAction || + !browser.pageAction.show || + !browser.pageAction.openPopup + ){ + browser.tabs.create({ + url: browser.extension.getURL("options/options.html?" + reason) + }); + } + } + switch (details.reason){ + case "install": + message("CanvasBlocker installed"); + openOptions(details.reason); + break; + case "update": + message("CanvasBlocker updated"); + openOptions(details.reason); + } }); message("end"); diff --git a/options/options.css b/options/options.css index cdd21a3..bc5d147 100644 --- a/options/options.css +++ b/options/options.css @@ -6,7 +6,7 @@ header { margin-bottom: 1em; } -header .installedNotice { +header .bookmarkNotice { margin: 0.5em; padding: 0.5em; border: 1px dotted #880000; diff --git a/options/options.js b/options/options.js index 929be97..4696b06 100644 --- a/options/options.js +++ b/options/options.js @@ -44,11 +44,15 @@ introduction.textContent = browser.i18n.getMessage("optionsIntroduction"); head.appendChild(introduction); - if (window.location.search === "?installed"){ - let bookmarkingNotice = document.createElement("div"); - bookmarkingNotice.className = "installedNotice"; - bookmarkingNotice.textContent = browser.i18n.getMessage("installedNotice"); - head.appendChild(bookmarkingNotice); + if (window.location.search){ + let noticeName = window.location.search.substr(1).trim() + "Notice"; + let notice = browser.i18n.getMessage(noticeName); + if (notice){ + let bookmarkingNotice = document.createElement("div"); + bookmarkingNotice.className = noticeName + " bookmarkNotice"; + bookmarkingNotice.textContent = notice; + head.appendChild(bookmarkingNotice); + } } document.body.appendChild(head); diff --git a/releaseNotes.txt b/releaseNotes.txt index 9141ca1..f13e14b 100644 --- a/releaseNotes.txt +++ b/releaseNotes.txt @@ -4,6 +4,7 @@ Version 0.4.5: new features: - Added way to inspect canvas content in ask mode while being asked + - Open options page on install or update if the options page cannot be accessed in another way fixes: - prevent possible double faking