Commit 44e3c8d1 authored by Pierre M's avatar Pierre M
Browse files

redesign UI


Signed-off-by: Pierre M's avatarPierre Mazière <pierre.maziere@gmx.com>
parent 7fa9e881
......@@ -35,10 +35,10 @@
let unlistClosedAccounts = GM_getValue("unlistClosedAccounts",true);
GM_addStyle(".overlaybg{position:fixed;top:0;left:0;width: 100%;height: 100%;background-color:#000; opacity:0.5;z-index:100}");
GM_addStyle(".overlaywin{position:fixed;left:0;right:0;top:0;bottom:0;width:600px;height:300px;margin:auto;background-color:#FFF;z-index:101;padding:10px 20px;border:thick double #000}");
GM_addStyle(".overlaywin select{width:100%;height:180px}");
GM_addStyle(".overlaywin button{background-image:none;padding-left:5px}");
GM_addStyle(".overlaywin button[disabled='disabled']{background-image:none;padding-left:5px;color:gray}");
GM_addStyle(".overlaywin{position:fixed;left:0;right:0;top:0;bottom:0;width:600px;height:480px;margin:auto;background-color:#FFF;z-index:101;padding:10px 20px;border:thick double #000}");
GM_addStyle("#plonkForm select{width:100%;height:180px}");
GM_addStyle("#plonkForm button{background-image:none;padding-left:5px}");
GM_addStyle("#plonkForm h2{text-align:center}");
function closePlonkList(){
document.getElementsByClassName("overlaywin").item(0).remove();
......@@ -47,6 +47,47 @@
}
function buildForm(form,user,alias){
let h2 = document.createElement("h2");
h2.appendChild(document.createTextNode("OPTIONS"));
form.appendChild(h2);
let checkbox = document.createElement("input");
checkbox.setAttribute("type","checkbox");
checkbox.setAttribute("id","closedAccounts");
checkbox.addEventListener("change",function(){plonkClosedAccounts=!plonkClosedAccounts; GM_setValue("plonkClosedAccounts",plonkClosedAccounts);});
if(plonkClosedAccounts){
checkbox.setAttribute("checked","checked");
}
let label = document.createElement("label");
label.appendChild(checkbox);
label.appendChild(document.createTextNode("Plonker les comptes désactivés."));
let div = document.createElement("div");
div.appendChild(label);
form.appendChild(div);
checkbox = document.createElement("input");
checkbox.setAttribute("type","checkbox");
checkbox.setAttribute("id","unlistClosedAccounts");
checkbox.addEventListener("change",function(){unlistClosedAccounts=!unlistClosedAccounts; GM_setValue("unlistClosedAccounts",unlistClosedAccounts);});
if(unlistClosedAccounts){
checkbox.setAttribute("checked","checked");
}
label = document.createElement("label");
label.appendChild(checkbox);
label.appendChild(document.createTextNode("Supprimer de la liste les comptes désactivés."));
div = document.createElement("div");
div.appendChild(label);
form.appendChild(div);
h2 = document.createElement("h2");
h2.appendChild(document.createTextNode("LISTE DE PLONKAGE"));
form.appendChild(h2);
let button = document.createElement("button");
button.setAttribute("id","plonkAdd");
button.appendChild(document.createTextNode("Plonker '"+user+"' alias '"+alias+"'"));
button.addEventListener("click",function(){plonk(user,alias);},true);
let p = document.createElement("p");
let select = document.createElement("select");
if(plonkList.length){
......@@ -60,50 +101,31 @@
select.appendChild(option);
}
}else{
p.appendChild(document.createTextNode("Aucun utilisateur plonké pour le moment."));
p.appendChild(document.createTextNode("Aucun utilisateur actif plonké pour le moment."));
select.remove();
select = null;
}
form.appendChild(p);
if(select){
form.appendChild(select);
}
let checkbox = document.createElement("input");
checkbox.setAttribute("type","checkbox");
checkbox.setAttribute("id","closedAccounts");
checkbox.addEventListener("change",function(){plonkClosedAccounts=!plonkClosedAccounts; GM_setValue("plonkClosedAccounts",plonkClosedAccounts);});
if(plonkClosedAccounts){
checkbox.setAttribute("checked","checked");
if(plonkList.indexOf(user) === -1){
form.appendChild(button);
}
let label = document.createElement("label");
label.appendChild(checkbox);
label.appendChild(document.createTextNode("plonker les comptes fermés."));
let div = document.createElement("div");
div.appendChild(label);
form.appendChild(div);
let addButton = document.createElement("button");
addButton.setAttribute("id","plonkAdd");
addButton.appendChild(document.createTextNode("Plonker '"+user+"' alias '"+alias+"'"));
addButton.addEventListener("click",function(){plonk(user,alias);},true);
if(plonkList.indexOf(user) !== -1){
addButton.setAttribute("disabled","disabled");
if(select){
form.appendChild(select);
}
form.appendChild(addButton);
let delButton = document.createElement("button");
delButton.appendChild(document.createTextNode("Supprimer la sélection"));
delButton.addEventListener("click",function(){unplonk(user,alias);},true);
if(!plonkList.length){
delButton.setAttribute("disabled","disabled");
button = document.createElement("button");
button.appendChild(document.createTextNode("Supprimer la sélection"));
button.addEventListener("click",function(){unplonk(user,alias);},true);
if(plonkList.length){
form.appendChild(button);
}
form.appendChild(delButton);
let cancelButton = document.createElement("button");
cancelButton.appendChild(document.createTextNode("Valider"));
cancelButton.addEventListener("click",function(){closePlonkList();},true);
form.appendChild(cancelButton);
button = document.createElement("button");
button.appendChild(document.createTextNode("Fermer"));
button.addEventListener("click",function(){closePlonkList();},true);
form.appendChild(button);
}
function plonk(user,alias){
......@@ -123,6 +145,7 @@
option.appendChild(document.createTextNode(user));
option.setAttribute("selected","selected");
select.appendChild(option);
document.getElementById("plonkAdd").style.visibility="hidden";
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment