Jump to content

Wikipedia:WikiProject User scripts/Requests/Fulfilled

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Ais523 (talk | contribs) at 12:33, 6 July 2007 (archiving fulfilled requests that have had a response or have been fulfilled for a while). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

This page contains requests for user scripts that have been recently fulfilled. The make a new request, please see Wikipedia:WikiProject User scripts/Requests. For older fulfilled requests, please see Wikipedia:WikiProject User scripts/Fulfilled requests/Archive index.

Add speedy deletion templates to a page

How about a script to allow me to post a speedy deletion template on a page. - PatricknoddyTALK (reply here)|HISTORY 11:19, 17 March 2007 (UTC)[reply]

Although I can't find it right now, I'm pretty sure we already have something like that.
WP:TWINKLE can do that. GrimRevenant 09:59, 18 May 2007 (UTC)[reply]

I'm not sure if this is possible. Here's what I would like. When browsing a category, such as Category:Unassessed-Class Environment articles, I want the script to point all the links in the category to point to the article and not the talk page of the article. So for example in the category, instead of pointing to Talk:Algae, it'll point to Algae. Is that possible? Right now when assessing articles, I have to click on the link which takes me to the talk page. Then I have to go to the article to review it. I want to skip that first step. MahangaTalk to me 02:36, 19 March 2007 (UTC)[reply]

Give this a try (adds an action button). --Splarka (rant) 07:32, 19 March 2007 (UTC)[reply]
function catSwapButton() {
  if(document.title.indexOf('Category:' == 0)) {
    addPortletLink('p-cactions','javascript:catSwap();','De-Talkify','ca-catswap','change category links from talk pages to article pages');
  }
}
addOnloadHook(catSwapButton)

function catSwap() {
  var cat = document.getElementById('mw-pages');
  cat.innerHTML = cat.innerHTML.replace(/Talk\:/g,'').replace(/[_\s]talk\:/g,':');
}
Thank you!

Highlight watchlist items by pattern

A script that allows a user to add a wildcard, and any items in his watchlist that contain that wildcard will be colored in a different color. This is especially useful for users who are monitoring things like many of the DYK templates. Yonatan talk 20:23, 19 March 2007 (UTC)[reply]

Here is a crude version (someone else could write it with regex support and a more compact array method I suppose). Note that this can be expanded to search the title="", by changing links[i].innerHTML. to links[i].title. below.
var wstyle = [];
// Watchlist styler, matches word or word fragments in the innerHTML of links on your watchlist page.
// Accepts 'color' and 'bgcol' parameters (link color and background color), either or both.
// Add as many as your browser can handle.
wstyle[wstyle.length] = {
  'match': 'Hydrogen',
  'color': '#ffff00',
  'bgcol': '#00ff00'}
wstyle[wstyle.length] = {
  'match': 'MediaWiki',
  'color': '#ff0000'}
wstyle[wstyle.length] = {
  'match': 'Talk:',
  'bgcol': '#000000'}

