Changelog opening no longer active tab + default to off
parent
9e86f6c5fe
commit
661875ceb8
|
@ -40,9 +40,9 @@ chrome.runtime.onInstalled.addListener(async function (detail) {
|
|||
}
|
||||
|
||||
// If update, open changelog if setting is enabled
|
||||
chrome.storage.sync.get({ 'openChangelog': 'on' }, function (item) {
|
||||
chrome.storage.sync.get({ 'openChangelog': 'off' }, function (item) {
|
||||
if (item.openChangelog === 'on' && detail.reason === 'update') {
|
||||
chrome.tabs.create({ url: 'https://getindie.wiki/changelog/?updated=true' });
|
||||
chrome.tabs.create({ url: 'https://getindie.wiki/changelog/?updated=true', active: false });
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -357,6 +357,13 @@
|
|||
independent English wikis when no same-language wiki exists
|
||||
</label>
|
||||
</div>
|
||||
<div class="settingToggle">
|
||||
<label>
|
||||
<input id="openChangelogCheckbox" type="checkbox" />
|
||||
<span id="openChangelogIcon" aria-hidden="true"></span>
|
||||
Open changelog when Indie Wiki Buddy is updated
|
||||
</label>
|
||||
</div>
|
||||
</fieldset>
|
||||
<fieldset id="breezewikiSettings">
|
||||
<legend>
|
||||
|
|
28
popup.js
28
popup.js
|
@ -250,6 +250,22 @@ function setCrossLanguage(setting, storeSetting = true) {
|
|||
}
|
||||
}
|
||||
|
||||
// Set open changelog setting
|
||||
function setOpenChangelog(setting, storeSetting = true) {
|
||||
if (storeSetting) {
|
||||
chrome.storage.sync.set({ 'openChangelog': setting });
|
||||
}
|
||||
|
||||
const openChangelogIcon = document.getElementById('openChangelogIcon');
|
||||
if (setting === 'on') {
|
||||
document.getElementById('openChangelogCheckbox').checked = true;
|
||||
openChangelogIcon.innerText = '📂';
|
||||
} else {
|
||||
document.getElementById('openChangelogCheckbox').checked = false;
|
||||
openChangelogIcon.innerText = '📁';
|
||||
}
|
||||
}
|
||||
|
||||
// Set default action setting
|
||||
chrome.storage.sync.get(['defaultWikiAction'], function (item) {
|
||||
if (item.defaultWikiAction === 'disabled') {
|
||||
|
@ -380,6 +396,9 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||
chrome.storage.sync.get({ 'crossLanguage': 'off' }, function (item) {
|
||||
setCrossLanguage(item.crossLanguage, false);
|
||||
});
|
||||
chrome.storage.sync.get({ 'openChangelog': 'off' }, function (item) {
|
||||
setOpenChangelog(item.openChangelog, false);
|
||||
});
|
||||
chrome.storage.sync.get({ 'breezewiki': 'off' }, function (item) {
|
||||
setBreezeWiki(item.breezewiki, false);
|
||||
|
||||
|
@ -417,6 +436,15 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||
}
|
||||
});
|
||||
});
|
||||
document.getElementById('openChangelogCheckbox').addEventListener('change', function () {
|
||||
chrome.storage.sync.get({ 'openChangelog': 'off' }, function (item) {
|
||||
if (item.openChangelog === 'on') {
|
||||
setOpenChangelog('off');
|
||||
} else {
|
||||
setOpenChangelog('on');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Add event listeners for BreezeWiki settings
|
||||
document.getElementById('breezewikiCheckbox').addEventListener('change', function () {
|
||||
|
|
|
@ -777,7 +777,7 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||
chrome.storage.sync.get({ 'crossLanguage': 'off' }, function (item) {
|
||||
setCrossLanguage(item.crossLanguage, false);
|
||||
});
|
||||
chrome.storage.sync.get({ 'openChangelog': 'on' }, function (item) {
|
||||
chrome.storage.sync.get({ 'openChangelog': 'off' }, function (item) {
|
||||
setOpenChangelog(item.openChangelog, false);
|
||||
});
|
||||
chrome.storage.sync.get({ 'breezewiki': 'off' }, function (item) {
|
||||
|
@ -818,7 +818,7 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||
});
|
||||
});
|
||||
document.getElementById('openChangelogCheckbox').addEventListener('change', function () {
|
||||
chrome.storage.sync.get({ 'openChangelog': 'on' }, function (item) {
|
||||
chrome.storage.sync.get({ 'openChangelog': 'off' }, function (item) {
|
||||
if (item.openChangelog === 'on') {
|
||||
setOpenChangelog('off');
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue