add donations webpages and mini fixes

This commit is contained in:
Aliberk Sandıkçı 2024-01-08 17:38:03 +03:00
parent 074ab9336f
commit e37da8efb9
Signed by: asandikci
GPG key ID: 25C67A03B5666BC1
2 changed files with 81 additions and 69 deletions

View file

@ -59,7 +59,7 @@ if (!$_SERVER['DOCUMENT_ROOT']) {
<hr style="width: 100%;"><br>
<h1 style="font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; font-weight: 800; margin-top:1px; margin-bottom:1px;">Bağışçılar</h1>
<div id="bagiscilar" style="text-align: left;"></div>
<div id="bagiscilar" style="text-align: left;width: max-content;"></div>
<br>
<hr style="width: 100%;"><br><br>
@ -129,81 +129,86 @@ if (!$_SERVER['DOCUMENT_ROOT']) {
lastjson = out;
} else {
var cnt = out.content;
console.log("base64: " + cnt);
// console.log("base64: " + cnt);
lastjson = JSON.parse(b64DecodeUnicode(cnt));
}
lastjson = lastjson.sort(function(a, b) {
console.warn(a.amount , b.amount)
return b.amount - a.amount;
});
for (let i = 0; i < lastjson.length; i++) {
const s = lastjson[i];
const curId = s.place + s.name;
document.getElementById("bagiscilar").innerHTML += "<p><span id='" + curId + "'>" + s.name + "</span> - <span id='" + curId + "amount'> " + s.amount + "₺<span></p>";
curAmount += s.amount;
document.getElementById(curId).style.fontWeight = "500";
if (s.amount <= 1) {
document.getElementById(curId).style.color = "grey";
document.getElementById(curId).style.fontSize = "12px";
} else if (s.amount <= 5) {
document.getElementById(curId).style.color = "white";
document.getElementById(curId).style.fontSize = "14px";
} else if (s.amount <= 10) {
document.getElementById(curId).style.color = "orange";
document.getElementById(curId).style.fontSize = "16px";
} else if (s.amount <= 15) {
document.getElementById(curId).style.color = "yellow";
document.getElementById(curId).style.fontSize = "18px";
} else if (s.amount <= 20) {
document.getElementById(curId).style.color = "purple";
document.getElementById(curId).style.fontSize = "20px";
} else if (s.amount <= 25) {
document.getElementById(curId).style.color = "red";
document.getElementById(curId).style.fontSize = "22px";
} else if (s.amount <= 30) {
document.getElementById(curId).style.color = "black";
document.getElementById(curId).style.fontSize = "24px";
} else if (s.amount <= 50) {
document.getElementById(curId).style.color = "#cc00ff";
document.getElementById(curId).style.fontSize = "26px";
} else if (s.amount <= 75) {
document.getElementById(curId).style.color = "#ff6e95";
document.getElementById(curId).style.fontSize = "28px";
} else if (s.amount <= 100) {
document.getElementById(curId).style.color = "#cc3300";
document.getElementById(curId).style.fontSize = "30px";
document.getElementById(curId).style.fontWeight = "500";
} else if (s.amount <= 150) {
document.getElementById(curId).style.color = "#00cc00";
document.getElementById(curId).style.fontSize = "32px";
document.getElementById(curId).style.fontWeight = "600";
} else if (s.amount <= 200) {
document.getElementById(curId).style.color = "#0066ff";
document.getElementById(curId).style.fontSize = "34px";
document.getElementById(curId).style.fontWeight = "700";
} else if (s.amount <= 300) {
document.getElementById(curId).style.color = "#ffff00";
document.getElementById(curId).style.fontSize = "36px";
document.getElementById(curId).style.fontWeight = "800";
if (s.webpage != ""){
document.getElementById("bagiscilar").innerHTML += "<p><a target='_blank' style='text-decoration: underline;' href = '" + s.webpage + "'><span id='" + curId + "'>" + s.name + "</span></a> - <span id='" + curId + "amount'> " + s.amount + "₺<span></p>";
} else {
document.getElementById(curId).style.color = "#ffff00";
document.getElementById(curId).style.fontSize = "38px";
document.getElementById(curId).style.fontWeight = "900";
document.getElementById(curId).style.textDecoration = "underline";
document.getElementById("bagiscilar").innerHTML += "<p><span id='" + curId + "'>" + s.name + "</span> - <span id='" + curId + "amount'> " + s.amount + "₺<span></p>";
}
curAmount += s.amount;
element = document.getElementById(curId);
element.style.fontWeight = "500";
if (s.amount <= 1) {
element.style.color = "grey";
element.style.fontSize = "12px";
} else if (s.amount <= 5) {
element.style.color = "white";
element.style.fontSize = "14px";
} else if (s.amount <= 10) {
element.style.color = "orange";
element.style.fontSize = "16px";
} else if (s.amount <= 15) {
element.style.color = "yellow";
element.style.fontSize = "18px";
} else if (s.amount <= 20) {
element.style.color = "purple";
element.style.fontSize = "20px";
} else if (s.amount <= 25) {
element.style.color = "red";
element.style.fontSize = "22px";
} else if (s.amount <= 30) {
element.style.color = "black";
element.style.fontSize = "24px";
} else if (s.amount <= 50) {
element.style.color = "#cc00ff";
element.style.fontSize = "26px";
} else if (s.amount <= 75) {
element.style.color = "#ff6e95";
element.style.fontSize = "28px";
} else if (s.amount <= 100) {
element.style.color = "#cc3300";
element.style.fontSize = "30px";
element.style.fontWeight = "500";
} else if (s.amount <= 150) {
element.style.color = "#00cc00";
element.style.fontSize = "32px";
element.style.fontWeight = "600";
} else if (s.amount <= 200) {
element.style.color = "#0066ff";
element.style.fontSize = "34px";
element.style.fontWeight = "700";
} else if (s.amount <= 300) {
element.style.color = "#ffff00";
element.style.fontSize = "36px";
element.style.fontWeight = "800";
} else {
element.style.color = "#ffff00";
element.style.fontSize = "38px";
element.style.fontWeight = "900";
element.style.textDecoration = "underline";
}
if (lastjson.length < 5) {
document.getElementById(curId).style.color = "#ffff00";
document.getElementById(curId).style.fontSize = "38px";
document.getElementById(curId).style.fontWeight = "900";
document.getElementById(curId).style.textDecoration = "underline";
element.style.color = "#ffff00";
element.style.fontSize = "38px";
element.style.fontWeight = "900";
element.style.textDecoration = "underline";
}
let progbar = document.getElementById("pprogress")
progbar.max = goalAmount;
console.log(curAmount, curAmount.toFixed(2));
// console.log(curAmount, curAmount.toFixed(2));
progbar.value = curAmount.toFixed(2);
progbar.labels[1].innerHTML = curAmount.toFixed(2) + "/" + goalAmount + "";
}
@ -227,14 +232,14 @@ if (!$_SERVER['DOCUMENT_ROOT']) {
publicjson = out[0]["public-todo"];
} else {
var cnt = out.content;
console.log("base64: " + cnt);
// console.log("base64: " + cnt);
publicjson = JSON.parse(b64DecodeUnicode(cnt))[0]["public-todo"];
}
publicjson.sort(function(a, b) {
return Number(Object.keys(a)) > Number(Object.keys(b));
});
console.log(publicjson);
// console.log(publicjson);
var curi = 0;
for (let i = 0; i < publicjson.length; i++) {
@ -245,11 +250,11 @@ if (!$_SERVER['DOCUMENT_ROOT']) {
break;
}
}
console.log(goalAmount);
// console.log(goalAmount);
// document.getElementById("sirada-yapilacaklar").innerHTML = publicjson[i][goalAmount][0];
let progbar = document.getElementById("pprogress")
progbar.max = goalAmount;
progbar.labels[1].innerHTML = curAmount + "/" + goalAmount + "";
progbar.labels[1].innerHTML = curAmount.toFixed(2) + "/" + goalAmount + "";
})
.catch(err => {
throw err

View file

@ -3,42 +3,49 @@
"name": "Deniz K***",
"amount": 10,
"place": 1,
"webpage": ""
"webpage": "",
"desc": ""
},
{
"name": "Aziz K***",
"amount": 10,
"place": 2,
"webpage": ""
"webpage": "",
"desc": ""
},
{
"name": "Anonim",
"amount": 0.31,
"place": 3,
"webpage": ""
"webpage": "",
"desc": ""
},
{
"name": "Eray A***",
"amount": 15,
"place": 4,
"webpage": ""
"webpage": "",
"desc": ""
},
{
"name": "İletken",
"amount": 0.69,
"place": 5,
"webpage": ""
"webpage": "",
"desc": ""
},
{
"name": "senin anonim",
"amount": 20.31,
"place": 6,
"webpage": "https://www.instagram.com/huseyinbatuhanoguz"
"webpage": "https://www.instagram.com/huseyinbatuhanoguz",
"desc": ""
},
{
"name": "Cem Deniz A***",
"amount": 0.67,
"place": 7,
"webpage": ""
"webpage": "",
"desc": ""
}
]