Gebruiker:Rots61/Gadget-LogTheCounter.js: verschil tussen versies

Uit Wikikids
Naar navigatie springen Naar zoeken springen
(Tekst vervangen door "→‎jshint sub:true maxerr:100000: // Gemaakt door User:Rots61 if (mw.config.get('wgArticleId') === 0) { var x = document.getElementById("newpagessection").innerHTML...")
Label: Vervangen
Regel 1: Regel 1:
 
/* jshint sub:true maxerr:100000 */
 
/* jshint sub:true maxerr:100000 */
 
// Gemaakt door [[User:Rots61]]
 
// Gemaakt door [[User:Rots61]]
 
+
console.log(mw.config.get('wgArticleId'));
if (mw.config.get('wgArticleId') === 0) {
+
function starten() {
var x = document.getElementById("newpagessection").innerHTML;
+
if (mw.config.get('wgArticleId') === 0) {
x = x.replaceAll('\" title=', '?x\" title=');
+
var x = document.getElementById("newpagessection").innerHTML;
document.getElementById("newpagessection").innerHTML = x;
+
x = x.replaceAll('\" title=', '?x\" title=');
}
+
document.getElementById("newpagessection").innerHTML = x;
 
 
if (mw.config.get('wgArticleId') === 149502) {
 
var yourDate = new Date();
 
yourDate.toISOString().split('T')[0];
 
gegevens = {};
 
gegevens['Title'] = mw.config.get('wgPageName');
 
gegevens['Date'] = yourDate;
 
if (mw.util.getParamValue('hp') === "x") {
 
gegevens['Hoofdpagina'] = true;
 
} else {
 
gegevens['Hoofdpagina'] = false;
 
 
}
 
}
 
 
fetch("https://example.com/",
+
if (mw.config.get('wgArticleId') === 149502) {
{
+
var yourDate = new Date();
    headers: {
+
yourDate.toISOString().split('T')[0];
      'Accept': 'application/json',
+
gegevens = {};
      'Content-Type': 'application/json'
+
gegevens['Title'] = mw.config.get('wgPageName');
    },
+
gegevens['Date'] = yourDate;
    method: "POST",
+
if (mw.util.getParamValue('hp') === "x") {
    body: JSON.stringify(gegevens)
+
gegevens['Hoofdpagina'] = true;
})
+
} else {
.then(function(res){ console.log(res) })
+
gegevens['Hoofdpagina'] = false;
.catch(function(res){ console.log(res) });
+
}
 +
 +
fetch("https://example.com/",
 +
{
 +
    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 );

Versie van 11 jan 2023 21:57

/* jshint sub:true maxerr:100000 */
// Gemaakt door [[User:Rots61]]
console.log(mw.config.get('wgArticleId'));
function starten() {
	if (mw.config.get('wgArticleId') === 0) {
		var x = document.getElementById("newpagessection").innerHTML;
		x = x.replaceAll('\" title=', '?x\" title=');
		document.getElementById("newpagessection").innerHTML = x;
	}
	
	if (mw.config.get('wgArticleId') === 149502) {
		var yourDate = new Date();
		yourDate.toISOString().split('T')[0];
		gegevens = {};
		gegevens['Title'] = mw.config.get('wgPageName'); 
		gegevens['Date'] = yourDate;
		if (mw.util.getParamValue('hp') === "x") {
			gegevens['Hoofdpagina'] = true;
		} else {
			gegevens['Hoofdpagina'] = false;
		}
		
		fetch("https://example.com/",
		{
		    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 );
Afkomstig van Wikikids , de interactieve Nederlandstalige Internet-encyclopedie voor en door kinderen. "https://wikikids.nl/index.php?title=Gebruiker:Rots61/Gadget-LogTheCounter.js&oldid=759419"