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 Grim Revenant (talk | contribs) at 09:59, 18 May 2007 (Add speedy deletion templates to a page: WP:TWINKLE can do that.). 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]