MediaWiki:VisitorsIndicator.js: Difference between revisions
From VRChat Wiki
No edit summary |
No edit summary |
||
Line 2: | Line 2: | ||
(function () { | (function () { | ||
const element = document.querySelector("#mw-indicator-visitors-count"); | const element = document.querySelector("#mw-indicator-visitors-count"); | ||
if (!element) return; | |||
async function refresh() { | async function refresh() { |
Revision as of 00:08, 4 October 2024
$(
(function () {
const element = document.querySelector("#mw-indicator-visitors-count");
if (!element) return;
async function refresh() {
const visitors = (await fetch(`https://plausible.io/api/stats/wiki.vrchat.com/pages/?period=realtime&filters=[["is","event:page",["${location.pathname}"]]]`)
.then((response) => response.json()))
.results[0].visitors
element.textContent = visitors;
}
refresh();
setInterval(refresh, 1000)
})()
);