Revert "Ultra commit"

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

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

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", "default_title": "ClearURLs Add-on",
"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">
<script type="text/javascript" src="jquery-3.2.1.min.js"></script> <link rel="stylesheet" type="text/css" href="switchButtons.css">
<script type="text/javascript" src="popup.js"></script> <script src="jquery-3.2.1.min.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">
<span id="statusText">En</span>able globally:<br> Enable globally:<br>
<button id="statusBtn" class="status statusEnabled"></button> <button id="globalStatus" class="status statusEnabled"></button>
</div> </div>
<div id="individual"> <div id="individual">
Enable individually:<br> Enable individually:<br>
<div id="presets"> <div id="presets">
<div class="element"><button class="switch switchEnabled"></button><div class="textElement">---placeholder---<br></div></div> <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 switchDisabled"></button><div class="textElement">---placeholder---<br></div></div> <span class="slider round"></span>
<div class="element"><button class="switch switchEnabled"></button><div class="textElement">---placeholderrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr---<br></div></div> <label>Google</label>
<div class="element"><button class="switch switchEnabled"></button><div class="textElement">---placeholder---<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>-->
<!-- <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,17 +32,12 @@
<div id="custom"> <div id="custom">
My rules (advanced):<br> My rules (advanced):<br>
<div id="rules"> <div id="rules">
<div class="element"><button class="switch switchEnabled"></button><div class="textElement">---placeholder---<br></div></div> ---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">---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 id="inputField" type="text"></div><button id="addRuleBtn"><img src="plus.png"></button> <div id="addRuleField"><input type="text"></div><button id="addRuleBtn"><img src="plus.png"></button>
</div> </div>
</div> </div>
</div> </div>

100
popup.js
View File

@ -1,47 +1,67 @@
var status = "enabled"; var exception = "off";
var exception = "false"; var resultFormRestore;
function changeStatus() { function saveOptions(key, result) {
var text = $("#statusText"); console.log("Save with key"+key+" the result: "+result);
var button = $("#statusBtn"); browser.storage.local.set({
if(status == "enabled") { key: result
console.log("was enabled"); });
text.html("Dis");
button.removeClass("statusEnabled").addClass("statusDisabled");
status = "disabled";
console.log("is disabled");
}
else {
console.log("was disabled");
text.html("En");
button.removeClass("statusDisabled").addClass("statusEnabled");
status = "enabled";
console.log("is enabled");
}
}; };
/*
function handleException() { function restoreOptions(key)
{
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");
}
};
function handleException(){
var element = $("#exception"); var element = $("#exception");
var val = "Enable on page"; var val = "Enable on page";
if(exception == false) { if(exception == "off"){
val = "Disable on page"; val = "Disable on page";
exception = "true"; exception = "on";
element.removeClass().addClass("disable"); element.removeClass().addClass("disable");
} }else{
else { exception = "off";
exception = "false"; element.removeClass().addClass("enable");
element.removeClass().addClass("enable");
} }
element.html(val); element.html(val);
}; };
*/
/* $(document).ready(function(){
$(document).ready(function() { $("#globalStatus").on("click", changeStatus);
$("#statusBtn").on("click", changeStatus); $("#exception").on("click", handleException);
//$("#exception").on("click", handleException);
});
*/
document.addEventListener("DOMContentLoaded", function() {
$("#statusBtn").on("click", changeStatus);
}); });

View File

@ -3,9 +3,6 @@ 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";
} }
@ -19,12 +16,16 @@ 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;
margin: 10px 10px 20px 10px; padding: 10px 10px 20px 10px;
width: calc(100% - 20px); width: calc(100% - 20px);
font-size: 14pt; font-size: 14pt;
} }
@ -50,7 +51,7 @@ img {
} }
#global { #global {
width: 165px; width: 50%;
float: left; float: left;
} }
@ -58,8 +59,9 @@ img {
display: block; display: block;
width: 145px; width: 145px;
height: 145px; height: 145px;
margin: 15px auto; margin-top: 10px;
padding: 0px; margin-left: 10px;
padding: 0;
background: none; background: none;
border: none; border: none;
} }
@ -76,8 +78,7 @@ img {
#individual { #individual {
width: calc(100% - 185px); width: 50%;
margin-left: 20px;
float: right; float: right;
} }
@ -101,60 +102,65 @@ img {
} }
#addRuleField { #addRuleField {
overflow: hidden;
float: left; float: left;
width: calc(100% - 55px); width: calc(100% - 55px);
height: 23px; height: 25px;
margin-top: 1px; border-radius: 3px;
outline: 1px solid #000; height: 30px;
} }
#inputField { #addRuleField input {
margin: 0px; width: 100%;
padding: 0px 5px 0px 5px; height: 100%;
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: 5px; border-radius: 3px;
height: 30px;
} }
#addRuleBtn:hover {
background-color: #96d160; #addRuleBtn:active {
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 {
width: calc(100% - 60px); clear: right;
margin-left: 10px;
float: right;
overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
} }