Gebruiker:Rots61/Gadget-LogTheCounter.js: verschil tussen versies
Naar navigatie springen
Naar zoeken springen
(Tekst vervangen door "→jshint sub:true maxerr:100000: // Gadget gemaakt door User:Rots61 var api = new mw.Api(); function editpage() { api.get({ action: 'query', prop: 'info', in...") Label: Vervangen |
|||
Regel 2: | Regel 2: | ||
// Gadget gemaakt door [[User:Rots61]] | // Gadget gemaakt door [[User:Rots61]] | ||
var api = new mw.Api(); | var api = new mw.Api(); | ||
+ | var samenvatting, bericht, volgpagina; | ||
function editpage() { | function editpage() { | ||
Regel 17: | Regel 18: | ||
'title': "WikiKids:Boomhut", | 'title': "WikiKids:Boomhut", | ||
'section': 'new', | 'section': 'new', | ||
− | 'sectiontitle': sectiontitle, | + | 'sectiontitle': sectiontitle ? sectiontitle : 'Nieuw bericht', |
'text': text, | 'text': text, | ||
− | 'summary': "Nieuwe vraag", | + | 'summary': "Nieuwe vraag: " + sectiontitle, |
'tags': 'Opschonen', | 'tags': 'Opschonen', | ||
'bot': true, | 'bot': true, | ||
Regel 35: | Regel 36: | ||
} | } | ||
− | |||
function voeghandtekeningtoe () { | function voeghandtekeningtoe () { | ||
samenvatting = document.getElementById('wpSummary').value; | samenvatting = document.getElementById('wpSummary').value; | ||
bericht = document.getElementById('wpTextbox1').value; | bericht = document.getElementById('wpTextbox1').value; | ||
volgpagina = document.getElementById('wpWatchthis').checked; | volgpagina = document.getElementById('wpWatchthis').checked; | ||
+ | if (!bericht.includes("{{Gebruiker:Rots61/Handtekening}} 5 jan 2023 22:38 (CET)")) { | ||
+ | bericht += '{{Gebruiker:Rots61/Handtekening}} 5 jan 2023 22:38 (CET)'; | ||
+ | } | ||
console.log(volgpagina, samenvatting, bericht); | console.log(volgpagina, samenvatting, bericht); | ||
+ | if (volgpagina === "true") { | ||
+ | volg = 'watch'; | ||
+ | } else if (volgpagina === "false") { | ||
+ | volg = 'unwatch'; | ||
+ | } | ||
+ | editpage(); | ||
} | } | ||
− | if (mw.config.get('wgArticleId') === 61839 ) { | + | if ((mw.config.get('wgArticleId') === 61839) && (mw.config.get('action') === 'edit' || mw.config.get('action') === 'submit')) { |
var opslaknop ='<span id="slaopknop" 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="slaopknop" 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>'; |
Versie van 5 jan 2023 23:38
/* jshint sub:true maxerr:100000 */
// Gadget gemaakt door [[User:Rots61]]
var api = new mw.Api();
var samenvatting, bericht, 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,
'tags': 'Opschonen',
'bot': true,
'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("{{Gebruiker:Rots61/Handtekening}} 5 jan 2023 22:38 (CET)")) {
bericht += '{{Gebruiker:Rots61/Handtekening}} 5 jan 2023 22:38 (CET)';
}
console.log(volgpagina, samenvatting, bericht);
if (volgpagina === "true") {
volg = 'watch';
} else if (volgpagina === "false") {
volg = 'unwatch';
}
editpage();
}
if ((mw.config.get('wgArticleId') === 61839) && (mw.config.get('action') === 'edit' || mw.config.get('action') === 'submit')) {
var opslaknop ='<span id="slaopknop" 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 = '';
}