Jump to content

Wikipedia:WikiProject User scripts/Requests

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Sfan00 IMG (talk | contribs) at 17:50, 9 April 2013 (Listas parram adding for Biography Wikiproject tag). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

This page is for requests for new user scripts or help with modifications to existing user scripts. Please first look through the existing scripts and recently fulfilled requests. Also see Old unfullfilled requests.

RFPP Admin templater script

It would be great to have something to speed up work at WP:RFPP. Something that would appear next to each of the headings / articles on the page with an option to add a template to that section. And then after selecting the type of template (i.e. semi, full, e.t.c) it would then ask you for the time to add as a parameter before posting to the section. I imagine it shouldnt be that hard as I have seen similar useful scripts for AFD and other such places. Intended for use on Chrome with monobook ·Add§hore· Talk To Me! 16:08, 16 January 2013 (UTC)[reply]

See User:Addshore/doRFPP.js for a start but I have no idea how to add this in line with each header on the page. This just adds tabs to the edit window, sure it does save a bit of time but not as much as having them next to section headers! ·Add§hore· Talk To Me! 16:42, 18 January 2013 (UTC)[reply]

script to hide the "feet" part of convert template while reading an article

Hello. I am looking for a script that would hide the "feet" part of measures displayed by the convert template. I couldn't find it as a gadget in the preferences page, and couldn't find it either there, but I still hope it exists somewhere. Regards, Freewol (talk) 11:02, 19 February 2013 (UTC)[reply]

There are a lot of different outputs of {{convert}} and it emits nothing that marks itself as coming from the template, so this job is quite complex as it requires pattern matching against the entire page and replacing text as opposed to just toggling the display style of an element. It would also require some kind of check to see if the feet measurement was paired with a metric measurement before it removed that content. I think what you're asking for is very possible if the infrastructure was in place to support it, but as is the scope of work is probably too large for a volunteer to take on for a user script. If the template wrapped the values in spans with appropriate classes, it would be a simple thing to hide all instances based on user preference. This would require a change to {{convert}} and other templates like it that output two values and then a simple gadget or user preference could handle the display. It's a cool idea at any rate, and is at least possible if enough people wanted it. — Bility (talk) 17:23, 5 April 2013 (UTC)[reply]

Listas parram adding for Biography Wikiproject tag

A large number of entries for the listas param could be constructed from the page name.

Much appreciated if a user script could be written to do this. Sfan00 IMG (talk) 15:13, 5 April 2013 (UTC)[reply]

There are a lot of different forms an article title can take. Consider these articles:
  • Confucius: No spaces found, don't put anything in listas.
  • Albert Camus: A space is found, the order is swapped and a comma inserted to produce "Camus, Albert".
  • Arthur Conan Doyle: More logic, this time the string should be split on the second space.
  • Brian De Palma: Same as above, except this time we want to split on the first space. Maybe a list of middle words like "de", "von", etc. could inform this logic.
  • Georg Wilhelm Friedrich Hegel: More words, need to split on the third space.
  • Augustine of Hippo: New logic is required, perhaps looking for the "[text] of [text]" pattern.
  • Frederick William I of Prussia: Different pattern requires expanding the logic to include spaces in the text on either side of "of". Also, currently sorted as "Frederick William 01 Of Prussia", would that require attempting to find roman numerals and convert them to numbers?
  • Alexandra Feodorovna (Alix of Hesse): More logic, perhaps to remove anything in parentheses altogether?
  • List of major biblical figures: Maybe don't include a listas for articles starting with "List of".
  • E. T. A. Hoffmann: Normally initials would be counted as one word and sorted correctly, but this one has spaces between each letter. Maybe check for single letters or single letters followed by a period?
  • Casimir II the Just: Don't know (currently sorted as "Casimir Ii Of Poland").
  • Boleslaus I, Duke of Bohemia: I don't think a script can determine this (it is currently being sorted as "Boleslaus I Of Bohemia").
  • Frankie Goes to Hollywood: Probably shouldn't get a listas, but no way to determine that.
