Wikipedia talk:WikiProject User scripts/Archive 2

From Wikipedia, the free encyclopedia

Archive This is an archive of past discussions. Do not edit the contents of this page. If you wish to start a new discussion or revive an old one, please do so on the current talk page.


Contents

Quote from IRC

"Where: I don't know how I would survive without WP:US" --Adam1213 Talk + 22:50, 3 February 2006 (UTC)

Image Autotagger (Firefox only)

I've created a brief demonstration of my Image Autotagger tool if anyone would like to preview it. The code is available from my monobook.js, but I've got to polish it a bit, make it a little more flexible, and of course write documentation. You can test the Fast Tagger tab on Image:TestImage.jpg.

Features:

  • Image Autotagger - A popup tool window for many images
    • Rapidly tag a list of images
    • Select license from a drop-down and have it inserted automatically
    • Automatic edit summaries
    • (To do) Automatically notify uploader
  • Fast Tagger - A popup "tag" tab for one image
    • Tag an image in just one click
    • Quickly tag an image with No License, No Source, or IFD.
    • Automatic, overridable edit summary

I'd really appreciate any comments or ideas! ~MDD4696 23:56, 5 February 2006 (UTC)

I should've put more of an explanation up, because it seems that YouTube takes a while to "process" videos you upload. Currently, you must use a list of images as your starting point. For example, type User:Mdd4696/Sandbox into the box in the upper right, and then click "Load". This loads a list of images for you to tag (you can also used the Wikipedia:Untagged Images lists, like Wikipedia:Untagged images/2005dec13-2). Double click on any of the images in the list to load it and edit it. You can automatically insert a tag from the drop-downs, or you can edit by hand. If anyone who tries this out could post a screenshot of it at ImageShack (free, no registration), it would be helpful for me. ~MDD4696 00:33, 6 February 2006 (UTC)
Alright, if anyone's interesting, the Image Autotagger now has a page: User:Mdd4696/Image Autotagger. ~MDD4696 05:28, 15 February 2006 (UTC)

Help with script

I'm trying to add Show last diff to my monobook.js. But when I do, the tab appears twice. I would also like to place it next to the edit tab. Thanks. —Wayward Talk 07:13, 8 February 2006 (UTC)

request

A script to add talk page links in article history next to editor username or IP?--Urthogie 16:34, 12 February 2006 (UTC)

I'm not too great at scripts yet, but I might be able to help. Could you describe more precisely what exactly you want the script to do? --Mathwizard1232 01:09, 16 February 2006 (UTC)
To add (talk) to the right of names in the page history, next to the edits, linking to each user's talk page.--Urthogie 14:39, 16 February 2006 (UTC)
Does anyone know how?--Urthogie 10:06, 23 February 2006 (UTC)
Yes, it wouldn't be too hard. Why don't you make a request? ~MDD4696 21:56, 23 February 2006 (UTC)

Quick Proposed Deletion Script

I don't know if this is really needed that often, or already done, but I thought I'd mention it. I created a small script similar to QWikify to be able to automatically load the edit page, ask for the reason, tag the page, add the summary, and submit to tag the page as proposed deletion (a new alternative to AfD here). It's somewhat buried in my code, but I could clean it off, and comment it up for use as tutorial and such if people were interested. --Mathwizard1232 01:11, 16 February 2006 (UTC)

I feel like an idiot...

Whenver I edit my monobook.js, I use document.getElementById() but it always, ALWAYS returns null or undefined or something even though I use the IDs from the HTML source code. I'm positive something is going wrong but it's probably something really simple and I know after I figure it out I'll wonder why I didn't sooner. DPFUNEditor 20:11, 16 February 2006 (UTC)

I took a look at your monobook.js, but it doesn't seem that you have created it yet. What page are you editing, specifically? Could you provide the code that's causing problems? ~MDD4696 23:11, 16 February 2006 (UTC)
Have you made sure that you are running the code after the page loads? For a monobook.js like this:
document.getElementById("ca-edit").firstChild.firstChild.data = "edit";
errors will be generated because the Document Object Model has not been initialized yet. You can fix this using something like the following:
function shortEditLink() {
  document.getElementById("ca-edit").firstChild.firstChild.data = "edit";
}
addOnloadHook(shortEditLink); // addOnloadHook is a Wikipedia-specific function
this attaches the function to the page load event. Hope this helps. Invitatious 18:54, 11 June 2006 (UTC)

help needed: "addOnloadHook is not defined"

I got the following error when I tried the user script on my local mediawiki (installed on my windows XP desktop): "addOnloadHook is not defined". However, the same script works well in the official en.wikipedia.com. Your help is greatly appreciated!

addOnloadHook() is defined in wikibits.js. Just copy the code you need. ~MDD4696 22:29, 22 February 2006 (UTC)

Newbie having a bad day

