User:Lupo/qmt.js
Jump to navigation
Jump to search
Note: After saving, you have to bypass your browser's cache to see the changes. Internet Explorer: press Ctrl-F5, Mozilla: hold down Shift while clicking Reload (or press Ctrl-Shift-R), Opera/Konqueror: press F5, Safari: hold down Shift + Alt while clicking Reload, Chrome: hold down Shift while clicking Reload.
Documentation for this user script can be added at User:Lupo/qmt. |
- Report page listing warnings and errors.
importScript ('MediaWiki:QuickModify.js');
var qmtest_step = 0;
function QMTest ()
{
var test_page = mw.config.get('wgServer') + mw.config.get('wgArticlePath').replace ('$1', 'User:' + wgUserName + '/qmtest1') + '?action=edit';
var test_talk = 'User talk:' + wgUserName + '/qmtest1';
var test_page2 = 'User:' + wgUserName + '/qmtest2';
var cmds = "";
switch (qmtest_step) {
case 0:
cmds = QuickModify.actions (['a', 'This is a test. \~\~\~\~'], ['s', 'Test a']);
break;
case 1:
cmds = QuickModify.actions (['i', 'Prepend\n\n'], ['c', 'Test i']);
break;
case 2:
cmds = QuickModify.actions (['i', 'PrePeND again\n\n'], ['a', '\n\nAPPeNDed'], ['c', 'Test ia']);
break;
case 3:
cmds = QuickModify.actions (['r', /pend/i, 'AAAA'], ['c', 'Test r1']);
break;
case 4:
cmds = QuickModify.actions (['r', /pend/ig, 'BBBB'], ['c', 'Test r2']);
break;
case 5:
cmds = QuickModify.actions (['d', /^.*?BBBB.*$/], ['c', 'Test d1']);
break;
case 6:
cmds = QuickModify.actions (['d', /BBBB/g], ['c', 'Test d2']);
break;
case 7:
cmds =
QuickModify.actions (['a', '\n\nNow editing the talk page [[' + test_talk + ']]. \~\~\~\~'], ['s', 'Test join1'])
+
QuickModify.join (
test_talk,
QuickModify.actions (['a', '\n\nTest edit. \~\~\~\~\~'], ['c', 'Test edit'])
);
break;
case 8:
cmds =
QuickModify.actions (['a', '\n\nNow editing two pages'], ['c', 'Test join2'])
+
QuickModify.join (
test_talk,
QuickModify.actions (['a', '\n\nAnother test edit. \~\~\~\~\~'], ['c', 'Test edit'])
)
+
QuickModify.join (
test_page2,
QuickModify.actions (['a', 'This is also a test edit'], ['r', 'also a', 'yet another'], ['c', 'Test edit 2'])
);
break;
default:
break;
}
if (cmds.length == 0)
alert ('No commands! (' + qmtest_step + ')');
else
if (confirm ('Run ' + cmds + '\non page ' + test_page)) QuickModify.execute (test_page, cmds);
qmtest_step++;
if (qmtest_step > 8) {
alert ('End of tests reached, next click will start from the beginning.');
qmtest_step = 0;
}
}