So these were examples found in the first 100 transclusions of {{WikiProject Biography}}, just to get an idea of what would go into an accurate listas generator. From the above I would suggest including these rules:
  1. Look for spaces, if none are found don't input a listas, otherwise
  2. Look for "List of" in the beginning and don't input a listas if found, otherwise
  3. Look for and remove anything in parentheses, then
  4. Look for a "[text] of [text]" pattern and use the only the text to the left of the "of", then
  5. Use a list of nobiliary particles (e.g. "von", "de", "zu", etc.) to split a name on the space before the particle, or if no particles are found
  6. Split a name on the last space.
I think this will hit a large portion of the names, and for corner cases, yes it will input an incorrect sort, but then you do what you're doing now which is make up your own manually. Thoughts? Also, how do you normally add this template? Copy/paste from somewhere? Some other script? — Bility (talk) 18:11, 5 April 2013 (UTC)[reply]
The intent was that this generated the intended listas= portion + a name which could be edited in the relevant point in the tmeplate used. The user would still have to save the page manually, so that a second check it was correct could be made.Sfan00 IMG (talk) 20:41, 5 April 2013 (UTC)[reply]
Right, what I'm asking is would the script input the entire template, or would it fill in the listas parameter of the template that is already in the edit box? If you're currently copy/pasting a blank template in or manually typing it out, then the script could insert the whole thing for you while it generates the listas, but if you already have an "insert template" button or something the new script would either need to be integrated into that one or fired afterward. Either way I think it's doable with the logic above. — Bility (talk) 22:21, 5 April 2013 (UTC)[reply]
The latter, the template concerned is already on the pages concerned. Sfan00 IMG (talk) 07:42, 6 April 2013 (UTC)[reply]
Okay, it has its little oddities, but here's the script. Just put this in your skin javascript or common.js:
importScript('User:Bility/biographyListasGenerator.js');
It pretty much follows the rules from above, with the exception of lists, where it uses whatever comes after the "List of" part. Articles with commas and nobiliary particles get pretty wacky due to the rules, so you'll still have to eyeball what it puts in to make sure it's correct. When you import the script it puts a little button above the edit box when you're editing an article talk page (or it will be at the end of the buttons if you have the toolbar enabled). It looks like this: . You just click it and it inserts the listas. It will also remove whatever is in there already. Let me know if there are any problems. Cheers, — Bility (talk) 11:54, 7 April 2013 (UTC)[reply]
I added it and it didn't seemingly respond by doing anything :( . Sfan00 IMG (talk) 15:05, 8 April 2013 (UTC)[reply]
Can you see the button above the edit text box? Are you in edit mode on an article talk page? Is there a WikiProject Biography template in the code with a |listas= parameter? — Bility (talk) 17:29, 8 April 2013 (UTC)[reply]
I see the edit box but nothing happened when I click it. Sfan00 IMG (talk) 21:38, 8 April 2013 (UTC)[reply]
N.B This one wasn't handled - http://en.wikipedia.org/w/index.php?title=Talk%3ABilly_Rogers_%28rugby_league%29&diff=549400202&oldid=548287530 so did it manually.. Tweak should suggest itself. Sfan00 IMG (talk) 21:40, 8 April 2013 (UTC)[reply]
So does that mean you got the script to work? I added WPBiography to what the script is looking for, so it should create the listas for that article (it suggested "Rogers, Billy" when I tested it). Let me know if there are any other redirect names for the template. Cheers, — Bility (talk) 22:17, 8 April 2013 (UTC)[reply]
I Got it working :) Sfan00 IMG (talk) 07:31, 9 April 2013 (UTC)[reply]
Redirects here - https://en.wikipedia.org/w/index.php?title=Special:WhatLinksHere/Template:WikiProject_Biography&hidelinks=1&hidetrans=1 Sfan00 IMG (talk) 07:34, 9 April 2013 (UTC)[reply]
Added. — Bility (talk) 15:33, 9 April 2013 (UTC)[reply]
Thanks, a further tweak would be to make this script so that for most articles it could be run from AWB or a bot Sfan00 IMG (talk) 17:50, 9 April 2013 (UTC)[reply]