User:Plastikspork/Greasemonkey

The following is a list of greasemonkey scripts I created to simplify editing tasks. Many of these scripts are either based-on or are refactored versions of other User scripts. There are a few advantages of using greasemonkey, instead of the standard Special:MyPage/skin.js javascript hooks. There are also a few disadvantages My method for partially circumventing these last two disadvantages is to store stable versions of these scripts here. If I get a new computer, or if something goes wrong, I just copy the last stable version from this page.
 * 1) Reduction in the load on Wikipedia servers, since they are not loaded from the WP server
 * 2) Reduction in the time it takes for initial login, since they are not loaded from the WP server
 * 3) Ability to use scripts with a legitimate alternate account (or while logged out), since they are not tied to an account
 * 4) Ability to quickly make numerous edits while developing a script without having a bunch of trivial small edits in your edit history
 * 1) Scripts must be installed on every computer, since they are not stored on the server
 * 2) No automatic revision history, which can make tracking bugs (and rolling back script changes) more difficult

Simple highlight redirects
This is a simplified Greasemonkey version of Dschwen's highlight redirects script. This simple version always displays redirects as green links. For the more advanced version which allows you toggle the coloring, like the original script, see the next section. Note that if you want to have redirects highlighted all the time, a far easier method is to just add  to your default skin.css file, although that would require you to log in.

Highlight redirects
This is a Greasemonkey version of Dschwen's highlight redirects script. It adds a link which, when pressed, changes the color of redirect links to green.

Admin dashboard
This is greasemonkey creates a link to the Admin dashboard template. The link is placed just to the left of the logout button. Almost the entire script is used to replicate the functionality of addPortletLink, which does not appear to be available within greasemonkey. There is also a function to check to see if we are using the secure or standard server. There is probably an easier way to do this, by importing the wgServer and wgScriptPath variables, but due to the sandboxing of Greasemonkey scripts, this requires some hacks to break out of the sandbox and read external global variables.

Replace
This is a greasemonkey version of the Replace script. It creates a "replace" button which allows the user to perform regular expression search and replace actions on the contents of the edit text box. The location of the button is set as either "p-cactions" or "p-views", if "p-cactions" doesn't exist. If you want the button in a different place, just change this value to the id of another div section (see the page source).

Close TFD
This creates a "close" button which automates the process of pasting the tfd top/tfd bottom templates to the top and bottom of a TFD discussion. The location of the button is right after the edit button in the "p-views" section. The script uses a default outcome of "delete", but does not save the page, so you can edit this outcome before saving.