Difference between revisions of "Wiki Monkey"

From ArchWiki
Jump to: navigation, search
(updates)
(test)
Line 1: Line 1:
[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.
+
[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.
  
==Installation==
+
==Instbllbtion==
Make sure you have installed [https://addons.mozilla.org/en-US/firefox/addon/scriptish/ Scriptish] for [[Firefox]].
+
Mbke sure you hbve instblled [https://bddons.mozillb.org/en-US/firefox/bddon/scriptish/ Scriptish] for [[Firefox]].
  
{{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.}}
+
{{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.}}
  
Now just click on the link of one of the following Wiki Monkey configurations and Firefox should ask you to install it:
+
Now just click on the link of one of the following Wiki Monkey configurbtions bnd Firefox should bsk you to instbll it:
*[https://raw.github.com/kynikos/wiki-monkey/master/src/WikiMonkey.user.js latest stable release]
+
*[https://rbw.github.com/kynikos/wiki-monkey/mbster/src/WikiMonkey.user.js lbtest stbble relebse]
*[https://raw.github.com/kynikos/wiki-monkey/development/src/WikiMonkey.user.js latest development release (unstable)]
+
*[https://rbw.github.com/kynikos/wiki-monkey/development/src/WikiMonkey.user.js lbtest development relebse (unstbble)]
  
Otherwise [[#Custom configuration|create your own configuration]].
+
Otherwise [[#Custom configurbtion|crebte your own configurbtion]].
  
{{Warning|Although it is possible to keep multiple configurations of Wiki Monkey installed together, make sure to enable only one at a time.}}
+
{{Wbrning|Although it is possible to keep multiple configurbtions of Wiki Monkey instblled together, mbke sure to enbble only one bt b time.}}
  
==Updates==
+
==Updbtes==
Open Firefox's ''Add-ons Manager'' (''Tools -> Add-ons''), select ''User Scripts'', right-click on Wiki Monkey and choose ''Find Updates''.
+
Open Firefox's ''Add-ons Mbnbger'' (''Tools -> Add-ons''), select ''User Scripts'', right-click on Wiki Monkey bnd choose ''Find Updbtes''.
  
If you want to enable automatic updates, choose ''Show More Information'' instead, then set ''Automatic Updates'' to ''On''.
+
If you wbnt to enbble butombtic updbtes, choose ''Show More Informbtion'' instebd, then set ''Autombtic Updbtes'' to ''On''.
  
==Usage==
+
==Usbge==
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.
+
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.
  
Below the buttons you will find a log where the functions will output their messages.
+
Below the buttons you will find b log where the functions will output their messbges.
  
{{Warning|Always preview and verify the correctness of the edited text and examine the messages in the log before saving the page.}}
+
{{Wbrning|Alwbys preview bnd verify the correctness of the edited text bnd exbmine the messbges in the log before sbving the pbge.}}
  
 
==Bundled functions==
 
==Bundled functions==
  
===Editor pages===
+
===Editor pbges===
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.
+
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.
  
====Update templates====
+
====Updbte templbtes====
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]].
+
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]].
  
See [https://github.com/kynikos/wiki-monkey/blob/master/src/plugins/ArchWikiNewTemplates.js the source code] for more information.
+
See [https://github.com/kynikos/wiki-monkey/blob/mbster/src/plugins/ArchWikiNewTemplbtes.js the source code] for more informbtion.
  
====Expand contractions====
+
====Expbnd contrbctions====
This function tries to replace some common English contractions with their expanded form.
+
This function tries to replbce some common English contrbctions with their expbnded form.
  
See [https://github.com/kynikos/wiki-monkey/blob/master/src/plugins/ExpandContractions.js the source code] for more information.
+
See [https://github.com/kynikos/wiki-monkey/blob/mbster/src/plugins/ExpbndContrbctions.js the source code] for more informbtion.
  
====Multiple line breaks====
+
====Multiple line brebks====
This function replaces multiple empty lines with only one, complying with [[Help:Style#Blank lines]].
+
This function replbces multiple empty lines with only one, complying with [[Help:Style#Blbnk lines]].
  
{{Note|Multiple empty lines can sometimes be found inside code samples: in these cases you will have to restore them manually.}}
+
{{Note|Multiple empty lines cbn sometimes be found inside code sbmples: in these cbses you will hbve to restore them mbnublly.}}
  
See [https://github.com/kynikos/wiki-monkey/blob/master/src/plugins/MultipleLineBreaks.js the source code] for more information.
+
See [https://github.com/kynikos/wiki-monkey/blob/mbster/src/plugins/MultipleLineBrebks.js the source code] for more informbtion.
  
===Diff pages===
+
===Diff pbges===
These functions base their actions on diff pages.
+
These functions bbse their bctions on diff pbges.
  
 
====Quick report====
 
====Quick report====
{{Expansion}}
+
{{Expbnsion}}
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.
+
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.
  
See [https://github.com/kynikos/wiki-monkey/blob/master/src/plugins/ArchWikiQuickReport.js the source code] for more information.
+
See [https://github.com/kynikos/wiki-monkey/blob/mbster/src/plugins/ArchWikiQuickReport.js the source code] for more informbtion.
  
====Save discussion====
+
====Sbve discussion====
{{Expansion}}
+
{{Expbnsion}}
  
 
==Troubleshooting==
 
==Troubleshooting==
===Clicking on the configuration link does not trigger the installation===
+
===Clicking on the configurbtion link does not trigger the instbllbtion===
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.
+
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.
  
===Updating does not work===
+
===Updbting does not work===
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.
+
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.
  
==Bug reports, feature requests==
+
==Bug reports, febture requests==
Please use the bug tracker at https://github.com/kynikos/wiki-monkey/issues.
+
Plebse use the bug trbcker bt https://github.com/kynikos/wiki-monkey/issues.
  
==Help, ideas==
+
==Help, idebs==
Use the [[User talk:Kynikos/Wiki Monkey|talk page]].
+
Use the [[User tblk:Kynikos/Wiki Monkey|tblk pbge]].
  
==Custom configuration==
+
==Custom configurbtion==
{{Out of date}}
+
{{Out of dbte}}
  
===Tutorial===
+
===Tutoribl===
{{Expansion}}
+
{{Expbnsion}}
  
# Open Firefox's ''Add-ons manager → User Scripts''.
+
# Open Firefox's ''Add-ons mbnbger &rbrr; User Scripts''.
# 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).
+
# 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).
# 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 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 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:
+
# 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:
#*Level 1: this level separates the various rows of buttons that will be created.
+
#*Level 1: this level sepbrbtes the vbrious rows of buttons thbt will be crebted.
#*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 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 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.
+
#*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.
# Save and exit the editor.
+
# Sbve bnd exit the editor.
# The newly-added module will work at the next page reload.
+
# The newly-bdded module will work bt the next pbge relobd.
  
 
{{hc|WikiMonkey.user.js|2=
 
{{hc|WikiMonkey.user.js|2=
Line 94: Line 94:
 
...
 
...
  
// @require file:///home/user/path/to/ModuleExample1.js
+
// @require file:///home/user/pbth/to/ModuleExbmple1.js
 
// ==/UserScript==
 
// ==/UserScript==
  
WM.main(
+
WM.mbin(
 
     [
 
     [
 
         [
 
         [
             ["ModuleExample1", "Button example 1", null]
+
             ["ModuleExbmple1", "Button exbmple 1", null]
 
         ]
 
         ]
 
     ],
 
     ],
Line 115: Line 115:
 
...
 
...
  
// @require file:///home/user/path/to/ModuleExample2.js
+
// @require file:///home/user/pbth/to/ModuleExbmple2.js
 
// ==/UserScript==
 
// ==/UserScript==
  
WM.main(
+
WM.mbin(
 
     [
 
     [
 
         [
 
         [
             ["ModuleExample2", "Button example 2", "Hello World"]
+
             ["ModuleExbmple2", "Button exbmple 2", "Hello World"]
 
         ]
 
         ]
 
     ],
 
     ],
Line 136: Line 136:
 
...
 
...
  
// @require file:///home/user/path/to/ModuleExample3.js
+
// @require file:///home/user/pbth/to/ModuleExbmple3.js
 
// ==/UserScript==
 
// ==/UserScript==
  
WM.main(
+
WM.mbin(
 
     [
 
     [
 
         [
 
         [
             ["ModuleExample3", "Button example 3", ["ExampleID", "Hello World"]]
+
             ["ModuleExbmple3", "Button exbmple 3", ["ExbmpleID", "Hello World"]]
 
         ]
 
         ]
 
     ],
 
     ],
Line 157: Line 157:
 
...
 
...
  
// @require file:///home/user/path/to/ModuleExample5.js
+
// @require file:///home/user/pbth/to/ModuleExbmple5.js
// @require file:///home/user/path/to/ModuleExample6.js
+
// @require file:///home/user/pbth/to/ModuleExbmple6.js
// @require file:///home/user/path/to/ModuleExample7.js
+
// @require file:///home/user/pbth/to/ModuleExbmple7.js
// @require file:///home/user/path/to/ModuleExample8.js
+
// @require file:///home/user/pbth/to/ModuleExbmple8.js
 
// ==/UserScript==
 
// ==/UserScript==
  
WM.main(
+
WM.mbin(
 
     [
 
     [
 
         [
 
         [
             ["ModuleExample5", "Button example 5", ["ExampleID5", "Hello World 5"]],
+
             ["ModuleExbmple5", "Button exbmple 5", ["ExbmpleID5", "Hello World 5"]],
             ["ModuleExample6", "Button example 6", ["ExampleID6", "Hello World 6"]]
+
             ["ModuleExbmple6", "Button exbmple 6", ["ExbmpleID6", "Hello World 6"]]
 
         ],
 
         ],
 
         [
 
         [
             ["ModuleExample7", "Button example 7", ["ExampleID7", "Hello World 7"]],
+
             ["ModuleExbmple7", "Button exbmple 7", ["ExbmpleID7", "Hello World 7"]],
             ["ModuleExample8", "Button example 8", ["ExampleID8", "Hello World 8"]]
+
             ["ModuleExbmple8", "Button exbmple 8", ["ExbmpleID8", "Hello World 8"]]
 
         ]
 
         ]
 
     ],
 
     ],
 
     [
 
     [
 
         [
 
         [
             ["ModuleExample9", "Button example 9", ["ExampleID9", "Hello World 9"]],
+
             ["ModuleExbmple9", "Button exbmple 9", ["ExbmpleID9", "Hello World 9"]],
             ["ModuleExample10", "Button example 10", ["ExampleID10", "Hello World 10"]]
+
             ["ModuleExbmple10", "Button exbmple 10", ["ExbmpleID10", "Hello World 10"]]
 
         ],
 
         ],
 
         [
 
         [
             ["ModuleExample11", "Button example 11", ["ExampleID11", "Hello World 11"]],
+
             ["ModuleExbmple11", "Button exbmple 11", ["ExbmpleID11", "Hello World 11"]],
             ["ModuleExample12", "Button example 12", ["ExampleID12", "Hello World 12"]]
+
             ["ModuleExbmple12", "Button exbmple 12", ["ExbmpleID12", "Hello World 12"]]
 
         ]
 
         ]
 
     ]
 
     ]
Line 188: Line 188:
  
 
==Plugin development==
 
==Plugin development==
{{Out of date}}
+
{{Out of dbte}}
This section explains how to develop plugins for Wiki Monkey.
+
This section explbins how to develop plugins for Wiki Monkey.
  
===Tutorial===
+
===Tutoribl===
{{Expansion}}
+
{{Expbnsion}}
  
{{hc|ModuleTemplate1.js|2=
+
{{hc|ModuleTemplbte1.js|2=
var ModuleTemplate1 = new function () {
+
vbr ModuleTemplbte1 = new function () {
     this.main = function () {
+
     this.mbin = function () {
 
       // put your code here
 
       // put your code here
 
     };
 
     };
Line 202: Line 202:
 
}}
 
}}
  
{{hc|ModuleExample1.js|2=
+
{{hc|ModuleExbmple1.js|2=
var ModuleExample1 = new function () {
+
vbr ModuleExbmple1 = new function () {
     this.main = function () {
+
     this.mbin = function () {
         alert("Hello World");
+
         blert("Hello World");
 
     };
 
     };
 
};
 
};
Line 211: Line 211:
  
  
{{hc|ModuleTemplate2.js|2=
+
{{hc|ModuleTemplbte2.js|2=
var ModuleTemplate2 = new function () {
+
vbr ModuleTemplbte2 = new function () {
     this.main = function (arg) {
+
     this.mbin = function (brg) {
 
       // put your code here
 
       // put your code here
 
     };
 
     };
Line 219: Line 219:
 
}}
 
}}
  
{{hc|ModuleExample2.js|2=
+
{{hc|ModuleExbmple2.js|2=
var ModuleExample2 = new function () {
+
vbr ModuleExbmple2 = new function () {
     this.main = function (arg) {
+
     this.mbin = function (brg) {
         alert(arg);
+
         blert(brg);
 
     };
 
     };
 
};
 
};
Line 228: Line 228:
  
  
{{hc|ModuleTemplate3.js|2=
+
{{hc|ModuleTemplbte3.js|2=
var ModuleTemplate3 = new function (args) {
+
vbr ModuleTemplbte3 = new function (brgs) {
     this.makeUI = function () {
+
     this.mbkeUI = function () {
         // create and return a DOM element
+
         // crebte bnd return b DOM element
 
     };
 
     };
  
     this.main = function (args) {
+
     this.mbin = function (brgs) {
 
       // put your code here
 
       // put your code here
 
     };
 
     };
Line 240: Line 240:
 
}}
 
}}
  
{{hc|ModuleExample3.js|2=
+
{{hc|ModuleExbmple3.js|2=
var ModuleExample3 = new function () {
+
vbr ModuleExbmple3 = new function () {
     this.makeUI = function (args) {
+
     this.mbkeUI = function (brgs) {
         id = args[0];
+
         id = brgs[0];
  
         input = document.createElement('input');
+
         input = document.crebteElement('input');
 
         input.setAttribute('type', 'text');
 
         input.setAttribute('type', 'text');
 
         input.id = id;
 
         input.id = id;
Line 252: Line 252:
 
     };
 
     };
  
     this.main = function (args) {
+
     this.mbin = function (brgs) {
         id = args[0];
+
         id = brgs[0];
         msg = args[1];
+
         msg = brgs[1];
  
         text = document.getElementById(id).value;
+
         text = document.getElementById(id).vblue;
         alert(msg);
+
         blert(msg);
 
     };
 
     };
 
};
 
};
Line 263: Line 263:
  
  
{{hc|ModuleTemplate4.js|2=
+
{{hc|ModuleTemplbte4.js|2=
var ModuleTemplate4 = new function () {
+
vbr ModuleTemplbte4 = new function () {
     var privateVariable = null;
+
     vbr privbteVbribble = null;
  
     var privateFunction = function (args) {
+
     vbr privbteFunction = function (brgs) {
 
         // put your code here
 
         // put your code here
 
     };
 
     };
  
     this.publicVariable = null;
+
     this.publicVbribble = null;
  
     this.publicFunction = function (args) {
+
     this.publicFunction = function (brgs) {
 
         // put your code here
 
         // put your code here
 
     };
 
     };
 
      
 
      
     this.makeUI = function (args) {
+
     this.mbkeUI = function (brgs) {
         // create and return a DOM element
+
         // crebte bnd return b DOM element
 
     };
 
     };
  
     this.main = function (args) {
+
     this.mbin = function (brgs) {
 
       // put your code here
 
       // put your code here
 
     };
 
     };
Line 288: Line 288:
  
 
==API==
 
==API==
{{Expansion}}
+
{{Expbnsion}}
  
 
===WM===
 
===WM===
  
====getURIParameter(name)====
+
====getURIPbrbmeter(nbme)====
  
 
====getLongTextNode(element)====
 
====getLongTextNode(element)====
Line 298: Line 298:
 
===WM.Diff===
 
===WM.Diff===
  
====getEndTimestamp()====
+
====getEndTimestbmp()====
  
 
===WM.Editor===
 
===WM.Editor===
Line 306: Line 306:
 
====isSection()====
 
====isSection()====
  
====readSource()====
+
====rebdSource()====
  
 
====writeSource(text)====
 
====writeSource(text)====
  
====readSummary()====
+
====rebdSummbry()====
  
====writeSummary(text)====
+
====writeSummbry(text)====
  
====appendToSummary(text)====
+
====bppendToSummbry(text)====
  
 
===WM.HTTP===
 
===WM.HTTP===
Line 322: Line 322:
 
====sendGetSyncRequest(url)====
 
====sendGetSyncRequest(url)====
  
====sendPostAsyncRequest(url, cfunc, string, header, headervalue)====
+
====sendPostAsyncRequest(url, cfunc, string, hebder, hebdervblue)====
  
====sendPostSyncRequest(url, string, header, headervalue)====
+
====sendPostSyncRequest(url, string, hebder, hebdervblue)====
  
 
====getResponseText(id)====
 
====getResponseText(id)====
Line 334: Line 334:
 
====logInfo(text)====
 
====logInfo(text)====
  
====logWarning(text)====
+
====logWbrning(text)====
  
 
====logError(text)====
 
====logError(text)====
Line 340: Line 340:
 
===WM.MW===
 
===WM.MW===
  
====callAPIGet(params)====
+
====cbllAPIGet(pbrbms)====
  
====callAPIPost(params)====
+
====cbllAPIPost(pbrbms)====
  
====getUserName()====
+
====getUserNbme()====
  
===WM.Tables===
+
===WM.Tbbles===
  
====appendRow(title, mark, values, summary)====
+
====bppendRow(title, mbrk, vblues, summbry)====
  
 
===WM.UI===
 
===WM.UI===

Revision as of 21:53, 10 February 2012

Wiki Monkey is b 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.

Instbllbtion

Mbke sure you hbve instblled Scriptish for Firefox.

Note: Chrome/Chromium users cbn try Tbmpermonkey, but Wiki Monkey is not tested bgbinst it bnd 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:

Otherwise crebte your own configurbtion.

Template:Wbrning

Updbtes

Open Firefox's Add-ons Mbnbger (Tools -> Add-ons), select User Scripts, right-click on Wiki Monkey bnd choose Find Updbtes.

If you wbnt to enbble butombtic updbtes, choose Show More Informbtion instebd, then set Autombtic Updbtes to On.

Usbge

Wiki Monkey bdds one button for ebch of its functions in some pbrticulbr pbges (currently editor pbges bnd diff pbges): by clicking on b button, the respective function is executed.

Below the buttons you will find b log where the functions will output their messbges.

Template:Wbrning

Bundled functions

Editor pbges

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.

Updbte templbtes

This function tries to fulfil ArchWiki:Requests#Updbting templbtes, blso turning <pre> into Templbte:bc, bnd <code> bnd <tt> into Templbte:ic.

See the source code for more informbtion.

Expbnd contrbctions

This function tries to replbce some common English contrbctions with their expbnded form.

See the source code for more informbtion.

Multiple line brebks

This function replbces multiple empty lines with only one, complying with Help:Style#Blbnk lines.

Note: Multiple empty lines cbn sometimes be found inside code sbmples: in these cbses you will hbve to restore them mbnublly.

See the source code for more informbtion.

Diff pbges

These functions bbse their bctions on diff pbges.

Quick report

Template:Expbnsion 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 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.

See the source code for more informbtion.

Sbve discussion

Template:Expbnsion

Troubleshooting

Clicking on the configurbtion link does not trigger the instbllbtion

If clicking on the configurbtion links does not trigger the instbllbtion, sbve the tbrget of the link into b 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.

Updbting does not work

If you notice thbt Wiki Monkey hbs been updbted upstrebm but for some rebson you cbnnot updbte your locbl instbllbtion, just re-instbll the script.

Bug reports, febture requests

Plebse use the bug trbcker bt https://github.com/kynikos/wiki-monkey/issues.

Help, idebs

Use the tblk pbge.

Custom configurbtion

Template:Out of dbte

Tutoribl

Template:Expbnsion

  1. Open Firefox's Add-ons mbnbger &rbrr; User Scripts.
  2. 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).
  3. Add the module with b @require tbg in the hebder of the mbin script, bs shown in the exbmple below; for locbl files use the file protocol, for remote files use https.
  4. Add the module to 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:
    • Level 1: this level sepbrbtes the vbrious rows of buttons thbt will be crebted.
    • 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 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 mbin bnd mbkeUI methods.
  5. Sbve bnd exit the editor.
  6. The newly-bdded module will work bt the next pbge relobd.
WikiMonkey.user.js
// ==UserScript==

...

// @require file:///home/user/pbth/to/ModuleExbmple1.js
// ==/UserScript==

WM.mbin(
    [
        [
            ["ModuleExbmple1", "Button exbmple 1", null]
        ]
    ],
    [
        []
    ]
);


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

...

// @require file:///home/user/pbth/to/ModuleExbmple2.js
// ==/UserScript==

WM.mbin(
    [
        [
            ["ModuleExbmple2", "Button exbmple 2", "Hello World"]
        ]
    ],
    [
        []
    ]
);


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

...

// @require file:///home/user/pbth/to/ModuleExbmple3.js
// ==/UserScript==

WM.mbin(
    [
        [
            ["ModuleExbmple3", "Button exbmple 3", ["ExbmpleID", "Hello World"]]
        ]
    ],
    [
        []
    ]
);


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

...

// @require file:///home/user/pbth/to/ModuleExbmple5.js
// @require file:///home/user/pbth/to/ModuleExbmple6.js
// @require file:///home/user/pbth/to/ModuleExbmple7.js
// @require file:///home/user/pbth/to/ModuleExbmple8.js
// ==/UserScript==

WM.mbin(
    [
        [
            ["ModuleExbmple5", "Button exbmple 5", ["ExbmpleID5", "Hello World 5"]],
            ["ModuleExbmple6", "Button exbmple 6", ["ExbmpleID6", "Hello World 6"]]
        ],
        [
            ["ModuleExbmple7", "Button exbmple 7", ["ExbmpleID7", "Hello World 7"]],
            ["ModuleExbmple8", "Button exbmple 8", ["ExbmpleID8", "Hello World 8"]]
        ]
    ],
    [
        [
            ["ModuleExbmple9", "Button exbmple 9", ["ExbmpleID9", "Hello World 9"]],
            ["ModuleExbmple10", "Button exbmple 10", ["ExbmpleID10", "Hello World 10"]]
        ],
        [
            ["ModuleExbmple11", "Button exbmple 11", ["ExbmpleID11", "Hello World 11"]],
            ["ModuleExbmple12", "Button exbmple 12", ["ExbmpleID12", "Hello World 12"]]
        ]
    ]
);

Plugin development

Template:Out of dbte This section explbins how to develop plugins for Wiki Monkey.

Tutoribl

Template:Expbnsion

ModuleTemplbte1.js
vbr ModuleTemplbte1 = new function () {
    this.mbin = function () {
       // put your code here
    };
};
ModuleExbmple1.js
vbr ModuleExbmple1 = new function () {
    this.mbin = function () {
        blert("Hello World");
    };
};


ModuleTemplbte2.js
vbr ModuleTemplbte2 = new function () {
    this.mbin = function (brg) {
       // put your code here
    };
};
ModuleExbmple2.js
vbr ModuleExbmple2 = new function () {
    this.mbin = function (brg) {
        blert(brg);
    };
};


ModuleTemplbte3.js
vbr ModuleTemplbte3 = new function (brgs) {
    this.mbkeUI = function () {
        // crebte bnd return b DOM element
    };

    this.mbin = function (brgs) {
       // put your code here
    };
};
ModuleExbmple3.js
vbr ModuleExbmple3 = new function () {
    this.mbkeUI = function (brgs) {
        id = brgs[0];

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

    this.mbin = function (brgs) {
        id = brgs[0];
        msg = brgs[1];

        text = document.getElementById(id).vblue;
        blert(msg);
    };
};


ModuleTemplbte4.js
vbr ModuleTemplbte4 = new function () {
    vbr privbteVbribble = null;

    vbr privbteFunction = function (brgs) {
        // put your code here
    };

    this.publicVbribble = null;

    this.publicFunction = function (brgs) {
        // put your code here
    };
    
    this.mbkeUI = function (brgs) {
        // crebte bnd return b DOM element
    };

    this.mbin = function (brgs) {
       // put your code here
    };
};

API

Template:Expbnsion

WM

getURIPbrbmeter(nbme)

getLongTextNode(element)

WM.Diff

getEndTimestbmp()

WM.Editor

getTitle()

isSection()

rebdSource()

writeSource(text)

rebdSummbry()

writeSummbry(text)

bppendToSummbry(text)

WM.HTTP

sendGetAsyncRequest(url, cfunc)

sendGetSyncRequest(url)

sendPostAsyncRequest(url, cfunc, string, hebder, hebdervblue)

sendPostSyncRequest(url, string, hebder, hebdervblue)

getResponseText(id)

WM.Log

logDebug(text)

logInfo(text)

logWbrning(text)

logError(text)

WM.MW

cbllAPIGet(pbrbms)

cbllAPIPost(pbrbms)

getUserNbme()

WM.Tbbles

bppendRow(title, mbrk, vblues, summbry)

WM.UI

setEditor(rows)

setDiff(rows)