I do lots of proof-reading, so I want the "edit zeroth section" capability. So I checked my preferences (still defaulted to MonoBook), read the Meta help, copied all the script for Edit Top (no helper requirements listed in the box) from between the PRE delimiters, pasted into my User:TJFrazier/monobook.js page, and got . . . nothing.
Then (after a lot of rechecking, of course) I clicked on the IRC link, and got some horrible Earthlink "disambiguation" page; did I really want www.whatever.com?
Your assistance muchly appreciated. After 40 years as a systems programmer, I'm usually on your side of the desk...--TJ 16:43, 3 March 2006 (UTC)

Javascript files tend to cache weirdly, depending on your browser (Opera in particular refuses to reload them for a long time). Try going directly to the exact URL referenced in the html source - http://en.wikipedia.org/w/index.php?title=User:TJFrazier/monobook.js&action=raw&ctype=text/javascript&dontcountme=s - and forcing a reload there. —Cryptic (talk) 13:32, 5 March 2006 (UTC)

Need to edit pages asynchronously?

Hey all. I just wrote a function for my Image Autotagger project that I thought might be useful to others. I just copied it (mostly) verbatim here, but anyone that knows javascript should be able to understand it and modify it to suit his needs. ~MDD4696 03:59, 8 March 2006 (UTC)

Just some comments: This code is not Internet Explorer compatible, and I think it can only be called once (maybe xmlhttp.abort() needs to be called somewhere). ~MDD4696 14:31, 9 March 2006 (UTC)
What does that? You can never overwrite (by mistake) an old version? We can easy make it IE compatibly

!? --Olliminatore 08:24, 2 May 2006 (UTC)

function tagImage() {
 var xmlhttp = new XMLHttpRequest();
 xmlhttp.open( "GET", "http://en.wikipedia.org/w/index.php?title=NAMESPACE:ARTICLENAME&action=edit", true );
 xmlhttp.onreadystatechange = function() {
 if ( xmlhttp.readyState == 4 ) {
 if ( xmlhttp.status == 200 ) {

 var rawPageText = xmlhttp.responseText;

 var editTokenExp = /value="(.{32})" name="wpEditToken"/g;
 var starttimeExp = /value="(.{14})" name="wpStarttime"/g;
 var edittimeExp = /value="(.{14})" name="wpEdittime"/g;

 formData = "";
 formData += "wpScrolltop=";
 formData += "&wpEditToken=" + editTokenExp.exec( rawPageText )[ 1 ];
 formData += "&wpSection=";
 formData += "&wpStarttime=" + starttimeExp.exec( rawPageText )[ 1 ];
 formData += "&wpEdittime=" + edittimeExp.exec( rawPageText )[ 1 ];
 formData += "&wpTextbox1=" + "Article text here";
 formData += "&wpSummary=" + "Edit summary here";
 formData += "&wpMinoredit=checked";
 formData += "&wpWatchthis=";

 var formSubmitter = new XMLHttpRequest();
 formSubmitter.open( "POST", "/w/index.php?title=NAMESPACE:ARTICLENAME&action=submit", true );
 formSubmitter.setRequestHeader( "Content-Type", "application/x-www-form-urlencoded" );
 formSubmitter.onreadystatechange = function() {
 if ( formSubmitter.readyState == 4 ) {
 if ( formSubmitter.status == 200 ) {
 alert( "All done!" );
 } else {
 alert( "There was a " + formSubmitter.status + " error :(" );
 }
 }
 }
 formSubmitter.send( formData );

 } else {
 alert( xmlhttp.status + " error" );
 }
 }
 }
 xmlhttp.send( null );
}

Attaching eventhandler to onkeypress and onkeydown for wpTextbox1

Hi:

I wanted to be able to type in a foreign language: (persian) within an English environment without installing keyboard. I have these js libraries that take care of that. But I need to attach eventhandler to wpTextbox1 and I just can't. I almost know no JS. Any help is deeply appreciated. My monobook can be seen here: [1]

Cheers, Behaafarid 03:59, 11 March 2006 (UTC)

Special:Mypage/monobook.js

I just discovered this amazingly convenient way of linking directly to a user's personal monobook.js page. I've updated the tutorial to use it, but I'm sure there are plenty of other places with convoluted instructions for locating your own monobook.js. Just thought I'd let people know and ask for help in spreading this useful trick. —Ilmari Karonen (talk) 17:07, 17 March 2006 (UTC)

javascript rollback broken?

Hi folks. I've been using godmodelight for some time to revert vandalism, but its suddenly stopped working. I now get the following error:-

Please wait, reverting edits by Contributions... Getting article history (/w/index.php?title=Sir_Henry_Floyd_Grammar_School&action=history&limit=50)... Error: Last editor is 195.93.21.6, not Contributions!

I've emailed Sam, but just wondered if anyone had suffered (and fixed) a similar problem. (I'm running firefox BTW). Thanks. Kcordina 10:59, 21 March 2006 (UTC)

I did notice it wasn't working a week or two ago -- to my surprise it worked fine when I just tried it on your edit here. Works fine for me at the moment. here 21:17, 21 March 2006 (UTC)

Many thanks for checking - it now works again for me too. I wonder if a bad version got caught up in a cache somewhere and has taken a while to be flushed out. Right, back to rolling back vandals. Kcordina 08:55, 22 March 2006 (UTC)

