From 2af72459fe903b51ccd92b0935a3bedc8bdb77a6 Mon Sep 17 00:00:00 2001 From: gorhill Date: Sun, 6 Dec 2015 16:43:58 -0500 Subject: [PATCH] minor code review: move vars closer to their 1st use + reference links --- platform/firefox/vapi-background.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/platform/firefox/vapi-background.js b/platform/firefox/vapi-background.js index e788ac6f9..2f5e65e93 100644 --- a/platform/firefox/vapi-background.js +++ b/platform/firefox/vapi-background.js @@ -2689,10 +2689,10 @@ vAPI.toolbarButton = { return; } - var palette = toolbox.palette; - var navbar = document.getElementById('nav-bar'); var toolbarButton = createToolbarButton(window); + // https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XUL/toolbarpalette + var palette = toolbox.palette; if ( palette && palette.querySelector('#' + tbb.id) === null ) { palette.appendChild(toolbarButton); } @@ -2723,6 +2723,7 @@ vAPI.toolbarButton = { break; } } + // https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XUL/Method/insertItem toolbar.insertItem(tbb.id, before); break; } @@ -2734,6 +2735,7 @@ vAPI.toolbarButton = { // No button yet so give it a default location. If forcing the button, // just put in in the palette rather than on any specific toolbar (who // knows what toolbars will be available or visible!) + var navbar = document.getElementById('nav-bar'); if ( navbar !== null && !vAPI.localStorage.getBool('legacyToolbarButtonAdded') ) { // https://github.com/gorhill/uBlock/issues/264 // Find a child customizable palette, if any.