Skip to content

Commit

Permalink
fix: update context menus.
Browse files Browse the repository at this point in the history
  • Loading branch information
svrnm committed Jul 28, 2022
1 parent 7a7bce1 commit 455b095
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
26 changes: 14 additions & 12 deletions src/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ try {
return
}

console.log(changeInfo.status)

scope.chrome.tabs.get(tabId, (tab) => {
if (tab.url) {
scope.chrome.scripting.executeScript({
Expand All @@ -149,7 +151,8 @@ try {
console.log('Injection completed for', tabId, tab.url)
})
} else {
console.log('Did not inject into tab ', tabId, 'Permission denied')
logger('warn', 'Did not inject into tab ', tabId, 'Permission denied').write()
badge.updateDemoCounter('!')
}
})
})
Expand Down Expand Up @@ -311,25 +314,24 @@ try {
}
})

/* TODO: MV3 Unfixed
scope.chrome.contextMenus.create({
id: 'dmContextMenu',
id: 'dmToggleLiveMode',
title: 'Toggle Live Mode',
contexts: ['browser_action'],
onclick: function () {
store.dispatch({ type: 'TOGGLE_LIVE_MODE' })
}
contexts: ['action']
})
scope.chrome.contextMenus.create({
id: 'dmContextMenu',
id: 'dmToggleDebugMode',
title: 'Toggle Debug Mode',
contexts: ['browser_action'],
onclick: function () {
contexts: ['action']
})
scope.chrome.contextMenus.onClicked.addListener((info, tab) => {
const { menuItemId } = info
if (menuItemId === 'dmToggleLiveMode') {
store.dispatch({ type: 'TOGGLE_LIVE_MODE' })
} else if (menuItemId === 'dmToggleDebugMode') {
store.dispatch({ type: 'TOGGLE_DEBUG_MODE' })
}
})
*/
}
})(globalThis)
} catch (e) {
Expand Down
2 changes: 1 addition & 1 deletion src/models/Badge.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class Badge {
this.browserAction.getBadgeText({ tabId }, (oldText) => {
// oldText can be undefined for a new tab, set it to ''
const text = this._updateText(typeof oldText === 'undefined' ? '' : oldText, count + '')
const color = count > 0 ? '#952613' : '#5c832f'
const color = (count === '!' || count > 0) ? '#952613' : '#5c832f'
this.browserAction.setBadgeText({ text, tabId })
this.browserAction.setBadgeBackgroundColor({
color,
Expand Down

0 comments on commit 455b095

Please sign in to comment.