aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pages/popup.coffee16
-rw-r--r--pages/popup.js20
2 files changed, 16 insertions, 20 deletions
diff --git a/pages/popup.coffee b/pages/popup.coffee
new file mode 100644
index 00000000..0bac6ca7
--- /dev/null
+++ b/pages/popup.coffee
@@ -0,0 +1,16 @@
+onLoad = ->
+ document.getElementById("optionsLink").setAttribute "href", chrome.extension.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 + "*"
+
+onExcludeUrl = (e) ->
+ url = document.getElementById("popupInput").value
+ chrome.extension.getBackgroundPage().addExcludedUrl url
+ document.getElementById("excludeConfirm").setAttribute "style", "display: inline-block"
+
+document.addEventListener "DOMContentLoaded", ->
+ document.getElementById("popupButton").addEventListener "click", onExcludeUrl, false
+ onLoad()
diff --git a/pages/popup.js b/pages/popup.js
deleted file mode 100644
index 1ade3696..00000000
--- a/pages/popup.js
+++ /dev/null
@@ -1,20 +0,0 @@
-function onLoad() {
- document.getElementById("optionsLink").setAttribute("href", chrome.extension.getURL("pages/options.html"));
- chrome.tabs.getSelected(null, function(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".
- var domain = tab.url.match(/[^\/]*\/\/[^\/]*\//) || tab.url;
- document.getElementById("popupInput").value = domain + "*";
- });
-}
-
-function onExcludeUrl(e) {
- var url = document.getElementById("popupInput").value;
- chrome.extension.getBackgroundPage().addExcludedUrl(url);
- document.getElementById("excludeConfirm").setAttribute("style", "display: inline-block");
-}
-
-document.addEventListener("DOMContentLoaded", function() {
- document.getElementById("popupButton").addEventListener("click", onExcludeUrl, false);
- onLoad();
-});