diff --git a/manifest-firefox.json b/manifest-firefox.json index 8b82551..9d7733b 100644 --- a/manifest-firefox.json +++ b/manifest-firefox.json @@ -5,7 +5,7 @@ "browser_specific_settings": { "gecko": { "id": "aviation-tools@cssnr.com", - "strict_min_version": "112.0", + "strict_min_version": "116.0", "update_url": "https://raw.githubusercontent.com/cssnr/aviation-tools/master/update.json" } } diff --git a/src/html/options.html b/src/html/options.html index f526dc6..1774749 100644 --- a/src/html/options.html +++ b/src/html/options.html @@ -34,7 +34,7 @@

Aviation Tools


Keyboard Shortcuts -
+
@@ -66,7 +66,7 @@

Aviation Tools


Search Defaults -
+
@@ -148,7 +148,7 @@
Airport Defaults

Tools -
+
@@ -200,7 +200,7 @@
Tools

Bookmarks -
+
@@ -246,7 +246,7 @@
Tools

Extension Options -
+
diff --git a/src/js/exports.js b/src/js/exports.js index dca0e47..3ea418e 100644 --- a/src/js/exports.js +++ b/src/js/exports.js @@ -163,8 +163,8 @@ export function updateOptions(options) { continue } if (key.startsWith('radio')) { - key = value - value = true + key = value // NOSONAR + value = true // NOSONAR } console.debug(`${key}:`, value) const el = document.getElementById(key) diff --git a/src/js/options.js b/src/js/options.js index 609d4a7..3dd1000 100644 --- a/src/js/options.js +++ b/src/js/options.js @@ -154,6 +154,10 @@ async function checkInstall() { // if (install) { if (window.location.search.includes('?install=new')) { history.pushState(null, '', location.href.split('?')[0]) + const userSettings = await chrome.action.getUserSettings() + if (userSettings.isOnToolbar) { + return console.log('%cToolbar Icon Already Pinned!', 'color: Aqua') + } const pin = document.getElementById('pin-notice') pin.addEventListener('click', pinClick) setTimeout(pinClick, 10000) @@ -416,8 +420,9 @@ function onChanged(changes, namespace) { * Set Keyboard Shortcuts * @function setShortcuts * @param {String} selector + * @param {Boolean} action */ -async function setShortcuts(selector = '#keyboard-shortcuts') { +async function setShortcuts(selector = '#keyboard-shortcuts', action = true) { const table = document.querySelector(selector) const tbody = table.querySelector('tbody') const source = table.querySelector('tfoot > tr').cloneNode(true) @@ -434,6 +439,22 @@ async function setShortcuts(selector = '#keyboard-shortcuts') { row.querySelector('kbd').textContent = command.shortcut || 'Not Set' tbody.appendChild(row) } + + if (action) { + try { + const userSettings = await chrome.action.getUserSettings() + const row = source.cloneNode(true) + row.querySelector('i').className = 'fa-solid fa-puzzle-piece me-1' + row.querySelector('.description').textContent = + 'Toolbar Icon Pinned' + row.querySelector('kbd').textContent = userSettings.isOnToolbar + ? 'Yes' + : 'No' + tbody.appendChild(row) + } catch (e) { + console.log('Error adding pinned setting:', e) + } + } } /** @@ -473,10 +494,12 @@ async function copySupport(event) { event.preventDefault() const manifest = chrome.runtime.getManifest() const { options } = await chrome.storage.sync.get(['options']) + const userSettings = await chrome.action.getUserSettings() const result = [ `${manifest.name} - ${manifest.version}`, navigator.userAgent, `options: ${JSON.stringify(options)}`, + `pinned: ${userSettings.isOnToolbar ? 'yes' : 'no'}`, ] await navigator.clipboard.writeText(result.join('\n')) showToast('Support Information Copied.')