Difference between revisions of "Wiki Monkey"

From ArchWiki
Jump to: navigation, search
(test)
(Updates: improve layout)
(41 intermediate revisions by 3 users not shown)
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.
+
[[Category:Internet Applications]]
 +
[https://github.com/kynikos/wiki-monkey/wiki Wiki Monkey] is a MediaWiki-compatible bot and editor assistant that can be used directly within wiki pages in the browser as a user script. Currently it is tested on [[Firefox]], [[Chromium]] and [[Opera]], but it is very likely to work also on other browsers out of the box or with minor adaptations. Wiki Monkey can also be easily extended through the creation of plugins, exploiting its API.
  
==Instbllbtion==
+
The project is currently focused on ArchWiki, and as such most plugins address ArchWiki-specific problems.
Mbke sure you hbve instblled [https://bddons.mozillb.org/en-US/firefox/bddon/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.}}
+
==Installation==
  
Now just click on the link of one of the following Wiki Monkey configurbtions bnd Firefox should bsk you to instbll it:
+
===Firefox===
*[https://rbw.github.com/kynikos/wiki-monkey/mbster/src/WikiMonkey.user.js lbtest stbble relebse]
+
Make sure you have installed '''either''' the [https://addons.mozilla.org/en-US/firefox/addon/scriptish/ Scriptish] extension (recommended) '''or''' the [https://addons.mozilla.org/en-US/firefox/addon/greasemonkey/ Greasemonkey] extension.
*[https://rbw.github.com/kynikos/wiki-monkey/development/src/WikiMonkey.user.js lbtest development relebse (unstbble)]
+
  
Otherwise [[#Custom configurbtion|crebte your own configurbtion]].
+
Now just click on the link of '''one''' of Wiki Monkey configurations from the "Scriptish/Greasemonkey/Tampermonkey" column in the [[#Configurations table]] and your browser should ask you to install it.
  
{{Wbrning|Although it is possible to keep multiple configurbtions of Wiki Monkey instblled together, mbke sure to enbble only one bt b time.}}
+
===Chromium===
 +
Wiki Monkey can be installed in two ways: either using [[#Tampermonkey (recommended)|Tampermonkey]] or exploiting Chromium's [[#Native support|native support]] for user scripts.
  
==Updbtes==
+
====Tampermonkey (recommended)====
Open Firefox's ''Add-ons Mbnbger'' (''Tools -> Add-ons''), select ''User Scripts'', right-click on Wiki Monkey bnd choose ''Find Updbtes''.
+
Make sure you have installed the [https://chrome.google.com/webstore/detail/dhdgffkkebhmkfjojejmpbldmpobfkfo Tampermonkey] extension.
  
If you wbnt to enbble butombtic updbtes, choose ''Show More Informbtion'' instebd, then set ''Autombtic Updbtes'' to ''On''.
+
Now just click on the link of '''one''' of Wiki Monkey configurations from the "Scriptish/Greasemonkey/Tampermonkey" column in the [[#Configurations table]] and your browser should ask you to install it.
  
==Usbge==
+
{{Note|Chromium will first ask you whether you want to install the script with the native support or through Tampermonkey: of course you need to choose the latter by clicking on OK.}}
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 b log where the functions will output their messbges.
+
====Native support====
 +
Just click on the link of '''one''' of Wiki Monkey configurations from the "Chromium native" column in the [[#Configurations table]] and your browser should ask you to install it.
  
{{Wbrning|Alwbys preview bnd verify the correctness of the edited text bnd exbmine the messbges in the log before sbving the pbge.}}
+
{{Note|Installing Wiki Monkey without Tampermonkey is '''not''' recommended since Chromium's native support is still [http://www.chromium.org/developers/design-documents/user-scripts limited] and some features may not work correctly, as is the case of updates. Besides, plugins that require cross-origin requests will not be available.}}
  
==Bundled functions==
+
===Opera===
 +
Go to: ''Opera menu > Settings > Preferences > Advanced > Content > JavaScript options'': in the ''User JavaScript folder'' field, select the directory where you will install user scripts.
  
===Editor pbges===
+
Now download '''one''' of Wiki Monkey configurations from the "Opera" column in the [[#Configurations table]] and save it in the folder you've chosen earlier.
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====
+
Finally, since the ArchWiki is accessed through the HTTPS protocol, you need to visit ''opera:config'' and enable the ''User Javascript on HTTPS'' setting under ''User Prefs''. You will be prompted to allow the execution of Wiki Monkey the first time you access the ArchWiki in each browsing session.
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/mbster/src/plugins/ArchWikiNewTemplbtes.js the source code] for more informbtion.
+
===Other browsers===
 +
It should be possible to install Wiki Monkey in other browsers in ways similar to one of the browsers above. If your browser only supports raw JavaScript files, installing '''one''' of Wiki Monkey configurations from the "standalone" column in the [[#Configurations table]] may work.
  
====Expbnd contrbctions====
+
==Configurations table==
This function tries to replbce some common English contrbctions with their expbnded form.
+
This is the table with the predefined configurations: read the section above for instructions on which link you must choose.
  
See [https://github.com/kynikos/wiki-monkey/blob/mbster/src/plugins/ExpbndContrbctions.js the source code] for more informbtion.
+
{| class="wikitable" border="1"
 +
!Name
 +
!Description
 +
!Scriptish/Greasemonkey/Tampermonkey
 +
!Chromium native
 +
!Opera
 +
!standalone
 +
|-
 +
|Editor
 +
|Provides only manual-editing aid functions in editor pages
 +
|[https://raw.github.com/kynikos/wiki-monkey/master/src/configurations/WikiMonkey-archwikieditor.user.js install]
 +
|[https://raw.github.com/kynikos/wiki-monkey/master/src/configurations/chromium/WikiMonkey-archwikieditor-chromium.user.js install]
 +
|[https://raw.github.com/kynikos/wiki-monkey/master/src/configurations/opera/WikiMonkey-archwikieditor-opera.user.js download]
 +
|[https://raw.github.com/kynikos/wiki-monkey/master/src/configurations/standalone/WikiMonkey-archwikieditor-standalone.js download]
 +
|-
 +
|Patrol-Lite
 +
|Provides a quick-report function in diff pages
 +
|[https://raw.github.com/kynikos/wiki-monkey/master/src/configurations/WikiMonkey-archwikipatrollite.user.js install]
 +
|[https://raw.github.com/kynikos/wiki-monkey/master/src/configurations/chromium/WikiMonkey-archwikipatrollite-chromium.user.js install]
 +
|[https://raw.github.com/kynikos/wiki-monkey/master/src/configurations/opera/WikiMonkey-archwikipatrollite-opera.user.js download]
 +
|[https://raw.github.com/kynikos/wiki-monkey/master/src/configurations/standalone/WikiMonkey-archwikipatrollite-standalone.js download]
 +
|-
 +
|Patrol
 +
|Editor + Patrol-Lite
 +
|[https://raw.github.com/kynikos/wiki-monkey/master/src/configurations/WikiMonkey-archwikipatrol.user.js install]
 +
|[https://raw.github.com/kynikos/wiki-monkey/master/src/configurations/chromium/WikiMonkey-archwikipatrol-chromium.user.js install]
 +
|[https://raw.github.com/kynikos/wiki-monkey/master/src/configurations/opera/WikiMonkey-archwikipatrol-opera.user.js download]
 +
|[https://raw.github.com/kynikos/wiki-monkey/master/src/configurations/standalone/WikiMonkey-archwikipatrol-standalone.js download]
 +
|-
 +
|Bot
 +
|Patrol + automatic operations on list pages
 +
|[https://raw.github.com/kynikos/wiki-monkey/master/src/configurations/WikiMonkey-archwikibot.user.js install]
 +
|[https://raw.github.com/kynikos/wiki-monkey/master/src/configurations/chromium/WikiMonkey-archwikibot-chromium.user.js install]
 +
|[https://raw.github.com/kynikos/wiki-monkey/master/src/configurations/opera/WikiMonkey-archwikibot-opera.user.js download]
 +
|[https://raw.github.com/kynikos/wiki-monkey/master/src/configurations/standalone/WikiMonkey-archwikibot-standalone.js download]
 +
|}
  
====Multiple line brebks====
+
Alternatively, you can [https://github.com/kynikos/wiki-monkey/wiki/Custom-configuration create your own configuration].
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.}}
+
{{Warning|Although it is possible to keep multiple configurations of Wiki Monkey installed together, make sure to enable only '''one''' at a time.}}
  
See [https://github.com/kynikos/wiki-monkey/blob/mbster/src/plugins/MultipleLineBrebks.js the source code] for more informbtion.
+
{{Note|Plugins that require cross-origin requests are not available for the Chromium-native, Opera and standalone versions.}}
  
===Diff pbges===
+
==Updates==
These functions bbse their bctions on diff pbges.
+
  
====Quick report====
+
===Firefox===
{{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 {{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/mbster/src/plugins/ArchWikiQuickReport.js the source code] for more informbtion.
+
====Scriptish====
 +
Open Firefox's ''Add-ons Manager'' (''Tools -> Add-ons''), select ''User Scripts'', right-click on Wiki Monkey and choose ''Find Updates''.
  
====Sbve discussion====
+
If you want to enable '''automatic updates''', choose ''Show More Information'' instead, then set ''Automatic Updates'' to ''On''.
{{Expbnsion}}
+
  
==Troubleshooting==
+
Scriptish's perferences are available in Firefox's ''Add-ons Manager'' (''Tools -> Add-ons''), selecting the ''Extensions'' tab.
===Clicking on the configurbtion link does not trigger the instbllbtion===
+
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.
+
  
===Updbting does not work===
+
====Greasemonkey====
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, febture requests==
+
Greasemonkey should enable automatic updates by default, you can check opening Firefox's ''Add-ons Manager'' (''Tools -> Add-ons''), selecting ''User Scripts'', right-clicking on ''Wiki Monkey'' and verifying ''Automatic check for updates'' is ticked.
Plebse use the bug trbcker bt https://github.com/kynikos/wiki-monkey/issues.
+
  
==Help, idebs==
+
Greasemonkey's perferences are available in Firefox's ''Add-ons Manager'' (''Tools -> Add-ons''), selecting the ''Extensions'' tab.
Use the [[User tblk:Kynikos/Wiki Monkey|tblk pbge]].
+
  
==Custom configurbtion==
+
===Chromium===
{{Out of dbte}}
+
  
===Tutoribl===
+
====Tampermonkey====
{{Expbnsion}}
+
Tampermonkey should enable automatic updates by default, you can check opening ''Tools -> Extensions'', selecting Tampermonkey's options, selecting the ''Settings'' tab and verifying the settings for ''Check Interval'' in the ''Script Update'' section.
  
# Open Firefox's ''Add-ons mbnbger &rbrr; User Scripts''.
+
====Native support====
# 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).
+
Chromium's native support for user scripts is rather limited and should not be able to update Wiki Monkey. If you want automatic or semi-automatic updates, it is recommended to use Tampermonkey as described in the Installation section.
# 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.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 {{ic|mbin}} bnd {{ic|mbkeUI}} methods.
+
# Sbve bnd exit the editor.
+
# The newly-bdded module will work bt the next pbge relobd.
+
  
{{hc|WikiMonkey.user.js|2=
+
===Opera===
// ==UserScript==
+
Due to how user scripts are installed in Opera, there is currently no way to have automatic or semi-automatic updates, you will have to check periodically and reinstall the script when a new version is released.
  
...
+
==Tour of the features==
 +
After installing the desired version of Wiki Monkey, start visiting [https://wiki.archlinux.org/index.php?title=Wiki_Monkey&action=submit the editor of this very page], you will find Wiki Monkey's interface right below the ''Save page'' button row. As you can see there are some buttons, each of which will execute a plugin action (see [https://github.com/kynikos/wiki-monkey/wiki/Bundled-plugins Bundled plugins] for detailed information):
 +
* ''Fix header'' reorders the elements in the header, warns about possible problems (e.g. lack of category) and tries to fix some.
 +
* ''Fix headings'' tries to fix the levels of section headings so that they start from level 2 and do not increase by more than 1 level with relation to the parent section.
 +
* ''Use code templates'' replaces {{ic|<pre>}}, {{ic|<code>}} and {{ic|<tt>}} with [[Template:bc]] and [[Template:ic]], taking care of adding numbered parameters or {{ic|<nowiki>}} tags when necessary.
 +
* ''Expand contractions'' expands some common English contractions, e.g. "don't" becomes "do not".
 +
* ''Multiple line breaks'' compresses multiple empty lines into one.
 +
* ''RegExp substitution'' lets you perform a regular expression substitution.
 +
* ''Sync interlanguage links'' <sup>'''*'''</sup> synchronizes the interlanguage links of the edited page with those of its translations.
 +
* ''Fix old AUR links'' <sup>'''**'''</sup> converts direct AUR-1.x package links to instances of [[Template:AUR]].
  
// @require file:///home/user/pbth/to/ModuleExbmple1.js
+
By pressing one of them, the text in the editor will be modified, but note that the page will not be saved, so you will still be able to see the diff or the preview and perform other modifications manually. The ''Execute row'' and ''Execute all'' buttons are used to execute more plugins one after the other, thus saving some clicks.
// ==/UserScript==
+
  
WM.mbin(
+
At the bottom of Wiki Monkey's interface you will always find the log area, on dark background, where Wiki Monkey and its plugins will output their messages.
    [
+
        [
+
            ["ModuleExbmple1", "Button exbmple 1", null]
+
        ]
+
    ],
+
    [
+
        []
+
    ]
+
);
+
}}
+
  
 +
Now, if you have installed the "Patrol Lite", "Patrol" or "Bot" configuration, visit [[Special:RecentChanges]] and select a diff from the list: right below the diff panes you will find Wiki Monkey's interface. Here the only bundled plugin is ''Quick report'', which adds a row with a link to the visited diff in the specialized table of [[ArchWiki:Reports]].
  
{{hc|WikiMonkey.user.js|2=
+
At this point, if you have installed the "Bot" configuration, visit [[Special:SpecialPages]]: at the top of the page you will find those plugins that have a generic purpose and are not based on a specific page: the only currently available plugin is a function to update Table of Contents pages.
// ==UserScript==
+
  
...
+
Finally, if you have installed the "Bot" configuration, visit the [[:Category:Internet Applications|''Category'']] of this article: right at the top you will find Wiki Monkey's bot interface, whose usage is explained in [https://github.com/kynikos/wiki-monkey/wiki/Bot-interface the upstream documentation]; other pages where you can find the bot are [[Special:WhatLinksHere/Wiki_Monkey|''What Links Here'']] pages and many of the list pages linked from [[Special:SpecialPages]]. The available plugins for the bot are a regular expression substitution function and a tool for synchronizing the interlanguage links of the pages with those of their translations<sup>'''*'''</sup>. The [https://wiki.archlinux.org/index.php?title=Special%3ALinkSearch&target=https%3A%2F%2Fwiki.archlinux.org ''External links search''] page also provides a plugin for converting direct AUR-1.x package links to instances of [[Template:AUR]]<sup>'''**'''</sup>.
  
// @require file:///home/user/pbth/to/ModuleExbmple2.js
+
<sup>'''*'''</sup> ''The Chromium-native, Opera and standalone configurations can only synchronize local languages.''
// ==/UserScript==
+
  
WM.mbin(
+
<sup>'''**'''</sup> ''Available only for the Scriptish/Greasemonkey/Tampermonkey configurations.''
    [
+
        [
+
            ["ModuleExbmple2", "Button exbmple 2", "Hello World"]
+
        ]
+
    ],
+
    [
+
        []
+
    ]
+
);
+
}}
+
  
 +
==Contributions==
 +
Of course any help in the resolution of bugs or the development of new plugins is appreciated: if you are interested, [https://wiki.archlinux.org/index.php/Special:EmailUser/Kynikos send an email] to the original author (or use [[User_talk:Kynikos|his talk page]]) and urge him to finally complete the documentation about the [https://github.com/kynikos/wiki-monkey/wiki/Plugin-development development of plugins], which is actually quite straightforward.
  
{{hc|WikiMonkey.user.js|2=
+
==See also==
// ==UserScript==
+
* [https://github.com/kynikos/wiki-monkey/wiki/Troubleshooting Troubleshooting]
 
+
* [https://github.com/kynikos/wiki-monkey/issues Bug reports, feature requests, questions]
...
+
 
+
// @require file:///home/user/pbth/to/ModuleExbmple3.js
+
// ==/UserScript==
+
 
+
WM.mbin(
+
    [
+
        [
+
            ["ModuleExbmple3", "Button exbmple 3", ["ExbmpleID", "Hello World"]]
+
        ]
+
    ],
+
    [
+
        []
+
    ]
+
);
+
}}
+
 
+
 
+
{{hc|WikiMonkey.user.js|2=
+
// ==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==
+
{{Out of dbte}}
+
This section explbins how to develop plugins for Wiki Monkey.
+
 
+
===Tutoribl===
+
{{Expbnsion}}
+
 
+
{{hc|ModuleTemplbte1.js|2=
+
vbr ModuleTemplbte1 = new function () {
+
    this.mbin = function () {
+
      // put your code here
+
    };
+
};
+
}}
+
 
+
{{hc|ModuleExbmple1.js|2=
+
vbr ModuleExbmple1 = new function () {
+
    this.mbin = function () {
+
        blert("Hello World");
+
    };
+
};
+
}}
+
 
+
 
+
{{hc|ModuleTemplbte2.js|2=
+
vbr ModuleTemplbte2 = new function () {
+
    this.mbin = function (brg) {
+
      // put your code here
+
    };
+
};
+
}}
+
 
+
{{hc|ModuleExbmple2.js|2=
+
vbr ModuleExbmple2 = new function () {
+
    this.mbin = function (brg) {
+
        blert(brg);
+
    };
+
};
+
}}
+
 
+
 
+
{{hc|ModuleTemplbte3.js|2=
+
vbr ModuleTemplbte3 = new function (brgs) {
+
    this.mbkeUI = function () {
+
        // crebte bnd return b DOM element
+
    };
+
 
+
    this.mbin = function (brgs) {
+
      // put your code here
+
    };
+
};
+
}}
+
 
+
{{hc|ModuleExbmple3.js|2=
+
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);
+
    };
+
};
+
}}
+
 
+
 
+
{{hc|ModuleTemplbte4.js|2=
+
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==
+
{{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)====
+

Revision as of 11:45, 30 November 2012

Wiki Monkey is a MediaWiki-compatible bot and editor assistant that can be used directly within wiki pages in the browser as a user script. Currently it is tested on Firefox, Chromium and Opera, but it is very likely to work also on other browsers out of the box or with minor adaptations. Wiki Monkey can also be easily extended through the creation of plugins, exploiting its API.

The project is currently focused on ArchWiki, and as such most plugins address ArchWiki-specific problems.

Installation

Firefox

Make sure you have installed either the Scriptish extension (recommended) or the Greasemonkey extension.

Now just click on the link of one of Wiki Monkey configurations from the "Scriptish/Greasemonkey/Tampermonkey" column in the #Configurations table and your browser should ask you to install it.

Chromium

Wiki Monkey can be installed in two ways: either using Tampermonkey or exploiting Chromium's native support for user scripts.

Tampermonkey (recommended)

Make sure you have installed the Tampermonkey extension.

Now just click on the link of one of Wiki Monkey configurations from the "Scriptish/Greasemonkey/Tampermonkey" column in the #Configurations table and your browser should ask you to install it.

Note: Chromium will first ask you whether you want to install the script with the native support or through Tampermonkey: of course you need to choose the latter by clicking on OK.

Native support

Just click on the link of one of Wiki Monkey configurations from the "Chromium native" column in the #Configurations table and your browser should ask you to install it.

Note: Installing Wiki Monkey without Tampermonkey is not recommended since Chromium's native support is still limited and some features may not work correctly, as is the case of updates. Besides, plugins that require cross-origin requests will not be available.

Opera

Go to: Opera menu > Settings > Preferences > Advanced > Content > JavaScript options: in the User JavaScript folder field, select the directory where you will install user scripts.

Now download one of Wiki Monkey configurations from the "Opera" column in the #Configurations table and save it in the folder you've chosen earlier.

Finally, since the ArchWiki is accessed through the HTTPS protocol, you need to visit opera:config and enable the User Javascript on HTTPS setting under User Prefs. You will be prompted to allow the execution of Wiki Monkey the first time you access the ArchWiki in each browsing session.

Other browsers

It should be possible to install Wiki Monkey in other browsers in ways similar to one of the browsers above. If your browser only supports raw JavaScript files, installing one of Wiki Monkey configurations from the "standalone" column in the #Configurations table may work.

Configurations table

This is the table with the predefined configurations: read the section above for instructions on which link you must choose.

Name Description Scriptish/Greasemonkey/Tampermonkey Chromium native Opera standalone
Editor Provides only manual-editing aid functions in editor pages install install download download
Patrol-Lite Provides a quick-report function in diff pages install install download download
Patrol Editor + Patrol-Lite install install download download
Bot Patrol + automatic operations on list pages install install download download

Alternatively, you can 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.
Note: Plugins that require cross-origin requests are not available for the Chromium-native, Opera and standalone versions.

Updates

Firefox

Scriptish

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.

Scriptish's perferences are available in Firefox's Add-ons Manager (Tools -> Add-ons), selecting the Extensions tab.

Greasemonkey

Greasemonkey should enable automatic updates by default, you can check opening Firefox's Add-ons Manager (Tools -> Add-ons), selecting User Scripts, right-clicking on Wiki Monkey and verifying Automatic check for updates is ticked.

Greasemonkey's perferences are available in Firefox's Add-ons Manager (Tools -> Add-ons), selecting the Extensions tab.

Chromium

Tampermonkey

Tampermonkey should enable automatic updates by default, you can check opening Tools -> Extensions, selecting Tampermonkey's options, selecting the Settings tab and verifying the settings for Check Interval in the Script Update section.

Native support

Chromium's native support for user scripts is rather limited and should not be able to update Wiki Monkey. If you want automatic or semi-automatic updates, it is recommended to use Tampermonkey as described in the Installation section.

Opera

Due to how user scripts are installed in Opera, there is currently no way to have automatic or semi-automatic updates, you will have to check periodically and reinstall the script when a new version is released.

Tour of the features

After installing the desired version of Wiki Monkey, start visiting the editor of this very page, you will find Wiki Monkey's interface right below the Save page button row. As you can see there are some buttons, each of which will execute a plugin action (see Bundled plugins for detailed information):

  • Fix header reorders the elements in the header, warns about possible problems (e.g. lack of category) and tries to fix some.
  • Fix headings tries to fix the levels of section headings so that they start from level 2 and do not increase by more than 1 level with relation to the parent section.
  • Use code templates replaces <pre>, <code> and <tt> with Template:bc and Template:ic, taking care of adding numbered parameters or <nowiki> tags when necessary.
  • Expand contractions expands some common English contractions, e.g. "don't" becomes "do not".
  • Multiple line breaks compresses multiple empty lines into one.
  • RegExp substitution lets you perform a regular expression substitution.
  • Sync interlanguage links * synchronizes the interlanguage links of the edited page with those of its translations.
  • Fix old AUR links ** converts direct AUR-1.x package links to instances of Template:AUR.

By pressing one of them, the text in the editor will be modified, but note that the page will not be saved, so you will still be able to see the diff or the preview and perform other modifications manually. The Execute row and Execute all buttons are used to execute more plugins one after the other, thus saving some clicks.

At the bottom of Wiki Monkey's interface you will always find the log area, on dark background, where Wiki Monkey and its plugins will output their messages.

Now, if you have installed the "Patrol Lite", "Patrol" or "Bot" configuration, visit Special:RecentChanges and select a diff from the list: right below the diff panes you will find Wiki Monkey's interface. Here the only bundled plugin is Quick report, which adds a row with a link to the visited diff in the specialized table of ArchWiki:Reports.

At this point, if you have installed the "Bot" configuration, visit Special:SpecialPages: at the top of the page you will find those plugins that have a generic purpose and are not based on a specific page: the only currently available plugin is a function to update Table of Contents pages.

Finally, if you have installed the "Bot" configuration, visit the Category of this article: right at the top you will find Wiki Monkey's bot interface, whose usage is explained in the upstream documentation; other pages where you can find the bot are What Links Here pages and many of the list pages linked from Special:SpecialPages. The available plugins for the bot are a regular expression substitution function and a tool for synchronizing the interlanguage links of the pages with those of their translations*. The External links search page also provides a plugin for converting direct AUR-1.x package links to instances of Template:AUR**.

* The Chromium-native, Opera and standalone configurations can only synchronize local languages.

** Available only for the Scriptish/Greasemonkey/Tampermonkey configurations.

Contributions

Of course any help in the resolution of bugs or the development of new plugins is appreciated: if you are interested, send an email to the original author (or use his talk page) and urge him to finally complete the documentation about the development of plugins, which is actually quite straightforward.

See also