Jump to content

User:Mr. Stradivarius/gadgets/SignpostTagger

From Wikipedia, the free encyclopedia
The tag-editing window with a Signpost article in the background.

SignpostTagger adds a window for editing tags for articles of the Signpost. The tags are stored in Lua data modules and used to generate lists of Signpost articles on the fly. Updating the modules manually would be tedious, and this gadget simplifies the process.

Installation

[edit]

Add the following to your skin.js page:

importScript( 'User:Mr. Stradivarius/gadgets/SignpostTagger.js' ); // Linkback: [[User:Mr. Stradivarius/gadgets/SignpostTagger.js]]

After saving the page, you may need to bypass your browser cache.

Usage

[edit]

When viewing a Signpost article, you should see a "Manage tags" tab like this among your top tabs. This tab only activates on Signpost articles, and only when viewing the page (not in "edit" or "history" mode).

The "Manage tags" tab.

On clicking the tab, you should see a window like this:

The tag-editing window.

When the window first opens, it will load the tag data. (The tag data is stored in a sub-module of Module:Signpost.) Once the data is loaded, you can start editing it.

Title

[edit]

This is the title of the Signpost article. If no title data was found in the Lua module, then SignpostTagger tries to guess the title from the HTML of the current page. If this guess is wrong, or if the data from the Lua module is wrong, then you can edit the title yourself.

Tags

[edit]

Here you can edit the tags for the article. Tags are separated by commas. Note that when you save the page:

  • Tags are stripped of all spaces and punctuation, and put in lower case.
  • They are sorted into alphabetical order.
  • Tag aliases are replaced with the canonical tag. For example, the tag "alexaranking" will be replaced with the tag "alexa".

This processing avoids us having to add lots of tag variants like "edit wars", "edit-wars" and "editwars". When you are adding tags, if you want, you can type in upper case, with punctuation and with spaces. Just beware that when you save the tags and load them again, they will have been altered for you. Also, if you find yourself wanting to add different tags for the same topic, please consider adding an alias instead. Using aliases helps to keep the tag data maintainable. The aliases are defined in Module:Signpost/aliases.

Please keep tags brief and informative. You can add as many tags as you like to a page, but adding many tags that are only tangentially related will decrease the usefulness of the tag data.

Saving

[edit]

To save the tag data, you can either click the green "Save" button at the top-right of the SignpostTagger window, or you can just hit the Enter key. You will only be able to save the page if you have changed either the tag data or the title data, or if if there is no data stored for the article. In addition, you cannot save the page if the title field is blank.

Deleting

[edit]

You can delete the data for the current page by clicking on the red "Delete" button at the bottom-left of the SignpostTagger window. This removes the tag data from the data module. If you delete some data by mistake, you can either open SignpostTagger again and add the tags back, or check your contributions and undo the relevant edit to the tag data module.

You will only be able to delete data if SignpostTagger found an entry for the article in the data module.

Compatibility

[edit]

This script has been tested with Firefox 37 and Chrome 41. It will probably work in Safari, Opera, and earlier versions of Firefox and Chrome as well, but isn't tested. It should work on Internet Explorer 9 and greater, but will definitely not work on Internet Explorer 8 or earlier.

If the script doesn't work for you, please contact me with your browser details and I will try and fix it.