diff --git a/platform/chromium/vapi-background.js b/platform/chromium/vapi-background.js index 26a949ea4..2c4ca6715 100644 --- a/platform/chromium/vapi-background.js +++ b/platform/chromium/vapi-background.js @@ -327,7 +327,9 @@ vAPI.tabs.registerListeners = function() { }; var onActivated = function(details) { - vAPI.contextMenu.onMustUpdate(details.tabId); + if ( vAPI.contextMenu instanceof Object ) { + vAPI.contextMenu.onMustUpdate(details.tabId); + } }; var onUpdated = function(tabId, changeInfo, tab) { @@ -628,7 +630,7 @@ vAPI.setIcon = (function() { tabId = toChromiumTabId(tabId); if ( tabId === 0 ) { return; } - if ( chrome.browserAction.setIcon instanceof Object ) { + if ( chrome.browserAction.setIcon !== undefined ) { chrome.browserAction.setIcon( { tabId: tabId, @@ -648,7 +650,7 @@ vAPI.setIcon = (function() { } } ); - } else if ( chrome.browserAction.setTitle instanceof Object ) { + } else if ( chrome.browserAction.setTitle !== undefined ) { chrome.browserAction.setTitle({ tabId: tabId, title: titleTemplate.replace( @@ -658,10 +660,19 @@ vAPI.setIcon = (function() { }); } - vAPI.contextMenu.onMustUpdate(tabId); + if ( vAPI.contextMenu instanceof Object ) { + vAPI.contextMenu.onMustUpdate(tabId); + } }; })(); +chrome.browserAction.onClicked.addListener(function(tab) { + vAPI.tabs.open({ + select: true, + url: 'popup.html?tabId=' + tab.id + '&mobile=1' + }); +}); + /******************************************************************************/ /******************************************************************************/ diff --git a/platform/webext/install.rdf b/platform/webext/install.rdf index aaf1dc12a..b17945134 100644 --- a/platform/webext/install.rdf +++ b/platform/webext/install.rdf @@ -29,7 +29,7 @@ {{aa3c5121-dab2-40e2-81ca-7ea25febc110}} - 54.0 + 56.0 * diff --git a/src/js/contextmenu.js b/src/js/contextmenu.js index ab2543555..54d939dee 100644 --- a/src/js/contextmenu.js +++ b/src/js/contextmenu.js @@ -27,12 +27,10 @@ /******************************************************************************/ -var api = { - update: function() {} -}; - if ( vAPI.contextMenu === undefined ) { - return api; + return { + update: function() {} + }; } var µb = µBlock; @@ -142,20 +140,20 @@ vAPI.contextMenu.onMustUpdate = update; /******************************************************************************/ -api.update = function(tabId) { - if ( µb.userSettings.contextMenuEnabled && tabId === undefined ) { - vAPI.tabs.get(null, function(tab) { - if ( tab ) { - update(tab.id); - } - }); - return; +return { + update: function(tabId) { + if ( µb.userSettings.contextMenuEnabled && tabId === undefined ) { + vAPI.tabs.get(null, function(tab) { + if ( tab ) { + update(tab.id); + } + }); + return; + } + update(tabId); } - update(tabId); }; -return api; - /******************************************************************************/ })();