Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Convert popup.js to Coffeescript.

  • Loading branch information...
commit 54fe05aab863c04877a3330d742058280977866c 1 parent 4a60e71
Jez Ng int3 authored
Showing with 16 additions and 20 deletions.
  1. +16 −0 pages/popup.coffee
  2. +0 −20 pages/popup.js
16 pages/popup.coffee
View
@@ -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()
20 pages/popup.js
View
@@ -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();
-});
Please sign in to comment.
Something went wrong with that request. Please try again.