Hmmm, it gets stranger. It will happily revert any edits by me, but will not revert edits by any other user names - for edits by others I still get the message above. How frustrating! Perhaps its time for an RFA to get a 'proper' rollback button. Kcordina Talk 09:35, 22 March 2006 (UTC)
I've been making changes to the version at User:Ilmari Karonen/godmode-light.js; I think it should now work as well as it did before the diff format change, but I may be wrong. In any case, the format change only broke the ability to revert anons; reverting logged-in users has been working all the time (I think). —Ilmari Karonen (talk) 13:30, 22 March 2006 (UTC)
I fixed this a while ago, check out Sam Hocevar's talk page. My monobook works for anons and users.Voice-of-AllT|@|ESP 16:48, 23 April 2006 (UTC)

Help!

Not sure if this is the place to ask, but it seems as likely as any. This morning, after not being able to connect to WP for most of yesterday, I was able to connect, but none of the tools in User:SteinbDJ/monobook.js seemed to be working. I tried reloading several times. I verified that I was still using the Monobook skin. Any thoughts on what might have happened? Thanks. SteinbDJ 18:21, 10 April 2006 (UTC)

The code looks fine; I'm assuming you haven't edited since then? What browser are you using? -rayluT 01:16, 11 April 2006 (UTC)
Firefox. No, I tried editing the monobook file, but then reverted it to the previous version. SteinbDJ 15:36, 11 April 2006 (UTC)
Presumably you've tried doing Shift+Refresh? Mike1024 (t/c) 17:33, 11 April 2006 (UTC)
I have. It seems that if I don't try and make it display nice by adding "nowiki pre" it all works fine. Whatever. I can live with lousy display; but I can't live without popups. SteinbDJ 17:46, 11 April 2006 (UTC)

getPname

...is broken. http://en.wikipedia.org/wiki/Wikipedia_talk:WikiProject_User_scripts/Scripts/Get_Page_Name -rayluT 02:29, 16 April 2006 (UTC)

Help please

I see that you have amazing tools for wikipedia, but I can understand a word about how to use them, can you add something in the page, or at least tell us what exactly is a user script and how to use it? --Argentino 19:16, 16 April 2006 (UTC)

I'll see what I can add. Generally they break down to Firefox extensions, Javascript snippets which one pastes into one's .js file on Wikipedia, or Greasemonkey scripts. --maru (talk) contribs 19:38, 16 April 2006 (UTC)
Actually on second thought, the pages link appropriately to meta-pages or decent descriptions of how to install them. If there isn't a specific one lacking documentation, all I can really say is that the problem probably lies on your end. --maru (talk) contribs 19:43, 16 April 2006 (UTC)

User:Zocky/Search Box

I've written a new javascript tool for edit pages. It adds full search/replace capability to the edit box. It's still under developments so testers and comments are welcome. Zocky | picture popups 22:30, 1 May 2006 (UTC)

RfA helpers

I'd appreciate it if someone with more scripting genius than I posess could look at adjusting the AFD helper scripts to work for RfA. Specifically, one that would hide all open RfA's until the "show" link was clicked, and one that would do the {{subst:rfap/f}} {{subst:rfab}} tags as well as "Vote here" → "Final" and "ending" → "ended". Obviously, that would either have to leave the p/f in the first rfa tag empty, to be filled in, or have a Passed/Failed? dialogue that would allow you to select. As for the show/hide option, something that would default hide all nominations until the "show" link was clicked, to make page loading and navigation faster. Essjay (TalkConnect) 04:11, 25 May 2006 (UTC)

Fulfilled.Voice-of-AllTalk 17:07, 1 June 2006 (UTC)

Godmode-light error

Hi guys, I'm having trouble with Godmode-light. Neither Sam Hocevar's original code or Misza13's version which I, er, borrowed seem to be working correctly. Whenever I click the Rollback link, I just get a page saying something like:

Please wait, reverting edits by 69.175.147.51...
Getting article history (/w/index.php?title=User_talk:129.186.205.71&action=history&limit=50)...

Nothing happens from here, and my browser produces an 'Error on Page' notification. This happens in both Internet Explorer 6.0.2900.2180 and my ISP's (BT Yahoo!) own browser, version 5.03.04.809. The latter lets me view the nature of the error:

Error: Object doesn't support this property or method
Line: 230
URL:http://en.wikipedia.org/w/index.php?title=User_talk:129.186.205.71&fakeaction=rollback&vandal=69.175.147.51&token=5f6aecf122398d8ebe59015929414c25

Whats going on? (My monobook.js) CaptainVindaloo t c e 21:03, 29 May 2006 (UTC)

