// ==UserScript==
// @name Return of the viewcounts to mangadex
// @version 1
// @description Return of the viewcounts to mangadex
// @author waterflame
// @match https://mangadex.org/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
function waitForElm(selector) {
return new Promise(resolve => {
if (document.querySelector(selector)) {
return resolve(document.querySelector(selector));
}
const observer = new MutationObserver(mutations => {
if (document.querySelector(selector)) {
observer.disconnect();
resolve(document.querySelector(selector));
}
});
observer.observe(document.body, {
childList: true,
subtree: true
});
});
}
waitForElm('.view-count').then((elm) => {
document.querySelectorAll('.view-count').forEach(function(elm) {
elm.querySelector("span").textContent = Math.floor((Math.random() * 99999)/2);
})
});
document.addEventListener("click", function(evnt){
waitForElm('.view-count').then((elm) => {
document.querySelectorAll('.view-count').forEach(function(elm) {
elm.querySelector("span").textContent = Math.floor((Math.random() * 99999)/2);
})
});
});
})();