diff options
author | gorhill <rhill@raymondhill.net> | 2015-08-01 11:34:31 -0400 |
---|---|---|
committer | gorhill <rhill@raymondhill.net> | 2015-08-01 11:34:31 -0400 |
commit | bfcf0e0bfead4ecfa622d5ab05f4ed69a36d335d (patch) | |
tree | 11052db8de409bd84a63840b35e8e95609e879ae | |
parent | 528354f5945d12fdff5dc7c4a699c4d6aec76125 (diff) | |
download | uBlock-bfcf0e0bfead4ecfa622d5ab05f4ed69a36d335d.zip uBlock-bfcf0e0bfead4ecfa622d5ab05f4ed69a36d335d.tar.gz uBlock-bfcf0e0bfead4ecfa622d5ab05f4ed69a36d335d.tar.bz2 |
code review for last commit: we want to keep namespacing though
-rw-r--r-- | src/js/popup.js | 48 |
1 files changed, 25 insertions, 23 deletions
diff --git a/src/js/popup.js b/src/js/popup.js index fa68cda..346e616 100644 --- a/src/js/popup.js +++ b/src/js/popup.js @@ -837,29 +837,31 @@ var onHideTooltip = function() { // Popup DOM is assumed to be loaded at this point -- because this script // is loaded after everything else.. -// If there's no tab id specified in the query string, -// it will default to current tab. -var tabId = null; - -// Extract the tab id of the page this popup is for -var matches = window.location.search.match(/[\?&]tabId=([^&]+)/); -if ( matches && matches.length === 2 ) { - tabId = matches[1]; -} -getPopupData(tabId); - -uDom('#switch').on('click', toggleNetFilteringSwitch); -uDom('#gotoPick').on('click', gotoPick); -uDom('a[href]').on('click', gotoURL); -uDom('h2').on('click', toggleFirewallPane); -uDom('#refresh').on('click', reloadTab); -uDom('.hnSwitch').on('click', toggleHostnameSwitch); -uDom('#saveRules').on('click', saveFirewallRules); -uDom('#revertRules').on('click', revertFirewallRules); -uDom('[data-i18n="popupAnyRulePrompt"]').on('click', toggleMinimize); - -uDom('body').on('mouseenter', '[data-tip]', onShowTooltip) - .on('mouseleave', '[data-tip]', onHideTooltip); +(function() { + // If there's no tab id specified in the query string, + // it will default to current tab. + var tabId = null; + + // Extract the tab id of the page this popup is for + var matches = window.location.search.match(/[\?&]tabId=([^&]+)/); + if ( matches && matches.length === 2 ) { + tabId = matches[1]; + } + getPopupData(tabId); + + uDom('#switch').on('click', toggleNetFilteringSwitch); + uDom('#gotoPick').on('click', gotoPick); + uDom('a[href]').on('click', gotoURL); + uDom('h2').on('click', toggleFirewallPane); + uDom('#refresh').on('click', reloadTab); + uDom('.hnSwitch').on('click', toggleHostnameSwitch); + uDom('#saveRules').on('click', saveFirewallRules); + uDom('#revertRules').on('click', revertFirewallRules); + uDom('[data-i18n="popupAnyRulePrompt"]').on('click', toggleMinimize); + + uDom('body').on('mouseenter', '[data-tip]', onShowTooltip) + .on('mouseleave', '[data-tip]', onHideTooltip); +})(); /******************************************************************************/ |