Ultra commit

jeeeeez
This commit is contained in:
astaar 2017-08-06 18:34:02 +02:00
parent 762e604cee
commit 2287c7041f
11 changed files with 96 additions and 117 deletions

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 5.7 KiB

BIN
icon16.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

BIN
icon16_g.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

BIN
icon19_g.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

BIN
icon38_g.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

8
jquery-3.2.1.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -14,18 +14,18 @@
"browser_action": { "browser_action": {
"browser_style": true, "browser_style": true,
"default_icon": { "default_icon": {
"16": "icon16.png",
"19": "icon19.png", "19": "icon19.png",
"38": "icon38.png" "38": "icon38.png"
}, },
"default_title": "ClearURLs Add-on", "default_title": "ClearURLs",
"default_popup": "popup.html" "default_popup": "popup.html"
}, },
"permissions": [ "permissions": [
"*://*/*", "*://*/*",
"webRequest", "webRequest",
"webRequestBlocking", "webRequestBlocking",
"management", "management"
"storage"
], ],
"background": { "background": {
"scripts": [ "scripts": [

View File

@ -2,10 +2,10 @@
<html> <html>
<head> <head>
<title>ClearURLs Add-on</title> <title>ClearURLs Add-on</title>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="popup_style.css"> <link rel="stylesheet" type="text/css" href="popup_style.css">
<link rel="stylesheet" type="text/css" href="switchButtons.css"> <script type="text/javascript" src="jquery-3.2.1.min.js"></script>
<script src="jquery-3.2.1.min.js"></script> <script type="text/javascript" src="popup.js"></script>
<script src="popup.js"></script>
</head> </head>
<body> <body>
<div id="main"> <div id="main">
@ -13,18 +13,18 @@
<div id="content"> <div id="content">
<div id="default"> <div id="default">
<div id="global"> <div id="global">
Enable globally:<br> <span id="statusText">En</span>able globally:<br>
<button id="globalStatus" class="status statusEnabled"></button> <button id="statusBtn" class="status statusEnabled"></button>
</div> </div>
<div id="individual"> <div id="individual">
Enable individually:<br> Enable individually:<br>
<div id="presets"> <div id="presets">
<label class="switch"> <div class="element"><button class="switch switchEnabled"></button><div class="textElement">---placeholder---<br></div></div>
<input type="checkbox"> <div class="element"><button class="switch switchEnabled"></button><div class="textElement">---placeholder---<br></div></div>
<span class="slider round"></span> <div class="element"><button class="switch switchDisabled"></button><div class="textElement">---placeholder---<br></div></div>
<label>Google</label> <div class="element"><button class="switch switchEnabled"></button><div class="textElement">---placeholderrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr---<br></div></div>
</label> <div class="element"><button class="switch switchEnabled"></button><div class="textElement">---placeholder---<br></div></div>
<!--<div class="element"><button class="switch switchEnabled"></button><div class="textElement">---placeholder---</div><br></div>--> <div class="element"><button class="switch switchEnabled"></button><div class="textElement">---placeholder---<br></div></div>
<!-- <button id="exception" class="enable" onclick="handleException()">Enable on page</button><br> --> <!-- <button id="exception" class="enable" onclick="handleException()">Enable on page</button><br> -->
</div> </div>
</div> </div>
@ -32,12 +32,17 @@
<div id="custom"> <div id="custom">
My rules (advanced):<br> My rules (advanced):<br>
<div id="rules"> <div id="rules">
---placeholder---<br> <div class="element"><button class="switch switchEnabled"></button><div class="textElement">---placeholder---<br></div></div>
<div class="element"><button class="switch switchEnabled"></button><div class="textElement">---placeholder---<br></div></div>
<div class="element"><button class="switch switchEnabled"></button><div class="textElement">---placeholdeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeer---<br></div></div>
<div class="element"><button class="switch switchEnabled"></button><div class="textElement">---placeholder---<br></div></div>
<div class="element"><button class="switch switchEnabled"></button><div class="textElement">---placeholder---<br></div></div>
<div class="element"><button class="switch switchDisabled"></button><div class="textElement">---placeholder---<br></div></div>
</div> </div>
<div id="addRuleOuter"> <div id="addRuleOuter">
Add new rule:<br> Add new rule:<br>
<div id="addRuleInner"> <div id="addRuleInner">
<div id="addRuleField"><input type="text"></div><button id="addRuleBtn"><img src="plus.png"></button> <div id="addRuleField"><input id="inputField" type="text"></div><button id="addRuleBtn"><img src="plus.png"></button>
</div> </div>
</div> </div>
</div> </div>

100
popup.js
View File

@ -1,67 +1,47 @@
var exception = "off"; var status = "enabled";
var resultFormRestore; var exception = "false";
function saveOptions(key, result) { function changeStatus() {
console.log("Save with key"+key+" the result: "+result); var text = $("#statusText");
browser.storage.local.set({ var button = $("#statusBtn");
key: result if(status == "enabled") {
}); console.log("was enabled");
}; text.html("Dis");
button.removeClass("statusEnabled").addClass("statusDisabled");
function restoreOptions(key) status = "disabled";
{ console.log("is disabled");
resultFormRestore = null;
function setCurrentChoise(_result)
{
console.log("Reload config with key: "+key+" and result: ");
resultFormRestore = _result;
console.log(resultFormRestore);
};
function onError(error) {
console.log(`Error: ${error}`);
};
var getting = browser.storage.local.get(key);
getting.then(setCurrentChoise, onError);
return resultFormRestore;
}
function changeStatus(){
var status = restoreOptions("globalStatus");
console.log("status: "+status);
var element = $("#globalStatus");
if(status == null){
saveOptions("globalStatus", true);
status = true;
}
if(status){
status = saveOptions("globalStatus", false);
element.removeClass().addClass("status statusDisabled");
}else{
status = saveOptions("globalStatus", true);
element.removeClass().addClass("status statusEnabled");
} }
}; else {
console.log("was disabled");
function handleException(){ text.html("En");
button.removeClass("statusDisabled").addClass("statusEnabled");
status = "enabled";
console.log("is enabled");
}
};
/*
function handleException() {
var element = $("#exception"); var element = $("#exception");
var val = "Enable on page"; var val = "Enable on page";
if(exception == "off"){ if(exception == false) {
val = "Disable on page"; val = "Disable on page";
exception = "on"; exception = "true";
element.removeClass().addClass("disable"); element.removeClass().addClass("disable");
}else{ }
exception = "off"; else {
element.removeClass().addClass("enable"); exception = "false";
element.removeClass().addClass("enable");
} }
element.html(val); element.html(val);
}; };
*/
$(document).ready(function(){ /*
$("#globalStatus").on("click", changeStatus); $(document).ready(function() {
$("#exception").on("click", handleException); $("#statusBtn").on("click", changeStatus);
//$("#exception").on("click", handleException);
});
*/
document.addEventListener("DOMContentLoaded", function() {
$("#statusBtn").on("click", changeStatus);
}); });

View File

@ -3,6 +3,9 @@ body {
background: #fff; background: #fff;
min-width: 500px; min-width: 500px;
max-width: 600px; max-width: 600px;
max-height: 400px;
overflow-y: auto;
overflow-x: hidden;
font-family: "Arial"; font-family: "Arial";
} }
@ -16,16 +19,12 @@ img {
#main { #main {
max-width: 500px;
max-height: 400px;
overflow-y: auto;
overflow-x: hidden;
white-space: nowrap; white-space: nowrap;
} }
#content { #content {
display: inline-block; display: inline-block;
padding: 10px 10px 20px 10px; margin: 10px 10px 20px 10px;
width: calc(100% - 20px); width: calc(100% - 20px);
font-size: 14pt; font-size: 14pt;
} }
@ -51,7 +50,7 @@ img {
} }
#global { #global {
width: 50%; width: 165px;
float: left; float: left;
} }
@ -59,9 +58,8 @@ img {
display: block; display: block;
width: 145px; width: 145px;
height: 145px; height: 145px;
margin-top: 10px; margin: 15px auto;
margin-left: 10px; padding: 0px;
padding: 0;
background: none; background: none;
border: none; border: none;
} }
@ -78,7 +76,8 @@ img {
#individual { #individual {
width: 50%; width: calc(100% - 185px);
margin-left: 20px;
float: right; float: right;
} }
@ -102,65 +101,60 @@ img {
} }
#addRuleField { #addRuleField {
overflow: hidden;
float: left; float: left;
width: calc(100% - 55px); width: calc(100% - 55px);
height: 25px; height: 23px;
border-radius: 3px; margin-top: 1px;
height: 30px; outline: 1px solid #000;
} }
#addRuleField input { #inputField {
width: 100%; margin: 0px;
height: 100%; padding: 0px 5px 0px 5px;
width: calc(100% - 10px);
height: calc(100% - 2px);
border: none; border: none;
background-color: #d7d6db;
-webkit-transition: .4s;
transition: .4s;
padding-left: 10px;
padding-right: 10px;
}
#addRuleField input:focus {
background-color: #ccc;
-webkit-transition: .4s;
transition: .4s;
} }
#addRuleBtn { #addRuleBtn {
width: 45px; width: 45px;
height: 25px;
padding: 3px 0px 3px 0px; padding: 3px 0px 3px 0px;
float: right; float: right;
background-color: #b5e61d; background-color: #b5e61d;
border: none; border: none;
border-radius: 3px; border-radius: 5px;
height: 30px;
} }
#addRuleBtn:hover {
#addRuleBtn:active { background-color: #96d160;
background-color: #96d160;
} }
.element {
margin-top: 10px;
}
.switch { .switch {
margin-right: 10px;
width: 50px; width: 50px;
height: 26px; height: 26px;
padding: 0px;
float: left; float: left;
background: none; background: none;
border: none; border: none;
}/* }
.switchEnabled { .switchEnabled {
background-image: url("switchEnabled.png"); background-image: url("switchEnabled.png");
} }
.switchDisabled { .switchDisabled {
background-image: url("switchDisabled.png"); background-image: url("switchDisabled.png");
}*/ }
.textElement { .textElement {
clear: right; width: calc(100% - 60px);
margin-left: 10px;
float: right;
overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
} }