Skip to content
Newer
Older
100644 80 lines (64 sloc) 1.88 KB
801a20f @dmac Add ability to exclude URLs from browser button
dmac authored
1 <style>
71413f5 @dmac Add options page link in popup
dmac authored
2 * {
3 margin: 0px;
4 padding: 0px;
5 }
6
801a20f @dmac Add ability to exclude URLs from browser button
dmac authored
7 #vimiumPopup { width: 300px; }
fc88ea1 @dmac Add visual confirmation when url excluded via popup
dmac authored
8
71413f5 @dmac Add options page link in popup
dmac authored
9 #excludeControls {
10 padding: 10px;
11 }
fc88ea1 @dmac Add visual confirmation when url excluded via popup
dmac authored
12
13 #popupInput {
14 width: 160px;
15 }
16
17 #excludeConfirm {
18 display: inline-block;
19 width: 18px;
20 height: 13px;
21 background: url(icons/check.png) 3px 2px no-repeat;
22 display: none;
23 }
24
801a20f @dmac Add ability to exclude URLs from browser button
dmac authored
25 #popupButton { margin-left: 10px; }
71413f5 @dmac Add options page link in popup
dmac authored
26
27 #popupMenu ul {
28 list-style: none;
29 }
30
31 #popupMenu a, #popupMenu a:active, #popupMenu a:visited {
32 color: #3F6EC2;
33 display: block;
34 border-top: 1px solid #DDDDDD;
35 padding: 3px;
36 padding-left: 10px;
37 }
38
39 #popupMenu a:hover {
40 background: #EEEEEE;
41 }
801a20f @dmac Add ability to exclude URLs from browser button
dmac authored
42 </style>
43
44 <div id="vimiumPopup">
71413f5 @dmac Add options page link in popup
dmac authored
45 <div id="excludeControls">
46 <input id="popupInput" type="text" />
47 <input id="popupButton" type="button" value="Exclude URL" />
fc88ea1 @dmac Add visual confirmation when url excluded via popup
dmac authored
48 <span id="excludeConfirm"></span>
71413f5 @dmac Add options page link in popup
dmac authored
49 </div>
50
51 <div id="popupMenu">
52 <ul>
53 <li><a id="optionsLink" target="_blank">Options</a></li>
54 </ul>
55 </div>
801a20f @dmac Add ability to exclude URLs from browser button
dmac authored
56 </div>
57
71413f5 @dmac Add options page link in popup
dmac authored
58
801a20f @dmac Add ability to exclude URLs from browser button
dmac authored
59 <script type="text/javascript">
60 function onLoad() {
71413f5 @dmac Add options page link in popup
dmac authored
61 document.getElementById("optionsLink").setAttribute("href", chrome.extension.getURL("options.html"));
801a20f @dmac Add ability to exclude URLs from browser button
dmac authored
62 chrome.tabs.getSelected(null, function(tab) {
c33bf2d @dmac Populate exclude input with <domain>/* by default
dmac authored
63 // The common use case is to disable Vimium at the domain level.
64 // This regexp will match "http://www.example.com/" from "http://www.example.com/path/to/page.html".
65 var domain = tab.url.match(/[^\/]*\/\/[^\/]*\//) || tab.url;
66 document.getElementById("popupInput").value = domain + "*";
801a20f @dmac Add ability to exclude URLs from browser button
dmac authored
67 });
68 }
69
70 function onExcludeUrl(e) {
71 var url = document.getElementById("popupInput").value;
72 chrome.extension.getBackgroundPage().addExcludedUrl(url);
fc88ea1 @dmac Add visual confirmation when url excluded via popup
dmac authored
73 document.getElementById("excludeConfirm").setAttribute("style", "display: inline-block");
801a20f @dmac Add ability to exclude URLs from browser button
dmac authored
74 }
75
76 window.addEventListener("load", onLoad, false);
77 document.getElementById("popupButton").addEventListener("click", onExcludeUrl, false);
78 </script>
79
Something went wrong with that request. Please try again.