Gebruiker:Rots61/Gadget-LogTheCounter.js: verschil tussen versies
Naar navigatie springen
Naar zoeken springen
Labels: Vervangen Ongedaan maken |
|||
Regel 12: | Regel 12: | ||
var yourDate = new Date(); | var yourDate = new Date(); | ||
yourDate.toISOString().split('T')[0]; | yourDate.toISOString().split('T')[0]; | ||
− | gegevens = {}; | + | var gegevens = {}; |
gegevens['Title'] = mw.config.get('wgPageName'); | gegevens['Title'] = mw.config.get('wgPageName'); | ||
gegevens['Date'] = yourDate; | gegevens['Date'] = yourDate; | ||
Regel 20: | Regel 20: | ||
gegevens['Hoofdpagina'] = false; | gegevens['Hoofdpagina'] = false; | ||
} | } | ||
− | |||
fetch("https://wikikids.martvanweeghel.nl/pages", | fetch("https://wikikids.martvanweeghel.nl/pages", | ||
− | + | { | |
− | + | headers: { | |
− | + | 'Accept': 'application/json', | |
− | + | 'Content-Type': 'application/json' | |
− | + | }, | |
− | + | method: "POST", | |
− | + | body: JSON.stringify(gegevens) | |
− | + | }) | |
− | + | .then(function(res){ console.log(res) }) | |
− | + | .catch(function(res){ console.log(res) }); | |
} | } | ||
} | } | ||
$.when( $.ready, mw.loader.using(['mediawiki.util'])).done( starten ); | $.when( $.ready, mw.loader.using(['mediawiki.util'])).done( starten ); |
Versie van 12 jan 2023 22:24
/* jshint sub:true maxerr:100000 */
// Gemaakt door [[User:Rots61]]
// Dank - [[User:MakiBoy]]
function starten() {
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 yourDate = new Date();
yourDate.toISOString().split('T')[0];
var gegevens = {};
gegevens['Title'] = mw.config.get('wgPageName');
gegevens['Date'] = yourDate;
if (mw.util.getParamValue('x') === "h") {
gegevens['Hoofdpagina'] = true;
} else {
gegevens['Hoofdpagina'] = false;
}
fetch("https://wikikids.martvanweeghel.nl/pages",
{
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
method: "POST",
body: JSON.stringify(gegevens)
})
.then(function(res){ console.log(res) })
.catch(function(res){ console.log(res) });
}
}
$.when( $.ready, mw.loader.using(['mediawiki.util'])).done( starten );