kontakt: [email protected]
Widżet:Orgonity: Różnice pomiędzy wersjami
Przejdź do nawigacji
Przejdź do wyszukiwania
imported>Sługa szatana mNie podano opisu zmian |
imported>Sługa szatana mNie podano opisu zmian |
||
(Nie pokazano 12 pośrednich wersji utworzonych przez tego samego użytkownika) | |||
Linia 4: | Linia 4: | ||
let wynik = []; | let wynik = []; | ||
let sec = interval / 1000; | let sec = interval / 1000; | ||
let plural = (value, a, b, c) => { | |||
return {"one": a, "other": b, "few": b, "many": c || b}[new Intl.PluralRules("en-us").select(value)]; | |||
} | |||
let [days, hours, minutes, seconds] = arr; | let [days, hours, minutes, seconds] = arr; | ||
if (days > 0) { | if (days > 0) { | ||
wynik.push(days + " days"); | wynik.push(days + plural(days, " day", " days")); | ||
} | } | ||
if (hours > 0) { | if (hours > 0) { | ||
wynik.push(hours + " hours"); | wynik.push(hours + plural(hours, " hour", " hours")); | ||
} | } | ||
if (minutes > 0) { | if (minutes > 0) { | ||
wynik.push(minutes + " minutes"); | wynik.push(minutes + plural(minutes, " minute", " minutes")); | ||
} | } | ||
if (seconds > 0) { | if (seconds > 0) { | ||
wynik.push(seconds + " seconds"); | wynik.push(seconds + plural(seconds, " second", " seconds")); | ||
} | } | ||
return wynik.join(", "); | return wynik.join(", "); | ||
Linia 40: | Linia 44: | ||
a.setSeconds(0); | a.setSeconds(0); | ||
a.setMilliseconds(0); | a.setMilliseconds(0); | ||
let b = new Date(); | |||
// zajebane ze stackoverflow | // zajebane ze stackoverflow | ||
a.setDate(a.getDate() + ( | a.setDate(a.getDate() + (12 - b.getDay()) % 7 + 1); | ||
let r = interval(Math.abs(b - a)); | let r = interval(Math.abs(b - a)); | ||
let formatted = format(r); | let formatted = format(r); | ||
Linia 53: | Linia 57: | ||
} | } | ||
let jupi = el => { | let jupi = el => { | ||
el.classList.add("pulse"); | |||
el.style.color = "green"; | el.style.color = "green"; | ||
el.style.fontSize = "1.25em"; | el.style.fontSize = "1.25em"; | ||
el.style.fontWeight = "bold"; | |||
el.innerText = "ORGONITY JUPI"; | el.innerText = "ORGONITY JUPI"; | ||
} | } | ||
Linia 63: | Linia 69: | ||
update(); | update(); | ||
timer = setInterval(update, 1000); | timer = setInterval(update, 1000); | ||
console.debug(timer); | |||
} | |||
</script><style>.pulse { | |||
animation-name: pulse; | |||
animation-iteration-count: infinite; | |||
animation-duration: 1s; | |||
} | |||
@keyframes pulse { | |||
0% { | |||
opacity: 1; | |||
} | |||
50% { | |||
opacity: 0; | |||
} | |||
100% { | |||
opacity: 1; | |||
} | } | ||
</ | } | ||
</style></includeonly> |