Move banner text icons from translation file

pull/765/head
Kevin Payravi 2024-07-24 01:41:49 -07:00
parent 8646f301c0
commit 67c46920fa
2 changed files with 16 additions and 16 deletions

View File

@ -70,27 +70,27 @@
"description": "Text to display in the banner for the BreezeWiki link" "description": "Text to display in the banner for the BreezeWiki link"
}, },
"bannerRestore": { "bannerRestore": {
"message": "Restore banner", "message": "Restore banner",
"description": "Text to display in the banner for the restore banner link" "description": "Text to display in the banner for the restore banner link"
}, },
"bannerRestoreDone": { "bannerRestoreDone": {
"message": "Banner restored", "message": "Banner restored",
"description": "Text to display in the banner after the banner has been restored" "description": "Text to display in the banner after the banner has been restored"
}, },
"bannerDisable": { "bannerDisable": {
"message": "Disable banner for this wiki", "message": "Disable banner for this wiki",
"description": "Text to display in the banner for the disable banner link" "description": "Text to display in the banner for the disable banner link"
}, },
"bannerDisableDone": { "bannerDisableDone": {
"message": "Banner disabled", "message": "Banner disabled",
"description": "Text to display in the banner after the banner has been disabled" "description": "Text to display in the banner after the banner has been disabled"
}, },
"bannerRedirect": { "bannerRedirect": {
"message": "Auto redirect this wiki", "message": "Auto redirect this wiki",
"description": "Text to display in the banner for the redirect link" "description": "Text to display in the banner for the redirect link"
}, },
"bannerRedirectDone": { "bannerRedirectDone": {
"message": "Redirect enabled", "message": "Redirect enabled",
"description": "Text to display in the banner after the redirect has been enabled" "description": "Text to display in the banner after the redirect has been enabled"
}, },
"searchResultLookup": { "searchResultLookup": {

View File

@ -119,18 +119,18 @@ function displayRedirectBanner(newUrl, id, destinationName, destinationLanguage,
bannerRestoreLink.classList.add('indie-wiki-banner-link'); bannerRestoreLink.classList.add('indie-wiki-banner-link');
bannerRestoreLink.classList.add('indie-wiki-banner-link-small'); bannerRestoreLink.classList.add('indie-wiki-banner-link-small');
bannerRestoreLink.classList.add('indie-wiki-banner-hidden'); bannerRestoreLink.classList.add('indie-wiki-banner-hidden');
bannerRestoreLink.textContent = extensionAPI.i18n.getMessage('bannerRestore'); bannerRestoreLink.textContent = '⎌ ' + extensionAPI.i18n.getMessage('bannerRestore');
bannerControls.appendChild(bannerRestoreLink); bannerControls.appendChild(bannerRestoreLink);
bannerRestoreLink.onclick = function (e) { bannerRestoreLink.onclick = function (e) {
extensionAPI.storage.sync.get({ 'wikiSettings': {} }, async (response) => { extensionAPI.storage.sync.get({ 'wikiSettings': {} }, async (response) => {
let wikiSettings = await commonFunctionDecompressJSON(response.wikiSettings); let wikiSettings = await commonFunctionDecompressJSON(response.wikiSettings);
wikiSettings[id] = 'alert'; wikiSettings[id] = 'alert';
extensionAPI.storage.sync.set({ 'wikiSettings': await commonFunctionCompressJSON(wikiSettings) }); extensionAPI.storage.sync.set({ 'wikiSettings': await commonFunctionCompressJSON(wikiSettings) });
e.target.textContent = extensionAPI.i18n.getMessage('bannerRestoreDone'); e.target.textContent = '✓ ' + extensionAPI.i18n.getMessage('bannerRestoreDone');
e.target.classList.add('indie-wiki-banner-disabled'); e.target.classList.add('indie-wiki-banner-disabled');
bannerControls.querySelector('.indie-wiki-banner-redirect').textContent = extensionAPI.i18n.getMessage('bannerRedirect'); bannerControls.querySelector('.indie-wiki-banner-redirect').textContent = '↪ ' + extensionAPI.i18n.getMessage('bannerRedirect');
bannerControls.querySelector('.indie-wiki-banner-redirect').classList.remove('indie-wiki-banner-disabled'); bannerControls.querySelector('.indie-wiki-banner-redirect').classList.remove('indie-wiki-banner-disabled');
bannerControls.querySelector('.indie-wiki-banner-disable').textContent = extensionAPI.i18n.getMessage('bannerDisable'); bannerControls.querySelector('.indie-wiki-banner-disable').textContent = '✕ ' + extensionAPI.i18n.getMessage('bannerDisable');
bannerControls.querySelector('.indie-wiki-banner-disable').classList.remove('indie-wiki-banner-hidden'); bannerControls.querySelector('.indie-wiki-banner-disable').classList.remove('indie-wiki-banner-hidden');
bannerControls.querySelector('.indie-wiki-banner-disable').classList.remove('indie-wiki-banner-disabled'); bannerControls.querySelector('.indie-wiki-banner-disable').classList.remove('indie-wiki-banner-disabled');
}); });
@ -141,16 +141,16 @@ function displayRedirectBanner(newUrl, id, destinationName, destinationLanguage,
bannerDisableLink.classList.add('indie-wiki-banner-disable'); bannerDisableLink.classList.add('indie-wiki-banner-disable');
bannerDisableLink.classList.add('indie-wiki-banner-link'); bannerDisableLink.classList.add('indie-wiki-banner-link');
bannerDisableLink.classList.add('indie-wiki-banner-link-small'); bannerDisableLink.classList.add('indie-wiki-banner-link-small');
bannerDisableLink.textContent = extensionAPI.i18n.getMessage('bannerDisable'); bannerDisableLink.textContent = '✕ ' + extensionAPI.i18n.getMessage('bannerDisable');
bannerControls.appendChild(bannerDisableLink); bannerControls.appendChild(bannerDisableLink);
bannerDisableLink.onclick = function (e) { bannerDisableLink.onclick = function (e) {
extensionAPI.storage.sync.get({ 'wikiSettings': {} }, async (response) => { extensionAPI.storage.sync.get({ 'wikiSettings': {} }, async (response) => {
let wikiSettings = await commonFunctionDecompressJSON(response.wikiSettings); let wikiSettings = await commonFunctionDecompressJSON(response.wikiSettings);
wikiSettings[id] = 'disabled'; wikiSettings[id] = 'disabled';
extensionAPI.storage.sync.set({ 'wikiSettings': await commonFunctionCompressJSON(wikiSettings) }); extensionAPI.storage.sync.set({ 'wikiSettings': await commonFunctionCompressJSON(wikiSettings) });
e.target.textContent = extensionAPI.i18n.getMessage('bannerDisableDone'); e.target.textContent = '✓ ' + extensionAPI.i18n.getMessage('bannerDisableDone');
e.target.classList.add('indie-wiki-banner-disabled'); e.target.classList.add('indie-wiki-banner-disabled');
bannerControls.querySelector('.indie-wiki-banner-restore').textContent = extensionAPI.i18n.getMessage('bannerRestore'); bannerControls.querySelector('.indie-wiki-banner-restore').textContent = '⎌ ' + extensionAPI.i18n.getMessage('bannerRestore');
bannerControls.querySelector('.indie-wiki-banner-restore').classList.remove('indie-wiki-banner-hidden'); bannerControls.querySelector('.indie-wiki-banner-restore').classList.remove('indie-wiki-banner-hidden');
bannerControls.querySelector('.indie-wiki-banner-restore').classList.remove('indie-wiki-banner-disabled'); bannerControls.querySelector('.indie-wiki-banner-restore').classList.remove('indie-wiki-banner-disabled');
}); });
@ -161,17 +161,17 @@ function displayRedirectBanner(newUrl, id, destinationName, destinationLanguage,
bannerRedirectLink.classList.add('indie-wiki-banner-redirect'); bannerRedirectLink.classList.add('indie-wiki-banner-redirect');
bannerRedirectLink.classList.add('indie-wiki-banner-link'); bannerRedirectLink.classList.add('indie-wiki-banner-link');
bannerRedirectLink.classList.add('indie-wiki-banner-link-small'); bannerRedirectLink.classList.add('indie-wiki-banner-link-small');
bannerRedirectLink.textContent = extensionAPI.i18n.getMessage('bannerRedirect'); bannerRedirectLink.textContent = '↪ ' + extensionAPI.i18n.getMessage('bannerRedirect');
bannerControls.appendChild(bannerRedirectLink); bannerControls.appendChild(bannerRedirectLink);
bannerRedirectLink.onclick = function (e) { bannerRedirectLink.onclick = function (e) {
extensionAPI.storage.sync.get({ 'wikiSettings': {} }, async (response) => { extensionAPI.storage.sync.get({ 'wikiSettings': {} }, async (response) => {
let wikiSettings = await commonFunctionDecompressJSON(response.wikiSettings); let wikiSettings = await commonFunctionDecompressJSON(response.wikiSettings);
wikiSettings[id] = 'redirect'; wikiSettings[id] = 'redirect';
extensionAPI.storage.sync.set({ 'wikiSettings': await commonFunctionCompressJSON(wikiSettings) }); extensionAPI.storage.sync.set({ 'wikiSettings': await commonFunctionCompressJSON(wikiSettings) });
e.target.textContent = extensionAPI.i18n.getMessage('bannerRedirectDone'); e.target.textContent = '✓ ' + extensionAPI.i18n.getMessage('bannerRedirectDone');
e.target.classList.add('indie-wiki-banner-disabled'); e.target.classList.add('indie-wiki-banner-disabled');
bannerControls.querySelector('.indie-wiki-banner-disable').classList.add('indie-wiki-banner-hidden'); bannerControls.querySelector('.indie-wiki-banner-disable').classList.add('indie-wiki-banner-hidden');
bannerControls.querySelector('.indie-wiki-banner-restore').textContent = extensionAPI.i18n.getMessage('bannerRestore'); bannerControls.querySelector('.indie-wiki-banner-restore').textContent = '⎌ ' + extensionAPI.i18n.getMessage('bannerRestore');
bannerControls.querySelector('.indie-wiki-banner-restore').classList.remove('indie-wiki-banner-hidden'); bannerControls.querySelector('.indie-wiki-banner-restore').classList.remove('indie-wiki-banner-hidden');
bannerControls.querySelector('.indie-wiki-banner-restore').classList.remove('indie-wiki-banner-disabled'); bannerControls.querySelector('.indie-wiki-banner-restore').classList.remove('indie-wiki-banner-disabled');
}); });