Gebruiker:Rots61/Gadget-LogTheCounter.js: verschil tussen versies
Naar navigatie springen
Naar zoeken springen
Regel 1: | Regel 1: | ||
− | /* jshint sub:true maxerr:100000 */ | + | /*<nowiki> jshint sub:true maxerr:100000 */ |
// Gadget gemaakt door [[User:Rots61]] | // Gadget gemaakt door [[User:Rots61]] | ||
var api = new mw.Api(); | var api = new mw.Api(); | ||
− | var samenvatting | + | var samenvatting; |
+ | var bericht; | ||
+ | var volgpagina; | ||
function editpage() { | function editpage() { | ||
Regel 21: | Regel 23: | ||
'text': text, | 'text': text, | ||
'summary': "Nieuwe vraag: " + sectiontitle, | 'summary': "Nieuwe vraag: " + sectiontitle, | ||
− | ' | + | 'watchlist': volg, |
− | |||
'token': edit_token, | 'token': edit_token, | ||
}).done( | }).done( | ||
Regel 40: | Regel 41: | ||
bericht = document.getElementById('wpTextbox1').value; | bericht = document.getElementById('wpTextbox1').value; | ||
volgpagina = document.getElementById('wpWatchthis').checked; | volgpagina = document.getElementById('wpWatchthis').checked; | ||
− | if (!bericht.includes(" | + | if (!bericht.includes("~~~~")) { |
− | bericht += ' | + | bericht += '~~~~'; |
} | } | ||
console.log(volgpagina, samenvatting, bericht); | console.log(volgpagina, samenvatting, bericht); | ||
Regel 49: | Regel 50: | ||
volg = 'unwatch'; | volg = 'unwatch'; | ||
} | } | ||
+ | console.log(volg, samenvatting, bericht); | ||
+ | |||
editpage(); | editpage(); | ||
} | } | ||
+ | console.log('Opslaknop'); | ||
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=" | + | 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>'; | + '<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); | $('#wpSaveWidget').after(opslaknop); | ||
document.getElementById('wpSaveWidget').innerHTML = ''; | document.getElementById('wpSaveWidget').innerHTML = ''; | ||
} | } | ||
+ | //</nowiki> |
Versie van 5 jan 2023 23:41
/*<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('Opslaknop');
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>