Gebruiker:Rots61/Gadget-LogTheCounter.js: verschil tussen versies
Naar navigatie springen
Naar zoeken springen
Regel 1: | Regel 1: | ||
/* jshint sub:true maxerr:100000 */ | /* jshint sub:true maxerr:100000 */ | ||
− | // Gemaakt door [[User: | + | // Gemaakt door [[User:MakiBoy]] en [[User:Rots61]] |
− | + | ||
− | function | + | function process() { |
− | + | if (mw.config.get('wgArticleId') === 1) { | |
− | + | var x = document.getElementById("newpagessection").innerHTML; | |
− | + | x = x.replaceAll('\" title=', '?x=h\" title='); | |
− | + | document.getElementById("newpagessection").innerHTML = x; | |
− | + | } | |
− | + | ||
− | + | var loggedPages = [149502, 149477]; | |
− | + | ||
− | + | if (loggedPages.includes(mw.config.get('wgArticleId'))) { | |
− | + | var object = { | |
− | + | title: mw.config.get('wgPageName'), | |
− | + | date: new Date().toISOString().split('T')[0], | |
− | + | fromMainPage: false | |
− | + | }; | |
− | + | ||
− | + | if (mw.util.getParamValue('x') === "h") { | |
− | + | object.fromMainPage = true; | |
− | + | } | |
− | + | ||
− | + | console.log(object); | |
− | + | fetch("https://wikikids.martvanweeghel.nl/pages", | |
− | + | { | |
− | + | headers: { | |
− | + | 'Accept': 'application/json', | |
− | + | 'Content-Type': 'application/json' | |
− | + | }, | |
− | + | method: "POST", | |
− | + | body: JSON.stringify(object) | |
− | + | }) | |
− | + | .then(function (res) { console.log(res); }) | |
+ | .catch(function (res) { console.log(res); }); | ||
+ | } | ||
} | } | ||
− | $.when( $.ready, mw.loader.using(['mediawiki.util'])).done( | + | $.when($.ready, mw.loader.using(['mediawiki.util'])).done(process); |
Versie van 12 jan 2023 22:36
/* jshint sub:true maxerr:100000 */
// Gemaakt door [[User:MakiBoy]] en [[User:Rots61]]
function process() {
if (mw.config.get('wgArticleId') === 1) {
var x = document.getElementById("newpagessection").innerHTML;
x = x.replaceAll('\" title=', '?x=h\" title=');
document.getElementById("newpagessection").innerHTML = x;
}
var loggedPages = [149502, 149477];
if (loggedPages.includes(mw.config.get('wgArticleId'))) {
var object = {
title: mw.config.get('wgPageName'),
date: new Date().toISOString().split('T')[0],
fromMainPage: false
};
if (mw.util.getParamValue('x') === "h") {
object.fromMainPage = true;
}
console.log(object);
fetch("https://wikikids.martvanweeghel.nl/pages",
{
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
method: "POST",
body: JSON.stringify(object)
})
.then(function (res) { console.log(res); })
.catch(function (res) { console.log(res); });
}
}
$.when($.ready, mw.loader.using(['mediawiki.util'])).done(process);