mirror of
https://github.com/YouHaveTrouble/youhavetrouble.github.io.git
synced 2026-05-12 14:26:56 +00:00
more classic style of visitor count - have a minimum amount of digits
This commit is contained in:
@@ -1,6 +1,11 @@
|
||||
<div class="view-counter">
|
||||
<div data-viewcount>
|
||||
<span>?</span>
|
||||
<span>?</span>
|
||||
<span>?</span>
|
||||
<span>?</span>
|
||||
<span>?</span>
|
||||
<span>?</span>
|
||||
</div>
|
||||
<div>unique visitors</div>
|
||||
</div>
|
||||
@@ -52,7 +57,10 @@
|
||||
if (result === null) return;
|
||||
const json = await result.json();
|
||||
const rawCount = json.count;
|
||||
const chars = rawCount.toString();
|
||||
let chars = rawCount.toString();
|
||||
while (chars.length < 6) {
|
||||
chars = "0" + chars;
|
||||
}
|
||||
viewCounter.innerHTML = "";
|
||||
for (let i = 0; i < chars.length; i++) {
|
||||
const span = document.createElement("span");
|
||||
|
||||
Reference in New Issue
Block a user