-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
37 lines (29 loc) · 1.11 KB
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
window.addEventListener('DOMContentLoaded', function() {
// Function to generate a random index
function getRandomIndex(max) {
return Math.floor(Math.random() * max);
}
// Get a random webpage index
const randomIndex = getRandomIndex(webPages.length);
// Display the random webpage
const iframe = document.getElementById('randomIframe');
iframe.src = webPages[randomIndex];
const headingLink = document.createElement('a');
headingLink.href = webPages[randomIndex];
headingLink.textContent = 'Case of The Day';
headingLink.target = "_blank"; // Open in a new window or tab
const heading = document.getElementById('heading');
heading.appendChild(headingLink);
});
// Your unique key
const key = "patolojiatlasi_com_home";
// Fetch the current count
fetch(`https://api.countapi.xyz/get/${key}`)
.then(response => response.json())
.then(data => {
const count = data.value;
document.getElementById("visitorCount").innerText = count;
// Increment the count for the next visitor
fetch(`https://api.countapi.xyz/hit/${key}`);
})
.catch(console.error);