Wikipedia:WikiProject User scripts/Requests/Fulfilled
This is the talk page for discussing improvements to the WikiProject User scripts/Requests/Fulfilled page. |
|
Archives: 1, 2, 3Auto-archiving period: 2 months ![]() |
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)
- 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)
Change all talk page links in a category to point to their main page
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)
- Give this a try (adds an action button). --Splarka (rant) 07:32, 19 March 2007 (UTC)
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)
- 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.
tolinks[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;}
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)
- 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)
"New pages" link in "interaction" portlet
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)
- 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)
- Yep, that works great. Thanks! Mr.Z-mantalk¢ 00:10, 23 April 2007 (UTC)
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)
- 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)
- 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)
- There's no more simple variant? — Pill (talk) 22:17, 5 May 2007 (UTC)
This might work for you. Mike Dillon 04:02, 8 May 2007 (UTC)
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:
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)
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)
- 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)
- 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
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)
"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)
- 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§ion=0", '0', 'ca-edit-0',
'Edit the lead section of this page', '0', x);
});
- Works, thank you :-) --.anaconda 22:50, 3 July 2007 (UTC)
Don't show articles in My Contributions where I'm the last contributor
I've looked and looked and can't find what I'm after. I'd like a script that, when I'm looking at My Contributions, only shows the articles where I'm not the most recent contributor. (Or, more specifically, a script that gives me the option to view the contributions that way.) ... discospinster talk 00:31, 25 September 2007 (UTC)
- Should just be a trivial tweak to User:ais523/topcontrib.js (which colours the lines corresponding to articles where you aren't top, rather than hiding them). I'll look into it. --ais523 07:25, 25 September 2007 (UTC)
- Here you go: User:ais523/hidetopcontrib.js puts a tab on Special:Contributions which hides (on all screens of results) all top edits and (on the first screen of results, and less reliably on later screens) all pages on which you have the top edit. --ais523 07:35, 25 September 2007 (UTC)
- Wonderful, thanks! Could you add a way to toggle between "hide top" and "show top"? ... discospinster talk 12:52, 25 September 2007 (UTC)
- Brilliant! Thanks so much. ... discospinster talk 14:02, 26 September 2007 (UTC)
- Here you go: User:ais523/hidetopcontrib.js puts a tab on Special:Contributions which hides (on all screens of results) all top edits and (on the first screen of results, and less reliably on later screens) all pages on which you have the top edit. --ais523 07:35, 25 September 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)
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)
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)
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)
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)
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)
- moved below with Mike Dillon's UTC corrections
- 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)
- Change this:
url += now.getFullYear() + '_' + mn[now.getMonth()] + '_' + now.getDate() + '&action=edit';
- to this:
url += now.getFullYear() + '_' + mn[now.getMonth()] + '_' + now.getDate();
- This is leaving aside the issue I mentioned earlier that these should all use UTC.
- P.S. the links are added to the toolbox in the order they appear in your user JavaScript. Mike Dillon 05:50, 12 September 2007 (UTC)
- Thanks very much! i said 06:00, 12 September 2007 (UTC)
- P.S. the links are added to the toolbox in the order they appear in your user JavaScript. Mike Dillon 05:50, 12 September 2007 (UTC)
- Right, so use this instead (Note that your example link included the edit link, why?). --Splarka (rant) 07:25, 12 September 2007 (UTC)
addOnloadHook(function() {
//add to tb: {{fullurl:Wikipedia:Articles for deletion/Log/{{CURRENTYEAR}}_{{CURRENTMONTHNAME}}_{{CURRENTDAY}}}}
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.getUTCFullYear() + '_' + mn[now.getUTCMonth()] + '_' + now.getUTCDate();
addPortletLink('p-tb', url, 'AFD/today', 'ca-afd', 'AFD for today');
});
Automatically view talk page discussion while looking at article
So often I notice that the discussion/talk page link is blue; back when I first signed up, I would usually visit the talk page to see what interesting discussions might have occurred on the article, and this was often valuable. But these days talk pages are so often a wasteland of banners and bot-edits and so I've fallen out of the habit, even though this often means I will miss the occasional real talk page. It's occurred to me that if there were some way to have the talk page for an article automatically shown, like at the bottom, then I could at a glance just from the scrollbar know whether there is real substantive stuff on the talk page and scroll down to look at it. Someone suggested that an 'inline' frame might be the way to go, but the closest I could find is "Wikipedia Inline Article Viewer", which doesn't quite do it. I don't know enough to modify it either. --Gwern (contribs) 03:14 18 September 2007 (GMT)
- Here is some ugly code to do that (test version). It appends the talk page to bodyContent in a 20em overflow:auto div. --Splarka (rant) 08:13, 18 September 2007 (UTC)
// ==================================================
// Fetch and Show talk page in bodyContent (test)
// ==================================================
var getReq;
if(wgNamespaceNumber==0) addOnloadHook(getTalkPage)
function getTalkPage() {
var tlink = document.getElementById('ca-talk');
if(tlink.className == 'new') return;
var url = tlink.getElementsByTagName('a')[0].href;
url += (url.indexOf('?')==-1) ? '?action=render' : '&action=render' ;
var tp = document.createElement('div');
tp.style.border = '1px solid blue';
tp.style.margin = '.5em 0';
tp.style.padding = '.35em';
tp.style.height = '20em';
tp.style.overflow = 'auto';
tp.id = 'ajax-talkpage';
tp.appendChild(document.createTextNode('fetching talk page...'));
document.getElementById('bodyContent').appendChild(tp);
getXML(url,getTalkPageStateChange);
}
function getTalkPageStateChange() {
switch (getReq.readyState) {
case 4:
if (getReq.status == 200) { // OK response
var tp = document.getElementById('ajax-talkpage');
clearNode(tp);
var txt = getReq.responseText;
tp.innerHTML = txt;
} else {
tp.appendChild(document.createTextNode('** Problem ** ' + getReq.statusText))
}
break;
}
}
function clearNode(obj) {
while(obj.firstChild) obj.removeChild(obj.firstChild);
}
function getText(obj) {
if (obj.nodeType == 3) return obj.nodeValue;
var txt = new Array();
var i=0;
while(obj.childNodes[i]) {
txt[txt.length] = getText(obj.childNodes[i]);
i++;
}
return txt.join('');
}
function getXML(url,func) {
if (window.XMLHttpRequest) { // Non-IE browsers
getReq = new XMLHttpRequest();
} else if (window.ActiveXObject) { // IE
getReq = new ActiveXObject('Microsoft.XMLHTTP');
}
if (getReq) {
getReq.onreadystatechange = func;
try {
getReq.open('GET', url, true);
getReq.send('');
} catch (e) {
alert(e);
}
} else {
alert('XMLHTTPRequest not supported');
}
}
- Neat! It seems to work pretty well, although it is perhaps not perfectly ideal - if it's greater than a certain length, it 'overflow's and is tucked away in its own frame? --Gwern (contribs) 16:49 18 September 2007 (GMT)
- If you want the entire talkpage to be shown whatever its length, change the line
tp.style.height = '20em';
- to
tp.style.height = 'auto';
- Seems to work. Thanks. --Gwern (contribs) 20:40 18 September 2007 (GMT)
Scheduler for WP-work or wikibreaks
Hi. I like the WikiBreak Enforcer script. But could somebody improve it, please? It'd be great to get a script that allows a log-in for a given period of time (hopefully adjusted by User) and then causes the User to log off. For instance, somebody could give themselves an hour in the morning and an hour in the evening to work on Wikipedia. Is this feasible and can somebody write the script? Thanks muchly. (Pls reply to my Talk, too, if you don't mind.) HG | Talk 07:23, 23 September 2007 (UTC)
- I've commented about this on HG's talk; more information's needed to pin down exactly what's being requested and whether this is feasible. --ais523 18:33, 24 September 2007 (UTC)
- Thanks very much for looking into this. My answers are: (1) Do I use the same browser and computer for everything? Yes, practically and if necessary. I would be very glad to have the script for that browser/computer. I also have access to other computers elsewhere. (2) Could the times at which you can log on are determined in advance? Yes, but. As you suggested, the script could select 2 time periods a day. But are you suggesting that the User (me) would be unable to modify those time periods? I would prefer to reset the time periods occasionally. (3) Would I mind information about whether you're logged on or not being publically available? Hmmm. Don't think I'd mind. (Where would I find info on this issue?) Thanks again for considering this request, ais523. Best wishes, HG | Talk 20:07, 24 September 2007 (UTC)
- I've written a script for this (it relies on (1) out of the three options given here). Sample usage: (copy to the start of your monobook.js, it won't work properly anywhere else)
- Thanks very much for looking into this. My answers are: (1) Do I use the same browser and computer for everything? Yes, practically and if necessary. I would be very glad to have the script for that browser/computer. I also have access to other computers elsewhere. (2) Could the times at which you can log on are determined in advance? Yes, but. As you suggested, the script could select 2 time periods a day. But are you suggesting that the User (me) would be unable to modify those time periods? I would prefer to reset the time periods occasionally. (3) Would I mind information about whether you're logged on or not being publically available? Hmmm. Don't think I'd mind. (Where would I find info on this issue?) Thanks again for considering this request, ais523. Best wishes, HG | Talk 20:07, 24 September 2007 (UTC)
wbeEditTime=60; wbeWaitTime=540; wbeEndDateY=2007; wbeEndDateM=12; wbeEndDateD=31; wbeBlockAnon=false; importScript("User:ais523/wikibreakenforcer.js");
- Basically, it enforces a wikibreak, but allows you to start 'editing periods' in which you can log in. The configuration above means that you can edit for 60 minutes at a time, but after doing so, you have to wait 540 minutes before you can log in again (that's wbeEditTime and wbeWaitTime). You can set a date on which it stops enforcing wikibreaks with wbeEndDateY, M, and D; the wbeBlockAnon option is an experimental option you can set to ask the script to try to prevent you viewing/editing Wikipedia even as an anon (you might not want to set this option, and anyway it doesn't work unless you use the 'remember me' preference when logging on). Hope that helps; if you have any more suggestions, feel free to contact me. --ais523 09:41, 25 September 2007 (UTC)
- Thanks so much for your fast work, Ais523. I'll give it a try this week and let you know (here) if I have any confusions about it. Thanks again! HG | Talk 00:09, 26 September 2007 (UTC)
- Basically, it enforces a wikibreak, but allows you to start 'editing periods' in which you can log in. The configuration above means that you can edit for 60 minutes at a time, but after doing so, you have to wait 540 minutes before you can log in again (that's wbeEditTime and wbeWaitTime). You can set a date on which it stops enforcing wikibreaks with wbeEndDateY, M, and D; the wbeBlockAnon option is an experimental option you can set to ask the script to try to prevent you viewing/editing Wikipedia even as an anon (you might not want to set this option, and anyway it doesn't work unless you use the 'remember me' preference when logging on). Hope that helps; if you have any more suggestions, feel free to contact me. --ais523 09:41, 25 September 2007 (UTC)
WikiBreak Enforcer modification.
Hello, I was wondering if this script could be modified to prevent me from editing during certain hours, but still edit the rest of the day. As you can probably tell, I'm not getting enough sleep. ;) · AndonicO Talk 23:39, 9 October 2007 (UTC)
- *Points up* Does that answer it? i said 23:41, 9 October 2007 (UTC)
After my request at Tra's talkpage about an extension to his script to arrange the translated sidebar alphabeticaly, he replied that he didn't know how but thought it possible (diff). Could someone here possibly write the new extension? ChrisDHDR 11:25, 20 October 2007 (UTC)
- See User talk:Alex Smotrov/iwtranslate.js. In the documentation I forgot the installation part, but it's just usual
importScript('User:Alex Smotrov/iwtranslate.js')
∴ AlexSm 22:24, 22 October 2007 (UTC)
Quicklink
Is there a script that could let me click a link in the toolbox or make a tab that would bring me down to a user's sandbox? If you really want to know why I want it I'll say, but it's embarrassing... YДмΔќʃʀï→ГC← 10-23-2007 • 23:38:52
- As a one-liner, you could use the following:
addPortletLink ('p-tb', location.href+'/Sandbox', 'Sandbox subpage');
- This may need to be customized depending on exactly what you want to do, though. --ais523 19:44, 2 November 2007 (UTC)
Watchlist script
I need A script that would automatically highlight new edits in my watchlist (ones that weren't there the last time I checked my watchlist). Note: I have already considered Wikipedia:WikiProject User scripts/Scripts/Watchlist since, however it doesn't suit my needs (in you are unsure you contact me on my talkpage). Script must work on Internet Explorer7.--Sunny910910 (talk|Contributions) 22:28, 30 October 2007 (UTC)
- I've added this feature to User:ais523/watchlistnotifier.js (tested on Firefox 2 and IE7); watchlist entries that weren't there the last time you viewed your watchlist will be bolded (as well as the other features of the script, which display an unobtrusive message whenever you have a new watchlist entry). You can include it the usual way (by adding {{subst:js|User:ais523/watchlistnotifier.js}} to the end of your monobook.js). --ais523 11:49, 31 October 2007 (UTC)
- Maybe I misunderstand the original request, but wouldn't using Watchlist since and simply leaving watchlist browser window open all the time be a more convenient option? The suggested watchlistnotifier script needs to be run on the same computer anyway (since it depends on a cookie) ∴ AlexSm 14:57, 31 October 2007 (UTC)
- Using the "Watchlist since" script may be more convenient for other people, but I dislike having too many browsers open as it clutters everything.--Sunny910910 (talk|Contributions) 23:56, 31 October 2007 (UTC)
- As for User:ais523/watchlistnotifier.js, I think its what I was looking for.--Sunny910910 (talk|Contributions) 23:58, 31 October 2007 (UTC)
- Using the "Watchlist since" script may be more convenient for other people, but I dislike having too many browsers open as it clutters everything.--Sunny910910 (talk|Contributions) 23:56, 31 October 2007 (UTC)
- Maybe I misunderstand the original request, but wouldn't using Watchlist since and simply leaving watchlist browser window open all the time be a more convenient option? The suggested watchlistnotifier script needs to be run on the same computer anyway (since it depends on a cookie) ∴ AlexSm 14:57, 31 October 2007 (UTC)
Drop down box
I have a script imported into my JS (I think it was made by ais523) which, when clicking on the tab, brings up a box, where I type in what type of stub I would like to add, and it will automatically add it. I would eventually like to have a drop down box with all the stub types (or some of them) implemented into the popup box. I would add all the necessary types myself, but it would help if someone here could tell me how add in the drop down box. Thanks jj137 (Talk) 00:23, 19 November 2007 (UTC)
- What do you think of User:ais523/stubtagtab2.js? --ais523 17:53, 22 December 2007 (UTC)
- That is really cool. Thank you! jj137 ♠ 18:04, 22 December 2007 (UTC)
Status script
What I am wanting is to add a script to my monobook.js where all I have to do is click a tab/radio button/drop down menu to change this instead of having to always manually go there and manually changing it to in/out/busy. I know this would be a useful script for a lot of people as well. So, anyone up for the task of writing this? -- ALLSTARecho 08:28, 10 December 2007 (UTC)
- No one want to tackle this? It'd be very useful and your WikiHomies would love you for it! ;) -- ALLSTARecho 19:33, 12 December 2007 (UTC)
- It shouldn't be very difficult, but I'm very busy in Real Life at the moment and don't really have time to write it right now. --ais523 19:56, 12 December 2007 (UTC)
- Personally I find such a script a misuse of server resources. Also, I would never write anything for a user with such signature ∴ AlexSm 20:31, 12 December 2007 (UTC)
- Thanks for your opinion. See this about what it means to me. -- ALLSTARecho 21:58, 12 December 2007 (UTC)
- Try this. Just made it, for my purposes, actually. I need the same thing. --cuckooman (talk) 21:03, 3 January 2008 (UTC)
- Thanks for your opinion. See this about what it means to me. -- ALLSTARecho 21:58, 12 December 2007 (UTC)
- Personally I find such a script a misuse of server resources. Also, I would never write anything for a user with such signature ∴ AlexSm 20:31, 12 December 2007 (UTC)
- It shouldn't be very difficult, but I'm very busy in Real Life at the moment and don't really have time to write it right now. --ais523 19:56, 12 December 2007 (UTC)
Script for different "modes" of editing
This is an idea for a script that I've had for a while. Basically, most editors will be doing one of these things at any given time: reading Wikipedia, contributing, performing maintenance tasks, discussing, or patrolling. While doing any one of these, editors are unlikely to use any scripts related to the others.
Would it be possible to create a script that lets editors switch between these "modes" of using Wikipedia? What I'm thinking is a pulldown menu in the small empty space to the left of the userpage/talk/prefs/contribs links at the top. It would have user-defined settings, and users could set each script they use to be enabled or disabled with certain settings. My guess is it could be created using cookies.
For example, using the example modes I mentioned above, Twinkle and Friendly would be enabled for patrolling and maintenance modes, but disabled for reading, contributing, and discussing modes, where they wouldn't be needed. wikEd would be enabled only for contributing, discussing, and maintenance, while popups would be enabled in all modes.
This script might decrease loading time of JavaScript by having pages load only the scripts for the current mode. It could also help to clear up page clutter caused by using a lot of scripts. Does anyone have an idea of how to go about making this script? Pyrospirit (talk · contribs) 22:22, 15 December 2007 (UTC)
- This wouldn't be too terribly hard. I wrote a quick example of how this could be done:
if (parseInt(getCookie('enableTwinkle')) == 1) importScript('User:AzaToth/twinkle.js')
if (parseInt(getCookie('enableSearchbox')) == 1) importScript('User:Zocky/SearchBox.js')
function extensionHandler() {
addPortletLink('p-tb','javascript:cookieToggle("enableTwinkle")','Twinkle','t-e-twinkle','toggle twinkle','1');
addPortletLink('p-tb','javascript:cookieToggle("enableSearchbox")','Searchbox','t-e-searchbox','toggle searchbox','2');
}
addOnloadHook(extensionHandler);
function cookieToggle(cookiename) {
var cookiestatustext = ['disabled','enabled'];
var cookiestatus = parseInt(getCookie(cookiename));
if (isNaN(cookiestatus)) cookiestatus = 0
cookiestatus = (cookiestatus==0) ? 1 : 0;
setCookie(cookiename,cookiestatus);
alert('The extension control >>' + cookiename + '<< has been:\n' + cookiestatustext[cookiestatus]);
}
// Cookie helpers, modified from en.wiktionary
function setCookie(cookieName, cookieValue) {
var today = new Date();
var expire = new Date();
var nDays = 365;
expire.setTime( today.getTime() + (3600000 * 24 * nDays) );
document.cookie = cookieName + "=" + escape(cookieValue)
+ ";path=/"
+ ";expires="+expire.toGMTString();
}
function getCookie(cookieName) {
var start = document.cookie.indexOf( cookieName + "=" );
if ( start == -1 ) return "";
var len = start + cookieName.length + 1;
if ( ( !start ) &&
( cookieName != document.cookie.substring( 0, cookieName.length ) ) )
{
return "";
}
var end = document.cookie.indexOf( ";", len );
if ( end == -1 ) end = document.cookie.length;
return unescape( document.cookie.substring( len, end ) );
}
function deleteCookie(cookieName) {
if ( getCookie(cookieName) ) {
document.cookie = name + "=" +
";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}
}
- As-is, this simply requires two extra lines for each new script, and sets a crude cookie to enable-disable each one via a javascript: link in the sidebar (and of course, a simple page refresh (but not cache purge) is required, as easy as clicking [Back] and [Forward] in your browser). This can be done a lot snazzier, and the scripts can be grouped in a bigger if() block for multiple scripts in one cookie... but this was simply a test/jumping point. --Splarka (rant) 09:27, 16 December 2007 (UTC)
- Thanks. This is pretty much what I was thinking of. Pyrospirit (talk · contribs) 18:11, 16 December 2007 (UTC)
I've been also thinking how scripts could be optimized for the pages where they cannot be not used at all. There are two aspects here:
- traffic: the script still gets reloaded from the server from time to time (I don't have any idea how often though)
- processing time: the script still takes some time to check that it has nothing to do on the page
I think some improvement can be achieved by checking conditions before importing a script: e.g. for editing mode script: if (wgAction=='edit' || wgAction=='submit') importScript(...)
. Also some scripts can be called "dynamically" on request (e.g. wlunwatch)∴ AlexSm 15:36, 18 December 2007 (UTC)
- Thanks, I'll try using that. Chance of me breaking something: 99%. Pyrospirit (talk · contribs) 21:46, 18 December 2007 (UTC)
- Sorry, but this time I broke it: should be
==
insideif
(fixed now) (that wasn't a real script, so I didn't test it as I usually do). I forgot to mention that generally I don't like cookie solutions because I visit Wikipedia from several computers. And another possible way to "switch modes" is to put some scripts into, say, myskin.js, and then switch skins (unfortunately, have to be done manually in preferences) ∴ AlexSm 22:08, 18 December 2007 (UTC)
- Sorry, but this time I broke it: should be
Cleanup of Splarka's sorting script for Special:Log/rights
/RightsSorter.js needs cleanup. This is supposed to let you filter out one right change you don't care about (ie. "rollback") and it autofilters out null rights changes. – Mike.lifeguard | @en.wb 04:52, 10 January 2008 (UTC)
- Not exactly what you requested, but I just updated LogPage Table script to recognize giving/removing rollback flag and use appropriate icons ∴ AlexSm 18:06, 10 January 2008 (UTC)
Right; this script is for looking at Special:Log/rights and sorting out the different rights changes (not just rollback, I think), since MW doesn't let you narrow the log down further than that (pending bugzilla:12571). – Mike.lifeguard | @en.wb 19:49, 10 January 2008 (UTC)
Done at User:Splarka/lifilter.js. It's really nice too! – Mike.lifeguard | @en.wb 00:38, 12 January 2008 (UTC)
- Yah, please delete /RightsSorter.js too, embarrasing outline. --Splarka (rant) 00:43, 12 January 2008 (UTC)
Man, that form building code would be so much nicer if it used my Easy DOM code:
with (easydom) {
var rf = form({ 'action': 'javascript:void(0)', 'id': 'rfform' },
fieldset(
legend('Filter rights log (javascript)'),
select({ 'id': 'rfselect' },
option('added rights'),
option('removed rights'),
option('added OR removed'),
option('added/removed/static')
),
label({ 'for': 'rfinput1' }, ' Regex string: '),
' ',
input({ 'id': 'rfinput1', 'name': 'rfinput1', 'type': 'text' }),
input({ 'id': 'rfinput2', 'name': 'rfinput2', 'type': 'checkbox' }),
label({ 'for': 'rfinput2' }, 'Invert '),
input({ 'type': 'button', 'value': 'filter', 'onclick': 'filterRights(false)' }),
' ',
input({ 'type': 'button', 'value': 'hilight', 'onclick': 'filterRights(true)' })
)
);
}
(this form is untested, but Easy DOM is extensively tested). Mike Dillon 03:51, 12 January 2008 (UTC)
- Well, sure, but that would require, what, four extra pages of code being downloaded and parsed by the browser?... to turn a page and a half of code into half a page of code. The net gain for this implementation seems negative. ^_^ --Splarka (rant) 04:42, 12 January 2008 (UTC)
- You just reminded my why I've been spending most of my wiki-time on Wiktionary. Thanks. Mike Dillon 04:55, 12 January 2008 (UTC)
Can someone tell me why my script doesn't work? It's suppost to added {{subst:Vandalism1}}
onto a user's talkpage, without saving it so I can added the article name. I need a script like this because TW doesn't work on IE which I intend to use it on. If anybody can help it would be appreciated. I am not much of a javascript writer, I borrowed this foundations of this script from another script that someone gave me, it needed I could show it. --Sunny910910 (talk|Contributions) 04:15, 3 February 2008 (UTC)
- Javascript is case sensitive. You have javascript:Vand1(), but function vand1(). --Splarka (rant) 08:16, 3 February 2008 (UTC)
- No wonder why it didn't work. Thanks!--Sunny910910 (talk|Contributions) 21:47, 3 February 2008 (UTC)
user script for magical Esperanto character conversion at arbitrary wikis
Dear friends; The MediaWiki code contains a « magical Esperanto character conversion » which is enabeled at all Esperanto projects. The requested Javascript should add this character conversion to arbitrary wikis via user JavaScript pages. Thanks for all your efforts in advance! Best regards
·לערי ריינהארט·T·m:Th·T·email me· 21:05, 3 February 2008 (UTC)
- Personally, I have no idea what kind of conversion is that ∴ AlexSm 17:30, 5 February 2008 (UTC)
Dear AlexSm please see http://eo.wikipedia.org/w/index.php?&oldid=1560278 and the following revisions. I tried to simulate
cx converts to ĉ gx converts to ĝ hx converts to ĥ jx converts to ĵ sx converts to ŝ ux converts to ŭ ... continued at « w:eo: »
Because the description here is a "meta language" I did not simulate all requirements at « w:eo: » .
cxx and cxX converts to cx cxxx converts to ĉx cXxX converts to ĉX cxXx, cXXx, and cXXX converts to ĉX
The algorithm is as follows:
- it is triggered if lower or upper case c, g, h, j, s or u is followed by lower or upper case x
- it is necessary to identify the string to be substituted
- that string starts with the (first) character that triggered the algorithm
- that string contains also the following lower or upper case x and all subsequent lower or upper case x's
- processing starts from the end of the string to be substituted; from the last x|X
- main substitution /convertion loop
- the last but one character is analyzed
- is it upper or lower case
- is it c|C, g|G, h|H, j|J, s|S, u|U or x|X
- to determing the substitution / conversion one should
- preserve the case
- substitute / convert the last and last but one character to ĉ|Ĉ, ĝ|Ĝ, ĥ|Ĥ, ĵ|Ĵ, ŝ|Ŝ, ŭ|Ŭ, or x|X depending of the match identified before
- readjust the string to be substituted; it is shortened by two characters at the end
- the last but one character is analyzed
- the algorithm stops either if only one character from the string to be substituted has left or that string is empty
- example:
- « cxgxhx » should trigger the algorithm three times and generate « ĉĝĥ »
- Best regards
- ·לערי ריינהארט·T·m:Th·T·email me· 04:28, 6 February 2008 (UTC)
An implementation
Here is a working example script: User:Splarka/esperanto.js
- Note that "
cXxX converts to ĉX
" ... it actually it produces "ĉx".
The way you described it seemed overly complex. What I did:
- On document load it adds a new portlet tab (this could be automated I suppose, but this can be very slow on large pages).
- Clicking the tab on action=edit or action=submit (preview) only affects the textarea, on all other actions it checks the bodyContent (this could be expanded to the whole document I suppose)
- All text nodes of the above selected object are searched for the regex matches to
/[cghjsu][x]+/ig
- These matches are iterated over in reverse for each node (this is to prevent messing up the match count by changing the match).
- For each match, the length of the match is determined.
- If it is an even length, the first two characters are converted (with the case determined by the case of the first character)
- If it is an odd length, the first one character is left literal, the rest of the X pairs (if any) are cropped to the first. so [xX][xx][Xx] returns xxX
- For the rest of the match, the pairs of Xs (if any) are cropped to the case of the first. so [xX][xx][Xx] returns xxX
- All text nodes of the above selected object are searched for the regex matches to
As far as I can tell, this almost exactly matches what eo.wikipedia does.... test it? --Splarka (rant) 23:02, 8 February 2008 (UTC)
validation check for ISBN links
→ bugzilla:002391 · "Implement a validation check for ISBN links"
Dear friends; Can somebody implement this as a JavaScript? Thanks for all your efforts in advance! Best regards
·לערי ריינהארט·T·m:Th·T·email me· 21:36, 3 February 2008 (UTC)
- The checking algorithm itself looks easy to implement, but you also need some kind of interface to that. Advisor script seems like a perfect choice for this task. You could ask the authour to build ISBN checks into his script, or we could probably create a "plugin" as described at the bottom of the script description ∴ AlexSm 17:30, 5 February 2008 (UTC)
- I added validation of 10 and 13-digit ISBN-s to the script. --Cameltrader (talk) 18:58, 22 March 2008 (UTC)
watch tab that adds images and/or templates of an article to watchlist
I'd like to request a script that would add a tab (or some other button) that could watchlist all images (and maybe templates) used in an article. A lot of images go unwatched for many articles. It would be great to be able to watchlist all of the images in an article in one click. -- Ned Scott 05:23, 5 February 2008 (UTC)
- I do not work with images, but as far as I know, you will not see deletions or new versions uploads in your watchlist. You will only be notified when someone changes the image description. Also, there doesn't seem to be a way for a script to add a Commons image to your watchlist. Adding templates to your watchlist is possible, however they might include other templates which are still not going to be watched by you ∴ AlexSm 17:30, 5 February 2008 (UTC)
- Yeah, I figured as much. While rare, I have seen some cases of image description page vandalism, and some test edits that have removed image tags and such. Deletion notices would also trigger the watchlist, as well as anything posted on the talk page. Most people probably wouldn't have a use for it, but it's something I've always kind of wanted. -- Ned Scott 07:23, 6 February 2008 (UTC)
- Another poke, would this even be possible? -- Ned Scott 07:39, 17 February 2008 (UTC)
- Here is something to tide you over until someone writes it for you in nice ajax.
if(wgNamespaceNumber == 0 && wgAction == 'view' && wgEnableAPI) {
var url = wgServer + wgScriptPath + '/api.php?action=query&prop=images|templates&callback=watchTemplatesImages&format=json&titles=' + encodeURIComponent(wgPageName);
var scriptElem = document.createElement('script');
scriptElem.setAttribute('src',url);
scriptElem.setAttribute('type','text/javascript');
document.getElementsByTagName('head')[0].appendChild(scriptElem);
var imagesHere = new Array();
var templatesHere = new Array();
addOnloadHook(function() {
addPortletLink('p-cactions','javascript:watchTemplatesImagesDo()','Watch All','ca-watchall','Watch all templates and images in this page');
});
}
function watchTemplatesImages(obj) {
if(!obj['query'] || !obj['query']['pages'] || !obj['query']['pages'][wgArticleId]) return
imagesHere = obj['query']['pages'][wgArticleId]['images'];
templatesHere = obj['query']['pages'][wgArticleId]['templates'];
if(!imagesHere) imagesHere = [];
if(!templatesHere) templatesHere = [];
}
function watchTemplatesImagesDo() {
//half-assed watchlist/addendum-generator thing
var cs = document.getElementById('contentSub');
if(!cs) return;
var wall = document.createElement('div');
wall.style.backgroundColor = '#bbffbb';
wall.style.padding = '8px';
wall.appendChild(document.createTextNode('WATCH ALL: Please copy the text in the textarea below to your '));
var wlink = document.createElement('a');
wlink.setAttribute('href',wgServer + wgScript + '?title=Special:Watchlist/raw');
wlink.appendChild(document.createTextNode('Raw watchlist'));
wall.appendChild(wlink);
var wlta = document.createElement('textarea');
wlta.setAttribute('id','wlta');
wlta.setAttribute('readonly','readonly');
wlta.style.height = '6em';
wlta.style.backgroundColor = '#fff6dd';
for(var i=0;i<imagesHere.length;i++) {
wlta.value += imagesHere[i].title + '\n';
}
for(var i=0;i<templatesHere.length;i++) {
wlta.value += templatesHere[i].title + '\n';
}
wall.appendChild(wlta);
cs.appendChild(wall);
}
- Should work, may be a bit buggy. Creates a textarea in your contentSub that you can copy to your raw watchlist. Someone else can create a queued ajax system that checks to make sure each template exists and each image is local and not on commons. --Splarka (rant) 10:19, 17 February 2008 (UTC)
- Awesome, thanks! -- Ned Scott 06:27, 28 February 2008 (UTC)
- MZMcBride and I had a thought on how you (or rather, whoever writes this) could check the list of images, for if they were local images or not with an intermediary api call. For example if you had Image:Wiki.png and Image:Bullet-blue.png as images in a page, an API call like:
/w/api.php?action=parse&format=json&callback=imagecommonscheck&text=[[:Image:Wiki.png]]+[[:Image:Bullet-blue.png]]
- and then a snippit to check it
function imagecommonscheck(obj) { var imagecheck = obj['parse'].links; for(var i=0;i<imagecheck.length;i++) { if(imagecheck[i].exists) { //this is only true if the image is not on commons, title is: imagecheck[i]['*'] } } }
- --Splarka (rant) 07:39, 4 March 2008 (UTC)
- I think a better way to do this is using imageinfo:
/w/api.php?action=query&format=jsonfm&titles=Image:Albert%20Einstein%20Head.jpg|Image:Hitler_with_other_German_soldiers.jpg&prop=imageinfo
To verify:
function imagecommonscheck(obj) { var imagecheck = obj['query']['pages']; for(var i=0;i<imagecheck.length;i++) { if(imagecheck[i]['imagerepository'] == "local") { //this is only true if the image is not on commons, title is: imagecheck[i]['*'] } } }
- Not yet tested. Superm401 - Talk 08:35, 23 April 2008 (UTC)
Two new incentives for continued work on this request: one is that MediaWiki has been updated and deletions now show up on the watchlist, and two, I've doubled the bounty on this request from $20 to $40. -- Ned Scott 03:29, 17 April 2008 (UTC)
- And new versions of images too. Also, if it makes it easier, a script that works with just images and not templates would be sufficient for this request. -- Ned Scott 05:53, 18 April 2008 (UTC)
Test this out: User:Splarka/watchimages.js. It is not fully automated though. What it does:
- On a content page, it adds a toolbox button.
- If clicked it queries the API for all images.
- It checks which are local vs commons, which exist, which have description pages.
- Currently selects local or missing images (with or without pages) not on commons.
- Sends you to Special:Watchlist/raw with the pages as a URI parameter
- Appends these to the textarea, alerts you.
- You then either choose to update, edit, or do nothing.
- Upon save, it returns you to the page.
Of course, it could be streamlined a bit more. It could be automated, have more logic (check if page has images, check if images are repeats on watchlist, filter out logos, etc). Also, it specifically does not use ajax at this time (ajax POST is annoying), but should be good enough to test. --Splarka (rant) 06:48, 24 April 2008 (UTC)
- Awesome! Even this alone is a huge help, and is probably enough to make claim to the donation bounty. Thanks Splarka! -- Ned Scott 03:32, 25 April 2008 (UTC)
- A part of the bounty process is to credit those who worked on the task (the bounty hunters). Here's what I have for the donation public comment "
en:WP:BOUNTY on image watchlist user script en:user:Splarka/watchimages.js . Major thanks to en:user:Splarka ! Also thanks to en:user: MZMcBride, Superm401, and AlexSm, in discussion.
" - Obviously Splarka is in there, and since there was room I also included all the names in this thread. Are there any names I should add or remove? -- Ned Scott 03:48, 25 April 2008 (UTC)
- Well, I went ahead and made the donation, though I was hopping to link to the public comment, I can't seem to figure out how (or where it is displayed). In any case, thank you again for the work on this, and I look forward to seeing how the script develops :D -- Ned Scott 07:53, 26 April 2008 (UTC)
- A part of the bounty process is to credit those who worked on the task (the bounty hunters). Here's what I have for the donation public comment "
- Awesome! Even this alone is a huge help, and is probably enough to make claim to the donation bounty. Thanks Splarka! -- Ned Scott 03:32, 25 April 2008 (UTC)
w3.org validation tabs
Dear friends; Please create some gadget functionality to provide w3.org validation tabs similar to
[http://validator.w3.org/check?uri={{URLENCODE:{{SERVER}}/wiki/{{FULLPAGENAME}}?uselang={{CONTENTLANG}}}}&charset=%28detect+automatically%29&doctype=Inline&group=0 XHTML 1.0]<br /> [http://jigsaw.w3.org/css-validator/validator?uri={{URLENCODE:{{SERVER}}/wiki/{{FULLPAGENAME}}?uselang={{CONTENTLANG}}}} CSS]<br />
Thanks for all your efforts in advance! Best regards
·לערי ריינהארט·T·m:Th·T·email me· 11:59, 8 February 2008 (UTC)
simplified
[http://validator.w3.org/check?uri={{URLENCODE:{{SERVER}}/wiki/{{FULLPAGENAME}}&charset=%28detect+automatically%29&doctype=Inline&group=0}} XHTML 1.0]<br /> [http://jigsaw.w3.org/css-validator/validator?uri={{URLENCODE:{{SERVER}}/wiki/{{FULLPAGENAME}}}} CSS]<br />
Best regards
·לערי ריינהארט·T·m:Th·T·email me· 12:03, 8 February 2008 (UTC)
notes
{{URLENCODE:... {{FULLPAGENAME}}}} will fail here; one could use short url's
[http://jigsaw.w3.org/css-validator/validator?uri={{URLENCODE:{{SERVER}}{{SCRIPTPATH}}/index.php?oldid={{REVISIONID}}}} CSS]<br />
generating:
CSS
alternatively one could try to use liks containing {{FULLPAGENAMEE}}
Best regards
·לערי ריינהארט·T·m:Th·T·email me· 12:11, 8 February 2008 (UTC)
- I am not sure I fully understand all of your request, but I took the first example and made it into a script to add tabs to the toolbox (below the search box):
addOnloadHook(function() {
var xmlurl = 'http://validator.w3.org/check?uri=' + encodeURIComponent(wgServer + wgScript + '?title=' + encodeURIComponent(wgPageName) + '&uselang=' + wgContentLanguage) + '&charset=%28detect+automatically%29&doctype=Inline&group=0';
addPortletLink('p-tb',xmlurl,'XHTML 1.0');
var cssurl = 'http://jigsaw.w3.org/css-validator/validator?uri=' + encodeURIComponent(wgServer + wgScript + '?title=' + encodeURIComponent(wgPageName) + '&uselang=' + wgContentLanguage);
addPortletLink('p-tb',cssurl,'CSS 2.1');
});
Thanks Splarka! I tested the functions at m:s:yi:MediaWiki:Common.js oldid=3489. Best regards
·לערי ריינהארט·T·m:Th·T·email me· 19:20, 9 February 2008 (UTC)
simplified and working (usinf {{FULLPAGENAMEE}})
[http://validator.w3.org/check?uri={{URLENCODE:{{SERVER}}/wiki/}}{{FULLPAGENAMEE}}&charset=%28detect+automatically%29&doctype=Inline&group=0 XHTML 1.0]<br /> [http://jigsaw.w3.org/css-validator/validator?uri={{URLENCODE:{{SERVER}}/wiki/}}{{FULLPAGENAMEE}} CSS]<br />
generating:
Best regards
·לערי ריינהארט·T·m:Th·T·email me· 18:57, 9 February 2008 (UTC)
FYI: CSS validator uri bug
Dear friends; Please read about "different uri= parameter encoding at http://validator.w3.org/check?uri= and http://jigsaw.w3.org/css-validator/validator?uri=" at m:wikt:yi:user:I18n/CSS validator uri bug. I noticed this while "traveling'"" through different language wikis. Best regards
·לערי ריינהארט·T·m:Th·T·email me· 01:21, 10 February 2008 (UTC)
- Okay, try this version with a null title, references the article by curid.
addOnloadHook(function() {
var xmlurl = 'http://validator.w3.org/check?uri=' + encodeURIComponent(wgServer + wgScript + '?title=-&curid=' + wgArticleId + '&uselang=' + wgContentLanguage) + '&charset=%28detect+automatically%29&doctype=Inline&group=0';
addPortletLink('p-tb',xmlurl,'XHTML 1.0');
var cssurl = 'http://jigsaw.w3.org/css-validator/validator?uri=' + encodeURIComponent(wgServer + wgScript + '?title=-&curid=' + wgArticleId + '&uselang=' + wgContentLanguage);
addPortletLink('p-tb',cssurl,'CSS 2.1');
});
- This would also be possible with '?title=-&curid=' + wgCurRevisionId too. --Splarka (rant) 09:55, 12 February 2008 (UTC)
uselang=foo tabs
Dear friends; Please create some gadget functionality to provide uselang=foo tabs. They should be used when working at a wiki and if one would like to see / verify the user interface in another language. The code can be similar to
{{fullurl:{{FULLPAGENAME}}|uselang=foo}}
An example is available at the test wiki: template:this/eng. Thanks for all your efforts in advance! Best regards
·לערי ריינהארט·T·m:Th·T·email me· 12:50, 8 February 2008 (UTC)
- Hows this? the var langs array defines which langs to add buttons for.
addOnloadHook(function() {
var langs = ['en','de','fr','ru'];
for(var i=0;i<langs.length;i++) {
addPortletLink('p-cactions',wgServer + wgScript + '?title=' + encodeURIComponent(wgPageName) + '&uselang=' + langs[i], langs[i]);
}
});
Thanks Splarka! I tested the functions at m:s:yi:MediaWiki:Common.js oldid=3490.
For some reason not known to me the tabs disapear if I select the « de » tab - Deutsch. I have selected « yi - ייִדיש » preferences.
I experienced similar behaviour about a disapearing « purge » tab at « wikt:yi: » if I select « de - Deutsch » as language in my preferences there.
I am using the following browsers:
- a) Mozilla/5.0 (X11; U; Linux i686; de; rv:1.8.1.3) Gecko/20070427 Firefox/2.0.0.3 on Linux KDE 3.5.5
- b) Opera see configuration at http://test.wikipedia.org/wiki/User:I18n/Opera
- c) Konqueror 3.5.5 (Using KDE 3.5.5)
- all on KDE version 3.5.5; System: Linux; Release: 2.6.22-gentoo-r2; Machine: i686
Can you please investigate on this? Thanks for all your efforts in advance. Best regards
·לערי ריינהארט·T·m:Th·T·email me· 19:40, 9 February 2008 (UTC)
- Common.js and Monobook.js is called on every page through title=-&action=raw&gen=js file. The new code you just added is not there yet, so this looks like a caching issue. I think you just have to wait. / AlexSm 20:45, 9 February 2008 (UTC)
Thanks Alex for the comment! I implemented w:yi:MediaWiki:Gadget-UseLang and w:yi:MediaWiki:Gadget-UseLang.js at w:yi:special:Preferences. As far as I can see the new tabs are inserted at an absolut position from the reference point which is at the right on « w:yi: » . Depending on the lenght of the previous tabs one can see some of the new tabs or not; this is language dependent; it depends on what tab you have clicked before.
Please take a look at w:nn:special:Prefixindex/MediaWiki:Gadget. There you will find many language related gadgets. They are implemented / selectable one by one. This might be also the case for different contributors and visitors at « w:yi: » . How such a code would look like?
re: « caching issues » I created a lot of test pages as « user:I18n » . These are oficial aliases as decribed at fr:project:Alias de Wikipédiens#Les alias officiels. The list can be seen at commons:user:I18n#i18n accounts. I did not experience much page caching because immediatelly after placing some notes at the « MediaWiki talk:Gadgets-definition » pages the « validations at w3.org: XHTML 1.0 » links at these test pages returned either a green / OK status or a minimal amount of errors (one error). Exceptions where the following UTF-8 languages: sd: ru: zh: ja: .
Best regards
·לערי ריינהארט·T·m:Th·T·email me· 22:48, 9 February 2008 (UTC)
P.S. w:yi:MediaWiki:Gadget-UseLang does not work at w:yi:special:Preferences. No clue why. Best regards
·לערי ריינהארט·T·m:Th·T·email me· 23:31, 9 February 2008 (UTC)
- P.P.S. The UseLang code work in « s:yi » (the language tabs show up at s:yi:special:Preferences). The UseLang code is defined there trough s:yi:MediaWiki:Common.js. But the language tabs do not show up at wikt:yi:special:Preferences and they do not show up at w:yi:special:Preferences. Regards
- ·לערי ריינהארט·T·m:Th·T·email me· 09:07, 11 February 2008 (UTC)
- Gadgets don't load for Special:Preferences (for security). So if you want this on that page, you can add to MediaWiki:Common.js at these projects :
if(wgCanonicalSpecialPageName == "Preferences") addOnloadHook(function() {
var langs = ['en','de','fr','ru'];
for(var i=0;i<langs.length;i++) {
addPortletLink('p-cactions',wgServer + wgScript + '?title=' + encodeURIComponent(wgPageName) + '&uselang=' + langs[i], langs[i]);
}
});
- And have that for all users, but any other page require the gadget. --Splarka (rant) 09:23, 11 February 2008 (UTC)
- Implemented at wikt:yi:MediaWiki:Common.js?diff=11822&oldid. It works fine. Thank you very much! Best regards
- ·לערי ריינהארט·T·m:Th·T·email me· 09:33, 11 February 2008 (UTC)
How can we make the Add edit section 0 script worked in Wikia, etc.?
In some other wikis such as MediaWiki.org, WikiaWikia, etc. (even in my wiki!), the Add edit section 0 script can't be worked, but I don't know the reason. How can we make it worked in those wikis? ― 韓斌/Yes0song (談笑 筆跡 다지모) 15:24, 11 February 2008 (UTC)
- Sorry, they're working now in MediaWiki.org and Wikia. ― 韓斌/Yes0song (談笑 筆跡 다지모) 14:46, 16 February 2008 (UTC)
Force show preview
i know ive seen this before, but can someone direct me/post the code for forcing the show preview button? it causes the save button to be unclickable until you click show preview.--24.109.218.172 (talk) 02:42, 13 February 2008 (UTC)
if(wgAction=='edit') addOnloadHook(function() { document.getElementById('wpSave').disabled = 'disabled'; })
if (wgAction=='edit') addOnloadHook(function() {
var wpSave = document.getElementById('wpSave')
if (wpSave) wpSave.disabled = 'disabled'
})
- This version above avoids JS errors on "View source" (protected pages). By the way, the code like this also usually changes "Save" button into "Save (after preview)", and makes "Preview" button bold. 6 out of 10 biggest Wikipedias implemented this for unlogged users, so just check Common.js on: de, fr, sv, nl, ja, pt. -AlexSm 17:20, 13 February 2008 (UTC)
Quickly add a new category
I am requesting a script that would add a link when viewing an article. When clicked on, it will show a JavaScript prompt, requesting for a Category to add to the current article; when one is entered and OK is hit, then the category will be added to the article. Gary King (talk) 07:02, 17 February 2008 (UTC)
- User:ais523/cattab.js is a start at this. It works, but it's a bit rudimentary; it always puts the category at the start of the article's category list (or at the end of the article if it doesn't have a category list), and doesn't handle sortkeys. --ais523 12:59, 25 February 2008 (UTC)
- You may want to try MediaWiki:Gadget-HotCat.js. Superm401 - Talk 01:49, 25 April 2008 (UTC)
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.
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)
- I think it's possible, but it would be pretty difficult. --ais523 14:36, 12 May 2007 (UTC)
- Mr.Z-man might be able to help with that, he did make refTools. – ThatWikiGuy (talk | life | I feel like I'm being watched) 23:43, 2 May 2008 (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)
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)
"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)
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)
warning scrips
i am just wondering if a warning script that uses uw tags that will work on IE will be created or if there is one already where i can find it--AFUSCO 22:20, 20 September 2007 (UTC)
One-click restore-this-version for wikibooks
I know this WikiProject is for Wikipedia, but here's hoping... I'm looking for a script that will provide a one-click restore-this-version functionality and nothing else. I imagine existing code, such as twinklefluff or revert tools, can easily be adapted and pared down to provide this. Big thanks in advance! – Mike.lifeguard | talk 05:05, 20 October 2007 (UTC)
Done Using only some part of TW does this. – Mike.lifeguard | @en.wb 17:53, 11 January 2008 (UTC)
New page link
I would like to have a link in the toolbox showing a link to Special:Newpages, just below the Recent changes link. ChrisDHDR 10:27, 17 November 2007 (UTC)
addOnloadHook(function() {
addPortletLink ('p-tb', wgArticlePath.replace(/\$1/,'Special:Newpages'), 'New pages');
});
--Splarka (rant) 08:09, 18 November 2007 (UTC)
- Sorry, but that doesn't work. ChrisDHDR 15:19, 1 December 2007 (UTC)
- Yes it does. Maybe try it at the top of your very crowded momobook.js, or on a blank slate. --Splarka (rant) 09:50, 2 December 2007 (UTC)
- I just did the above to set a link to CAT:SPEEDY and IT WORKS! Muahahah! I had to leave a message just to revel in the fact that I, inept at any kind of programmingness, managed to do that. Woot!! SGGH speak! 10:58, 27 January 2008 (UTC)
Alternate watchlists
I haven't found this but if it exists, point me to it. I find myself struggling against the limitations of a single watchlist. What I really want is alternate watchlists which I can automatically add pages to with minimal fuss. This way I could focus different watchlists on specific projects/interests. I have one page set up like this here. It uses [[Special:Recentchangeslinked/User:{{PAGENAME}}]] to make a watchlist out of the links on the page where the code is placed.
Ideally, I want a way to add a regular wikilink for a page I'm viewing onto a subpage of my userpages, at the end of a column of such links. Preferably, it would allow me to specify one of, say, five pages (just pulling a number out of the air).
If anyone knows of a way to do this, point me to it. Cheers, Pigmanwhat?/trail 00:58, 22 November 2007 (UTC)
- I don't exactly see what you mean. Something like this? (to use it, make a new array of page names called
watchlists
) --cuckooman (talk) 00:37, 4 January 2008 (UTC)
Image tagging script only partially working
The functions "freeimg", "nonfreeimage", "extrarationale" and "nonfreemedia" only work on Special:Upload, not while editing imagespace. Any idea why? Will (talk) 01:55, 1 December 2007 (UTC)
- Conflicty definitions, try something like this instead
if(wgAction=='edit') { var txt = document.editform.wpTextbox1; txt.value += thetag; } if(wgPageName=='Special:Upload') { var txt = document.getElementById("wpUploadDescription"); txt.value = thetag; }
- Or simply check if the elements exist, eg
if(document.editform.wpTextbox1)
.--Splarka (rant) 09:04, 1 December 2007 (UTC)
Warn
I'm sorry to have to ask your assistance again, but I've been trying to develop a tool and I think I needs your (the people here's) help. I'm trying to develop a tool (see User:Jj137/quickwarn.js) that will add a link at top next to "watch"-- but only on user talk pages-- that will allow me to open two prompt windows, one at a time, and automatically add a warning to a vandal's talk page. If you see the quickwarn.js page you will probably understand what I am trying to do. Thanks, and hope you can help. jj137 ♠ 05:02, 26 December 2007 (UTC)
- Maybe you should use my auto_mod script. Add it to your script with:
importScript("User:Jnothman/automod.js");
- Then, given an article TITLE which you want to add BEFORE to the beginning of, AFTER to the end of and using a SUMMARY, simply send the browser to the to the URL created by am_make_url("TITLE", "BEFORE", "AFTER", "SUMMARY"). To get the page title, use am_get_title(), which you might then want to check for starting with "User talk". jnothman talk 13:23, 29 December 2007 (UTC)
Suggest links script
I am looking for a script to help with WP:Dead-end pages. There is a tool here: [1] that seems to be broken and a script tool would be great.
Thanks GtstrickyTalk or C 17:31, 26 December 2007 (UTC)
Script Requested
Is there a possibility if a script could be made, so that anyone can detect which IP address or user who has been on there userpage or monobook.js file and what they have done, which will be updated every second or minutes reason for this is because occasionally i always have a feeling that someone is on the userpage or subpage doing something which the watchlist isn't reporting, since certain things have vanished on the toolbox or some text on userpages and subpages. Is this possible. →Yun-Yuuzhan→ 17:36, 28 December 2007 (UTC)
- This isn't about the request, but no one else can edit your monobook.js but you. (and probably admins) Or so I gather from that I can't edit your monobook.js. It's probably just a glitch. --cuckooman (talk) 20:49, 3 January 2008 (UTC)
- Yep, admins can edit monobooks. jj137 ♠ 03:49, 4 January 2008 (UTC)
Image Summary Editing
I've written a proposal here User:Mbisanz/ImageSystemProposal that would create a script that could add the article= variable to image summaries of images used in more than one article. There is an existing script, but I don't know how to modify it. Mbisanz (talk) 22:55, 30 December 2007 (UTC)
Coordinate alternate links
Could somebody create a popup when click on it similar to the wikiminialtas. And fill in map services that can be customized with a final link to the geohack page at the bottom. — Dispenser 15:07, 3 February 2008 (UTC)
- If I understand correctly, instead of going directly to geohack you would like a "popup menu" with several choices, right? ∴ AlexSm 17:30, 5 February 2008 (UTC)
- Yes, I think there might be some code in the wikiminiatlas that you could steal to do this easily. The original idea was posted on the GeoHack page. — Dispenser 02:21, 9 February 2008 (UTC)
- Actually, there are two separate ideas. The one linked above would allow people to move services around in the GeoHack list, and have them in the same order when coming back to the page again. I've implemented the shuffling part to test it, see GeoHack-shuffletest.html. It still needs more Javascript to save the offsets to a cookie every time a row is moved, and to load them from the cookie and shuffle the rows when the page is loaded.
Another idea closer to what AlexSm is thinking of, is a GeoHack replacement in Javascript, as some people are uncomfortable having to go to a separate page and choose a service. There are probably two groups: 1) people who don't want to choose at all, but just want direct links to any map service, and 2) people who want to choose from the most popular ones only. I've implemented the first one partially with Google Maps Love.js, which adds another icon next to all coordinates, but it doesn't handle scales which is somewhat important with getting a map of the right size. The second one would indeed need a popup to be fast for people who don't like the extra clicking.
If anyone feels like working on these, please go ahead and rip the code. --Para (talk) 03:57, 9 February 2008 (UTC)
- Actually, there are two separate ideas. The one linked above would allow people to move services around in the GeoHack list, and have them in the same order when coming back to the page again. I've implemented the shuffling part to test it, see GeoHack-shuffletest.html. It still needs more Javascript to save the offsets to a cookie every time a row is moved, and to load them from the cookie and shuffle the rows when the page is loaded.
toolbox item or tab with a short format link using « oldid={{REVISIONID}} »
→ bugzilla:000268 · "Short-hand link / URL for referring to specific version"
Dear friends; Can somebody implement a gadget which adds a toolbox item or tab with a short format link using « oldid={{REVISIONID}} » ? It will be very helpfull for non-Latin projects. Thanks for all your efforts in advance! Best regards
·לערי ריינהארט·T·m:Th·T·email me· 20:35, 3 February 2008 (UTC)
- Example:
- today m:wikt:yi:װיקיװערטערבוך:קאַװע־הױז should generate the link
http://yi.wiktionary.org/w/index.php?oldid=11715
·לערי ריינהארט·T·m:Th·T·email me· 21:00, 3 February 2008 (UTC)
- today m:wikt:yi:װיקיװערטערבוך:קאַװע־הױז should generate the link
- test:
[{{fullurl:{{FULLPAGENAME}}|action=purge}}#bugzilla_268 ↺ purge ↺] · generates {{REVISIONID}} here<br /> [{{fullurl:{{FULLPAGENAME}}|oldid={{REVISIONID}}}} rev-ID : {{REVISIONID}}] · helps only if {{REVISIONID}} is available<br /> [{{fullurl:|oldid={{REVISIONID}}}} rev-ID : {{REVISIONID}}] · does not help here<br /> {{SERVER}}{{SCRIPTPATH}}/index.php?oldid={{REVISIONID}} · helps only if {{REVISIONID}} is available<br /> {{#IF: {{REVISIONID}} | '''[{{SERVER}}{{SCRIPTPATH}}/index.php?oldid={{REVISIONID}} short url]''' }}
generates:
↺ purge ↺ · generates {{REVISIONID}} here
rev-ID : - · helps only if {{REVISIONID}} is available
rev-ID : - · does not help here
//en.wikipedia.org/w/index.php?oldid=- · helps only if {{REVISIONID}} is available
short url
- Bests regards
- ·לערי ריינהארט·T·m:Th·T·email me· 16:56, 5 February 2008 (UTC)
- I'm not sure I fully understand you request. There was a (maybe similar) request in ru.wp to remove
title=...
part from the existing «Permanent link» on the left. As a result, when you follow this link, you do not have a long percent-encoded URL in the browser address field. The code is simple, see below ∴ AlexSm 17:30, 5 February 2008 (UTC)
- I'm not sure I fully understand you request. There was a (maybe similar) request in ru.wp to remove
addOnloadHook(function(){ //remove title from permalink
var pLink = document.getElementById('t-permalink')
if (pLink) pLink.firstChild.href = pLink.firstChild.href.replace(/title=[^&]*&/,'')
})
- Thanks AlexSm! I remember this request and I remember also a bugzilla: report but I could not find it.
- With http://yi.wiktionary.org/w/index.php?diff=11784&oldid=11464 I experimented with this / implemented this at « wikt:yi: » . It works fine. As you can see I am using short format diff links. Have there been similar discussions about « diff » at « w:ru: » beside the « Permanent link » discussion? Best regards
- ·לערי ריינהארט·T·m:Th·T·email me· 03:26, 6 February 2008 (UTC)
- http://yi.wikisource.org/w/index.php?oldid=3487 is the code at « s:yi: »
- ·לערי ריינהארט·T·m:Th·T·email me· 03:34, 6 February 2008 (UTC)
- You could try this code below. It should cut the
title
part from diff links whenever you click on them, even when you open them in new windows/tabs ∴ AlexSm 16:38, 7 February 2008 (UTC)
addOnloadHook(shortDiffURLs)
function shortDiffURLs(){
addEvent(document.body, 'mousedown', shortDiffClick)
}
function shortDiffClick(e){
e = e || window.event
var targ = e.srcElement || e.target
var url = targ.href
if (!url || (url.indexOf('diff=') == -1)) return
targ.href = url.replace(/title=[^&]*&/,'')
}
- I also happent to have a script (not published here yet) that can decode URLs in the edit window. E.g. you paste
http://en.wikipedia.org/wiki/Wikipedia:Administrators%27_noticeboard
, press the button, and this is changed into
[[Wikipedia:Administrators' noticeboard]]
. Of course, this script is much more useful on non-latin wikis ∴ AlexSm 16:38, 7 February 2008 (UTC)
- I noticed that you have a very unusual signature that makes it very difficult to follow conversations ... ∴ AlexSm 16:38, 7 February 2008 (UTC)
- The signature demonstrates bugzilla:012225. Please look at commons:user:לערי ריינהארט#bugzilla 012225 (the last section of the user page), edit that section and look at the usage of template:style/ril. Best regards
- ·לערי ריינהארט·T·m:Th·T·email me· 12:57, 8 February 2008 (UTC)
Script Request
Hi, I'd like to request a script. WP:PT used to be ordered by date until it was deprecated in December 2007. I would like to be able to order protected titles by date again, so I can see the most recent additions to the list. I am unable to code such myself. (of course, if there is an existing way to do so, I'd be very happy). Please let me know if I can/should help in any way. Chubbles (talk) 01:31, 8 February 2008 (UTC)
- Please fix your shortcut. If you meant Special:Protectedtitles, I think the only way is to check the protection log: Special:Log/protect. Of course, a script could be created to filter log entries and show only "create" protections, maybe using API ∴ AlexSm 03:25, 8 February 2008 (UTC)
- Yeah, that shortcut used to point to Wikipedia:Protected titles. Chubbles (talk) 06:43, 8 February 2008 (UTC)
- I made a script recently for filtering Special:Log/rights (that later was expanded to all rights, and later to work with any page that has a bunch of <li> in it). It works fine for Special:Log/rights but only filters what is on the page. To use it you simply add to your user js: importScript(User:Splarka/lifilter.js), go to the protect log eg: limit=500, click the [filter] tab, use the regex string create\=, and click [filter] or [hilight]. Of course it could be done better, but this is already written as a springboard (if badly). --Splarka (rant) 08:17, 8 February 2008 (UTC)
Syntax highlighting
I'd like to have a tool that highlights the wiki syntax. I know that WikiEd does this, but it also does a lot of other stuff I don't need nor want. All I need is syntax highlighting. I'm using Mozilla Firefox. MahangaTalk 01:47, 9 February 2008 (UTC)
- Do you mean highlighting inside edit box? I think the best option would be to ask Cacycle to select and cut the necessary code for you, like a "Lite" version. Or someone else to do that, again, using existing WikEd code. / AlexSm 20:45, 9 February 2008 (UTC)
Advanced "Short Link"
I want to make MediaWiki delete long unicode titles in the URL, not only historic pages (permanent links) but also diff. pages and the printable pages of those. Can someone make the javascript? ― 韓斌/Yes0song (談笑 筆跡 다지모 한자위키) 12:53, 20 February 2008 (UTC)
- You could take the 2nd script in that section (with shortDiffURLs()) and slightly modify it to recognize other links and remove the title from URL whenever possible. Also, just a thought: when title cannot be removed, the script could at least decode it, if I remember correcty, this should help Opera display readable titles in the address bar. I would help, but your 8-line signature makes it too difficult to follow this conversation. —AlexSm 20:31, 21 February 2008 (UTC)
Tool to highlight matching braces, to aid in debugging templates with mismatched opening and closing braces
Well, basically I am looking for something that, analogously to what Netbeans does with Java code, will highlight the braces so that it's easy to distinguish what matches with what:
fdksajhsdfhksdflh{{{{dfjkalhfdslsaflklhdsfdfsadhflsalsdfhsd{{jaksdfslkadslhjhjhlklhlh
khlk{{sfdakllsdfaljksdalf}}khfdksdh}}sdafhhdsasfd
lk;lkjadfjlksadfs{{fdalhsafdlksafdhdsfaks}}lfdhahlkfds}}asdfhlfdsahklh}}ksdahksadkhsdafl
I'm working on nested #ifs and keep running into bugs that I'm having trouble tracing. It's driving me nuts. Absidy (talk) 05:07, 24 February 2008 (UTC)
- I've filed bugzilla:13829; if and when that enhancement is fixed, it should be much easier to write a script that does that. --ais523 12:07, 23 April 2008 (UTC)
- See User:ais523/bracketmatch.js. It adds a link 'Parse' above the edit box; clicking on it will add a bracket-matched copy of the edit box. (It works by calling the Wikimedia servers and asking them to parse the code, so the resulting parse will be exactly how the code will be interpreted, even in pathological cases.) --ais523 12:13, 14 May 2008 (UTC)
Can anyone create a link
Can anyone create a link on the top (near the my preference) or on the left side of the page (near toolbox). The link will contain a customised help page containing template messages and other commonly used links. Suppose the page will be located at User:Amartyabag/Help. Please help. Amartyabag TALK2ME 12:27, 6 March 2008 (UTC)
addOnloadHook(function() {
addPortletLink('p-personal','/wiki/Special:Mypage/Help','my help','pt-help','my templates and links','',document.getElementById('pt-watchlist'));
});
- A bit more functional: user:js/popupBookmarks. This will show popup window with the content of your User:Amartyabag/Bookmarks (by default). I wrote this a long time ago. There are some parameters that can change page name and popup behaviour, but they are not documented yet. —AlexSm 23:00, 7 March 2008 (UTC)
Another link, like the request above
This (my monobook page) is my first try at creating any kind of script on Wikipedia. The response to the request immediately above this one, is just what I'm looking for! But I can't get it to work. I've tried exiting my browser entirely, to make sure it refreshes. Can anyone have a look, and see what I'm doing wrong? --A Knight Who Says Ni (talk) 19:34, 23 March 2008 (UTC)
- The last but one bracket should be curly. --Cameltrader (talk) 20:02, 23 March 2008 (UTC)
- Dang, I can't even tell a curly bracket from a curved in this font! Thank you very much; it works fine now! --A Knight Who Says Ni (talk) 20:25, 23 March 2008 (UTC)
I'd like to be able to see a user's permission status, such as if they are an administrator or have rollback permission, on their user page, if possible. Thanks! Gary King (talk) 22:39, 3 March 2008 (UTC)
- I have a script which can show this for any user linked from the page, just need to polish and then publish it, probably next week. —AlexSm 23:00, 7 March 2008 (UTC)
xFD closer
There is a script to close AFDs, can it be expanded to all xFds???? The Placebo Effect (talk) 03:30, 6 March 2008 (UTC)
- I've made one for MFDs - see User:Jj137/CloseMFD.js. I'm still working on the others (sort of a long term goal, but I'll give it a shot). jj137 (talk) 03:03, 23 March 2008 (UTC)
- Could there be a script to not only close the AfD, but also pull down the AfD notice on Kept pages and add the OldAfDFull template to their talk pages? MBisanz talk 08:41, 23 March 2008 (UTC)
Submit
Does anyone know how to automatically submit the page for the delete function? I know for edits it is
document.getElementById('editform').submit();
so it is probably something similar. jj137 (talk) 01:45, 27 March 2008 (UTC)
Hint in page source:
<input type="submit" value="Delete page" name="wpConfirmB" id="wpConfirmB" tabindex="4" />
- I think you'll need to obtain a
wpEditToken
from the server before submitting, so you may need to send two requests. --Cameltrader (talk) 08:36, 27 March 2008 (UTC)
- How would I obtain that? Would I use
document.getElementById('wpEditToken').submit();
? jj137 (talk) 22:18, 27 March 2008 (UTC)
- I can't help you much, because I've never done that, but the API could well give you what you need, assuming you have some familiarity with AJAX and XMLHttpRequest. Also, there are scripts scattered around—in Python, in Perl, and maybe others, which might give you an idea of how to deal with the edit token. --Cameltrader (talk) 22:36, 27 March 2008 (UTC)
document.getElementById('deleteconfirm').submit(); , although I don't understand why you would need that. —AlexSm 23:26, 27 March 2008 (UTC)
- That works, but it doesn't give me a choice of what I want for the delete summary. I would like for the delete confirm screen to appear, and then with the script I am writing tabs will appear with some of the CSD reasons. When I click that tab, it will automatically delete the page with that CSD reason as the delete summary. I'm just trying to save time when doing maintenance tasks. jj137 (talk) 00:44, 28 March 2008 (UTC)
- I must be getting something wrong, because I don't see how these tab are supposed to help. The way you described them, they would save you two clicks on the SELECT drop-down box, but before that you still have to load the delete confirmation page anyway. I can create a script that would skip the confirmation screen entirely (only making one extra API query for edittoken), deleting the page in only one click. However, it would not insert the usual quote of the page content. —AlexSm 04:29, 31 March 2008 (UTC)
- Well, that's what the
document.getElementById('deleteconfirm').submit();
seemed to do. How exactly would I specify a reason? jj137 (talk) 01:30, 1 April 2008 (UTC)
You could also pass along a reason as a URL parameter: wgServer + wgScript + '?title=Main_Page&action=delete&wpReason=' + encodeURIComponent('[[WP:CSD#G8]]: talk page without a corresponding article')
. You seem to already have this in your script.
To instruct the script to automatically submit a page like that, you could also pass along a fake URL parameter, such as '&autosubmit=true'. (Be careful, though, since this makes you vulnerable to attacks like http://tinyurl.com/yoe45f, which logs you out if you don't have tinyurl preview enabled.) Alternatively, you can use an XHR request to get a delete token, although this is a bit more complicated. GracenotesT § 15:22, 2 April 2008 (UTC)
Meta script for linking locations in scripts
See Wikipedia_talk:WikiProject_User_scripts/Scripts#Deprecate_syntax_highlighter_and_inclusion_scripts
I had an autolinker written that turned any [[bracketed text]] in a script into a link when the script is displayed (like on Special:Mypage/monobook.js), so that things like this:
winc('[[User:SOMEONE/monobook.js]]'); /* Comment about what the script does */
would be clickable. It seems we have such a script floating around somewhere because bracketed text in diff view is now clickable. Maybe this could be co-opted to create links when viewing a script, too.
Then we'd need to allow bracketed links inside the importScript argument, as they are allowed in my winc() function. — Omegatron 02:15, 4 April 2008 (UTC)
highlight links to disambiguation ("dab") page
Links to redirects are faintly annoying, but links to dab pages are a fatal error. Anybody wanna do this? Ling.Nut (talk) 15:36, 5 April 2008 (UTC)
- See Wikipedia:WikiProject Disambiguation. Fixing disambig links is usually not a task that can be handled automatically, and there are no JavaScript tools that I know of which can assist in fixing links (although some programs can do this, notably AWB). What specifically are you requesting: a script to highlight disambig links on a given page, a script to fix links to a given disambiguation page (e.g., those listed at Wikipedia:Disambiguation pages with links/Maintenance), or something else? GracenotesT § 01:09, 6 April 2008 (UTC)
- I'm asking for whatever is doable. :-) If a script can fix them, that would be best. If no script can fix them, then a script that merely hightlights them (not in green; the redirect script already uses that color) would be a huge step in a good direction. Thanks! Ling.Nut (talk) 10:56, 6 April 2008 (UTC)
- See immediately above, and PS here note esp. that I'm looking to identify the links on a given article that go to dab pages. I think CorHomo already has the ability to fix the list of articles that link to a given dab page. I also think WP:AWB has only that same ability, am I correct? But if you have a long article... find dab links could be very tedious.. Ling.Nut (talk) 11:02, 6 April 2008 (UTC)
- Not all links to disambiguation pages are invalid, although I will agree that many are. Anyway, just for fun, I wrote a disambiguation finder: User:Splarka/dabfinder.js ... note that it does take a few seconds for longer pages to make the necessary API calls. It is still rough, all it does is hilight them on the page for you, and alert you when done. It is rather complex code of several layers of iteration, but basically it: checks which templates are disambiguation templates, checks what links on the page link to pages that contain one of these templates, and then hilights all these matched links on the page itself. You can test it with
importScript('User:Splarka/dabfinder.js');
in your user js. Click on the portlet link in the toolbox (on any content page), and then wait a few seconds. --Splarka (rant) 10:33, 7 April 2008 (UTC)
(undent) Thanks! I tested it out on a couple articles, and it seems to do a great job of catching different types of dab page templates. A million thanks! Ling.Nut (talk) 13:18, 7 April 2008 (UTC)
Categorizing links
Hiding categorized links
After visiting a Wikipedia link, that link changes color from blue to purple on my computer screen. To tag pages with categories, I've been opening all the pages at Category:NA-Class articles, for example, to turn the links purple. Then I use the All pages with prefix. Those pages for which the link still is blue need a Category:NA-Class category tag. It takes a lot of time to initially open all the pages within a particular category to turn the link from blue to purple. Is there a way to change the colors of the links in Category:NA-Class articles as the appear on my computer screen without having to visit each of the links? I tried editing my temporary internet file (browser history) and tried using the 'Print all linked documents' option of windows print feature to printing to a file (that I then deleted). I wasn't able to edit my temporary internet file (browser history) and the 'Print all linked documents' option didn't result in making the category links purple. Can you create me a script that causes all the links on a page (e.g. Category:NA-Class articles) to change color to show that I visited the page (without actually opening the linked page)? I am open to other methods as well. Thanks. GregManninLB (talk) 16:10, 17 April 2008 (UTC)
- If I understand correctly, you need to exclude members of the 1st list form the 2nd list. I suggest using "other methods", which in this case is supposed to look like this:
- you open Special:PrefixIndex/Category:Non-article
- you start the script
- the script asks you for a category name, you enter «NA-Class articles»
- script queries API to get all category members
- script hides all returned titles from the current page
- Splarka sure can do it, or I could do it if he doesn't have time at the moment. Let's wait for his answer then. —AlexSm 16:50, 17 April 2008 (UTC)
- Someone called my name? Hmm. I think this does what AlexSm described: User:Splarka/cmlhider.js ... Not highly tested, and rather highly specific, and it is very slow, you may think your browser is locked up (takes about 10 seconds on mine for 227 category members * 559 links). But give it a shot. You can copy it to your Special:Mypage/monobook.js user js, or add:
importScript('User:Splarka/cmlhider.js');
to test it directly. --Splarka (rant) 09:12, 18 April 2008 (UTC)
- Hi Splarka. I added User:Splarka/cmlhider.js to my monobook. I logged off and then logged back in. I then opened Special:PrefixIndex/Category:Non-article. However, Special:PrefixIndex/Category:Non-article still is displaying those categories already tagged with Category:NA-Class articles. Got any idea where I messed up? GregManninLB (talk) 15:09, 18 April 2008 (UTC)
- You're supposed to click on a new link «Hide links» on the left (in the «toolbox» portlet) to actually start the script. To Splarka: 1) should have used «p-cactions»; 2) how about
categorymembers ... join('|')
and then using indexOf? might speed things up a little. —AlexSm 15:24, 18 April 2008 (UTC)
- Thanks for the tip (which fixed my problem). I then tagged all the pages. However, even after clicking on the new link «Hide links» to excluded Category:NA-Class articles categories, Special:PrefixIndex/Category:Non-article still is displaying a few stubborn categories tagged with Category:NA-Class articles. Is it possible to tweek the script to exclude these as well? GregManninLB (talk) 20:35, 18 April 2008 (UTC)
- Probably have to wait for the job queue to catch up. Modifying category lists isn't always instantaneous. Not my script's fault if categorymembers isn't totally up to date ^_^. --Splarka (rant) 07:36, 19 April 2008 (UTC)
Catgory text string index
Special:PrefixIndex allows a user to display pages beginning with a particular prefix, such as categories beginning with "Non-article". Is there a way ( would you write me a script) to display pages containing a particular text string, such as categories containing "Non-article". This would allow me to find categories such as Category:WikiProject Biography non-article pages where "non-article" appears other than at the beginning of the category name. Thanks. GregManninLB (talk) 07:02, 24 April 2008 (UTC)
- Try title grep. That isn't feasable as a userscript. --Splarka (rant) 07:13, 24 April 2008 (UTC)
- Thanks. I followed up here. GregManninLB (talk) 14:04, 24 April 2008 (UTC)
- User:Nikola Smolenski improved wikimedia grep to search categories with regular text. Thanks again for the lead. GregManninLB (talk) 14:28, 27 April 2008 (UTC)