Commit 8e9b05e6 authored by Pierre M's avatar Pierre M
Browse files

simplify code ... maybe not lisibility


Signed-off-by: Pierre M's avatarPierre Mazière <pierre.maziere@gmx.com>
parent 2365e767
......@@ -19,6 +19,10 @@
(function() {
let userRE = new RegExp("https://linuxfr.org/users/(.*)$");
let types = {
article: 0,
comment: 1
}
let plonkList = JSON.parse(GM_getValue("plonkList","[]"));
switch(typeof plonkList){
......@@ -68,12 +72,7 @@
GM_addStyle("#plonkForm h2{text-align:center}");
function togglePlonk(user,type){
let i;
switch(type){
case 'article': i=0; break;
case 'comment': i=1; break;
}
plonkList[user][i] = !plonkList[user][i];
plonkList[user][types[type]] = !plonkList[user][types[type]];
GM_setValue("plonkList",JSON.stringify(plonkList));
}
......@@ -359,12 +358,7 @@
if (userLink.href !== "https://linuxfr.org/users/"+u){
continue;
}
let plonk = false;
switch(type){
case 'article': if (plonkList[u][0]){plonk=true;} break;
case 'comment': if (plonkList[u][1]){plonk=true;} break;
}
if(plonk){
if(plonkList[u][types[type]]){
contents[i].style.display = "none";
break;
}
......
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