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

Uit Wikikids
Naar navigatie springen Naar zoeken springen
Regel 55: Regel 55:
 
}
 
}
  
console.log('Opslaknop');
+
console.log(mw.config.get('wgArticleId'),  mw.config.get('action'), (mw.config.get('action') === 'edit' || mw.config.get('action') === 'submit'));
 
if ((mw.config.get('wgArticleId') === 61839) && (mw.config.get('action') === 'edit' || mw.config.get('action') === 'submit')) {
 
if ((mw.config.get('wgArticleId') === 61839) && (mw.config.get('action') === 'edit' || mw.config.get('action') === 'submit')) {
 
var opslaknop ='<span id="WKslaopknop" class="oo-ui-widget oo-ui-widget-enabled oo-ui-inputWidget oo-ui-buttonElement oo-ui-buttonElement-framed oo-ui-labelElement oo-ui-flaggedElement-progressive oo-ui-flaggedElement-primary oo-ui-buttonInputWidget">'  
 
var opslaknop ='<span id="WKslaopknop" class="oo-ui-widget oo-ui-widget-enabled oo-ui-inputWidget oo-ui-buttonElement oo-ui-buttonElement-framed oo-ui-labelElement oo-ui-flaggedElement-progressive oo-ui-flaggedElement-primary oo-ui-buttonInputWidget">'  

Versie van 5 jan 2023 23:42

/*<nowiki> jshint sub:true maxerr:100000 */
// Gadget gemaakt door [[User:Rots61]]
var api = new mw.Api();
var samenvatting;
var bericht;
var volgpagina; 

function editpage() {
	api.get({
		action: 'query',
		prop: 'info',
		intoken: 'edit',
		titles: 'kassdfalv', //Pagina moet niet bestaan. 
	}).done(
		function(data) {
			edit_token = data.query.pages['-1'].edittoken;
		}).done(function(data) {
		api.post({
			'action': 'edit',
			'title': "WikiKids:Boomhut",
			'section': 'new',
			'sectiontitle': sectiontitle ? sectiontitle : 'Nieuw bericht',
			'text': text,
			'summary': "Nieuwe vraag: " + sectiontitle,
			'watchlist': volg,
			'token': edit_token,
		}).done(
			function(data) {
				if (data.edit.result == "Success") { 
					mw.notify("Opgeslagen!");
				} else {
					mw.notify("Opslaan mislukt");
				}
				console.log(data.edit);
			});
	});
}

function voeghandtekeningtoe () {
	samenvatting = document.getElementById('wpSummary').value;
	bericht = document.getElementById('wpTextbox1').value;
	volgpagina = document.getElementById('wpWatchthis').checked;
	if (!bericht.includes("~~~~")) {
		bericht += '~~~~';
	}
	console.log(volgpagina, samenvatting, bericht);
	if (volgpagina === "true") {
		volg = 'watch';
	} else if (volgpagina === "false") {
		volg = 'unwatch';
	}
	console.log(volg, samenvatting, bericht);

	editpage();
}

console.log(mw.config.get('wgArticleId'),  mw.config.get('action'), (mw.config.get('action') === 'edit' || mw.config.get('action') === 'submit'));
if ((mw.config.get('wgArticleId') === 61839) && (mw.config.get('action') === 'edit' || mw.config.get('action') === 'submit')) {
	var opslaknop ='<span id="WKslaopknop" class="oo-ui-widget oo-ui-widget-enabled oo-ui-inputWidget oo-ui-buttonElement oo-ui-buttonElement-framed oo-ui-labelElement oo-ui-flaggedElement-progressive oo-ui-flaggedElement-primary oo-ui-buttonInputWidget">' 
	+ '<input onClick="voeghandtekeningtoe();" tabindex="4" aria-disabled="false" title="Sla jouw wijzigingen op [Alt+Shift+s]" accesskey="s" name="wpSave" id="wpSave" value="Wijzigingen opslaan" class="oo-ui-inputWidget-input oo-ui-buttonElement-button"></span>';
	$('#wpSaveWidget').after(opslaknop);
	document.getElementById('wpSaveWidget').innerHTML = '';
}
//</nowiki>
Afkomstig van Wikikids , de interactieve Nederlandstalige Internet-encyclopedie voor en door kinderen. "https://wikikids.nl/index.php?title=Gebruiker:Rots61/Gadget-LogTheCounter.js&oldid=758427"