Jump to content

User:Nux/Code Cleanup

From Wikipedia, the free encyclopedia

The idea of the Code Clean up project is to automatically change wikicode so it can be changed more easily by humans :). Code clean up project was founded in early 2007 on Polish Wikipedia.

Script for normal users

[edit]

A script written in JavaScript is available for any logged in user of English Wikipedia. This script should be used for normal work on wiki. To add a button for clean up () you need to install the script and set a variable that tells the script to add a button to your toolbar.

Author's notes

[edit]
var wp_sk_show_as_button = true; // show the button
importScript('User:Nux/wp_sk.js')

Special thanks to:

  • ABach - za zebranie i opracowanie długiej listy elementów do sprzątania
  • Malarz pl - za garść kolejnych elementów do sprzątania
  • BartekChom - za pomysły i gotowe wyrażenia regularne
  • Gregul - za garść wyrażeń regularnych
  • PMG - za wytrwałe i szczegółowe testowanie
  • ToSter - za testy i pomysły na nowe rozwiązania

Additional settings

[edit]

Settings should be added to your monobook above the code inserted upon installing manually.

Example code to insert inside your monobook (button and redirects replacement enabled):

var wp_sk_show_as_button = true; // show the button
var wp_sk_redir_enabled = true; // AJAX redirects
importScript('User:Nux/wp_sk.js')
Show the button
var wp_sk_show_as_button = true; // show the button

The script can be (theoretically) used in a different way then by pushing a button - in can be a part of a bigger script. And so if you will not insert any settings the button will not be visible.

Redirects replacement
var wp_sk_redir_enabled = true; // AJAX redirects

Adding this setting, will make the script look for replacements of redirects after you will use the preview button (or you have enabled preview on your first edit).

If any redirects were found in the preview, then a loading icon will appear (). After this will be finished, the loading icon will disappear and a small "#R" will appear on the clean up button (). Pushing the clean up button with "#R" will start the process of replacing redirects along with normal clean up process.

Currently redirects are only checked when the preview for an article is visible. Note that you can enable preview on your first edit - you just need to set an option on your preference page ("Edit" tab → "Show preview when starting to edit").

Debug
var wp_sk_debug_enabled = true; // debug

Special setting for advanced users. You will also need a special debugging function to use this - you can get more info from the author.