-
+
+ diff --git a/src/js/about.js b/src/js/about.js index d7407c63a..4b5ebd34f 100644 --- a/src/js/about.js +++ b/src/js/about.js @@ -108,7 +108,7 @@ uDom('#export').on('click', exportToFile); uDom('#import').on('click', startImportFilePicker); uDom('#reset').on('click', resetUserData); uDom('#restoreFilePicker').on('change', handleImportFilePicker); -uDom('#aboutVersion').html(µBlock.version); +uDom('#aboutNameVer').html(vAPI.app.name + ' v' + vAPI.app.version); /******************************************************************************/ diff --git a/src/js/assets.js b/src/js/assets.js index 80dc0fe5b..6d8164b70 100644 --- a/src/js/assets.js +++ b/src/js/assets.js @@ -97,7 +97,7 @@ var cachedAssetsManager = (function() { // Flush cached non-user assets if these are from a prior version. // https://github.com/gorhill/httpswitchboard/issues/212 var onLastVersionRead = function(store) { - var currentVersion = µBlock.version; + var currentVersion = vAPI.app.version; var lastVersion = store.extensionLastVersion || '0.0.0.0'; if ( currentVersion !== lastVersion ) { vAPI.storage.set({ 'extensionLastVersion': currentVersion }); diff --git a/src/js/background.js b/src/js/background.js index 54a465b53..0f3340567 100644 --- a/src/js/background.js +++ b/src/js/background.js @@ -51,9 +51,6 @@ var defaultExternalLists = [ /******************************************************************************/ return { - name: "µBlock", - version: "0.7.0", - userSettings: { autoUpdate: true, collapseBlocked: true, diff --git a/src/js/messaging.js b/src/js/messaging.js index 8086b65c0..878f0290f 100644 --- a/src/js/messaging.js +++ b/src/js/messaging.js @@ -677,7 +677,7 @@ var getUserData = function(callback) { var onUserFiltersReady = function(details) { callback({ 'timeStamp': Date.now(), - 'version': µb.version, + 'version': vAPI.app.version, 'userSettings': µb.userSettings, 'filterLists': µb.remoteBlacklists, 'netWhitelist': µb.stringFromWhitelist(µb.netWhitelist), diff --git a/src/js/popup.js b/src/js/popup.js index 8596d5d06..0583511a5 100644 --- a/src/js/popup.js +++ b/src/js/popup.js @@ -181,7 +181,8 @@ var toggleNetFilteringSwitch = function(ev) { var renderHeader = function() { var hdr = uDom('#version'); - hdr.html(hdr.html() + 'v'); // + chrome.runtime.getManifest().version); + hdr.nodes[0].previousSibling.textContent = vAPI.app.name; + hdr.html(hdr.html() + 'v' + vAPI.app.version); }; /******************************************************************************/ diff --git a/src/js/storage.js b/src/js/storage.js index bdd51b746..fb7b6103a 100644 --- a/src/js/storage.js +++ b/src/js/storage.js @@ -592,47 +592,47 @@ // - Initialize internal state with maybe already existing tabs. // - Schedule next update operation. var onAllDone = function() { - // http://code.google.com/p/chromium/issues/detail?id=410868#c11 - // Need to be sure to access `chrome.runtime.lastError` to prevent - // spurious warnings in the console. - var scriptDone = function() { - chrome.runtime.lastError; - }; - var scriptEnd = function(tabId) { - if ( chrome.runtime.lastError ) { - return; - } - vAPI.tabs.injectScript(tabId, { - file: 'js/contentscript-end.js', - allFrames: true, - runAt: 'document_idle' - }, scriptDone); - }; - var scriptStart = function(tabId) { - vAPI.tabs.injectScript(tabId, { - file: 'js/contentscript-start.js', - allFrames: true, - runAt: 'document_idle' - }, function(){ scriptEnd(tabId); }); - }; - var bindToTabs = function(tabs) { - var i = tabs.length, tab; - while ( i-- ) { - tab = tabs[i]; - µb.bindTabToPageStats(tab.id, tab.url); - // https://github.com/gorhill/uBlock/issues/129 - scriptStart(tab.id); - } - }; - if (vAPI.chrome) { + // http://code.google.com/p/chromium/issues/detail?id=410868#c11 + // Need to be sure to access `chrome.runtime.lastError` to prevent + // spurious warnings in the console. + var scriptDone = function() { + chrome.runtime.lastError; + }; + var scriptEnd = function(tabId) { + if ( chrome.runtime.lastError ) { + return; + } + vAPI.tabs.injectScript(tabId, { + file: 'js/contentscript-end.js', + allFrames: true, + runAt: 'document_idle' + }, scriptDone); + }; + var scriptStart = function(tabId) { + vAPI.tabs.injectScript(tabId, { + file: 'js/contentscript-start.js', + allFrames: true, + runAt: 'document_idle' + }, function(){ scriptEnd(tabId); }); + }; + var bindToTabs = function(tabs) { + var i = tabs.length, tab; + while ( i-- ) { + tab = tabs[i]; + µb.bindTabToPageStats(tab.id, tab.url); + // https://github.com/gorhill/uBlock/issues/129 + scriptStart(tab.id); + } + }; + chrome.tabs.query({ url: 'http://*/*' }, bindToTabs); chrome.tabs.query({ url: 'https://*/*' }, bindToTabs); } // https://github.com/gorhill/uBlock/issues/184 // If we restored a selfie, check for updates not too far - // in the future. + // in the future. var nextUpdate = fromSelfie === false && µb.userSettings.autoUpdate ? µb.nextUpdateAfter : µb.firstUpdateAfter; diff --git a/src/js/vapi-appinfo.js b/src/js/vapi-appinfo.js new file mode 100644 index 000000000..dc4684d68 --- /dev/null +++ b/src/js/vapi-appinfo.js @@ -0,0 +1,10 @@ +// can be included anywhere if it's needed +'use strict'; + +window.vAPI = window.vAPI || {}; + +vAPI.app = { + /**/name: 'µBlock', + /**/version: '0.7.0.7', + /**/url: 'https://github.com/gorhill/uBlock', +}; \ No newline at end of file diff --git a/src/popup.html b/src/popup.html index 0c2ea30d4..c86b5128a 100644 --- a/src/popup.html +++ b/src/popup.html @@ -9,7 +9,7 @@
-
@@ -55,6 +55,7 @@