Jump to content

Snippets/Autoedit

From mediawiki.org
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
How to use Snippets
List of Snippets
Autoedit
Language(s): JavaScript
Compatible with: unknown

Autoedit is Lupin's user-space script that enables automatic page editing via commands in URLs (see also: Manual:Parameters to index.php). To use, you need to include autoedit.js in your personal or global JavaScript (if you have working Pop-ups, you must also have included that) by adding the following lines:

mw.loader.load('//en.wikipedia.org/w/index.php?title=User:Lupin/autoedit.js&action=raw&ctype=text/javascript');

Arguments

?title=Article
&action=edit
&autoedit=s~...~...~g;s~...~...~g
&autoclick=wpDiff
&autominor=false
&autosummary=Summary
  1. ?title=... – article title
  2. &action=edit – action
  3. &autoedit=... – autoedit script
    • s~ – begin of replace command
    • ... – it will be replaced by next text (may be a regular expression); cannot contain ~ chars, for enter text to empty page (or new section in existing one) keep it empty
    • ~
    • ... – next text ;); cannot contain ~ chars
    • ~g – end of replace command

    Script can contain multiple commands, separated by ;

  4. &autoclick=... – button pressed after autoedit (wpDiff, wpSave, wpPreview)
  5. &autominor=... – is change minor
  6. &autosummary=... – summary of edit

Example

To replace all cat words with dog in article Animals, you can use this command:

http://www.yourwiki.org/w/index.php?title=Animals&action=edit&autoedit=s~cat~dog~g&autoclick=wpSave&autominor=false&autosummary=Replace%20cat%20by%20dog

Using in

This function is used in Lupin's Pop-ups script.

See also

Snippets/WriteInPage