fix styles

This commit is contained in:
Hamidreza Ghavami
2023-05-15 23:12:52 +04:30
parent 68b0cb1312
commit eb7fda21be
5 changed files with 47 additions and 24 deletions

View File

@@ -69,40 +69,40 @@ function debounce(fn, delay) {
}
function getCookie(cname) {
let name = cname + '=';
let name = cname + "=";
let decodedCookie = decodeURIComponent(document.cookie);
let ca = decodedCookie.split(';');
let ca = decodedCookie.split(";");
for (let i = 0; i < ca.length; i++) {
let c = ca[i];
while (c.charAt(0) == ' ') {
while (c.charAt(0) == " ") {
c = c.substring(1);
}
if (c.indexOf(name) == 0) {
return c.substring(name.length, c.length);
}
}
return '';
return "";
}
function setCookie(cname, cvalue, exdays) {
const d = new Date();
d.setTime(d.getTime() + exdays * 24 * 60 * 60 * 1000);
let expires = 'expires=' + d.toUTCString();
document.cookie = cname + '=' + cvalue + ';' + expires + ';path=/';
let expires = "expires=" + d.toUTCString();
document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
}
function usageColor(data, threshold, total) {
switch (true) {
case data === null:
return 'blue';
return "blue";
case total <= 0:
return 'blue';
return "blue";
case data < total - threshold:
return 'cyan';
return "cyan";
case data < total:
return 'orange';
return "orange";
default:
return 'red';
return "red";
}
}