Have you tested without firewall (because IE6 need it for Ajax (ActiveX)))? I'm not sure whether it is an XML parse failure. But works it with IE6 for anyone? (I don't know) --Olliminatore 18:33, 30 May 2006 (UTC)
It does not work at all for IE, the XML parse is confirmed to be the problem (IE does return the raw XML). At User:VoA/monobook.js there is rollback script that switches its method slightly for IE and for FF/NS. It also does not have the "&" bug for articles that have "&" in their name (it switches to the IE script to avoid the bug). Hope that helps!Voice-of-AllTalk 14:26, 31 May 2006 (UTC)
It must be a problem with my browser, it might be based on IE. Is there anything I could do to make it work with that browser, or am going to have to get Firefox (or something)? I have tried Olliminatore's fixed version, but got the same error. Sorry it took me a while to get back, my monitor decided to drop off its perch. CaptainVindaloo t c e 16:01, 31 May 2006 (UTC)
Use User: VoA/monobook.js. I tried Olliminatore's version and it still fails on IE due to DOM parsing failure. IE just can run the usual script, thats why VoA/monobook does browser detection so that it can alter the script for IE browsers.Voice-of-AllTalk 17:34, 31 May 2006 (UTC)
Oh, sorry, I thought you meant your version wasn't working, and had to be fixed. Fair enough, I'll nick yours :-) and go hunt a vandal. I wish I could help fix this problem, but I've never worked with Java, just good 'ol Visual Basic. Thanks, CaptainVindaloo t c e 19:43, 31 May 2006 (UTC)
Ah, that works a treat! Nice one! CaptainVindaloo t c e 19:57, 31 May 2006 (UTC)

I've fixed the DOM parsing for IE(6) it works now too (the "&" Bug fix is also included). --Olliminatore 11:41, 4 June 2006 (UTC)

You fixed it? Really! What did you do?Voice-of-AllTalk 23:10, 7 June 2006 (UTC)
What is the link to the 'fixed' IE version mentioned above? I'd like to try and see if I can muck about and get it to work with Opera (all other versions that I can find return DOM errors).
Regards, -- That Guy, From That Show! 01:52, 8 June 2006 (UTC)

Godmode light is broken

Good ol' "Last editor is Contributions, not X.X.X.X" error. Anyone got a fix?--digital_me(t/c) 02:36, 31 May 2006 (UTC)

Fix here a new Mediawiki version added a edit link. --Olliminatore 14:15, 31 May 2006 (UTC)
Indeed, I had to fix User:VoA/monobook.js, which has similar script used by 100 users.Voice-of-AllTalk 14:23, 31 May 2006 (UTC)

Sense of the list

Is the meaning of the monobooks.js list gone lost? I think it's seems unpracticable, can someone clear/ control it? Everyone put his link without description and someone have only copys (redundant) from others (or have only external files included). Where is the (quality control) patrol?!? --Olliminatore 12:21, 5 June 2006 (UTC)

I started the list, and I intended it to be a temporary project, for volunteers to go through all of them, identify ones with interesting code, to be copied into the User scripts library, and when we were finished, to delete the whole mess. It seems to have been adapted to be used as a way of advertizing tools people have written, which was never the intent. Hope this clarifies things. JesseW, the juggling janitor 22:45, 9 June 2006 (UTC)
ah, then (I suggest) we could export this list to an extra site, before we (whenever) delete it!? --Olliminatore 14:20, 10 June 2006 (UTC)

Wikimania

Are any of our leading tools authors going to WikiMania? I'm wondering if there are any plans for presentations or roundtables or suchlike. There are so many great tools now that sharing info with others might be goodness. ++Lar: t/c 17:20, 7 June 2006 (UTC)

I wish more people new about my little stash of goodies :).Voice-of-AllTalk 22:38, 7 June 2006 (UTC)
Are you coming to WikiMania? I was thinking of trying to organise a session. If you're not maybe someone else could present about it. Are you ever on IRC? I would love to chat further with you or anyone else about this topic. ++Lar: t/c 15:31, 8 June 2006 (UTC)

DYK automation

I just created 3 functions for DYK automation, which can be seen in User:Lar/DYK/monobook.js (and invoked from User:Lar/moretabs/monobook.js. They are suitable for use in tabs or dropdown menu tabs, to be activated while editing a page. Two are for user talk pages and one is for the article talk page. I'm not saying they are great but they do help speed up the DYK process a bit. My question (and you knew there would be a question) is this: the one for article talk pages puts the notice box at the end of whatever section you are editing at the time. (thanks to the typical tacking on to the end of the existing text which I cribbed from other helper functions:

  var f = document.editform, t = f.wpTextbox1;
  if (t.value.length > 0)
    t.value += '\n';
  t.value += "{{subst:dyktalk|"+dayMoStr+"|"+yearStr+"}}  ~~~~";

But in fact the best place to put the notice box, if you're editing an articletalk that already has notice boxes, is after all the existing notice boxes but before any other text. You can achieve this manually by editing section 0, if there is a section break after the notice boxes but it was pointed out that actually FINDING the notice boxes and putting the new text in right after them, irregardless of other text. So... (finally!) is there an example of a function that uses regexp parsing to find a mid text insertion point I can crib from. If it was regexp parsing that could find ANY notice box (whether templatised or substed in) that would be swell, but I think that's a bit much to ask for... or is it? You guys are pretty clever... Maybe find the start of regular text instead? Or just live with having to move the box after it's pasted in? Or ask more questions about where it should go before pasting it in? thoughts? (It was suggested I ask Lupin directly but I'd rather ask here, maybe the answer will benefit others) ++Lar: t/c 17:43, 11 June 2006 (UTC)

