Wikipedia:WikiProject User scripts/Requests
Requests for new user scripts or help with modifications to existing user scripts can be placed on this page. Please look through the recently fulfilled requests, archived requests, and Wikipedia:WikiProject User scripts/Scripts to see if an existing script will fulfill your needs.
Add new requests to the bottom of the page. Please provide a detailed description of how you would like the script to operate to increase the likelihood of your request being answered.
If you are unable to find a request that you left on this page (or its predecessor at Wikipedia:WikiProject User scripts#Open requests), please look at Wikipedia:WikiProject User scripts/Fulfilled requests for recently fulfilled requests or Wikipedia:WikiProject User scripts/Fulfilled requests/Archive index for older fulfilled requests.
Add pages to shared watchlists
A one click way to add pages to shared watchlists, i.e. like the ones under Wikipedia:Watch in the same way as pages can be added to the private watchlist. JesseW 19:51, 18 August 2005 (UTC)
Add descriptions to pages on the private watchlist
A way to add descriptions to pages on the private watchlist. i.e. "watch for vandalism", "watch for replies to my comment", "watch until the end of December", etc. JesseW 19:51, 18 August 2005 (UTC)
Improved image upload box
Improved image upload box(see VP discussion for more details) JesseW 23:01, 24 August 2005 (UTC)
Highlight watched articles by category
A way to highlight articles on your watchlist which are in a specific category(in this case, Category:Proposed deletion) JesseW, the juggling janitor 07:58, 12 February 2006 (UTC)
Open unvisited watchlist diffs in tabs
A way to open up in tabs all diffs on one's watchlist that haven't been visited. I guess this would probably be a browser-specific thing, but I waste so much time just clicking on links to open up diffs on my watchlist, almost as much as I do checking! --maru (talk) contribs 05:24, 21 March 2006 (UTC)
Featured picture candidates nomination
A tool to help with nominating images for commons:COM:FPC, which at the moment is inordinately hard due to nesting of templates needed to allow multilingual versions of pages. In fact, anyone interested in developing stuff for the Commons would be very welcome to contact me. Thanks, pfctdayelise (translate?) 00:58, 1 April 2006 (UTC)
History of a single section of a page
This request is related to the one above about the watchlist. A way to only see the history for that section. It would be hard to search the whole page's history for one little change in one section. --GeorgeMoneyTalk Contribs 22:21, 21 April 2006 (UTC)
Add footnotes using dialog box
A script to aid adding footnotes. Computerjoe's talk 11:57, 30 April 2006 (UTC)
- That's rather vague... -rayluT 19:24, 30 April 2006 (UTC)
- A script which adds a button to allow footnotes to be added through a JS dialog box. Computerjoe's talk 15:58, 1 May 2006 (UTC)
- How about User:AndyZ/monobook.js/footnotehelper.js? As of now, it simplifies the process of creating web footnotes; I'll take care of the book footnotes later. Andy t 01:47, 10 June 2006 (UTC)
Universal "new messages" notification
A universal or global 'new messages' notification system (or in the simpler case: a Commons: 'new messages' notification system, that tells you on en.wp when you have new messages on the Commons). This is needed so that people are informed of image deletion warnings which are placed on their Commons talk pages. Also if the universal login is implemented, something like this would be super handy, although it hasn't been official proposed AFAIK. If en.wp's free uploads are RDRed to Commons (as mooted on wikien-l), we would really want this. Thanks. pfctdayelise (translate?) 11:37, 4 May 2006 (UTC)
- Scratch this: Brion has indicated it will be part of the universal login system. pfctdayelise (translate?) 02:53, 5 May 2006 (UTC)
- The ULS still is not implemented though. For the record. t is possible, check the last script in my monobook User:Voice of All/monobook.js, and you will find a cross-site XML request system and instructions. I use a similar code to check Commons images licenses and a normal XML request script to inform me of all admin backlogs just like new messages. What you are asking for could be created by merging those ideas and applying it to al relavent wikis (though you would have to be logged into them).Voice-of-All 20:17, 3 July 2006 (UTC)
Rename "edit this page" tab to "edit"
A way to turn the "edit this page" link to "edit". --GeorgeMoney (talk) 00:15, 6 May 2006 (UTC)
- I don't know if this is the best way to do it, but it works:
addOnloadHook(function(){ document.getElementById("ca-edit").firstChild.innerHTML = "edit";});
~MDD4696 02:44, 6 May 2006 (UTC)
- That doesn't work under my blue colgne skin. --maru (talk) contribs 04:18, 6 May 2006 (UTC)
- An equivalent script in Cologne Blue is significantly more complicated. ~MDD4696 00:18, 8 May 2006 (UTC)
- How about this: User:Ilmari Karonen/cologneblue/shorteditlinks.js? —Ilmari Karonen (talk) 16:09, 8 May 2006 (UTC).
- That works nicely, thank you. --maru (talk) contribs 04:30, 17 May 2006 (UTC)
- It works in monobook, but it seems to contradict with the popups script. --GeorgeMoneyTalk Contribs 04:33, 6 May 2006 (UTC)
- Can you indicate in what way it breaks? Shinobu 02:18, 13 December 2006 (UTC)
Copyvio helper script
This may well already exist, but I'd like a simple way to deal with copyvios. Specifically, I should be able to click one link which will open a tab (or tabs, if editing more than one page is needed) editing the relevant page, with a skeleton copyvio notice in there. Bonus points for being able to add the url easily. It'd also be nice to be able to notify the authors of the page of the listing by clicking links on the history page. Lupin|talk|popups 03:06, 6 June 2006 (UTC)
- Can you please clarify? Do you mean a way to easily tag copyvios and notify the contributors? GeorgeMoney (talk) 01:35, 8 October 2006 (UTC)
Watchlist watcher
Watchlist watcher: I want a function to blink the watchlist link (change it to color #FFCC00 my watchlist) at 20% duty cycle (250 ms on, then 1000 ms off) whenever a page on my watchlist has changed. The alert should reset whenever the watchlist is accessed. I know there's Lupin's anti-vandal tool (which I have actually changed to show the most recent edits first), but I want to patrol my watchlist while I'm reading Wikipedia. (The watched pages don't change before 15 minutes usually.) Invitatious 17:04, 9 June 2006 (UTC)
- I actually wrote a very similar script, but had to disable it again, because the developers removed the watchlist API access. (Apparently it was because the code that was handling the watchlist access server-side was putting its load onto the wrong server.) --ais523 11:50, 4 May 2007 (UTC)
Check copyright tag for all images in article
A way to check if every single image on an article has an image copyright tag, or if it is fair use if it has a fair use rationale. Andy t 01:27, 23 June 2006 (UTC)
Shortcut key for delete in classic skin
I'd like to know a way in the classic skin to make ctrl-/ a shortcut key for delete.Geni 00:14, 6 September 2006 (UTC)
- You can't. Keyboard shortcuts must be an ALT-? combination. So do you want ALT-/ (forward slash) to do the same action as clicking the "delete" tab? ~MDD4696 02:01, 6 September 2006 (UTC)
- it would be useful.Geni 10:31, 6 September 2006 (UTC)
- In monobook it would be:
ta['ca-delete'] = ['/', 'Delete page'];
but since I don't use Classic I'm not sure how well this would translate. [ælfəks] 08:52, 14 October 2006 (UTC)
- In monobook it would be:
Correct variations of "Weidenfeld & Nicolson" globally
I've noticed a lot of variation in the name of the publishers 'Weidenfeld & Nicolson' (which seems to be the correct version acc to http://www.orionbooks.co.uk/). (My own surname is Nicolson so I have had a lifetime's experience of deleting the h and indeed the occasional k.) No doubt Weidenfeld is subject to variations too. I'm sure there's some clever way of globally correcting any infelicities. Any suggestions or (better still) volunteers? roundhouse 15:25, 20 September 2006 (UTC)
- User scripts aren't really perfect for that sort of thing, as you would probably have to navigate manually to each page that needs fixing. If you can find a list of pages that need changing (e.g. by Wikipedia or Google search), it would certainly be possible to write a script that would make the change in one click. Another possibility would be to use AWB. --ais523 15:29, 20 September 2006 (UTC)
Wikitext syntax parser
Is there any javascript implementation of a reusable wikitext syntax parser? --Cameltrader 22:27, 6 October 2006 (UTC)
- You could have a look at live preview, and I've worked on something similar myself, but both are wikitext→HTML converters. I've been meaning to rewrite it in a generic parser, a grammar, and an HTML-generator, but I'm not sure whether I ever find the time to finish that. Still, have a look at live preview. Shinobu 02:00, 7 October 2006 (UTC)
- Yes, User:Pilaf/livepreview.js seems to be doing replacements with regular expressions to convert wikisource immediately to HTML, and I guess you are using a similar approach. MediaWiki's PHPs are doing that too. I'd imagine that some day we will all have a common parser producing an object model similar to DOM, but it's too much for me to do anything serious about it this weekend. --Cameltrader 08:06, 8 October 2006 (UTC)
Convert external links to <ref> tags
Is there any way to write a script that converts normal links in <ref> tags to use the {{cite web}} template? Anything would be appreciated. -- Selmo (talk) 21:44, 8 October 2006 (UTC)
- You could use one of the regex search tools to search for <ref>.*http:\/\/.*<\/ref> or something. But automatically replacing is very difficult considering the large differences in the way these are linked. Shinobu 23:14, 8 October 2006 (UTC)
Possible to fork Speller Pages?
Is it possible to fork this?
- That would be so cool! How is their hotlinking policy? Is it alright, or should we mirror? Shinobu 16:52, 27 October 2006 (UTC)
- It needs a server-side component, which would put too much a strain on the servers, and will be very hard to port to JavaScript. It won't happen. At least not any time soon. Try to find a browser plug-in with the same functionality. Shinobu 20:02, 1 November 2006 (UTC)
Tag articles with {{prod}}
How about a script for tagging articles for PROD? We have them for speedy deletes and AFDs, but not PROD. It'd be pretty useful, I think. ♠PMC♠ 20:16, 3 November 2006 (UTC)
- There's something on the tutorial similar to this.
function doprod() { var prompt=prompt("Reason for prod?"); document.editform.wpTextbox1.value = "{"+"{wikify|"+prompt+"}}\n\n" + document.editform.wpTextbox1.value; document.editform.submit(); }
- Then call it with addToolbox link, or something like that. Z388 13:50, 4 November 2006 (UTC)
- Call it? I'm sorry, you've already lost me. I have no head for code at all. I don't know how to do that. ♠PMC♠ 06:20, 5 November 2006 (UTC)
- He means "put it in the toolbox using the little script to be found here", like:
addToolboxLink("javascript:void doprod();", "Some informative caption");
- Perhaps you may think you "have no head for code", but JavaScript doesn't need to be difficult. It can be, if you wish, but it doesn't need to be. Shinobu 02:12, 13 December 2006 (UTC)
- He means "put it in the toolbox using the little script to be found here", like:
Automatic imagecopyvio script
I'd like an automatic imagecopyvio script, could be adapted from autocopyvio with a few simple additions and tweaks, such as adding user talk page notification, there isn't much work. I tried to modify it but failed. See User:Mecu/imagevio.js. --MECU≈talk 23:01, 30 December 2006 (UTC)
Automatically watchlist article of the day
I don't know if this is possible, but I'd like a script that automatically adds the article of the day to my watchlist, so I can revert vandalism there. If this is not possible, then perhaps something in the toolbox that says "add AOTD to watchlist" or something of the like. I'd appreciate any help, as I am a completly incompetent when it comes to scripts. Thanks! | AndonicO Talk · Sign Here 17:05, 25 January 2007 (UTC)
- Doing it automatically would be incredibly difficult to keep track of, so instead I've made it a toolbox link (per your second choice). Does User:ais523/watchTFA.js do what you want? --ais523 18:02, 25 January 2007 (UTC)
- It's fine, but it seems to have an error. It says "Not Found". | AndonicO Talk · Sign Here 18:19, 25 January 2007 (UTC)
Highlight the character "g" in IPA tags
I'd like a script to search pages for {{IPA}} tags containing the character "g" [U+0067] and hilight it in red so that I know it's wrong and needs to be replaced with "ɡ" [U+0261] - they look identical in the font I use for IPA, but not so much in other fonts. Plus, such a script once written could be adapted to deal with other subtle textual errors. —Random832(tc) 04:30, 1 February 2007 (UTC)
- I've had a go at this one: User:Mike Dillon/Scripts/highlightNonIPA.js. It highlights all non-IPA characters in an IPA block in a golden color. It also allows "[", "/", "<", ",", and a few other punctuation characters. It correctly highlights "g". It probably needs some tweaking to determine what should and shouldn't be highlighted, but I think it's a good start. One area I didn't look at too much was pre-combined characters with diacritics. In particular, I was hesitant to add vowels with macrons for pre-combined tone marks since I'd be afraid that they are incorrect transcriptions of long vowels more often than not. Mike Dillon 19:29, 5 May 2007 (UTC)
Determining canonical namespace names
How do I obtain the canonical name of the Category (or any other) namespace? I need this in order to modify some scripts for cross-project usage.--DStoykov 17:31, 15 February 2007 (UTC)
- The namespace list for any wiki can be found at http://en.wikipedia.org/w/query.php?what=namespaces (obviously change the en.wikipedia.org part for other wikis). The Category namespace is 14 in the list. You can change the format as described in http://en.wikipedia.org/w/query.php to something useful for the script (such as XML); the main problem is trying to access that page. You might want to see a script like User:ais523/contribcalendar.js for a guide as to how to access query.php from a user script. (I copied the code for doing that off someone else, as it happens; it's hard to get it to work in both FireFox and IE without seeing how it's done first.) --ais523 17:48, 15 February 2007 (UTC)
Revert counter
I would like a counter somewhere that counts the number of reverts you have done in 24 hours, coz i've just been a bit revert happy, and nearly broken the 3RR reverting vandalism. If it wasn't for other users getting there first and partly User:Lupin's script, I would have broken a ten revert rule! The counter should just be visible, so i can just look and see how many reverts I have done, so I do not actually break the 3RR. Thanks in advance. Stwalkerster 21:36, 9 March 2007 (UTC)
- 3RR only applies to legitimate edits. You can revert vandalism as many times as you like. Tra (Talk) 21:40, 9 March 2007 (UTC)
Alter tab names in quickbar
A little earlier someone posted a script to alter the linknames for the quickbar at the top. Is there an easy script to alter tab names too? - Mgm|(talk) 17:40, 15 April 2007 (UTC)
- It's a one-liner; this example is for the ca-edit tab, changing what it says to 'edit'.
addOnloadHook(function() {document.getElementById('ca-edit').firstChild.innerHTML = 'edit';});
- There is absolutely no difference between "link" and "tabs" on the top and on the left. The same code can be used, only ids should be changed. As for one-liner, it will result in error on the pages without 'ca-edit' (like history or watchlist), possibly stopping some other scripts from working. — Alex Smotrov 19:43, 16 April 2007 (UTC)
WP:PUI helper script
How about a script to aid in the WP:PUI process, namely:
- (From an image page)
- Tag the image with a {{PUIdisputed}} or {{PUInonfree}} (possibly from a tab that is only visible on a page in the Image: namespace.)
- Pop-up a window for the uploader of this image, and add {{subst:idw-pui|Image:filename.ext}} to the bottom of the User talk page.
- Pop-up a second window with Wikipedia:Possibly unfree images, and place at the bottom of the page [[:Image:filename.ext]] - <!-- insert reason here --> ~~~~
- (It'd be great too if the "reason" that was inserted could be a pop-up text entry box.)
If this already exists, please let me know so I can start using it! And if not, I'd appreciate your help with it. The whole process is really time-consuming, and I feel that a lot of unfree images are being used because people don't have the patience to make all these edits. Thanks! tiZom(2¢) 19:51, 16 April 2007 (UTC)
- Perhaps rather than opening a new window, the edits can be manually approved on the image page and then made with Ajax? Gah... now we're turning into Google Web Development... (at least I am) It's possible, though. What does anyone else think about going about this? GracenotesT § 01:20, 18 April 2007 (UTC)
- It's certainly possible. Wouldn't AJAX saving script always win edit conflicts though? ;) — Alex Smotrov 23:00, 18 April 2007 (UTC)
Auto link
Can you create a script that makes it so that when you type in [[User:example]] or something of the like, it turns it into Example user without having to type the "|Example User" in. Sincerely, Sir intellegent - smartr tahn eaver!!!! 22:08, 4 May 2007 (UTC)
- Do you always say Example user, wouldn't [[User:Example|]] which produces Example be enough? — Alex Smotrov 22:19, 4 May 2007 (UTC)
Templates in edit toolbar
Something like this:
Templates
Cleanup |
Software Taxobox Book |
Choosing "Software", could add to edit box:
{{Infobox Software | name = | logo = | screenshot = | caption = | author = | developer = | released = | latest release version = | latest release date = | latest preview version = | latest preview date = | operating system = | platform = | language = | status = | genre = | license = | website = }}
It's just an example. Is this possible? Mosca2 09:15, 12 May 2007 (UTC)
RC birds
What about a script version of RC birds that runs in the background, while still having controls in the form of a user subpage. — Preceding unsigned comment added by CommonEditor2345 (talk • contribs)
- What are you talking about? Do you mean "RC birds" like an ornithopter? This page is for requests for scripts that help you improve the encyclopedia and it doesn't sound like that's what you're looking for. Sorry if I misunderstand. Mike Dillon 14:37, 25 May 2007 (UTC)
- I ment this: http://meta.wikimedia.org/wiki/Rcbirds(RC is recent changes).But ok.Also I think that would help because odd patterns while on wikipedia but not on recent changes patrol at the time, like if I was looking up some thing and unusual sonds apeared, I would return to my recent changes patrol and find out what happend.
Rollback
Could anybody make me a rollback link thing? Up until now I've only done mostly color stuff with my monobook(on other wikis), but I'm interested in adding a rollback link. If you can, make it as similar to the one used by admins as possible. i.e. [ rollback ] looks like this, reverts last users edits, shows up on user contribution page, as well as the history of the page. I can't seem to find this anywhere, but I've heard of a few people doing it, so I'd like it for myself. Thanks, Pinky 06:03, 10 June 2007 (UTC)
- User:Ilmari_Karonen/godmode-light.js used to do this, but it hasn't been maintained for ages so I don't know if it still works. If it doesn't, fixing it would probably be easier than writing a new script. --ais523 12:54, 11 June 2007 (UTC)
- WP:TW has one too. The Sunshine Man 11:49, 25 June 2007 (UTC)
Easy Stubify
Can someone create a script similar to this that adds a stubify tab to the top of articles? Preferably, it would include a pop-up box that asks which stub type, add a summary, then automatically click the preview button at the bottom. Thanks, ~ thesublime514 • talk • sign 02:08, July 5, 2007 (UTC)
- Try User:Ais523/stubtagtab.js. --ais523 12:22, 6 July 2007 (UTC)
- Thanks, it works great ~ thesublime514 • talk • sign 18:48, July 6, 2007 (UTC)
Wikipedia Suggest
If it's possible, it would be cool is someone could add another search bar below the normal one via a portlet modification to create a Wikipedia Suggest. I found this site and was wondering if anyone could write a script to incorporate it. Also, this site has some screenshots of script that perhaps (?) would be helpful. Thanks, — thesublime514 • talk • 00:14, July 10, 2007 (UTC)
- Notes to help with possibly making something like this: a search suggestions database query is available at <http://en.wikipedia.org/w/api.php?action=opensearch&search=URL%20encoded%20search%20terms>; this is what Firefox 2 uses for its search suggestions when searching Wikipedia from its own search box. The output's in JSON format. --ais523 16:53, 10 July 2007 (UTC)
Arabic script
I've been adding Arabic script to articles in Wikipedia for 9 months now, and have added thousands of 'em. I would really appreciate if someone can create this script for me.
Basically, this script will help me add Arabic script to articles with Arabic names (as in Jamal Suliman) and remove the request tags from the talk pages.
This is a description of what I would like the script to do:
- In article talk pages, a tab labeled "ar" is added. Clicking on this tab removes {{Arabic}} from the talk page. It uses an edit summary of "Removed {{Arabic}}".
- In articles (main space), a tab labeled "ar" is added. Clicking on this tab launches a small box with one option, Arabic, with a box where the Arabic script is added. The proper way of formatting the script is by adding "({{lang-ar|'''ARABIC SCRIPT'''}})" immediately after the subject's name. The script uses an edit summary of "Added original Arabic script".
If it helps, I use Firefox 2.0.0.4 on Vista X86. I think this shouldn't be any difficult for the average script whizz. :-) Thanks, Anas talk? 00:18, 13 July 2007 (UTC)
- I'm not entirely sure what you mean by the mainspace part of the script. Do you want it to open a dialog box (or similar) prompting you for the Arabic text? Should the script just place in the template with one parameter, what you typed in the input box with triple-apostrophes around it? Or have I misunderstood the request? --ais523 17:51, 16 July 2007 (UTC)
- Yes, it opens a dialog box prompting me for the Arabic script, which is placed between the triple-apostrophes (for bold text). It is placed after the subject's name in the lead, if possible. Thanks, Anas talk? 13:13, 17 July 2007 (UTC)
I think this works:
// Arabic tagging script, by [[User:ais523]] on a request by [[User:Anas Salloum]]
addOnloadHook(function()
{
var actionToTake='wpDiff'; // you can change to wpSave once you're happy this works properly
if(wgAction=="view"&&location.href.indexOf("/wiki/")!=-1)
{
if(wgNamespaceNumber==1) //talk page
{
addPortletLink('p-cactions', "javascript:arremovetag();","ar","ca-ar","remove {"+"{arabic}} tag","");
}
else if(wgNamespaceNumber==0) //article
{
addPortletLink('p-cactions', "javascript:araddtag();","ar","ca-ar","add {"+"{lang-ar}} tag","");
}
}
if(location.href.indexOf("&arremovetag=yes")!=-1)
{
var tb1=document.getElementById('wpTextbox1');
tb1.value=tb1.value.split(/\{\{\ *[aA]rabic\ *(\|[^}]*)?\}\}/).join("");
document.getElementById('wpSummary').value="Removed {"+"{[[Template:Arabic|Arabic]]}}";
document.getElementById(actionToTake).click();
}
else if(location.href.indexOf("&araddtag=")!=-1)
{
var x=decodeURIComponent(location.href.split("&araddtag=")[1]);
var tb1=document.getElementById('wpTextbox1');
var a=tb1.value.split("'''");
if(a.length<3)
{
alert("Couldn't figure out where to put the tag; try adding it manually.");
return;
}
a[2]=" ({"+"{lang-ar|'''"+x+"'''}})"+a[2];
tb1.value=a.join("'''");
document.getElementById('wpSummary').value="Added original [[Arabic alphabet|Arabic script]]";
document.getElementById('wpDiff').click(); //too dangerous to save without user intervention
}
});
function arremovetag()
{
location.href+="?action=edit&arremovetag=yes";
}
function araddtag()
{
var x=prompt("Please enter the parameter for the {"+"{lang-ar}} tag (it will be bolded "+
"automatically):");
if(x==null) return
location.href+="?action=edit&araddtag="+encodeURIComponent(x);
}
As I've written it at the moment, it sets off 'show changes' both on the talkpage and articlepage tagging. You can change wpDiff on the fourth line of the script to wpSave to cause the talkpage to save automatically, once you're happy that the script works; I think the risk that the script adds the lang-ar tag in the wrong place is too high, so that will always 'show changes' rather than saving immediately to give you a chance to check it's in the right place. Hope that helps; let me know if it works! --ais523 16:08, 17 July 2007 (UTC)
- Cough, cough… not gonna works since
addTab()
is not defined; what's wrong with usingaddPortletLink()
which was added to wikibits.js ages ago? As for script behaviour, personally I would prefer the script to focus textarea and put the cursor in the correct position so the user could start typing directly into textarea ∴ Alex Smotrov 16:56, 17 July 2007 (UTC)- It didn't work. It also canceled the other scripts I have installed. I have an idea; is it possible to design this script to only remove the talk page tag? Maybe you could help me add a new button in my edit panel (see below) which adds the lang-ar template (as described above) where the cursor is placed? Thanks a lot! —Anas talk? 20:47, 17 July 2007 (UTC)
- Forget about the extra button; I got that figured out. Could you just help me with the talk page script (first part of my request)? :-) Thanks, Anas talk? 13:28, 18 July 2007 (UTC)
- Alex Smotrov was right; I was using an obsolete function by mistake (which worked in my monobook because I have it installed to run some old code, but wouldn't work in yours...). Here's the corrected version, minus the article page script. (I've also edited the script above if you want the full thing.)
- Forget about the extra button; I got that figured out. Could you just help me with the talk page script (first part of my request)? :-) Thanks, Anas talk? 13:28, 18 July 2007 (UTC)
- It didn't work. It also canceled the other scripts I have installed. I have an idea; is it possible to design this script to only remove the talk page tag? Maybe you could help me add a new button in my edit panel (see below) which adds the lang-ar template (as described above) where the cursor is placed? Thanks a lot! —Anas talk? 20:47, 17 July 2007 (UTC)
// Arabic tag removal script, by [[User:ais523]] on a request by [[User:Anas Salloum]]
addOnloadHook(function()
{
var actionToTake='wpDiff'; // you can change to wpSave once you're happy this works properly
if(wgAction=="view"&&location.href.indexOf("/wiki/")!=-1)
{
if(wgNamespaceNumber==1) //talk page
{
addPortletLink('p-cactions', "javascript:arremovetag();","ar","ca-ar","remove {"+"{arabic}} tag","");
}
}
if(location.href.indexOf("&arremovetag=yes")!=-1)
{
var tb1=document.getElementById('wpTextbox1');
tb1.value=tb1.value.split(/\{\{\ *[aA]rabic\ *(\|[^}]*)?\}\}/).join("");
document.getElementById('wpSummary').value="Removed {"+"{[[Template:Arabic|Arabic]]}}";
document.getElementById(actionToTake).click();
}
});
function arremovetag()
{
location.href+="?action=edit&arremovetag=yes";
}
- Hope that helps! --ais523 16:52, 24 July 2007 (UTC)
- The (complete) first script won't work, but that's no problem. As for the second script, it will do everything I want it to except for actually removing the template. Maybe there's a small mistake that's interrupting it; can you revise it? Much appreciated, ais! —Anas talk? 17:40, 24 July 2007 (UTC)
- The script doesn't do anything but remove the template, though; I've made a minor fix for the situation when a user added spaces around the name of the tag. What's the problem, exactly? If it's that it isn't saving after showing the diff, this is intentional when I write a new script (until you've used it a bit there's always the chance of some mistake I didn't notice), and you can change wpDiff to wpSave in the fourth line to make it save immediately. If it's that the script is making a null edit with the correct summary, then see if the fix I've made above works, and if not, let me know a page on which it fails and I'll look into it. Hope that helps! (Sorry for the late reply; I've been offline for a while.) --ais523 07:39, 27 July 2007 (UTC)
- Thanks a lot for your time, ais. The script is working OK; it adds the script flawlessly now. However, it still won't remove the tag from talk pages; it will make a null edit with the correct summary, as it was doing before your fix. You can test it in Talk:Jamal Suliman. Thanks again! I really appreciate your help. —Anas talk? 11:51, 27 July 2007 (UTC)
- The script doesn't do anything but remove the template, though; I've made a minor fix for the situation when a user added spaces around the name of the tag. What's the problem, exactly? If it's that it isn't saving after showing the diff, this is intentional when I write a new script (until you've used it a bit there's always the chance of some mistake I didn't notice), and you can change wpDiff to wpSave in the fourth line to make it save immediately. If it's that the script is making a null edit with the correct summary, then see if the fix I've made above works, and if not, let me know a page on which it fails and I'll look into it. Hope that helps! (Sorry for the late reply; I've been offline for a while.) --ais523 07:39, 27 July 2007 (UTC)
- The (complete) first script won't work, but that's no problem. As for the second script, it will do everything I want it to except for actually removing the template. Maybe there's a small mistake that's interrupting it; can you revise it? Much appreciated, ais! —Anas talk? 17:40, 24 July 2007 (UTC)
- Hope that helps! --ais523 16:52, 24 July 2007 (UTC)
"Leave a comment"
I don't know if it's going to stay, but can someone write a script that changes the "Leave a comment" tab back to a "+"? I think it's a one-liner.
Also, I was wondering if there was a way to make tabs at the top a set distance apart, or at least add a pixel or two of margin between them. I have a few that are right next to each other, and it's bugging me. [/OCD] Thanks, — thesublime514 • talk • 20:32, July 13, 2007 (UTC)
- One-liner for "+" was already mentioned on Wikipedia:Village pump (technical), but here you go:
addOnloadHook(function () {
var caAdd = document.getElementById('ca-addsection');
if (caAdd) caAdd.firstChild.innerHTML = '+';
})
- I started to enter the script for your 2nd request (similar to above, but with
caAdd.style.marginLeft = '20px';
), then realized it's better with CSS, e.g.
li#ca-history {margin-left: 20px !important}
- in your monobook.css will make more empty space on the left from the "history" tab ∴ Alex Smotrov 21:32, 13 July 2007 (UTC)
- Thanks, man — thesublime514 • talk • 22:37, July 13, 2007 (UTC)
References
Is there any script that can help add references using {{cite web}}, {{cite news}} and {{cite book}}? If there isn't, would it be too hard to create one? Basically the script will open a window with options for the different parameters and, once done, will add the reference where the cursor is placed (if possible). —Anas talk? 13:22, 14 July 2007 (UTC)
- Would the custom edit button system be dynamic enough for your needs? The javascript tool-buttons above edit boxes are easy to agument, and you could, for example, make a button to insert {{cite web|example text}} at the cursor position, with the exmaple text hilighted (replaced when you type). I couldn't find a good wikimedia help page about it, but see: wikicities:Help:Custom edit buttons. There are problably images for these in commons:Category:ButtonToolbar (or you can make some). --Splarka (rant) 08:04, 15 July 2007 (UTC)
- Thanks, man. I stumbled upon User:MarkS/Extra edit buttons, which looks exactly like what I'm looking for. —Anas talk? 13:08, 15 July 2007 (UTC)
- Unfortunately, the script didn't have what I was looking for. It only had the basic references tags. I tried making my own buttons, but my efforts were in vain. Is it possible to modify the tool to have one more button for {{cite web}} and another for {{cite book}}? —Anas talk? 13:16, 17 July 2007 (UTC)
- Well, the custom edit buttons can be modified easy (see below for example) --Splarka (rant) 07:55, 18 July 2007 (UTC)
if (mwCustomEditButtons) { mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "/media/wikipedia/commons/9/91/Button_cite_web.png", "speedTip": "Cite Web", "tagOpen": "{{cite web\n", "tagClose": "\n}}", "sampleText": "|url = \n|title = \n|accessdate = \n|accessdaymonth = \n|accessmonthday = \n|accessyear = \n|author = \n|last = \n|first = \n|authorlink = \n|coauthors = \n|date = \n|year = \n|month = \n|format = \n|work = \n|publisher = \n|pages = \n|language = \n|doi = \n|archiveurl = \n|archivedate = \n|quote = "}; mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "/media/wikipedia/commons/2/2c/Button_cite_news.png", "speedTip": "Cite News", "tagOpen": "{{cite news\n", "tagClose": "\n}}", "sampleText": "|first = \n|last = \n|authorlink = \n|author = \n|coauthors = \n|title = \n|url = \n|format = \n|work = \n|publisher = \n|id = \n|pages = \n|page = \n|date = \n|accessdate = \n|language = \n|quote = "}; mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "/media/wikipedia/commons/e/ef/Button_cite_book.png", "speedTip": "Cite Book", "tagOpen": "{{cite book\n", "tagClose": "\n}}", "sampleText": "|last = \n|first = \n|authorlink = \n|coauthors = \n|editor = \n|others = \n|title = \n|origdate = \n|origyear = \n|origmonth = \n|url = \n|format = \n|accessdate = \n|accessyear = \n|accessmonth = \n|edition = \n|series = \n|date = \n|year = \n|month = \n|publisher = \n|location = \n|language = \n|isbn = \n|oclc = \n|doi = \n|id = \n|pages = \n|chapter = \n|chapterurl = \n|quote = \n|ref = "}; mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "/media/wikipedia/commons/4/47/Button_arabic.png", "speedTip": "Insert Template:Lang-ar", "tagOpen": "{{lang-ar|", "tagClose": "}}", "sampleText": "'''Text'''"}; }
Works brilliantly! Thank you so much! —Anas talk? 13:23, 18 July 2007 (UTC)
- Is it possible to make another button for adding "({{lang-ar|'''Text'''}})"? —Anas talk? 14:12, 18 July 2007 (UTC)
- Done (see above). I made a generic "Arabic" (العربية) button for it. You can make your own and upload them to commons, by working off of: commons:Image:Button_base.png --Splarka (rant) 20:08, 18 July 2007 (UTC)
- Works like a charm! Though I wish it was possible to have the text bolded; it seems not to work with this. Thanks again, Splarka! —Anas talk? 21:21, 18 July 2007 (UTC)
Change the wikipedia search bar
I'd like a script that changes the behavior of the wikipedia search bar in the left pane of the screen. Wikipedia's search functionality isn't great. I'd like a script that changed the search button to do a search on google in the wikipedia.org domain. It may help to base off of User:Henrik/sandbox/google-search.
Thanks! St.isaac 17:02, 14 July 2007 (UTC)
- Try this:
addOnloadHook(function() {
document.getElementById('searchform').action = 'http://www.google.com/search';
document.getElementById('searchInput').name = 'q';
document.getElementById('searchGoButton').name = 'btnG';
document.getElementById('mw-searchButton').name = 'btnI';
document.getElementById('searchGoButton').value = 'Google';
document.getElementById('mw-searchButton').value = 'Lucky!';
var enwp = document.createElement('input');
enwp.id = 'as_sitesearch';
enwp.name = 'as_sitesearch';
enwp.value = 'en.wikipedia.org';
enwp.type = 'hidden';
document.getElementById('searchform').appendChild(enwp);
return false;
});
- I made the second button the "I'm feeling lucky" (rather than the first, which is default on MediaWiki). --Splarka (rant) 08:16, 15 July 2007 (UTC)
- It's very good. I like it a lot. St.isaac 02:29, 16 July 2007 (UTC)
Constructing templates and copy to clipboard
I have looked through available scripts and can't find anything quite like what I would like. It it exists already, a pointer would be great.
I would like to have added to popups a facility to construct useful templates. This might even be customizable; not sure. The idea is that when you mouse over a link, you have the option to create some standard templates that would be instantly placed into the clipboard. You could then paste them into comments or pages that you are editing. Here are examples.
- When you mouse over a user link, there is an option to put "{{user|username}}" into the clipboard.
- When you mouse over a diff link, there is an option to put "{{wp-diff|page=pagetitle|diff=diffid|oldid=oldid|title=diff}}"
I'm sure other useful possibilities could be given.
Once in the clip board, these could be pasted as required into whatever text you are writing at the time. -- Duae Quartunciae (t|c) 00:20, 21 July 2007 (UTC)
Monobook problems
OK Guys, this is a (rather) large request. I have a fairly clean monobook.js and it won't work. Period!. I don't know what's wrong with it, I've tried disabling things for debugging but nothing seems to work. Can somebody take a look and see if there's something obvious? It was taken from a larger monobook, so it's possible I've removed something vital....
Thanks! Isaac 17:08, 23 July 2007 (UTC)
- There's a semicolon missing; it should be just after the last ) on the page. Apart from that, I don't see anything obviously wrong. (Some of the scripts there are seriously out of date, though they should still work.) --ais523 16:48, 24 July 2007 (UTC)
- I think Isaac already fixed it by now. As for semicolon, I recently started writing my scripts almost without any. Please let me know if it's a problem for some particular browsers, then I'll stop doing that ;) ∴ Alex Smotrov 17:01, 24 July 2007 (UTC)
- Firefox, at least, requires a semicolon at the end of a function call (such as to addOnloadHook) if it's immediately followed by another function call, or I suspect anything else. I'm not sure whether it's strictly required at the end of a block, though, like that one was, but it would cause problems if another script were added at the end. --ais523 17:09, 24 July 2007 (UTC)
- I just looked it up, actually; in JavaScript, apparently a newline will add a semicolon if one's needed (I didn't use a newline when testing). This seems to allow for ambiguities, though; it might mean that the following code is ambiguous:
- Firefox, at least, requires a semicolon at the end of a function call (such as to addOnloadHook) if it's immediately followed by another function call, or I suspect anything else. I'm not sure whether it's strictly required at the end of a block, though, like that one was, but it would cause problems if another script were added at the end. --ais523 17:09, 24 July 2007 (UTC)
- I think Isaac already fixed it by now. As for semicolon, I recently started writing my scripts almost without any. Please let me know if it's a problem for some particular browsers, then I'll stop doing that ;) ∴ Alex Smotrov 17:01, 24 July 2007 (UTC)
var a
a="test"
+4
alert(a)
- (because '+4' is a valid statement in its own right, which calculates the value of 4 and does nothing with it). I wonder how browsers interpret this sort of thing? (I get a messagebox saying test4 when I run this script in Firefox 2 and also in Internet Explorer 7.) --ais523 17:13, 24 July 2007 (UTC)
- The plus sign is both unary and binary, though... when a browser looks ahead to see if it should place a semicolon, I assume it checks for binary operators (and possibly nothing else). GracenotesT § 03:10, 25 July 2007 (UTC)
- (because '+4' is a valid statement in its own right, which calculates the value of 4 and does nothing with it). I wonder how browsers interpret this sort of thing? (I get a messagebox saying test4 when I run this script in Firefox 2 and also in Internet Explorer 7.) --ais523 17:13, 24 July 2007 (UTC)
"Undo" button
Please make a script that will add a "Undo" button at the top when viewing articles. The button will undo the current edit, with out having to go though the edit screen. This would be very good for undoing vandalism... thanks! EvilHom3r 02:21, 7 August 2007 (UTC)
- From the article page it's not clear how many last edits to undo. If you simply want to skip the eidt screen, I'm not sure but I think that Navigation popups and Twinkle can do that. P.S. Did you really need 3 edits to write your message? ∴ Alex Smotrov 03:15, 7 August 2007 (UTC)
Page edit alert
Hi, there. I was wondering if it is possible to create a user script (to be located on monobook.js) that enables a user to be alerted when a specific WP page gets edited (this would be the talk page of WikProject Olympics). A script that would work in the same way that when a user gets a "new message" alert whenever his/her talk page gets edited by other users. Can anyone help? Thank you. Parutakupiu 17:45, 8 August 2007 (UTC)
- This would require additional requests to the server; what's wrong with simply checking your watchlist from time to time? ∴ Alex Smotrov 20:13, 8 August 2007 (UTC)
- Perhaps a watchlist notifier is what you are looking for? It will display a message every time a watched page is edited. —Anas talk? 20:49, 8 August 2007 (UTC)
Change image red links to not link to edit page
It would be really nice for people doing image work if the image redlinks were just normal links rather than the w/index.php?title=Image:example.jpg&action=edit style so we could see if there were previous versions, or if one exists on commons etc. (red links exist on logs even if they are on commons) - cohesion 02:07, 10 August 2007 (UTC)
- The problem is, depending on what kind of link it is ([[Image:...]] or [[:Image:...]] or an entry in a log), sometimes it is an edit link, and sometimes it is an upload link. But give this a try:
// ==================================================
// Image Redlink Toolkit
// ==================================================
addOnloadHook(redImageTools);
function redImageTools() {
var img = getElementsByClassName(document.getElementById('bodyContent'),'a','new');
for(var i=0;i<img.length;i++) {
var iu = img[i].href;
if(iu.search(/Special\:Upload/i)!=-1) {
var it = 'Image:' + iu.substring(iu.indexOf('wpDestFile=')+11,iu.length);
insertWrappedLinkAfter(img[i], wgScriptPath + '/index.php?title=Special:Log&page=' + it,'logs');
insertWrappedLinkAfter(img[i], wgScriptPath + '/index.php?title=' + it + '&action=edit','edit');
insertWrappedLinkAfter(img[i], wgScriptPath + '/index.php?title=' + it,'view');
img[i].className = 'new newimage';
} else if(iu.search(/title\=Image\:/i)!=-1) {
var it = iu.substring(iu.indexOf('title=')+6,iu.indexOf('&action=edit'));
insertWrappedLinkAfter(img[i], wgScriptPath + '/index.php?title=Special:Upload&wpDestFile=' + it,'upload');
insertWrappedLinkAfter(img[i], wgScriptPath + '/index.php?title=Special:Log&page=' + it,'logs');
insertWrappedLinkAfter(img[i], wgScriptPath + '/index.php?title=' + it,'view');
img[i].className = 'new newimage';
}
}
}
function insertWrappedLinkAfter(object,link,text) {
var sm = document.createElement('small');
var li = document.createElement('a');
li.href = link;
var tx = document.createTextNode(text);
var po = document.createTextNode(' (');
var pc = document.createTextNode(')');
li.appendChild(tx);
sm.appendChild(po);
sm.appendChild(li);
sm.appendChild(pc);
object.nextSibling && object.parentNode.insertBefore(sm,object.nextSibling) || object.parentNode.appendChild(sm)
}
// ==================================================
// End Image Redlink Toolkit
// ==================================================
For every red image it finds, it sets a class "newimage" and then proceeds to insert 3 links after it ("view edit logs" or "view logs upload" depending on what type of link it is). It only works in English as-is (would need to be customized for other content languages). You can style the red image links in your user css, for example: a.newimage {background-color:#aaffbb;}
. Yes, this can be rewritten better and possibly doesn't need to be so complex. {{sofixit}} zocky ^_^. --Splarka (rant) 09:14, 10 August 2007 (UTC)
- Wow, this is perfect! :D Thanks so much!! :D - cohesion 23:46, 10 August 2007 (UTC)
Whatlinkshere sorting
I suppose I'm not the first one to request this, but I would appreciate it greatly if a script that sorts entries in Special:Whatlinkshere is written or suggested. The required feature is bringing redirects to the top of the page, that is pages from the main namespace automatically tagged "(redirect)". The same goes for "(transclusion)" entries for templates. Additionally, entries can be also grouped by namespace at the end of the list. (I'm aware of scripts that add selection tabs, but as far as I know they do not provide sorting redirects and transclusions.) Súrendil 20:49, 12 August 2007 (UTC)
- It's a great idea, but it can't be done correctly just with javascript. Any javascript tool will work only on the links that are already shown on the page. OTOH, it should be possible to fake this by listing links and transclusions separately using api.php. I'm not sure about redirects though. All in all, it would probably work best as a Mediawiki feature. Zocky | picture popups 08:41, 13 August 2007 (UTC)
- Mightn't it just be possible to ask for the maximum (5000), and then assume that's everything and sort that? That would get around the problem with which links are already shown on the page. ais523 14:17, 13 August 2007 (UTC)
Users link in Toolbox
This script will have easy access through the Toolbox instead of walking through the Special Pages and finding the "User list". -- PNiddy Go! 18:17, 18 August 2007 (UTC)
- Do you mean Special:Listusers? Try:
addOnloadHook(function() {
addPortletLink('p-tb','/wiki/Special:Listusers','User list','t-userlist','Special:Listusers');
});
- --Splarka (rant) 07:29, 19 August 2007 (UTC)
- Can that be modified so that it searches for the user on whose page it is clicked? i said 04:52, 23 August 2007 (UTC)
- Maybe try this instead. --Splarka (rant) 07:42, 23 August 2007 (UTC)
if(wgNamespaceNumber==2||wgNamespaceNumber==3) addOnloadHook(function() {
var n = wgTitle;
if(n.indexOf('/')!=-1) n = n.substring(0,wgTitle.indexOf('/'))
addPortletLink('p-tb', wgScript + '?title=Special:Listusers&username=' + n,'User Search','t-usersearch','Special:Listusers&username=' + n);
})
Yes. That works. Thank you very very much. i said 07:49, 23 August 2007 (UTC)
2 requests for specific code
- First request. Is there a template that I can use that when placed on a page converts into the articles name? for instance if I put {{Page}}(an example) it would automatically convert into the name of the article which it's placed on? Does such a thing exist? If not, What javascript would be required to make such a script possible to create such a template?
- Second request. I'm trying to add a link to my toolbox that shows the log of todays AFD pages. Specifically this link: [articles for deletion log]. How would I add such a link to my "toolbox" to the left. What would the specific script be?
Thanks in advance for anyone who might be able to help. Wikidudeman (talk) 19:48, 10 September 2007 (UTC)
- To answer your first question: {{PAGENAME}}, or {{FULLPAGENAME}} if you want the namespace included. Anomie 22:36, 10 September 2007 (UTC)
- Thanks. I figured out the first one earlier today thankfully. As far as the second one goes, I can't figure it out. Perhaps someone knows javascript well enough to write it out for me. Wikidudeman (talk) 23:26, 10 September 2007 (UTC)
- This should do what you want. --Splarka (rant) 08:44, 11 September 2007 (UTC)
addOnloadHook(function() {
//add to tb: {{fullurl:Wikipedia:Articles for deletion/Log/{{CURRENTYEAR}}_{{CURRENTMONTHNAME}}_{{CURRENTDAY}}|action=edit}}
var now = new Date(); var url = '';
var mn = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
url += wgServer + wgScript + '?title=Wikipedia:Articles_for_deletion/Log/';
url += now.getFullYear() + '_' + mn[now.getMonth()] + '_' + now.getDate() + '&action=edit';
addPortletLink('p-tb', url, 'AFD/today', 'ca-afd', 'AFD for today');
});
- Bingo, You're a genius. Wikidudeman (talk) 12:26, 11 September 2007 (UTC)
- If you really want to match the current page, you'll need to use UTC, i.e.
now.getUTCFullYear()
,now.getUTCMonth()
, andnow.getUTCDate()
. Mike Dillon 03:17, 12 September 2007 (UTC)
- If you really want to match the current page, you'll need to use UTC, i.e.
- Is there a way to make it so that it isn't in the edit page? Also, I have another addition to my toolbox, and I'd rather this one be above it. Is there a way to do that? I really like this tool. i said 03:31, 12 September 2007 (UTC)