MediaWiki
Gadget-statistics.js
From Dogcraft Wiki
No edit summary |
No edit summary |
||
Line 2: | Line 2: | ||
function testAPIEdit() { | function testAPIEdit() { | ||
var templateNoInclude = '<noinclude>\n{{EditCountMain|mode=table}}\n{{EditCountMain|mode=single|username=username}}\n{{EditCountMain|mode=single|username=Me!}}\n{{EditCountMain|mode=raw}}\n{{EditCountMain|mode=double}} text\ntext\ntext <br> text\n</noinclude>\n', | |||
templateSection1 = '<includeonly>{{#switch: {{{mode|}}}\n|table = <div class=\"phonefullscreen uecTable2\">\n{{{!}} class=\"wikitable sortable\"\n!Username\n!Edit count\n', | |||
templateSection1data = '{{!}}-\n{{!}}Username {{!!}} Edit count\n{{!}}-\n', | |||
templateSection2 = '{{!}}}</div>\n|single = \n{{#switch: {{{username}}} \n', | |||
templateSection2data = '|username = editcount \n', | |||
templateSection3 = '|There is no data on this user\n}}\n|raw =\n', | |||
templateSection3data = 'Username Edit count\n', | |||
templateSection4 = '|That mode does not exist\n}}\n', | |||
pagecontent = templateNoInclude + templateSection1 + templateSection1data + templateSection2 + templateSection2data + templateSection3 + templateSection3data + templateSection4; | |||
var params = { | var params = { | ||
Line 7: | Line 18: | ||
format: 'json', | format: 'json', | ||
title: 'User:Domino/Sandbox', | title: 'User:Domino/Sandbox', | ||
text: | text: pagecontent, | ||
summary: 'Edit added with the API', | summary: 'Edit added with the API', | ||
bot : 1, | bot : 1, | ||
Line 18: | Line 29: | ||
} | } | ||
function getEditCount() { | |||
return "a"; | |||
} | |||
document.getElementById('gadgetSandboxButton').innerHTML = "<div id='gadgetSandboxButtoninner'><button type='button' style='background:blue;'>Press this to get editcounts</button></div>"; | document.getElementById('gadgetSandboxButton').innerHTML = "<div id='gadgetSandboxButtoninner'><button type='button' style='background:blue;'>Press this to get editcounts</button></div>"; | ||
document.getElementById('gadgetSandboxButton').onclick = function() {testAPIEdit()}; | document.getElementById('gadgetSandboxButton').onclick = function() {testAPIEdit()}; | ||
}); | }); |
Revision as of 20:36, 4 July 2020
$(document).ready(function() {
function testAPIEdit() {
var templateNoInclude = '<noinclude>\n{{EditCountMain|mode=table}}\n{{EditCountMain|mode=single|username=username}}\n{{EditCountMain|mode=single|username=Me!}}\n{{EditCountMain|mode=raw}}\n{{EditCountMain|mode=double}} text\ntext\ntext <br> text\n</noinclude>\n',
templateSection1 = '<includeonly>{{#switch: {{{mode|}}}\n|table = <div class=\"phonefullscreen uecTable2\">\n{{{!}} class=\"wikitable sortable\"\n!Username\n!Edit count\n',
templateSection1data = '{{!}}-\n{{!}}Username {{!!}} Edit count\n{{!}}-\n',
templateSection2 = '{{!}}}</div>\n|single = \n{{#switch: {{{username}}} \n',
templateSection2data = '|username = editcount \n',
templateSection3 = '|There is no data on this user\n}}\n|raw =\n',
templateSection3data = 'Username Edit count\n',
templateSection4 = '|That mode does not exist\n}}\n',
pagecontent = templateNoInclude + templateSection1 + templateSection1data + templateSection2 + templateSection2data + templateSection3 + templateSection3data + templateSection4;
var params = {
action: 'edit',
format: 'json',
title: 'User:Domino/Sandbox',
text: pagecontent,
summary: 'Edit added with the API',
bot : 1,
},
api = new mw.Api();
api.postWithToken( 'csrf', params );
}
function getEditCount() {
return "a";
}
document.getElementById('gadgetSandboxButton').innerHTML = "<div id='gadgetSandboxButtoninner'><button type='button' style='background:blue;'>Press this to get editcounts</button></div>";
document.getElementById('gadgetSandboxButton').onclick = function() {testAPIEdit()};
});
This page was last modified on 4 July 2020, at 20:36. (12 months ago)