Skip to content

Commit

Permalink
this should replace the .yml file (#12)
Browse files Browse the repository at this point in the history
* this should replace the .yml file

stalked some websites to get this working - this should be able to replace the .yml file

* convert to IIFE

---------

Co-authored-by: Markus <[email protected]>
  • Loading branch information
Eterhox and headquarter8302 authored Jul 21, 2023
1 parent 656bf50 commit 175db47
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions res/script.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
"use strict";
(function() {
const a = 'https://youtube.fandom.com/api.php?action=query&format=json&meta=siteinfo&formatversion=latest&siprop=statistics';
const sc = document.createElement('script');

const countElem = document.getElementById("articleCount");
fetch("count.json", { mode: "no-cors" })
.then((response) => response.json())
.then(
(data) => (countElem.textContent = new Intl.NumberFormat().format(data.int))
);
window.handler = function(data) {
const ac = data.query.statistics.articles;
const htmlSwitch = document.getElementById('articleCount');
htmlSwitch.textContent = ac.toLocaleString();
};

sc.src = a + '&callback=handler';
document.body.appendChild(sc);
})();

0 comments on commit 175db47

Please sign in to comment.