I imagine that first off, since DYKs have to be new, they usually won't have much on their talk pages; I guess if they do, wouldn't it be easier simply to squeeze in the DYK at the very top of the talk page? Like instead of t.value += "{{subst:dyktalk|"+dayMoStr+"|"+yearStr+"}} ~~~~";, use t.value = "{{subst:dyktalk|"+dayMoStr+"|"+yearStr+"}} ~~~~" + t.value. Andy t 17:57, 11 June 2006 (UTC)
right, the very top is easy, just prepend not postpend, dead straightforward, I'd sussed that bit out already as I do it in other funcs.... but... in the case of a DYK already being known to be in a WikiProject, stylistically it's better to put the DYK box BELOW the project box, not above it. I personally am fine with always at the very top and fix it by hand but one of my potential users asked for the enhancement. (pesky users!) :) ++Lar: t/c 20:36, 11 June 2006 (UTC)
Why not just tell them to change it ;)? I guess you could just do
box=/\}\}/
t=document.editform.wpTextbox1
if(box.test(t.value)){
t.value = t.value.replace(box,"}}\n{{subst:dyktalk|"+dayMoStr+"|"+yearStr+"}} ~~~~")
}

which will add it below the first project box (assuming its not WP:SUBST'd). Andy t 22:15, 11 June 2006 (UTC)

Not a bad little regexp... but of course they probably HAVE subst'ed the boxes, at least some of the time After all, we do... While I think that regexp could be extended to look for ending div tags, etc, I think asking the other editors to use their brains is not the end of the world, though. ++Lar: t/c 00:04, 12 June 2006 (UTC)
Wait... don't boxes end with |}? Then you could just shortern the regular exp. to /\}/ (or maybe /(\}|<\/div>)/) Andy t 19:03, 12 June 2006 (UTC)

"Changes since I last edited" script doesn't work

Just gives a "Parsing history... please wait..." in red and then does nothing, while on the history page. —Centrxtalk 21:54, 15 June 2006 (UTC)

I think it just does not work, see Wikipedia talk:WikiProject User scripts/Scripts/Changes since I last edited and Wikipedia talk:WikiProject User scripts/Archive 1#Request for script. I put a warning above the script. -- Jitse Niesen (talk) 11:20, 21 June 2006 (UTC)
I see. That is unfortunate. Thank you. —Centrxtalk • 08:17, 22 June 2006 (UTC)
I've tried to fix it. Lupin|talk|popups 21:56, 27 June 2006 (UTC)
Does this mean you have tried unfortunately without success, or that you have since tried and I should attempt using it again? —Centrxtalk • 02:45, 6 July 2006 (UTC)
It means that I think I've fixed it, so please try again. Lupin|talk|popups 05:04, 11 July 2006 (UTC)

It works, gloriously. Thank you. Is there any way to have it work for long-past edits as well, or this might tax the servers too much? —Centrxtalk • 21:00, 11 July 2006 (UTC)

Yeah, I fixed this script here[2] a while back, so that the "since" tab actually works.Voice-of-All 21:49, 12 July 2006 (UTC)

How to activate the analysis? I do not see any other tabs. —Centrxtalk • 09:50, 18 July 2006 (UTC)
Dumb question, but have you tried a Force-Refresh? Ctrl-F5 on Firefox, I believe. — Mike (talkcontribs) 14:28, 18 July 2006 (UTC)

Seems to work now. —Centrxtalk • 02:13, 23 July 2006 (UTC)

name of the description text box on an upload page

This is specifically for commons but presumably the forms have the same names everywhere. Most editable pages, the name of the form where you insert text is "editform" and the field is "wpTextbox1", so you do this to get the txt hook to append or prepend to:

var txt = document.editform.wpTextbox1; ... this is very common, you see this statement in a LOT of js...

What is the equivalent form and field name pair for an image upload page (for example http://commons.wikimedia.org/wiki/Special:Upload )? I tried that and it did not work, so I viewed source on that page and read the tags. Based on that I thought the form was "upload" and the field "wpUploadDescription", but if i do this

var txt = document.upload.wpUploadDescription;,

I am getting "Error: document.upload has no properties" at that assignment in my javascript console... What am I doing wrong? (pointing me at code that inserts things in fields on upload pages would be as good as an answer... ) Thanks!!! ++Lar: t/c 03:50, 22 June 2006 (UTC)

Just do a view source and grap the elements by ID. Then .value that. I use that trick for auto protection summaries and the summary for "Revert all moves".Voice-of-All 01:15, 23 June 2006 (UTC)
Well, here's what I did
   // upload is the ID but not the name... so this fails    
   // var txt = document.upload.wpUploadDescription;
   // this works but it is brittle
   // var txt=document.forms[0].wpUploadDescription;
   
   var txt=document.getElementById('upload').wpUploadDescription;
I think that's like what you mean... It works. the problem is that the form on the upload page doesn't HAVE a name.... it has ID upload but not name, unlike the edit page which has both ID and name of editform... ++Lar: t/c 01:53, 23 June 2006 (UTC)
An ID is usally the best thing, since you can getElementByID it and you have it. Tag names, like<NAME>, generally require for loops to test for some other quality, like "name=" or ".ClassName=" or ".title=". So if you have an ID, you have all you need usually.Voice-of-All 02:02, 23 June 2006 (UTC)

Tool for researchers needed

Please see Wikipedia:Bot_requests#Bot_for_researchers_needed - perhaps a script will be better then a bot?--Piotr Konieczny aka Prokonsul Piotrus Talk 00:41, 28 June 2006 (UTC)

Monobook code causing wonky history diff radio buttons -- can't figure out why!

I would very much appreciate your help, folks — I cannot seem to figure out what the bloody heck is causing this, despite attempts to figure it out by removing and replacing code.

My monobook.js is at User:WCityMike/monobook.js. For some reason, when I am on an article's history page, I can click whatever lefthand radio button I desire, but the other versions' right radiohand buttons don't open up and follow down, thus preventing me from diff-ing two particular versions.

When I remove the AfD Helper code from my monobook.js (which I had subst-ed in and added a few more reasonings and thoughts to), it seems to solve the problem -- but it always operated fine before, never before having causing this error to the best of my knowledge. My thought is that it might be an interaction with some new code I just installed, but my attempts to figure out what's going on have really been the equivalent of stumbling around blindly in the dark.

If any of you would have a clue as to what's causing it, please let me know (and/or feel free to edit it yourself, of course). I'm, in advance, much obliged. — Mike (talkcontribs) 15:20, 7 July 2006 (UTC)

Substed your monobook.js into mine with nothing else added. Works for me in the latest version of Mozilla Firefox. What browser are you using? Also, you can't edit somebody else's user script file because they are automatically protected (so some hacker can't just hijack an admin's account that easily, stealing the session cookie). (By the way, that's why my shortcut for the unsigned comments script is named US2.js.) Invitatious 20:14, 7 July 2006 (UTC)
Ah. Well, good tidbit to know re: the non-editability. I'm using Mozilla Firefox, too ... I believe the error shows up on both my home Mac and on this Portable Firefox install. (I'll double-check that when I get home). The Portable Firefox install is at v1.5.0.3. — Mike (talkcontribs) 20:54, 7 July 2006 (UTC)
Shows up on my Mac, too, so it's got to be something in the code. Here's a differential, though: I'm noticing the problem, it seems, only with Wikipedia namespace articles. Bedbug's history, for example, shows up fine — but this page's history manifests the problem. — Mike (talkcontribs) 03:41, 8 July 2006 (UTC)

Still hoping someone might be kind enough to help, as I'm going a bit bonkers. I've seen the problem on both Portable Firefox v1.5.0.3 and on MacFirefox v1.5.0.4, making me think it is a code-specific and not machine-specific problem; as my two Firefox installs have some mutual extensions, I've also tested that theory by running Portable Firefox in safe mode, and the problem still readily recurred, so I don't think it's a problem caused by a Greasemonkey script or a Firefox extension.

My educated, and layman's, guess is that the AFD Helper code is conflicting with some other piece of code in the template; if I remove the AFD Helper code from the monobook.js code, the problem does not occur. However, I have been participating in AfD a great deal, and the nomination and voting script has been particularly useful in that participation; furthermore, I don't think it's a problem specifically with the AFD Helper code, as it was one of the earlier pieces of code I put into my monobook.js and this behavior has only recently come to light. (If I could track down precisely when, I imagine I'd have my answer.)

The problem, specifically, is that the diffs radio buttons don't populate down when a diff is selected, making it impossible to select two diffs on the history screen to compare to.

The problem does not occur with Bedbug or with a few other randomly sampled articlespace pages, but does appear to occur with non-articlespace articles, such as my talk page or this very page. The problem does not seem to occur with the history page of User:WCityMike/monobook.js. I'm not sure what these differentials mean, but I hope they are of diagnostic help.

A question: if you are subst-ing in the error-ing code to test it and not seeing this behavior, are you doing a Force Refresh (Ctrl-F5 on Firefox) afterwards to make sure the code is loaded?

I'm sorry to disturb you all, but I'm really at a loss to figure out what's misbehaving here, and would very much appreciate your insight and/or diagnosis. — Mike (talkcontribs) 20:48, 11 July 2006 (UTC)

Just a wild guess, but could it be triggered by page names containing spaces? Those are notoriously error-prone due to the way MediaWiki converts them to underscores and back again, and it would fit the pattern you describe above. —Ilmari Karonen (talk) 22:23, 11 July 2006 (UTC)
I appreciate your insight on this one, Ilmari. Unfortunately, my programming prowess is of the quality of "oh, that looks like cool code, COPY, PASTE." ;-) I'm not sure what to be looking for in the monobook.js code with regard to this spacing issue. I'll give it the ol' college try, but if you (or anyone else) wish to cast a programmer's eye at the code to see if you spot the problem, I would be indebted. — Mike (talkcontribs) 02:03, 12 July 2006 (UTC)
Neither do I, so far, but you could test the theory on a bunch of pages with and without spaces in the title to see if it's true or just a coincidence. —Ilmari Karonen (talk) 03:43, 12 July 2006 (UTC)
Well, a namespace article with spaces works, but three Wikipedia-space articles with spaces in their name don't [3], [4], and [5]. — Mike (talkcontribs) 04:07, 12 July 2006 (UTC)
Well, I essentially rebuilt my monobook.js from scratch. I went to the source of each code and pasted a fresh copy in, aside from the AfD helper, which I had made too many personal modifications to. I didn't include some extraneous features I had used but never put in. Once I was done, the problem still existed. Fortunately, though, in the process of rebuilding, I had ordered these scripts by the order in which I had put them into the file, using my monobook.js' history as a guide, and so I started removing code chronologically.

