It's so beautiful

wow
This commit is contained in:
astaar 2017-08-04 15:37:22 +02:00
parent 3fcbd3a221
commit 1495391c72
2 changed files with 91 additions and 0 deletions

45
popup.html Normal file
View File

@ -0,0 +1,45 @@
<!doctype html>
<html>
<head>
<title>ClearURLs Add-on</title>
<style>
body {
overflow: hidden;
margin: 5px;
padding: 5px;
background: #fff;
}
div:first-child {
margin-top: 0px;
}
div {
text-align: center;
padding: 5px 3px;
font-family: sans-serif;
font-size: 1.4em;
width: 110px;
margin-top: 5px;
background: #FFE2BF;
}
div:hover {
background: #FFD19A;
}
#enable {
border: 5px solid #FF8B00;
color: #A43B00;
}
#disable {
border: 5px solid #FF8B00;
color: #A43B00;
}
</style>
<script src="popup.js"></script>
</head>
<body>
<div id="enable"><b>Enable</b></div>
<div id="disable"><b>Disable</b></div><br>
<img src="icon_128.png"></img>
</body>
</html>

46
popup.js Normal file
View File

@ -0,0 +1,46 @@
chrome.management.onEnabled.addListener(function(e){
var disableButton = document.getElementById("disable");
var enableButton = document.getElementById("enable");
chrome.browserAction.setIcon ({path: "icon_19.png"});
enableButton.style.display = "none";
disableButton.style.display = "block";
});
chrome.management.onDisabled.addListener(function(e){
var disableButton = document.getElementById("disable");
var enableButton = document.getElementById("enable");
chrome.browserAction.setIcon ({path: "icon_19g.png"});
disableButton.style.display = "none";
enableButton.style.display = "block";
})
function toggle() {
var disableButton = document.getElementById("disable");
var enableButton = document.getElementById("enable");
disableButton.addEventListener("click", disable, false);
enableButton.addEventListener("click", enable, false);
var id = "gmcgchmkljbejmhenadknkdjgjlcinld"
chrome.management.get(id, function(ex) {
if(ex.enabled)
{
chrome.browserAction.setIcon ({path: "icon_19.png"});
enableButton.style.display = "none";
disableButton.style.display = "block";
}
if(!ex.enabled)
{
chrome.browserAction.setIcon ({path: "icon_19g.png"});
disableButton.style.display = "none";
enableButton.style.display = "block";
}
});
}
function enable() {
chrome.management.setEnabled("gmcgchmkljbejmhenadknkdjgjlcinld", true);
window.close();
}
function disable() {
chrome.management.setEnabled("gmcgchmkljbejmhenadknkdjgjlcinld", false);
window.close();
}
document.addEventListener("DOMContentLoaded", toggle, false);