Skip to content

Commit

Permalink
Replaced hardcoded iconDimensions w/ manifest extraction in `sync.f…
Browse files Browse the repository at this point in the history
…ade()`, eliminated `iconPaths` init for compactness ↞ [auto-sync from https://github.com/adamlui/ai-web-extensions]
  • Loading branch information
kudo-sync-bot committed Jan 5, 2025
1 parent f122419 commit eec9846
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions chromium/extension/popup/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
fade() {

// Update toolbar icon
const iconDimensions = [16, 32, 48, 64, 128], iconPaths = {}
iconDimensions.forEach(dimension => iconPaths[dimension] = `../icons/${
config.extensionDisabled ? 'faded/' : '' }icon${dimension}.png` )
chrome.action.setIcon({ path: iconPaths })
chrome.action.setIcon({ path: Object.fromEntries(
Object.keys(chrome.runtime.getManifest().icons).map(dimension =>
[dimension, `../icons/${config.extensionDisabled ? 'faded/' : ''}icon${dimension}.png`]
))})

// Update menu contents
document.querySelectorAll('div.logo, div.menu-title, div.menu')
Expand Down
8 changes: 4 additions & 4 deletions firefox/extension/popup/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
fade() {

// Update toolbar icon
const iconDimensions = [16, 32, 48, 64, 128], iconPaths = {}
iconDimensions.forEach(dimension => iconPaths[dimension] = `../icons/${
config.extensionDisabled ? 'faded/' : '' }icon${dimension}.png` )
chrome.action.setIcon({ path: iconPaths })
chrome.action.setIcon({ path: Object.fromEntries(
Object.keys(chrome.runtime.getManifest().icons).map(dimension =>
[dimension, `../icons/${config.extensionDisabled ? 'faded/' : ''}icon${dimension}.png`]
))})

// Update menu contents
document.querySelectorAll('div.logo, div.menu-title, div.menu')
Expand Down

0 comments on commit eec9846

Please sign in to comment.