I'm fairly certain I found the culprit — Where's script that changes the time and dates on comments to your local time zone. This would make special sense given that what is right next to the radio buttons on a history page? The date and time.

I even tried removing the AfD Helper and restoring Where's script to see if it was an intrascript conflict. Not the case; even with the AfD helper gone and the comment localization script in place, the problem still recurred.

I'll bring it to Where's attention. It's a shame, since I really liked this script. Maybe he can manually exclude histories, or figure out what went wrong.

Thanks, guys. — Mike (talkcontribs) 17:47, 12 July 2006 (UTC)

Update: Where released a version of the script (currently on my talk page, but I imagine he'll update the main script) that's hard-coded to ignore history pages, since history pages are already in local time zone via the system. Seems to solve the problem! :-)Mike (talkcontribs) 19:51, 12 July 2006 (UTC)

Dumb ... but minor and easier ;-) ... question

What combination of <nowiki> and/or <pre> and/or whatever do you guys use to get your monobook.js to display "nice" visually without screwing up the code? — Mike (talkcontribs) 18:06, 12 July 2006 (UTC)

//<pre><nowiki>
code here
//</nowiki></pre>

GeorgeMoney (talk) 21:25, 12 July 2006 (UTC)

Thanks. — Mike (talkcontribs) 21:31, 12 July 2006 (UTC)

