-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add browser-action, disabling feature, and redirect/block counts
- Loading branch information
Showing
6 changed files
with
110 additions
and
2 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
body { | ||
background-color: #ffd | ||
} | ||
|
||
.info { | ||
white-space: nowrap; | ||
padding: 3pt; | ||
} |
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 | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<link rel="stylesheet" href="popup.css"></style> | ||
<script src="scripts/popup.js" ></script> | ||
</head> | ||
<body> | ||
<div class="info"> | ||
<input type="checkbox" checked="true" id="enabled"> | ||
<label for="enabled">Enable redirects and blocking</label> | ||
</div> | ||
|
||
<hr> | ||
|
||
<div class="info">URLs redirected: <span id="redirect-count"></span> | ||
</div> | ||
<div class="info">URLs blocked: <span id="block-count"></span> | ||
</div> | ||
</body> | ||
<html> |
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 | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
window.onload = function(){ | ||
chrome.storage.local.get( | ||
["enabled", "redirected", "blocked"], initPopup); | ||
}; | ||
|
||
function initPopup(items){ | ||
//add event listener to checkbox | ||
document.getElementById("enabled").onclick = toggle; | ||
//set whether the checkbox is checked | ||
document.getElementById("enabled").checked = items.enabled; | ||
//set the number redirected | ||
document.getElementById("redirect-count").innerText= items.redirected; | ||
//set the number blocked | ||
document.getElementById("block-count").innerText = items.blocked; | ||
} | ||
|
||
function toggle(checkbox){ | ||
console.log("Changing enable-status to " + this.checked); | ||
chrome.storage.local.set({enabled: this.checked}); | ||
} |