forked from philc/vimium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ability to exclude URLs from browser button
- Loading branch information
Showing
3 changed files
with
35 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,27 @@ | |||
<style> | |||
#vimiumPopup { width: 300px; } | |||
#popupInput { width: 200px; } | |||
#popupButton { margin-left: 10px; } | |||
</style> | |||
|
|||
<div id="vimiumPopup"> | |||
<input id="popupInput" type="text" /> | |||
<input id="popupButton" type="button" value="Exclude URL" /> | |||
</div> | |||
|
|||
<script type="text/javascript"> | |||
function onLoad() { | |||
chrome.tabs.getSelected(null, function(tab) { | |||
document.getElementById("popupInput").value = tab.url; | |||
}); | |||
} | |||
|
|||
function onExcludeUrl(e) { | |||
var url = document.getElementById("popupInput").value; | |||
chrome.extension.getBackgroundPage().addExcludedUrl(url); | |||
} | |||
|
|||
window.addEventListener("load", onLoad, false); | |||
document.getElementById("popupButton").addEventListener("click", onExcludeUrl, false); | |||
</script> | |||
|
It's worth adding a comment explaining that this will be used by the popup. Either here or in the UI, you should check for empty string (with the current UI you can exclude an empty URL) and you should trim whitespace around the URL.