diff options
author | Raymond Hill <rhill@raymondhill.net> | 2014-11-16 00:21:13 -0200 |
---|---|---|
committer | Raymond Hill <rhill@raymondhill.net> | 2014-11-16 00:21:13 -0200 |
commit | 84c069dfaa607391505a0d9ddb6c3a554fa690fe (patch) | |
tree | ab98f61ae6d9bf8e679bbb9f1a258e942a4f42ad /meta | |
parent | eafc96859ca2a5567948f69afccb49e556a86cdd (diff) | |
download | uBlock-84c069dfaa607391505a0d9ddb6c3a554fa690fe.zip uBlock-84c069dfaa607391505a0d9ddb6c3a554fa690fe.tar.gz uBlock-84c069dfaa607391505a0d9ddb6c3a554fa690fe.tar.bz2 |
continued: corralling platform-specific stuff into their meta folder
Diffstat (limited to 'meta')
-rw-r--r-- | meta/crx/manifest.json | 59 | ||||
-rw-r--r-- | meta/crx/vapi-background.js | 30 |
2 files changed, 42 insertions, 47 deletions
diff --git a/meta/crx/manifest.json b/meta/crx/manifest.json index 0f5d226..321cc96 100644 --- a/meta/crx/manifest.json +++ b/meta/crx/manifest.json @@ -1,40 +1,29 @@ { "manifest_version": 2, - "minimum_chrome_version": "22.0", - "default_locale": "{def_lang}", - "update_url": "https://clients2.google.com/service/update2/crx", - "version": "{version}", - "name": "{name}", - "description": "__MSG_extShortDesc__", - "homepage_url": "{url}", - "author": "{author}", - "developer": { - "name": "{author}", - "email": "{author_email}" - }, + "name": "µBlock", + "version": "0.7.0.10", + "default_locale": "en", + "description": "__MSG_extShortDesc__", "icons": { "16": "img/icon_16.png", "128": "img/icon_128.png" }, - "permissions": [ - "contextMenus", - "storage", - "tabs", - "unlimitedStorage", - "webNavigation", - "webRequest", - "webRequestBlocking", - "http://*/*", - "https://*/*" - ], + "browser_action": { + "default_icon": { + "19": "img/browsericons/icon19-off.png", + "38": "img/browsericons/icon38-off.png" + }, + "default_title": "µBlock", + "default_popup": "popup.html" + }, + "author": "Raymond Hill", "background": { "page": "background.html" }, - "options_page": "dashboard.html", "content_scripts": [ { "matches": ["http://*/*", "https://*/*"], @@ -49,13 +38,17 @@ "all_frames": true } ], - - "browser_action": { - "default_icon": { - "19": "img/browsericons/icon19-off.png", - "38": "img/browsericons/icon38-off.png" - }, - "default_title": "{name}", - "default_popup": "popup.html" - } + "minimum_chrome_version": "22.0", + "options_page": "dashboard.html", + "permissions": [ + "contextMenus", + "storage", + "tabs", + "unlimitedStorage", + "webNavigation", + "webRequest", + "webRequestBlocking", + "http://*/*", + "https://*/*" + ] }
\ No newline at end of file diff --git a/meta/crx/vapi-background.js b/meta/crx/vapi-background.js index 6af3cb7..d5a0eda 100644 --- a/meta/crx/vapi-background.js +++ b/meta/crx/vapi-background.js @@ -111,10 +111,9 @@ vAPI.tabs = { // update doesn't accept index, must use move chrome.tabs.update(details.tabId, _details, function(tab) { // if the tab doesn't exist - if (chrome.runtime.lastError) { + if ( vAPI.lastError() ) { chrome.tabs.create(_details); - } - else if (details.index !== undefined) { + } else if ( details.index !== undefined ) { chrome.tabs.move(tab.id, {index: details.index}); } }); @@ -195,7 +194,7 @@ vAPI.tabs = { vAPI.setIcon = function(tabId, img, badge) { var onIconReady = function() { - if ( chrome.runtime.lastError ) { + if ( vAPI.lastError() ) { return; } @@ -213,6 +212,7 @@ vAPI.setIcon = function(tabId, img, badge) { vAPI.messaging = { ports: {}, listeners: {}, + connector: null, listen: function(listenerName, callback) { this.listeners[listenerName] = callback; @@ -226,11 +226,11 @@ vAPI.messaging = { this.connector = function(port) { var onMessage = function(request) { var callback = function(response) { - if (chrome.runtime.lastError || response === undefined) { + if ( vAPI.lastError() || response === undefined ) { return; } - if (request.requestId) { + if ( request.requestId ) { port.postMessage({ requestId: request.requestId, portName: request.portName, @@ -239,16 +239,18 @@ vAPI.messaging = { } }; + // Default handler var listener = connector(request.msg, port.sender, callback); + if ( listener !== null ) { + return; + } - if ( listener === null ) { - listener = vAPI.messaging.listeners[request.portName]; - - if (typeof listener === 'function') { - listener(request.msg, port.sender, callback); - } else { - console.error('µBlock> messaging > unknown request: %o', request); - } + // Specific handler + listener = vAPI.messaging.listeners[request.portName]; + if ( typeof listener === 'function' ) { + listener(request.msg, port.sender, callback); + } else { + console.error('µBlock> messaging > unknown request: %o', request); } }; |