function watchlistStyle() {
  if(document.title.indexOf('My watchlist -') != 0) return;
  var links = document.getElementById('bodyContent').getElementsByTagName('a');
  for(var i=0;i < links.length;i++) {
    for(var k=0;k < wstyle.length;k++) {
      if(links[i].innerHTML.indexOf(wstyle[k].match)!= -1) {
        if(wstyle[k].color) links[i].style.color = wstyle[k].color
        if(wstyle[k].bgcol) links[i].style.backgroundColor = wstyle[k].bgcol
      }
    }
  }
}
addOnloadHook(watchlistStyle)
Note that this can also be done in just CSS if your browser supports 2.1 (any Firefox should work), eg:
body.page-Special_Watchlist a[title*="MediaWiki"] {color: #ff0000; background-color:#000000;}
--Splarka (rant) 23:22, 19 March 2007 (UTC)[reply]

Post a random smiley to a random user

Could someone make me a script that posts a random smiley to a random user all in one go? For more information on what I mean, see WP:BOTREQ#Smiling Bot, at the very bottom, specefically. TomasBat (@)(Contribs)(Sign!) 20:34, 17 April 2007 (UTC)[reply]

I'm dealing with this on the user's talk page (this is something of a niche request anyway, and it probably isn't appropriate for the scripts list due to the havoc this might cause if overused, and given its nature it'll probably spread by talkpage spam anyway). --ais523 14:51, 18 April 2007 (UTC)

Could someone make a script that would add a link to Special:NewPages to the "interaction" box on the side of the page? Mr.Z-mantalk¢ 22:44, 22 April 2007 (UTC)[reply]

This should work:
addOnloadHook(function () {
    addPortletLink("p-interaction", wgArticlePath.replace(/\$1/, 'Special:Newpages'), "New pages",
        "n-newpages", "View a list of recently created pages");
});
Be aware that changes have been made in the recent past to MediaWiki:Sidebar that could break this in the future. Particularly, the id for p-interaction could change. I've attempted to get some interest in addressing this issue at MediaWiki talk:Sidebar and Wikipedia:Village pump (technical), but there has been zero response to my dismay. Mike Dillon 23:34, 22 April 2007 (UTC)[reply]
Yep, that works great. Thanks! Mr.Z-mantalk¢ 00:10, 23 April 2007 (UTC)[reply]

Pre-defined edit summary drop-down

I would be really glad about a script that creates a drop-down menu over the edit summary line. From that menu you should be able to choose some pre-defined edit summaries. Reason: Doing stupid tasks sometimes require extensive summaries in order to avoid confusion among others. Furthermore, it is simply nice to have kind of "standardized" summaries for always the same task. The summaries in the menu should be definable in the monobook. — Pill (talk) 18:22, 30 April 2007 (UTC)[reply]

IIRC wikEd (User:Cacycle/wikEd) does something like this (among many other things), but it's probably overkill for such a simple task. Maybe the relevant part of the code could be made into a separate script? --ais523 10:40, 1 May 2007 (UTC)
There's no more simple variant? — Pill (talk) 22:17, 5 May 2007 (UTC)[reply]
Well, I have a feeling that either me or Mike Dillon will eventually write this script. Remind me in a week if that doesn't happen. — Alex Smotrov 00:44, 6 May 2007 (UTC)[reply]

This might work for you. Mike Dillon 04:02, 8 May 2007 (UTC)[reply]

var predefinedSummaries = {
    "stuff": "Doing stuff",
    "things": "Doing things"
};
addOnloadHook(function () {
    var summary = document.getElementById("wpSummary");
    if (!summary) return;

    var dropdown = document.createElement("select");
    dropdown.style.width = "15%";

    for (var label in predefinedSummaries) {
        var option = document.createElement("option");
        option.setAttribute("value", predefinedSummaries[label]);
        option.appendChild(document.createTextNode(label));
        dropdown.appendChild(option);
    }

    dropdown.onchange = function () {
        summary.value = summary.value.replace(/(\/\*.*?\*\/\s+)?.*/,
            "$1" + dropdown.options[dropdown.selectedIndex].value);
    };

    summary.parentNode.insertBefore(dropdown, summary.nextSibling);
});

Voting script

It would be really usefull if there was a script that added three extra buttons to the toolbar, one for a support, oppose, and neutral vote respectively, maybe something like this:

  • Support. Comment (optional) ~~~~
  • Oppose. Comment (optional) ~~~~
  • Neutral. Comment (optional) ~~~~

Seeing as voting is an essential part of Wikipedia, this could also standartise the procedure and save time. If someone doesn't want to leave a comment, he simply removes the ''Comment'' part. Thanks. —May the Edit be with you, always. (T-borg) (drop me a line) 21:15, 13 May 2007 (UTC)[reply]

 if (mwCustomEditButtons) {
   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "/media/wikipedia/commons/b/ba/Button_conserver.png",
     "speedTip": "Support",
     "tagOpen": "*[[Image:Symbol support vote.svg|15px]] \'\'\'Support\'\'\'. ",
     "tagClose": " ~~~~",
     "sampleText": "\'\'comment\'\'"};
 
   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "/media/wikipedia/commons/f/fc/Button_supp.png",
     "speedTip": "Oppose",
     "tagOpen": "*[[Image:Symbol oppose vote.svg|15px]] \'\'\'Oppose\'\'\'. ",
     "tagClose": " ~~~~",
     "sampleText": "\'\'comment\'\'"};
 
   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "/media/wikipedia/commons/4/4e/Button_neutre.png",
     "speedTip": "Neutral",
     "tagOpen": "*[[Image:Symbol neutral vote.svg|15px]] \'\'\'Neutral\'\'\'. ",
     "tagClose": " ~~~~",
     "sampleText": "\'\'comment\'\'"};
  }
Hint: you can probably also put in some simple logic to only trigger it on voting pages (if it were established site-wide). --Splarka (rant) 07:25, 14 May 2007 (UTC)[reply]
A script such as this would run counter to guidelines here on the English Wikipedia: see WP:!VOTE. Generally speaking, decisions should be made via consensus rather than voting. Templates showing Support and similar have been deleted several times at TfD for such reasons (e.g. see Template:Support's deletion log, which dates back to June 2005). There was a standalone program to do something like this called 'WikiVoter', but there was a backlash against it (people assumed that the name implied that it did nothing but add votes), and it was renamed WikiDiscussion Manager. This script appears to be something that does simply add votes, so I would recommend not using it. --ais523 07:49, 14 May 2007 (UTC)

I see. Thanks for clearing things up. —May the Edit be with you, always. (T-borg) (drop me a line) 07:52, 14 May 2007 (UTC)[reply]

"Add edit section 0" doesn't work on Safari 3

As the subject says, this script stopped working after an upgrade to Safari 3. Any way to fix it? --.anaconda 16:02, 3 July 2007 (UTC)[reply]

I don't have Safari to test it on, but here's a simplified version of the script I've just written that may avoid the problem:
// Simplified edit section 0
// Loosely based on [[Wikipedia:WikiProject User scripts/Scripts/Add edit section 0]]
 
addOnloadHook(function()
{
  var x=document.getElementById('ca-history');
  if(x!=null)
    addPortletLink('p-cactions', wgServer+wgScript+"?title="+encodeURIComponent(wgPageName)+
                                 "&action=edit&section=0", '0', 'ca-edit-0',
                                 'Edit the lead section of this page', '0', x);
});
Works, thank you :-) --.anaconda 22:50, 3 July 2007 (UTC)[reply]