Duplication of Toolbox Links/Tabs

Eh, I was lucky with the other problem, so let's see if I can conquer this longstanding one.

Once in a while, if I add a script portion to my monobook.js file, all of a sudden, all of my list items and my tabs will duplicate. So, for example, if I have a "changes since last edited" tab, and a piece of code is added, I'll then see two of them, or if I've added links to "personal tools" or to "toolbox," they'll be duplicated. (Ditto with additions to my watchlist such as (unwatch) or (adah), which then become (adah) (adah) and (unwatch) (unwatch).) I usually then have to revert the addition. I've seen this so far with the "rename 'edit this page' to 'edit'" script fragment and the "list red links" script fragment. Very often, this will also mean the script in question won't work — although not all the time (the "list red links" script, for example, doesn't work in this case, but the "rename edit this page" fragment did).

Not asking you guys to reinvent the wheel, but is this a known quirk? Any idea what might cause this? — Mike (talkcontribs) 20:31, 13 July 2006 (UTC)

In all honesty, I am not sure what may cause it, as I have never experienced this problem. Have you tried clearing your cache (CTRL+SHIFT+R)? Also, I saw from before that you were using an old version of FireFox; you might want to upgrade. -- Where 20:39, 13 July 2006 (UTC)
Portable Firefox is maxed out at v1.5.0.3, and v1.5.0.4 is the newest for when I'm at home. :) I had tried a Force Reload with Ctrl-F5; I'll try clearing the cache. — Mike (talkcontribs) 20:46, 13 July 2006 (UTC)
Hmm. The absence of AddToolboxLink may have been screwing me up. — Mike (talkcontribs) 20:49, 13 July 2006 (UTC)
Well, no, putting in AddToolboxLink made List red links work, but it didn't help solve the "'edit-this-page' to 'edit'" script. It appears as if this sort of duplication is an error message of sorts. — Mike (talkcontribs) 20:57, 13 July 2006 (UTC)

Central repository of scripts

For those developers who would rather put their scripts in a central repository, I have created User:Userscripts. (It seems that scripts can't be hosted anywhere outside of the User namespace.) Instructions for setting up a script there can be found on the userpage. Just FYI. Ingoolemo talk 23:12, 1 August 2006 (UTC)

You are aware nobody can edit other users js files right? — Ian Moody (talk) 23:16, 1 August 2006 (UTC)
Non-sysops, that is. User scripts can be hosted on any page whatsoever; see Wikipedia:WikiProject_User_scripts/Scripts. The only difficulty arises when one sources a script from a page which anyone can edit (an unprotected JS page not in userspace), since that opens you up to nastiness. Lupin|talk|popups 15:56, 5 August 2006 (UTC)
Which would mean that I would have to provide any scripters who moved stuff to that namespace with password access. Actually, that's not such a bad thing, because it doesn't require any page protections and yet still avoids any potential nastiness. I think that's what I'll do. Ingoolemo talk 02:51, 7 August 2006 (UTC)


Access from a new window

Hi, I'm from the German Wikipedia but we don't have such experts there ;) So my question here: I open a new window which contains a list of categories and this javascript:

