From cb5d860725c51eb6c80a1a3bf6b9df4273f87fa8 Mon Sep 17 00:00:00 2001 From: Deathamns Date: Tue, 16 Dec 2014 13:44:34 +0100 Subject: [PATCH] Firefox: implement toolbar button and popup --- platform/chromium/vapi-client.js | 2 +- platform/firefox/bootstrap.js | 8 +- platform/firefox/frameModule.js | 34 +-- platform/firefox/frameScript.js | 19 +- platform/firefox/install.rdf | 4 +- platform/firefox/vapi-background.js | 343 +++++++++++++++++------ platform/firefox/vapi-client.js | 4 +- platform/firefox/vapi-common.js | 6 +- platform/safari/Info.plist | 2 +- platform/safari/vapi-client.js | 4 +- src/img/browsericons/icon16-off.svg | 16 ++ src/img/{ => browsericons}/icon16.png | Bin src/img/browsericons/icon16.svg | 16 ++ src/img/{ => browsericons}/icon16@2x.png | Bin src/js/asset-viewer.js | 9 +- 15 files changed, 341 insertions(+), 126 deletions(-) create mode 100644 src/img/browsericons/icon16-off.svg rename src/img/{ => browsericons}/icon16.png (100%) create mode 100644 src/img/browsericons/icon16.svg rename src/img/{ => browsericons}/icon16@2x.png (100%) diff --git a/platform/chromium/vapi-client.js b/platform/chromium/vapi-client.js index e4099a20f..c35de73b0 100644 --- a/platform/chromium/vapi-client.js +++ b/platform/chromium/vapi-client.js @@ -87,7 +87,7 @@ var messagingConnector = function(response) { /******************************************************************************/ var uniqueId = function() { - return parseInt(Math.random() * 1e10, 10).toString(36); + return Math.random().toString(36).slice(2); }; /******************************************************************************/ diff --git a/platform/firefox/bootstrap.js b/platform/firefox/bootstrap.js index a3096afa8..9cac5344a 100644 --- a/platform/firefox/bootstrap.js +++ b/platform/firefox/bootstrap.js @@ -39,9 +39,7 @@ function shutdown(data, reason) { } } -function install() { - // https://bugzil.la/719376 - Services.strings.flushBundles(); -} +// https://bugzil.la/719376 +function install() Services.strings.flushBundles(); -function uninstall() {} \ No newline at end of file +function uninstall() {} diff --git a/platform/firefox/frameModule.js b/platform/firefox/frameModule.js index 7465c2bd5..9aa9f7a4a 100644 --- a/platform/firefox/frameModule.js +++ b/platform/firefox/frameModule.js @@ -1,14 +1,18 @@ /* global Services, Components, XPCOMUtils */ -/* exported EXPORTED_SYMBOLS, isTabbed */ 'use strict'; -var EXPORTED_SYMBOLS = ['contentPolicy', 'docObserver']; +this.EXPORTED_SYMBOLS = ['contentPolicy', 'docObserver']; Components.utils['import']('resource://gre/modules/Services.jsm'); Components.utils['import']('resource://gre/modules/XPCOMUtils.jsm'); -const Ci = Components.interfaces, appName = 'ublock'; +const Ci = Components.interfaces; +var appName; + +try { throw new Error; } catch (ex) { + appName = ex.fileName.match(/:\/\/([^\/]+)/)[1]; +} let getMessager = function(win) { try { @@ -33,9 +37,10 @@ let getMessager = function(win) { let contentPolicy = { classDescription: 'ContentPolicy implementation', classID: Components.ID('{e6d173c8-8dbf-4189-a6fd-189e8acffd27}'), - contractID: '@ublock/content-policy;1', + contractID: '@' + appName + '/content-policy;1', ACCEPT: Ci.nsIContentPolicy.ACCEPT, REJECT: Ci.nsIContentPolicy.REJECT_REQUEST, + requestMessageName: appName + ':onBeforeRequest', get componentRegistrar() { return Components.manager.QueryInterface(Ci.nsIComponentRegistrar); }, @@ -89,7 +94,7 @@ let contentPolicy = { return this.ACCEPT; } - let result = getMessager(win).sendSyncMessage('ublock:onBeforeRequest', { + let result = getMessager(win).sendSyncMessage(this.requestMessageName, { url: location.spec, type: type, tabId: -1, @@ -105,7 +110,7 @@ let contentPolicy = { }; let docObserver = { - contentBaseURI: 'chrome://ublock/content/js/', + contentBaseURI: 'chrome://' + appName + '/content/js/', initContext: function(win, sandbox) { let messager = getMessager(win); @@ -115,6 +120,8 @@ let docObserver = { wantComponents: false, wantXHRConstructor: false }); + + win.self = win; } win.sendAsyncMessage = messager.sendAsyncMessage; @@ -151,17 +158,12 @@ let docObserver = { lss(this.contentBaseURI + 'vapi-client.js', win); lss(this.contentBaseURI + 'contentscript-start.js', win); - if (doc.readyState === 'interactive' || doc.readyState === 'complete') { - lss(this.contentBaseURI + 'contentscript-end.js', win); - } - else { - let docReady = function(e) { - this.removeEventListener(e.type, docReady, true); - lss(docObserver.contentBaseURI + 'contentscript-end.js', win); - }; + let docReady = function(e) { + this.removeEventListener(e.type, docReady, true); + lss(docObserver.contentBaseURI + 'contentscript-end.js', win); + }; - doc.addEventListener('DOMContentLoaded', docReady, true); - } + doc.addEventListener('DOMContentLoaded', docReady, true); } }; diff --git a/platform/firefox/frameScript.js b/platform/firefox/frameScript.js index 21586a991..37caefb63 100644 --- a/platform/firefox/frameScript.js +++ b/platform/firefox/frameScript.js @@ -1,20 +1,27 @@ /* globals Services, sendAsyncMessage, addMessageListener, removeMessageListener */ +(function(frameScriptContext) { + 'use strict'; -let appName = 'ublock'; +let appName; let listeners = {}; -let frameModule = Components.utils['import']('chrome://' + appName + '/content/frameModule.js', {}); -this.ublock_addMessageListener = function(id, fn) { - ublock_removeMessageListener(id); +try { throw new Error; } catch (ex) { + appName = ex.fileName.match(/:\/\/([^\/]+)/)[1]; +} + +Components.utils['import']('chrome://' + appName + '/content/frameModule.js', {}); + +frameScriptContext[appName + '_addMessageListener'] = function(id, fn) { + frameScriptContext[appName + '_removeMessageListener'](id); listeners[id] = function(msg) { fn(msg.data); }; addMessageListener(id, listeners[id]); }; -this.ublock_removeMessageListener = function(id) { +frameScriptContext[appName + '_removeMessageListener'] = function(id) { if (listeners[id]) { removeMessageListener(id, listeners[id]); } @@ -27,3 +34,5 @@ addMessageListener(appName + ':broadcast', function(msg) { listeners[id](msg); } }); + +})(this); \ No newline at end of file diff --git a/platform/firefox/install.rdf b/platform/firefox/install.rdf index 9be5d79e1..ca810e374 100644 --- a/platform/firefox/install.rdf +++ b/platform/firefox/install.rdf @@ -17,7 +17,7 @@ {ec8030f7-c20a-464f-9b0e-13a3a9e97384} - 24.0 + 29.0 37.0 @@ -26,7 +26,7 @@ {92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a} - 2.21 + 2.26 2.34 diff --git a/platform/firefox/vapi-background.js b/platform/firefox/vapi-background.js index 753124f7c..d5dce5692 100644 --- a/platform/firefox/vapi-background.js +++ b/platform/firefox/vapi-background.js @@ -19,7 +19,7 @@ Home: https://github.com/gorhill/uBlock */ -/* global Services */ +/* global Services, CustomizableUI */ // For background page @@ -34,26 +34,30 @@ const {classes: Cc, interfaces: Ci, utils: Cu} = Components; Cu['import']('resource://gre/modules/Services.jsm'); +Cu['import']('resource:///modules/CustomizableUI.jsm'); /******************************************************************************/ self.vAPI = self.vAPI || {}; - vAPI.firefox = true; /******************************************************************************/ vAPI.app = { name: 'µBlock', - cleanName: 'ublock', - version: '0.7.2.0' + version: '0.7.2.0', + cleanName: location.host }; /******************************************************************************/ -vAPI.app.restart = function() { +vAPI.app.restart = function() {}; -}; +/******************************************************************************/ + +// list of things that needs to be destroyed when disabling the extension + +vAPI.unload = []; /******************************************************************************/ @@ -76,10 +80,11 @@ var SQLite = { 'CREATE TABLE IF NOT EXISTS settings' + '(name TEXT PRIMARY KEY NOT NULL, value TEXT);' ); - }, - close: function() { - this.run('VACUUM'); - this.db.asyncClose(); + + vAPI.unload.push(function() { + SQLite.run('VACUUM'); + SQLite.db.asyncClose(); + }); }, run: function(query, values, callback) { if (!this.db) { @@ -233,10 +238,15 @@ vAPI.storage = { var windowWatcher = { onTabClose: function(e) { - vAPI.tabs.onClosed(vAPI.tabs.getTabId(e.target)); + var tabId = vAPI.tabs.getTabId(e.target); + vAPI.tabs.onClosed(tabId); + delete vAPI.tabIcons[tabId]; }, - onTabSelect: function() { - // vAPI.setIcon(); + onTabSelect: function(e) { + vAPI.setIcon( + vAPI.tabs.getTabId(e.target), + e.target.ownerDocument.defaultView + ); }, onLoad: function(e) { if (e) { @@ -259,20 +269,10 @@ var windowWatcher = { tC.addEventListener('TabClose', windowWatcher.onTabClose); tC.addEventListener('TabSelect', windowWatcher.onTabSelect); + vAPI.toolbarButton.add(this.document); + // when new window is opened TabSelect doesn't run on the selected tab? }, - unregister: function() { - Services.ww.unregisterNotification(this); - - for (var win of vAPI.tabs.getWindows()) { - win.removeEventListener('load', this.onLoad); - win.gBrowser.removeTabsProgressListener(tabsProgressListener); - - var tC = win.gBrowser.tabContainer; - tC.removeEventListener('TabClose', this.onTabClose); - tC.removeEventListener('TabSelect', this.onTabSelect); - } - }, observe: function(win, topic) { if (topic === 'domwindowopened') { win.addEventListener('load', this.onLoad); @@ -320,10 +320,35 @@ vAPI.tabs.registerListeners = function() { Services.ww.registerNotification(windowWatcher); - // already opened windows for (var win of this.getWindows()) { windowWatcher.onLoad.call(win); } + + vAPI.toolbarButton.init(); + + vAPI.unload.push(function() { + Services.ww.unregisterNotification(windowWatcher); + + for (var win of vAPI.tabs.getWindows()) { + vAPI.toolbarButton.remove(win.document); + + win.removeEventListener('load', windowWatcher.onLoad); + win.gBrowser.removeTabsProgressListener(tabsProgressListener); + + var tC = win.gBrowser.tabContainer; + tC.removeEventListener('TabClose', windowWatcher.onTabClose); + tC.removeEventListener('TabSelect', windowWatcher.onTabSelect); + + // close extension tabs + for (var tab of win.gBrowser.tabs) { + var URI = tab.linkedBrowser.currentURI; + + if (URI.scheme === 'chrome' && URI.host === vAPI.app.cleanName) { + win.gBrowser.removeTab(tab); + } + } + } + }); }; /******************************************************************************/ @@ -513,21 +538,164 @@ vAPI.tabs.close = function(tabIds) { /******************************************************************************/ -/*vAPI.tabs.injectScript = function(tabId, details, callback) { +vAPI.tabs.injectScript = function(tabId, details, callback) { -};*/ +}; /******************************************************************************/ -vAPI.setIcon = function() { +vAPI.tabIcons = { /*tabId: {badge: 0, img: dict}*/ }; +vAPI.setIcon = function(tabId, img, badge) { + var curWin = badge === undefined ? img : Services.wm.getMostRecentWindow('navigator:browser'); + var curTabId = vAPI.tabs.getTabId(curWin.gBrowser.selectedTab); + // from 'TabSelect' event + if (tabId === undefined) { + tabId = curTabId; + } + else if (badge !== undefined) { + vAPI.tabIcons[tabId] = { + badge: badge === '>1K' ? '1k+' : badge, + img: img && img[19] && img[19].replace(/19(-off)?\.png$/, '16$1.svg') + }; + } + + if (tabId !== curTabId) { + return; + } + + var button = curWin.document.getElementById(vAPI.toolbarButton.widgetId); + var icon = vAPI.tabIcons[tabId]; + button.setAttribute('badge', icon && icon.badge || ''); + button.style.listStyleImage = 'url(' + vAPI.getURL(icon && icon.img || 'img/browsericons/icon16-off.svg') + ')'; +}; + +/******************************************************************************/ + +vAPI.toolbarButton = { + widgetId: vAPI.app.cleanName + '-button', + panelId: vAPI.app.cleanName + '-panel' +}; + +/******************************************************************************/ + +vAPI.toolbarButton.init = function() { + CustomizableUI.createWidget({ + id: this.widgetId, + type: 'view', + viewId: this.panelId, + defaultArea: CustomizableUI.AREA_NAVBAR, + label: vAPI.app.name, + tooltiptext: vAPI.app.name, + onViewShowing: function(e) { + e.target.firstChild.setAttribute('src', vAPI.getURL('popup.html')); + }, + onViewHiding: function(e) { + e.target.firstChild.setAttribute('src', 'about:blank'); + } + }); + + var doc = Services.wm.getMostRecentWindow('navigator:browser').document; + + var button = doc.getElementById(this.widgetId); + button.style.listStyleImage = 'url(' + vAPI.getURL('img/icon16.svg') + ')'; + + if (!this.styleURI) { + var css = encodeURIComponent([ + '#' + this.widgetId + '[badge]:not([badge=""])::after {', + 'position: absolute; color: #fff; background: #666;', + 'content: attr(badge); font-size: 9px; font-weight: bold;', + 'padding: 1px 2px; margin-left: -16px; margin-top: 3px }' + ].join('')); + + this.styleURI = Services.io.newURI('data:text/css,' + css, null, null); + } + + var sss = Cc['@mozilla.org/content/style-sheet-service;1'] + .getService(Ci.nsIStyleSheetService); + + sss.loadAndRegisterSheet(this.styleURI, sss.USER_SHEET); + + vAPI.unload.push(function() { + sss.unregisterSheet(this.styleURI, sss.USER_SHEET); + CustomizableUI.createWidget(this.widgetId); + }.bind(this)); +}; + +/******************************************************************************/ + +// it runs with windowWatcher when a window is opened +// vAPI.tabs.registerListeners initializes it + +vAPI.toolbarButton.add = function(doc) { + var panel = doc.createElement('panelview'); + panel.id = this.panelId; + + var iframe = panel.appendChild(doc.createElement('iframe')); + iframe.setAttribute('type', 'content'); + + panel.style.cssText = iframe.style.cssText + = 'width: 180px; height: 310px; transition: width .1s, height .1s'; + + doc.getElementById('PanelUI-multiView') + .appendChild(panel) + .appendChild(iframe); + + var updateTimer = null; + var delayedResize = function() { + if (updateTimer) { + return; + } + + updateTimer = setTimeout(resizePopup, 20); + }; + + var resizePopup = function() { + var panelStyle = panel.style; + var body = iframe.contentDocument.body; + panelStyle.width = iframe.style.width = body.clientWidth + 'px'; + panelStyle.height = iframe.style.height = body.clientHeight + 'px'; + updateTimer = null; + }; + + var onPopupReady = function() { + if (!this.contentWindow + || this.contentWindow.location.host !== vAPI.app.cleanName) { + return; + } + + var mutObs = this.contentWindow.MutationObserver; + + (new mutObs(delayedResize)).observe(this.contentDocument, { + childList: true, + attributes: true, + characterData: true, + subtree: true + }); + + delayedResize(); + }; + + iframe.addEventListener('load', onPopupReady, true); +}; + +/******************************************************************************/ + +vAPI.toolbarButton.remove = function(doc) { + var panel = doc.getElementById(this.panelId); + panel.parentNode.removeChild(panel); + doc.defaultView.QueryInterface(Ci.nsIInterfaceRequestor). + getInterface(Ci.nsIDOMWindowUtils).removeSheet(this.styleURI, 1); }; /******************************************************************************/ vAPI.messaging = { - gmm: Cc['@mozilla.org/globalmessagemanager;1'].getService(Ci.nsIMessageListenerManager), - frameScript: 'chrome://' + vAPI.app.cleanName + '/content/frameScript.js', + get globalMessageManager() { + return Cc['@mozilla.org/globalmessagemanager;1'] + .getService(Ci.nsIMessageListenerManager); + }, + frameScript: vAPI.getURL('frameScript.js'), listeners: {}, defaultHandler: null, NOOPFUNC: function(){}, @@ -536,10 +704,6 @@ vAPI.messaging = { /******************************************************************************/ -vAPI.messaging.gmm.loadFrameScript(vAPI.messaging.frameScript, true); - -/******************************************************************************/ - vAPI.messaging.listen = function(listenerName, callback) { this.listeners[listenerName] = callback; }; @@ -548,6 +712,15 @@ vAPI.messaging.listen = function(listenerName, callback) { vAPI.messaging.onMessage = function(request) { var messageManager = request.target.messageManager; + + if (!messageManager) { + // Message came from a popup, and its message manager is not usable. + // So instead we broadcast to the parent window. + messageManager = request.target + .webNavigation.QueryInterface(Ci.nsIDocShell) + .chromeEventHandler.ownerDocument.defaultView.messageManager; + } + var listenerId = request.data.portName.split('|'); var requestId = request.data.requestId; var portName = listenerId[1]; @@ -556,14 +729,18 @@ vAPI.messaging.onMessage = function(request) { var callback = vAPI.messaging.NOOPFUNC; if ( requestId !== undefined ) { callback = function(response) { - messageManager.sendAsyncMessage( - listenerId, - JSON.stringify({ - requestId: requestId, - portName: portName, - msg: response !== undefined ? response : null - }) - ); + var message = JSON.stringify({ + requestId: requestId, + portName: portName, + msg: response !== undefined ? response : null + }); + + if (messageManager.sendAsyncMessage) { + messageManager.sendAsyncMessage(listenerId, message); + } + else { + messageManager.broadcastAsyncMessage(listenerId, message); + } }; } @@ -610,16 +787,28 @@ vAPI.messaging.setup = function(defaultHandler) { } this.defaultHandler = defaultHandler; - this.gmm.addMessageListener( + this.globalMessageManager.addMessageListener( vAPI.app.cleanName + ':background', this.onMessage ); + + this.globalMessageManager.loadFrameScript(vAPI.messaging.frameScript, true); + + vAPI.unload.push(function() { + var gmm = vAPI.messaging.globalMessageManager; + + gmm.removeDelayedFrameScript(vAPI.messaging.frameScript); + gmm.removeMessageListener( + vAPI.app.cleanName + ':background', + vAPI.messaging.onMessage + ); + }); }; /******************************************************************************/ vAPI.messaging.broadcast = function(message) { - this.gmm.broadcastAsyncMessage( + this.globalMessageManager.broadcastAsyncMessage( vAPI.app.cleanName + ':broadcast', JSON.stringify({broadcast: true, msg: message}) ); @@ -627,20 +816,12 @@ vAPI.messaging.broadcast = function(message) { /******************************************************************************/ -vAPI.messaging.unload = function() { - this.gmm.removeMessageListener( - vAPI.app.cleanName + ':background', - this.onMessage - ); - this.gmm.removeDelayedFrameScript(this.frameScript); +vAPI.net = { + beforeRequestMessageName: vAPI.app.cleanName + ':onBeforeRequest' }; /******************************************************************************/ -vAPI.net = {}; - -/******************************************************************************/ - vAPI.net.registerListeners = function() { var types = { 2: 'script', @@ -677,20 +858,30 @@ vAPI.net.registerListeners = function() { return false; }; - vAPI.messaging.gmm.addMessageListener( - vAPI.app.cleanName + ':onBeforeRequest', + vAPI.messaging.globalMessageManager.addMessageListener( + this.beforeRequestMessageName, this.onBeforeRequest ); + + vAPI.unload.push(function() { + vAPI.messaging.globalMessageManager.removeMessageListener( + vAPI.net.beforeRequestMessageName, + vAPI.net.onBeforeRequest + ); + }); }; /******************************************************************************/ -vAPI.net.unregisterListeners = function() { - vAPI.messaging.gmm.removeMessageListener( - vAPI.app.cleanName + ':onBeforeRequest', - this.onBeforeRequest - ); -}; +vAPI.contextMenu = {}; + +/******************************************************************************/ + +vAPI.contextMenu.create = function(details, callback) {}; + +/******************************************************************************/ + +vAPI.contextMenu.remove = function() {}; /******************************************************************************/ @@ -703,30 +894,16 @@ vAPI.lastError = function() { // clean up when the extension is disabled window.addEventListener('unload', function() { - SQLite.close(); - windowWatcher.unregister(); - vAPI.messaging.unload(); - vAPI.net.unregisterListeners(); + for (var unload of vAPI.unload) { + unload(); + } - var URI = vAPI.messaging.frameScript.replace('Script.', 'Module.'); + // frameModule needs to be cleared too var frameModule = {}; - Cu['import'](URI, frameModule); + Cu['import'](vAPI.getURL('frameModule.js'), frameModule); frameModule.contentPolicy.unregister(); frameModule.docObserver.unregister(); - Cu.unload(URI); - - // close extension tabs - var win, tab, host = vAPI.app.cleanName; - - for (win of vAPI.tabs.getWindows()) { - for (tab of win.gBrowser.tabs) { - URI = tab.linkedBrowser.currentURI; - - if (URI.scheme === 'chrome' && URI.host === host) { - win.gBrowser.removeTab(tab); - } - } - } + Cu.unload(vAPI.getURL('frameModule.js')); }); /******************************************************************************/ diff --git a/platform/firefox/vapi-client.js b/platform/firefox/vapi-client.js index 72191795a..0ecb65529 100644 --- a/platform/firefox/vapi-client.js +++ b/platform/firefox/vapi-client.js @@ -19,6 +19,8 @@ Home: https://github.com/gorhill/uBlock */ +/* global addMessageListener, removeMessageListener, sendAsyncMessage */ + // For non background pages /******************************************************************************/ @@ -74,7 +76,7 @@ var messagingConnector = function(response) { /******************************************************************************/ var uniqueId = function() { - return parseInt(Math.random() * 1e10, 10).toString(36); + return Math.random().toString(36).slice(2); }; /******************************************************************************/ diff --git a/platform/firefox/vapi-common.js b/platform/firefox/vapi-common.js index 71a0e5453..0bcc95c30 100644 --- a/platform/firefox/vapi-common.js +++ b/platform/firefox/vapi-common.js @@ -69,13 +69,15 @@ vAPI.download = function(details) { /******************************************************************************/ vAPI.getURL = function(path) { - return 'chrome://ublock/content/' + path.replace(/^\/+/, ''); + return 'chrome://' + location.host + '/content/' + path.replace(/^\/+/, ''); }; +/******************************************************************************/ + vAPI.i18n = (function() { var stringBundle = Components.classes['@mozilla.org/intl/stringbundle;1'] .getService(Components.interfaces.nsIStringBundleService) - .createBundle('chrome://ublock/locale/messages.properties'); + .createBundle('chrome://' + location.host + '/locale/messages.properties'); return function(s) { try { diff --git a/platform/safari/Info.plist b/platform/safari/Info.plist index 37223df73..7c1da4c86 100644 --- a/platform/safari/Info.plist +++ b/platform/safari/Info.plist @@ -37,7 +37,7 @@ Identifier toolbarItem Image - img/icon16.png + img/browsericons/icon16.png Label {name} Popover diff --git a/platform/safari/vapi-client.js b/platform/safari/vapi-client.js index 8bfbeb7e6..e7c1cd76e 100644 --- a/platform/safari/vapi-client.js +++ b/platform/safari/vapi-client.js @@ -74,7 +74,7 @@ var messagingConnector = function(response) { /******************************************************************************/ var uniqueId = function() { - return parseInt(Math.random() * 1e10, 10).toString(36); + return Math.random().toString(36).slice(2); }; /******************************************************************************/ @@ -359,7 +359,7 @@ var firstMutation = function() { 'return r;', '};', 'history.replaceState = function() {', - 'var r = pR.apply(this, arguments);', + 'var r = rS.apply(this, arguments);', 'onpopstate();', 'return r;', '};' diff --git a/src/img/browsericons/icon16-off.svg b/src/img/browsericons/icon16-off.svg new file mode 100644 index 000000000..58ebf4053 --- /dev/null +++ b/src/img/browsericons/icon16-off.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + diff --git a/src/img/icon16.png b/src/img/browsericons/icon16.png similarity index 100% rename from src/img/icon16.png rename to src/img/browsericons/icon16.png diff --git a/src/img/browsericons/icon16.svg b/src/img/browsericons/icon16.svg new file mode 100644 index 000000000..4f6ce99ce --- /dev/null +++ b/src/img/browsericons/icon16.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + diff --git a/src/img/icon16@2x.png b/src/img/browsericons/icon16@2x.png similarity index 100% rename from src/img/icon16@2x.png rename to src/img/browsericons/icon16@2x.png diff --git a/src/js/asset-viewer.js b/src/js/asset-viewer.js index ba55083a1..fb6c80633 100644 --- a/src/js/asset-viewer.js +++ b/src/js/asset-viewer.js @@ -44,14 +44,7 @@ if ( !matches || matches.length !== 2 ) { return; } -uDom.onLoad(function() { - messager.send({ - what: 'getAssetContent', - url: matches[1] - }, - onAssetContentReceived - ); -}); +messager.send({ what : 'getAssetContent', url: matches[1] }, onAssetContentReceived); /******************************************************************************/