Add jquery 3.2.1 for popup

This commit is contained in:
Kevin Röbert 2017-08-05 23:22:38 +02:00
parent 483b8d48d2
commit 4bec2d6928
3 changed files with 38 additions and 99 deletions

4
jquery-3.2.1.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -1,72 +0,0 @@
<!doctype html>
<html>
<head>
<title>ClearURLs Add-on</title>
<style>
body {
overflow: hidden;
margin: 0;
padding: 5px;
background: #fff;
width: 150px;
}
div{
width: 150px;
}
button {
border: none;
border-radius: 5px;
text-align: center;
padding: 5px 3px;
font-family: sans-serif;
font-size: 1em;
width: 140px;
margin-bottom: 10px;
}
.enable {
color: #A43B00;
background: #FFE2BF;
}
.enable:hover {
background: #FFD19A;
}
.disable {
color: #fcf9fa;
background: #b2aeaf;
}
.disable:hover {
background: #4c4b4c;
}
#rule {
color: #4c4b4c;
background: #a5e569;
}
#rule:hover {
background: #96d160;
}
img {
margin-left: auto;
margin-right: auto;
display: block;
}
</style>
<script src="popup.js"></script>
</head>
<body>
<div>
<button id="status" class="enable" onclick="changeStatus()">Global Enable</button><br>
<button id="exception" class="enable" onclick="handleException()">Enable on page</button><br>
<button id="rule">Add rule</button><br>
<img src="icon96.png"></img>
</div>
</body>
</html>

View File

@ -1,30 +1,37 @@
var status = "on";
var exception = "off";
var exception = "off";
function changeStatus(){
var element = document.getElementById('status');
var element = $("#status");
var val = "Global Enable";
if(status == "on"){
val = " Global Disable";
status = "off";
element.className = "disable";
element.removeClass().addClass("disable");
}else{
status = "on";
element.className = "enable";
}
element.innerHTML = val;
element.removeClass().addClass("enable");
}
element.html(val);
};
function handleException(){
var element = document.getElementById('exception');
var element = $("#exception");
var val = "Enable on page";
if(exception == "off"){
val = "Disable on page";
exception = "on";
element.className = "disable";
element.removeClass().addClass("disable");
}else{
exception = "off";
element.className = "enable";
}
element.innerHTML = val;
element.removeClass().addClass("enable");
}
element.html(val);
};
$(document).ready(function(){
$("#status").on("click", changeStatus);
$("#exception").on("click", handleException);
});