function add_cat(cat){
link = "\n" + cat + "";
opener.document.editform.wpTextbox1.value += link;
}

(And then I've got links like that: <a href="javascript:add_cat('Kategorie:Test');">Test</a>)

So far so good, and on my own PC, with a dummy file containing a form called "editform" and the textarea "wpTextbox1", it works perfectly fine.

Is there any script in MediaWiki that "protects" the editform from being controlled from another window or something? And if so, how can I get around that? Thanks a lot, Bernardissimo

Well, now, for possible contact purposes: I'm in here, too: --Bernardissimo 17:09, 8 August 2006 (UTC)

qwikify

I'm trying to add the qwikify function to my monobook, and it isn't working. :( I've purged cache, so that's not the problem. I'm still a liiiitle new to JS editing, so help would be appreciated. Thanks! Lauren 23:40, 20 August 2006 (UTC)

Nevermind, it just started working somehow. Lauren 00:55, 21 August 2006 (UTC)

Editing another page (not the one the browser is on)

How do you do that? Eyu100 01:08, 25 August 2006 (UTC)

XmlHttpRequest--83.43.152.107 17:03, 25 August 2006 (UTC)

??? Eyu100 18:12, 25 August 2006 (UTC)

Script problem

Script:

function gotoURL(myURL){

  window.location=myURL;

}

function write_to_ratings_page() {

gotoURL("http://en.wikipedia.org/w/index.php?title=User:Eyu100/Bot_area&action=edit");
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value + "(" + quality + " and " + importance + " and " + pagename + ")";
document.editform.wpSummary.value = "Added rating";
document.editform.wpMinoredit.checked = true;
document.editform.submit();

}

function get_rating() { var quality=prompt("Please enter a quality rating from 1 to 6, 1 is stub, 6 is FA","") var importance=prompt("Please enter an importance rating from 1 to 4, 1 is low, 4 is top","") }

function rate() {

  get_rating();
  gotoURL("http://en.wikipedia.org/wiki/User:Eyu100/Bot_area");
  write_to_ratings_page();

}

addOnloadHook(

function() { 
  var pagename=getPname();
  addTab("javascript:rate()", "rate", "ca-rate", "Rate this page", "");

);

Retrieved from "http://en.wikipedia.org/wiki/User:Eyu100/monobook.js"

Can someone figure out the problem? This script makes my entire monobook.js defective. Eyu100 17:41, 25 August 2006 (UTC)

Plugin system?

One of the stated goals is "Create a plugin system for user scripts".

A while ago I added an idea here Wikipedia talk:WikiProject User scripts/Scripts#Helper_functions that might make script installation (and perhaps programming) considerably simpler.

I have several ideas for useful functionality. Shinobu 10:40, 28 August 2006 (UTC)

Please allow me to plug another, more radical idea to simplify script installation, illustrated by the proof-of-concept at Wikipedia:WikiProject User scripts/User-script manager. -- Jitse Niesen (talk) 02:48, 31 August 2006 (UTC)

I have since seen it. The difference is one of focus: your system aims to simplify installation of scripts. But I was thinking more along the lines of simplifying code reuse through a plugin system like thingy. Both can be very useful: one aids the user, the other aids the programmer. Shinobu 17:26, 18 September 2006 (UTC)

Un-RfD

This is probably obvious, but....

I have a collection of redirects I've nominated for deletion, and, after some consideration, I'm withdrawing (most of) the nominations. There are approximately 136 of them. Maybe more, maybe less. In any case, I want to change:


{{rfd}}
#Redirect [[blah]]

to

#Redirect [[blah]] {{R from Unicode}}

in each of them. (Obviously, if the {{rfd}} isn't there, I don't want to edit...) Can this be done by a script?

Arthur Rubin | (talk) 01:23, 31 August 2006 (UTC)

What's A User Script?

What is a user script?100110100 22:32, 6 September 2006 (UTC)

A bit of javascript that gets loaded each time you visit a Wikipedia article that does things for you. Their use is very varied. Some add popups to links, others make editing easier (regex search and replace), others change the way an article is formatted or simplify common tasks. Shinobu 23:21, 8 October 2006 (UTC)

Inline script loading script

Have hade a code, that will load a script file and evaluate it without writing html code. The script is located at (it doesn't work at the moment, could someone pleaae look it up?)User:AzaToth/loadscript.js AzaToth 15:30, 14 September 2006 (UTC)

I've seen the technique before. I think it can be done asynchronously too. Shinobu 17:12, 18 September 2006 (UTC)