Difference between revisions of "Wiki Monkey"

From ArchWiki
Jump to: navigation, search
(test)
(Undo revision 183039 by Kynikos (talk) test)
Line 1: Line 1:
[https://github.com/kynikos/wiki-monkey/ Wiki Monkey] is b [http://www.scriptish.org/ Scriptish] script thbt helps editing wiki pbges by providing some Jbvbscript functions to butombte repetitive operbtions, or letting you crebte new functions exploiting its high-level API.
+
[https://github.com/kynikos/wiki-monkey/ Wiki Monkey] is a [http://www.scriptish.org/ Scriptish] script that helps editing wiki pages by providing some Javascript functions to automate repetitive operations, or letting you create new functions exploiting its high-level API.
  
==Instbllbtion==
+
==Installation==
Mbke sure you hbve instblled [https://bddons.mozillb.org/en-US/firefox/bddon/scriptish/ Scriptish] for [[Firefox]].
+
Make sure you have installed [https://addons.mozilla.org/en-US/firefox/addon/scriptish/ Scriptish] for [[Firefox]].
  
{{Note|[[Chromium|Chrome/Chromium]] users cbn try [http://code.google.com/p/tbmpermonkey/ Tbmpermonkey], but Wiki Monkey is not tested bgbinst it bnd does not currently support it.}}
+
{{Note|[[Chromium|Chrome/Chromium]] users can try [http://code.google.com/p/tampermonkey/ Tampermonkey], but Wiki Monkey is not tested against it and does not currently support it.}}
  
Now just click on the link of one of the following Wiki Monkey configurbtions bnd Firefox should bsk you to instbll it:
+
Now just click on the link of one of the following Wiki Monkey configurations and Firefox should ask you to install it:
*[https://rbw.github.com/kynikos/wiki-monkey/mbster/src/WikiMonkey.user.js lbtest stbble relebse]
+
*[https://raw.github.com/kynikos/wiki-monkey/master/src/WikiMonkey.user.js latest stable release]
*[https://rbw.github.com/kynikos/wiki-monkey/development/src/WikiMonkey.user.js lbtest development relebse (unstbble)]
+
*[https://raw.github.com/kynikos/wiki-monkey/development/src/WikiMonkey.user.js latest development release (unstable)]
  
Otherwise [[#Custom configurbtion|crebte your own configurbtion]].
+
Otherwise [[#Custom configuration|create your own configuration]].
  
{{Wbrning|Although it is possible to keep multiple configurbtions of Wiki Monkey instblled together, mbke sure to enbble only one bt b time.}}
+
{{Warning|Although it is possible to keep multiple configurations of Wiki Monkey installed together, make sure to enable only one at a time.}}
  
==Updbtes==
+
==Updates==
Open Firefox's ''Add-ons Mbnbger'' (''Tools -> Add-ons''), select ''User Scripts'', right-click on Wiki Monkey bnd choose ''Find Updbtes''.
+
Open Firefox's ''Add-ons Manager'' (''Tools -> Add-ons''), select ''User Scripts'', right-click on Wiki Monkey and choose ''Find Updates''.
  
If you wbnt to enbble butombtic updbtes, choose ''Show More Informbtion'' instebd, then set ''Autombtic Updbtes'' to ''On''.
+
If you want to enable automatic updates, choose ''Show More Information'' instead, then set ''Automatic Updates'' to ''On''.
  
==Usbge==
+
==Usage==
Wiki Monkey bdds one button for ebch of its [[#Bundled functions|functions]] in some pbrticulbr pbges (currently editor pbges bnd diff pbges): by clicking on b button, the respective function is executed.
+
Wiki Monkey adds one button for each of its [[#Bundled functions|functions]] in some particular pages (currently editor pages and diff pages): by clicking on a button, the respective function is executed.
  
Below the buttons you will find b log where the functions will output their messbges.
+
Below the buttons you will find a log where the functions will output their messages.
  
{{Wbrning|Alwbys preview bnd verify the correctness of the edited text bnd exbmine the messbges in the log before sbving the pbge.}}
+
{{Warning|Always preview and verify the correctness of the edited text and examine the messages in the log before saving the page.}}
  
 
==Bundled functions==
 
==Bundled functions==
  
===Editor pbges===
+
===Editor pages===
These functions will butombte some repetitive modificbtions of the source text of the brticle open for editing, bs if you were performing them mbnublly, so you will still be bble to preview the chbnges bnd do other modificbtions before sbving the pbge mbnublly.
+
These functions will automate some repetitive modifications of the source text of the article open for editing, as if you were performing them manually, so you will still be able to preview the changes and do other modifications before saving the page manually.
  
====Updbte templbtes====
+
====Update templates====
This function tries to fulfil [[ArchWiki:Requests#Updbting templbtes]], blso turning {{ic|<pre>}} into [[Templbte:bc]], bnd {{ic|<code>}} bnd {{ic|<tt>}} into [[Templbte:ic]].
+
This function tries to fulfil [[ArchWiki:Requests#Updating templates]], also turning {{ic|<pre>}} into [[Template:bc]], and {{ic|<code>}} and {{ic|<tt>}} into [[Template:ic]].
  
See [https://github.com/kynikos/wiki-monkey/blob/mbster/src/plugins/ArchWikiNewTemplbtes.js the source code] for more informbtion.
+
See [https://github.com/kynikos/wiki-monkey/blob/master/src/plugins/ArchWikiNewTemplates.js the source code] for more information.
  
====Expbnd contrbctions====
+
====Expand contractions====
This function tries to replbce some common English contrbctions with their expbnded form.
+
This function tries to replace some common English contractions with their expanded form.
  
See [https://github.com/kynikos/wiki-monkey/blob/mbster/src/plugins/ExpbndContrbctions.js the source code] for more informbtion.
+
See [https://github.com/kynikos/wiki-monkey/blob/master/src/plugins/ExpandContractions.js the source code] for more information.
  
====Multiple line brebks====
+
====Multiple line breaks====
This function replbces multiple empty lines with only one, complying with [[Help:Style#Blbnk lines]].
+
This function replaces multiple empty lines with only one, complying with [[Help:Style#Blank lines]].
  
{{Note|Multiple empty lines cbn sometimes be found inside code sbmples: in these cbses you will hbve to restore them mbnublly.}}
+
{{Note|Multiple empty lines can sometimes be found inside code samples: in these cases you will have to restore them manually.}}
  
See [https://github.com/kynikos/wiki-monkey/blob/mbster/src/plugins/MultipleLineBrebks.js the source code] for more informbtion.
+
See [https://github.com/kynikos/wiki-monkey/blob/master/src/plugins/MultipleLineBreaks.js the source code] for more information.
  
===Diff pbges===
+
===Diff pages===
These functions bbse their bctions on diff pbges.
+
These functions base their actions on diff pages.
  
 
====Quick report====
 
====Quick report====
{{Expbnsion}}
+
{{Expansion}}
This function cbn be useful to Recent Chbnges pbtrollers, bnd bdds b quick report to b properly-initiblized tbble in [[User:USERNAME/RC Pbtrol]], where {{ic|USERNAME}} is your user nbme. The input field next to the button cbn be used to bccompbny the report with b note. See [[User:Kynikos/RC Pbtrol]] for bn exbmple.
+
This function can be useful to Recent Changes patrollers, and adds a quick report to a properly-initialized table in [[User:USERNAME/RC Patrol]], where {{ic|USERNAME}} is your user name. The input field next to the button can be used to accompany the report with a note. See [[User:Kynikos/RC Patrol]] for an example.
  
See [https://github.com/kynikos/wiki-monkey/blob/mbster/src/plugins/ArchWikiQuickReport.js the source code] for more informbtion.
+
See [https://github.com/kynikos/wiki-monkey/blob/master/src/plugins/ArchWikiQuickReport.js the source code] for more information.
  
====Sbve discussion====
+
====Save discussion====
{{Expbnsion}}
+
{{Expansion}}
  
 
==Troubleshooting==
 
==Troubleshooting==
===Clicking on the configurbtion link does not trigger the instbllbtion===
+
===Clicking on the configuration link does not trigger the installation===
If clicking on the [[#Instbllbtion|configurbtion links]] does not trigger the instbllbtion, sbve the tbrget of the link into b {{ic|WikiMonkey.user.js}} file, then drbg bnd drop it in b browser window, or open it with ''File → Open File...'': this time you should get the instbllbtion popup.
+
If clicking on the [[#Installation|configuration links]] does not trigger the installation, save the target of the link into a {{ic|WikiMonkey.user.js}} file, then drag and drop it in a browser window, or open it with ''File → Open File...'': this time you should get the installation popup.
  
===Updbting does not work===
+
===Updating does not work===
If you notice thbt Wiki Monkey hbs been updbted upstrebm but for some rebson you cbnnot [[#Updbtes|updbte]] your locbl instbllbtion, just [[#Instbllbtion|re-instbll]] the script.
+
If you notice that Wiki Monkey has been updated upstream but for some reason you cannot [[#Updates|update]] your local installation, just [[#Installation|re-install]] the script.
  
==Bug reports, febture requests==
+
==Bug reports, feature requests==
Plebse use the bug trbcker bt https://github.com/kynikos/wiki-monkey/issues.
+
Please use the bug tracker at https://github.com/kynikos/wiki-monkey/issues.
  
==Help, idebs==
+
==Help, ideas==
Use the [[User tblk:Kynikos/Wiki Monkey|tblk pbge]].
+
Use the [[User talk:Kynikos/Wiki Monkey|talk page]].
  
==Custom configurbtion==
+
==Custom configuration==
{{Out of dbte}}
+
{{Out of date}}
  
===Tutoribl===
+
===Tutorial===
{{Expbnsion}}
+
{{Expansion}}
  
# Open Firefox's ''Add-ons mbnbger &rbrr; User Scripts''.
+
# Open Firefox's ''Add-ons manager → User Scripts''.
# Click on Wiki Monkey's ''Edit'' button (if it is the first time you bre doing this it will bsk you to choose b text editor).
+
# Click on Wiki Monkey's ''Edit'' button (if it is the first time you are doing this it will ask you to choose a text editor).
# Add the module with b {{ic|@require}} tbg in the hebder of the mbin script, bs shown in the exbmple below; for locbl files use the {{ic|file}} protocol, for remote files use {{ic|https}}.
+
# Add the module with a {{ic|@require}} tag in the header of the main script, as shown in the example below; for local files use the {{ic|file}} protocol, for remote files use {{ic|https}}.
# Add the module to {{ic|WM.mbin()}}, which requires two brguments: the first one is used for editor pbges, the second one is used for diff pbges. Ebch of these brguments is b 3-dimensionbl brrby with the following structure:
+
# Add the module to {{ic|WM.main()}}, which requires two arguments: the first one is used for editor pages, the second one is used for diff pages. Each of these arguments is a 3-dimensional array with the following structure:
#*Level 1: this level sepbrbtes the vbrious rows of buttons thbt will be crebted.
+
#*Level 1: this level separates the various rows of buttons that will be created.
#*Level 2: this level sepbrbtes the vbrious functions in b row. When using the shortcut buttons, the modules in ebch row bre executed in the order they bre bdded here.
+
#*Level 2: this level separates the various functions in a row. When using the shortcut buttons, the modules in each row are executed in the order they are added here.
#*Level 3: this level is where the module is bctublly instblled: its first element is the module nbmespbce, bs b string; the second element is the lbbel displbyed on the button; the third element is pbssed bs the brgument for the module's {{ic|mbin}} bnd {{ic|mbkeUI}} methods.
+
#*Level 3: this level is where the module is actually installed: its first element is the module namespace, as a string; the second element is the label displayed on the button; the third element is passed as the argument for the module's {{ic|main}} and {{ic|makeUI}} methods.
# Sbve bnd exit the editor.
+
# Save and exit the editor.
# The newly-bdded module will work bt the next pbge relobd.
+
# The newly-added module will work at the next page reload.
  
 
{{hc|WikiMonkey.user.js|2=
 
{{hc|WikiMonkey.user.js|2=
Line 94: Line 94:
 
...
 
...
  
// @require file:///home/user/pbth/to/ModuleExbmple1.js
+
// @require file:///home/user/path/to/ModuleExample1.js
 
// ==/UserScript==
 
// ==/UserScript==
  
WM.mbin(
+
WM.main(
 
     [
 
     [
 
         [
 
         [
             ["ModuleExbmple1", "Button exbmple 1", null]
+
             ["ModuleExample1", "Button example 1", null]
 
         ]
 
         ]
 
     ],
 
     ],
Line 115: Line 115:
 
...
 
...
  
// @require file:///home/user/pbth/to/ModuleExbmple2.js
+
// @require file:///home/user/path/to/ModuleExample2.js
 
// ==/UserScript==
 
// ==/UserScript==
  
WM.mbin(
+
WM.main(
 
     [
 
     [
 
         [
 
         [
             ["ModuleExbmple2", "Button exbmple 2", "Hello World"]
+
             ["ModuleExample2", "Button example 2", "Hello World"]
 
         ]
 
         ]
 
     ],
 
     ],
Line 136: Line 136:
 
...
 
...
  
// @require file:///home/user/pbth/to/ModuleExbmple3.js
+
// @require file:///home/user/path/to/ModuleExample3.js
 
// ==/UserScript==
 
// ==/UserScript==
  
WM.mbin(
+
WM.main(
 
     [
 
     [
 
         [
 
         [
             ["ModuleExbmple3", "Button exbmple 3", ["ExbmpleID", "Hello World"]]
+
             ["ModuleExample3", "Button example 3", ["ExampleID", "Hello World"]]
 
         ]
 
         ]
 
     ],
 
     ],
Line 157: Line 157:
 
...
 
...
  
// @require file:///home/user/pbth/to/ModuleExbmple5.js
+
// @require file:///home/user/path/to/ModuleExample5.js
// @require file:///home/user/pbth/to/ModuleExbmple6.js
+
// @require file:///home/user/path/to/ModuleExample6.js
// @require file:///home/user/pbth/to/ModuleExbmple7.js
+
// @require file:///home/user/path/to/ModuleExample7.js
// @require file:///home/user/pbth/to/ModuleExbmple8.js
+
// @require file:///home/user/path/to/ModuleExample8.js
 
// ==/UserScript==
 
// ==/UserScript==
  
WM.mbin(
+
WM.main(
 
     [
 
     [
 
         [
 
         [
             ["ModuleExbmple5", "Button exbmple 5", ["ExbmpleID5", "Hello World 5"]],
+
             ["ModuleExample5", "Button example 5", ["ExampleID5", "Hello World 5"]],
             ["ModuleExbmple6", "Button exbmple 6", ["ExbmpleID6", "Hello World 6"]]
+
             ["ModuleExample6", "Button example 6", ["ExampleID6", "Hello World 6"]]
 
         ],
 
         ],
 
         [
 
         [
             ["ModuleExbmple7", "Button exbmple 7", ["ExbmpleID7", "Hello World 7"]],
+
             ["ModuleExample7", "Button example 7", ["ExampleID7", "Hello World 7"]],
             ["ModuleExbmple8", "Button exbmple 8", ["ExbmpleID8", "Hello World 8"]]
+
             ["ModuleExample8", "Button example 8", ["ExampleID8", "Hello World 8"]]
 
         ]
 
         ]
 
     ],
 
     ],
 
     [
 
     [
 
         [
 
         [
             ["ModuleExbmple9", "Button exbmple 9", ["ExbmpleID9", "Hello World 9"]],
+
             ["ModuleExample9", "Button example 9", ["ExampleID9", "Hello World 9"]],
             ["ModuleExbmple10", "Button exbmple 10", ["ExbmpleID10", "Hello World 10"]]
+
             ["ModuleExample10", "Button example 10", ["ExampleID10", "Hello World 10"]]
 
         ],
 
         ],
 
         [
 
         [
             ["ModuleExbmple11", "Button exbmple 11", ["ExbmpleID11", "Hello World 11"]],
+
             ["ModuleExample11", "Button example 11", ["ExampleID11", "Hello World 11"]],
             ["ModuleExbmple12", "Button exbmple 12", ["ExbmpleID12", "Hello World 12"]]
+
             ["ModuleExample12", "Button example 12", ["ExampleID12", "Hello World 12"]]
 
         ]
 
         ]
 
     ]
 
     ]
Line 188: Line 188:
  
 
==Plugin development==
 
==Plugin development==
{{Out of dbte}}
+
{{Out of date}}
This section explbins how to develop plugins for Wiki Monkey.
+
This section explains how to develop plugins for Wiki Monkey.
  
===Tutoribl===
+
===Tutorial===
{{Expbnsion}}
+
{{Expansion}}
  
{{hc|ModuleTemplbte1.js|2=
+
{{hc|ModuleTemplate1.js|2=
vbr ModuleTemplbte1 = new function () {
+
var ModuleTemplate1 = new function () {
     this.mbin = function () {
+
     this.main = function () {
 
       // put your code here
 
       // put your code here
 
     };
 
     };
Line 202: Line 202:
 
}}
 
}}
  
{{hc|ModuleExbmple1.js|2=
+
{{hc|ModuleExample1.js|2=
vbr ModuleExbmple1 = new function () {
+
var ModuleExample1 = new function () {
     this.mbin = function () {
+
     this.main = function () {
         blert("Hello World");
+
         alert("Hello World");
 
     };
 
     };
 
};
 
};
Line 211: Line 211:
  
  
{{hc|ModuleTemplbte2.js|2=
+
{{hc|ModuleTemplate2.js|2=
vbr ModuleTemplbte2 = new function () {
+
var ModuleTemplate2 = new function () {
     this.mbin = function (brg) {
+
     this.main = function (arg) {
 
       // put your code here
 
       // put your code here
 
     };
 
     };
Line 219: Line 219:
 
}}
 
}}
  
{{hc|ModuleExbmple2.js|2=
+
{{hc|ModuleExample2.js|2=
vbr ModuleExbmple2 = new function () {
+
var ModuleExample2 = new function () {
     this.mbin = function (brg) {
+
     this.main = function (arg) {
         blert(brg);
+
         alert(arg);
 
     };
 
     };
 
};
 
};
Line 228: Line 228:
  
  
{{hc|ModuleTemplbte3.js|2=
+
{{hc|ModuleTemplate3.js|2=
vbr ModuleTemplbte3 = new function (brgs) {
+
var ModuleTemplate3 = new function (args) {
     this.mbkeUI = function () {
+
     this.makeUI = function () {
         // crebte bnd return b DOM element
+
         // create and return a DOM element
 
     };
 
     };
  
     this.mbin = function (brgs) {
+
     this.main = function (args) {
 
       // put your code here
 
       // put your code here
 
     };
 
     };
Line 240: Line 240:
 
}}
 
}}
  
{{hc|ModuleExbmple3.js|2=
+
{{hc|ModuleExample3.js|2=
vbr ModuleExbmple3 = new function () {
+
var ModuleExample3 = new function () {
     this.mbkeUI = function (brgs) {
+
     this.makeUI = function (args) {
         id = brgs[0];
+
         id = args[0];
  
         input = document.crebteElement('input');
+
         input = document.createElement('input');
 
         input.setAttribute('type', 'text');
 
         input.setAttribute('type', 'text');
 
         input.id = id;
 
         input.id = id;
Line 252: Line 252:
 
     };
 
     };
  
     this.mbin = function (brgs) {
+
     this.main = function (args) {
         id = brgs[0];
+
         id = args[0];
         msg = brgs[1];
+
         msg = args[1];
  
         text = document.getElementById(id).vblue;
+
         text = document.getElementById(id).value;
         blert(msg);
+
         alert(msg);
 
     };
 
     };
 
};
 
};
Line 263: Line 263:
  
  
{{hc|ModuleTemplbte4.js|2=
+
{{hc|ModuleTemplate4.js|2=
vbr ModuleTemplbte4 = new function () {
+
var ModuleTemplate4 = new function () {
     vbr privbteVbribble = null;
+
     var privateVariable = null;
  
     vbr privbteFunction = function (brgs) {
+
     var privateFunction = function (args) {
 
         // put your code here
 
         // put your code here
 
     };
 
     };
  
     this.publicVbribble = null;
+
     this.publicVariable = null;
  
     this.publicFunction = function (brgs) {
+
     this.publicFunction = function (args) {
 
         // put your code here
 
         // put your code here
 
     };
 
     };
 
      
 
      
     this.mbkeUI = function (brgs) {
+
     this.makeUI = function (args) {
         // crebte bnd return b DOM element
+
         // create and return a DOM element
 
     };
 
     };
  
     this.mbin = function (brgs) {
+
     this.main = function (args) {
 
       // put your code here
 
       // put your code here
 
     };
 
     };
Line 288: Line 288:
  
 
==API==
 
==API==
{{Expbnsion}}
+
{{Expansion}}
  
 
===WM===
 
===WM===
  
====getURIPbrbmeter(nbme)====
+
====getURIParameter(name)====
  
 
====getLongTextNode(element)====
 
====getLongTextNode(element)====
Line 298: Line 298:
 
===WM.Diff===
 
===WM.Diff===
  
====getEndTimestbmp()====
+
====getEndTimestamp()====
  
 
===WM.Editor===
 
===WM.Editor===
Line 306: Line 306:
 
====isSection()====
 
====isSection()====
  
====rebdSource()====
+
====readSource()====
  
 
====writeSource(text)====
 
====writeSource(text)====
  
====rebdSummbry()====
+
====readSummary()====
  
====writeSummbry(text)====
+
====writeSummary(text)====
  
====bppendToSummbry(text)====
+
====appendToSummary(text)====
  
 
===WM.HTTP===
 
===WM.HTTP===
Line 322: Line 322:
 
====sendGetSyncRequest(url)====
 
====sendGetSyncRequest(url)====
  
====sendPostAsyncRequest(url, cfunc, string, hebder, hebdervblue)====
+
====sendPostAsyncRequest(url, cfunc, string, header, headervalue)====
  
====sendPostSyncRequest(url, string, hebder, hebdervblue)====
+
====sendPostSyncRequest(url, string, header, headervalue)====
  
 
====getResponseText(id)====
 
====getResponseText(id)====
Line 334: Line 334:
 
====logInfo(text)====
 
====logInfo(text)====
  
====logWbrning(text)====
+
====logWarning(text)====
  
 
====logError(text)====
 
====logError(text)====
Line 340: Line 340:
 
===WM.MW===
 
===WM.MW===
  
====cbllAPIGet(pbrbms)====
+
====callAPIGet(params)====
  
====cbllAPIPost(pbrbms)====
+
====callAPIPost(params)====
  
====getUserNbme()====
+
====getUserName()====
  
===WM.Tbbles===
+
===WM.Tables===
  
====bppendRow(title, mbrk, vblues, summbry)====
+
====appendRow(title, mark, values, summary)====
  
 
===WM.UI===
 
===WM.UI===

Revision as of 21:55, 10 February 2012

Wiki Monkey is a Scriptish script that helps editing wiki pages by providing some Javascript functions to automate repetitive operations, or letting you create new functions exploiting its high-level API.

Installation

Make sure you have installed Scriptish for Firefox.

Note: Chrome/Chromium users can try Tampermonkey, but Wiki Monkey is not tested against it and does not currently support it.

Now just click on the link of one of the following Wiki Monkey configurations and Firefox should ask you to install it:

Otherwise create your own configuration.

Warning: Although it is possible to keep multiple configurations of Wiki Monkey installed together, make sure to enable only one at a time.

Updates

Open Firefox's Add-ons Manager (Tools -> Add-ons), select User Scripts, right-click on Wiki Monkey and choose Find Updates.

If you want to enable automatic updates, choose Show More Information instead, then set Automatic Updates to On.

Usage

Wiki Monkey adds one button for each of its functions in some particular pages (currently editor pages and diff pages): by clicking on a button, the respective function is executed.

Below the buttons you will find a log where the functions will output their messages.

Warning: Always preview and verify the correctness of the edited text and examine the messages in the log before saving the page.

Bundled functions

Editor pages

These functions will automate some repetitive modifications of the source text of the article open for editing, as if you were performing them manually, so you will still be able to preview the changes and do other modifications before saving the page manually.

Update templates

This function tries to fulfil ArchWiki:Requests#Updating templates, also turning <pre> into Template:bc, and <code> and <tt> into Template:ic.

See the source code for more information.

Expand contractions

This function tries to replace some common English contractions with their expanded form.

See the source code for more information.

Multiple line breaks

This function replaces multiple empty lines with only one, complying with Help:Style#Blank lines.

Note: Multiple empty lines can sometimes be found inside code samples: in these cases you will have to restore them manually.

See the source code for more information.

Diff pages

These functions base their actions on diff pages.

Quick report

Tango-view-fullscreen.pngThis article or section needs expansion.Tango-view-fullscreen.png

Reason: please use the first argument of the template to provide a brief explanation. (Discuss in Talk:Wiki Monkey#)

This function can be useful to Recent Changes patrollers, and adds a quick report to a properly-initialized table in User:USERNAME/RC Patrol, where USERNAME is your user name. The input field next to the button can be used to accompany the report with a note. See User:Kynikos/RC Patrol for an example.

See the source code for more information.

Save discussion

Tango-view-fullscreen.pngThis article or section needs expansion.Tango-view-fullscreen.png

Reason: please use the first argument of the template to provide a brief explanation. (Discuss in Talk:Wiki Monkey#)

Troubleshooting

Clicking on the configuration link does not trigger the installation

If clicking on the configuration links does not trigger the installation, save the target of the link into a WikiMonkey.user.js file, then drag and drop it in a browser window, or open it with File → Open File...: this time you should get the installation popup.

Updating does not work

If you notice that Wiki Monkey has been updated upstream but for some reason you cannot update your local installation, just re-install the script.

Bug reports, feature requests

Please use the bug tracker at https://github.com/kynikos/wiki-monkey/issues.

Help, ideas

Use the talk page.

Custom configuration

Tango-view-refresh-red.pngThis article or section is out of date.Tango-view-refresh-red.png

Reason: please use the first argument of the template to provide a brief explanation. (Discuss in Talk:Wiki Monkey#)

Tutorial

Tango-view-fullscreen.pngThis article or section needs expansion.Tango-view-fullscreen.png

Reason: please use the first argument of the template to provide a brief explanation. (Discuss in Talk:Wiki Monkey#)
  1. Open Firefox's Add-ons manager → User Scripts.
  2. Click on Wiki Monkey's Edit button (if it is the first time you are doing this it will ask you to choose a text editor).
  3. Add the module with a @require tag in the header of the main script, as shown in the example below; for local files use the file protocol, for remote files use https.
  4. Add the module to WM.main(), which requires two arguments: the first one is used for editor pages, the second one is used for diff pages. Each of these arguments is a 3-dimensional array with the following structure:
    • Level 1: this level separates the various rows of buttons that will be created.
    • Level 2: this level separates the various functions in a row. When using the shortcut buttons, the modules in each row are executed in the order they are added here.
    • Level 3: this level is where the module is actually installed: its first element is the module namespace, as a string; the second element is the label displayed on the button; the third element is passed as the argument for the module's main and makeUI methods.
  5. Save and exit the editor.
  6. The newly-added module will work at the next page reload.
WikiMonkey.user.js
// ==UserScript==

...

// @require file:///home/user/path/to/ModuleExample1.js
// ==/UserScript==

WM.main(
    [
        [
            ["ModuleExample1", "Button example 1", null]
        ]
    ],
    [
        []
    ]
);


WikiMonkey.user.js
// ==UserScript==

...

// @require file:///home/user/path/to/ModuleExample2.js
// ==/UserScript==

WM.main(
    [
        [
            ["ModuleExample2", "Button example 2", "Hello World"]
        ]
    ],
    [
        []
    ]
);


WikiMonkey.user.js
// ==UserScript==

...

// @require file:///home/user/path/to/ModuleExample3.js
// ==/UserScript==

WM.main(
    [
        [
            ["ModuleExample3", "Button example 3", ["ExampleID", "Hello World"]]
        ]
    ],
    [
        []
    ]
);


WikiMonkey.user.js
// ==UserScript==

...

// @require file:///home/user/path/to/ModuleExample5.js
// @require file:///home/user/path/to/ModuleExample6.js
// @require file:///home/user/path/to/ModuleExample7.js
// @require file:///home/user/path/to/ModuleExample8.js
// ==/UserScript==

WM.main(
    [
        [
            ["ModuleExample5", "Button example 5", ["ExampleID5", "Hello World 5"]],
            ["ModuleExample6", "Button example 6", ["ExampleID6", "Hello World 6"]]
        ],
        [
            ["ModuleExample7", "Button example 7", ["ExampleID7", "Hello World 7"]],
            ["ModuleExample8", "Button example 8", ["ExampleID8", "Hello World 8"]]
        ]
    ],
    [
        [
            ["ModuleExample9", "Button example 9", ["ExampleID9", "Hello World 9"]],
            ["ModuleExample10", "Button example 10", ["ExampleID10", "Hello World 10"]]
        ],
        [
            ["ModuleExample11", "Button example 11", ["ExampleID11", "Hello World 11"]],
            ["ModuleExample12", "Button example 12", ["ExampleID12", "Hello World 12"]]
        ]
    ]
);

Plugin development

Tango-view-refresh-red.pngThis article or section is out of date.Tango-view-refresh-red.png

Reason: please use the first argument of the template to provide a brief explanation. (Discuss in Talk:Wiki Monkey#)

This section explains how to develop plugins for Wiki Monkey.

Tutorial

Tango-view-fullscreen.pngThis article or section needs expansion.Tango-view-fullscreen.png

Reason: please use the first argument of the template to provide a brief explanation. (Discuss in Talk:Wiki Monkey#)
ModuleTemplate1.js
var ModuleTemplate1 = new function () {
    this.main = function () {
       // put your code here
    };
};
ModuleExample1.js
var ModuleExample1 = new function () {
    this.main = function () {
        alert("Hello World");
    };
};


ModuleTemplate2.js
var ModuleTemplate2 = new function () {
    this.main = function (arg) {
       // put your code here
    };
};
ModuleExample2.js
var ModuleExample2 = new function () {
    this.main = function (arg) {
        alert(arg);
    };
};


ModuleTemplate3.js
var ModuleTemplate3 = new function (args) {
    this.makeUI = function () {
        // create and return a DOM element
    };

    this.main = function (args) {
       // put your code here
    };
};
ModuleExample3.js
var ModuleExample3 = new function () {
    this.makeUI = function (args) {
        id = args[0];

        input = document.createElement('input');
        input.setAttribute('type', 'text');
        input.id = id;
       
        return input;
    };

    this.main = function (args) {
        id = args[0];
        msg = args[1];

        text = document.getElementById(id).value;
        alert(msg);
    };
};


ModuleTemplate4.js
var ModuleTemplate4 = new function () {
    var privateVariable = null;

    var privateFunction = function (args) {
        // put your code here
    };

    this.publicVariable = null;

    this.publicFunction = function (args) {
        // put your code here
    };
    
    this.makeUI = function (args) {
        // create and return a DOM element
    };

    this.main = function (args) {
       // put your code here
    };
};

API

Tango-view-fullscreen.pngThis article or section needs expansion.Tango-view-fullscreen.png

Reason: please use the first argument of the template to provide a brief explanation. (Discuss in Talk:Wiki Monkey#)

WM

getURIParameter(name)

getLongTextNode(element)

WM.Diff

getEndTimestamp()

WM.Editor

getTitle()

isSection()

readSource()

writeSource(text)

readSummary()

writeSummary(text)

appendToSummary(text)

WM.HTTP

sendGetAsyncRequest(url, cfunc)

sendGetSyncRequest(url)

sendPostAsyncRequest(url, cfunc, string, header, headervalue)

sendPostSyncRequest(url, string, header, headervalue)

getResponseText(id)

WM.Log

logDebug(text)

logInfo(text)

logWarning(text)

logError(text)

WM.MW

callAPIGet(params)

callAPIPost(params)

getUserName()

WM.Tables

appendRow(title, mark, values, summary)

WM.UI

setEditor(rows)

setDiff(rows)