diff options
Diffstat (limited to 'pages')
| -rw-r--r-- | pages/popup.coffee | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/pages/popup.coffee b/pages/popup.coffee index 6d7afafc..5332a596 100644 --- a/pages/popup.coffee +++ b/pages/popup.coffee @@ -1,10 +1,19 @@ onLoad = -> document.getElementById("optionsLink").setAttribute "href", chrome.runtime.getURL("pages/options.html") chrome.tabs.getSelected null, (tab) -> - # The common use case is to disable Vimium at the domain level. - # This regexp will match "http://www.example.com/" from "http://www.example.com/path/to/page.html". - domain = tab.url.match(/[^\/]*\/\/[^\/]*\//) or tab.url - document.getElementById("popupInput").value = domain + "*" + # Check if we have an existing exclusing rule for this page. + isEnabled = chrome.extension.getBackgroundPage().isEnabledForUrl(url: tab.url) + if isEnabled.matchingUrl + # There is an existing rule for this page. + pattern = isEnabled.matchingUrl + pattern += " " + isEnabled.passKeys if isEnabled.passKeys + document.getElementById("popupInput").value = pattern + else + # No existing exclusion rule. + # The common use case is to disable Vimium at the domain level. + # This regexp will match "http://www.example.com/" from "http://www.example.com/path/to/page.html". + domain = tab.url.match(/[^\/]*\/\/[^\/]*\//) or tab.url + document.getElementById("popupInput").value = domain + "*" onExcludeUrl = (e) -> url = document.getElementById("popupInput").value |
