Wikipedia talk:User scripts/Archive 1
Are we making vandalism too easy?While I do agree with, and intend to support, this project - I thought I should bring up the following concern: There is a well-founded concern on the pedia against bots - they are valued, and useful, but require various hurdles to be jumped through, out of fear of their power in the hands of bad apples. User scripts have some of the same powers and dangers. By making this project, are we making it too easy to get a semi-automatic vandalbot set up, and thereby opening up the pedia to Even More Vandalism? Any thoughts, comments, etc, would be much appreciated. JesseW 16:21, 13 August 2005 (UTC)
Thanks guysI've added "Add purge to tabs", "Add edit section 0", and "Changes since I last edited". They all work as advertised. My only complaint now is that at 800x600, I've now run out of tab "real estate" if I find another nifty script. :-( BlankVerse ∅ 06:23, 19 August 2005 (UTC)
Wikipedia:CustomisationI've set up the Wikipedia:Customisation page which I would see as a great place to show off the best of what you guys come up with here. It contains some customisation options, but I've never really gone into the javascript and CSS of Wikipedia. Anything that you could do to help expand that page would be great – the intention is that it is a very simple description of how to customise the Wikipedia experience, particularly visual settings. violet/riga (t) 11:32, 3 September 2005 (UTC) Towards a plugin systemOk, finally managed to remember where I saw how to import chunks of code: User:Pilaf/monobook.js To import eg. Pilaf's Live Preview, you do: document.write('<script type="text/javascript" src="http://en.wikipedia.org/w/index.php?title=User:Pilaf/livepreview.js&action=raw&ctype=text/javascript&dontcountme=s"></script>'); To create a "plugins" system, we'd need to write a function that can parse an array of pagenames and import the code from them - I'm sure it's doable, I just don't have the time right now... Alphax τεχ 07:00, 1 October 2005 (UTC)
function loadPlugins(list) { // list is an array or a comma-separated string var wpTitleBaseUrl='http://en.wikipedia.org/w/index.php?title='; var wpEndScriptUrl='&action=raw&ctype=text/javascript&dontcountme=s'; if (typeof list == 'string') list=list.split(','); for (var i=0; i<list.length; ++i) { document.write('<script type="text/javascript" src="' + wpTitleBaseUrl + encodeURI(list[i]) + wpEndScriptUrl + '"></script>'); } };
loadPlugins('Wikipedia:WikiProject_User_scripts/Scripts/Force_edit_summary'); window.addEventListener('load', addForceSummary, false);
#include [[Wikipedia:WikiProject_User_scripts/Scripts/Force_edit_summary]]
I've given this quite some thought and I wrote the function at the bottom Mediawiki talk:monobook.js to encapsulate the inclusion and provide rudimentary configuration, but that just solves a small part of the problem. See my monobook.js to see it in some action. Thoughtful coding of scripts could make scripts load in the right order (some juggling of include calls would do the trick). The real solution of this problem, of course, is to have ordinary transclusion, just like other pages, i.e. {{user:lupin/popups.js|structure=menus}}. I recently suggested that this be enabled, but was told that it's not secure. Is it more unsecure than what we're doing now? Zocky 13:46, 1 November 2005 (UTC) Would the code below help at all at getting things to load in order? I'm playing around with something similar at wikisource. However, I really don't know much about javascript/browsers. Derex 18:42, 19 December 2005 (UTC) if (window.addEventListener) window.addEventListener('load', plugin_hook, false); else if (window.attachEvent) window.attachEvent('onload', plugin_hook); function loadScript(name){ script = document.createElement('script'); script.src = 'http://en.wikipedia.org/w/index.php?title=SCRIPT_REPOSITORY/'+ name +'.js&action=raw&ctype=text/javascript&dontcountme=s?'; script.type = 'text/javascript'; document.getElementsByTagName('head')[0].appendChild(script); } function plugin_hook() { loadScript('script1'); loadScript('script2'); } PS: I noticed someone raised the issue of whether one disgruntled admin could sabotage the whole system by trojaning the plugins ... making other admins delete stuff unknowingly, etc. You can make subpages off of your user monobook.js ... these are protected just like the main page (on WS anyway). So, you could plugin off a single user's space ... that way only one admin could sabotage the system. It would be a little inconvenient if that person left, because all the users would be pointing at the wrong (unmaintained) page ... not a huge deal to fix though. Derex 18:58, 19 December 2005 (UTC)
Peer Review, externalBeen fiddling with code from here and a few other places, and some of my own, on Uncyclopedia, thought I might ask for comments on it (link). Most of it is pretty self explanatory. addblockuser() gives me a "Block user" button (on uncyc) on Special:Contribs (for /wiki/ and for /index.php/ versions of the link). MTU is a macro, and could be modified to add a template or any text to a page pretty easily. Something I can't figure out how to do is add or change the edit macro buttons (bold/italic/sig/etc), but it looks unlikely to be very editable as it is embedded in the html and not an external script.... thoughts? Splarka (rant) 04:59, 18 October 2005 (UTC) (long time javascript noob)
Sidebar linksIt's funny to see my toolbox links described as "interesting" here. I don't really recommend copying them though. I once used a screenshot of Wikipedia with my javascript and CSS applied in a presentation as an example of what can go wrong when you let users edit the site's style and navigation by themselves since it really is a mess, especially when you scroll down a page with interlanguage links on it. If there's an easier way to add a bunch of links (internal and external) to the sidebar, I'd like to know about it. :) Angela. 05:44, 22 October 2005 (UTC)
/**** Add links to the toolbox ****/ function addToolBoxLinks() { var tb = document.getElementById('p-tb').getElementsByTagName('ul')[0]; var afdtime = new Date(); var months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']; afdtime.setUTCDate(afdtime.getUTCDate() - 7); addlilink(tb, '/wiki/Special:Newpages', 'New pages', ''); addlilink(tb, '/wiki/Special:Shortpages', 'Short pages', ''); addlilink(tb, '/wiki/Special:Log', 'Logs', ''); addlilink(tb, '/wiki/Template:Deletiontools', 'Deletion tools', ''); addlilink(tb, '/wiki/Wikipedia:Articles_for_deletion/Log/' + afdtime.getUTCFullYear() + '_' + months[afdtime.getUTCMonth()] + '_' + afdtime.getUTCDate(), 'Week old AfD', ''); addlilink(tb, '/wiki/Wikipedia:Disambiguation_pages_with_links', 'Dab list', ''); addlilink(tb, '/wiki/Wikipedia:Template_messages/User_talk_namespace', 'Talk messages', ''); addlilink(tb, '/wiki/User_talk:Alphax/special', 'Special characters', ''); addlilink(tb, '/wiki/User:Alphax/Sandbox', 'My sandbox', ''); addlilink(tb, '/wiki/WP:ICT', 'Image Copyright tags', ''); }
Available skillsetHi everyone! Would it be possible for us to summarize the skillset we have in this group with respect to software engineering and programming experience? There are a number of interesting scripts here, and I think this project would benefit greatly if we did some brainstorming to see what sort of things this project intends to support for Wikipedia. --HappyCamper 14:05, 30 October 2005 (UTC) mergeUmm no. Have you seen how much content is spread accross those pages? they were broken down for a reason.Geni 15:09, 6 November 2005 (UTC)
It's a great deal easier to type in WP:KT into the URL than to wade through a Wikiproject, so I oppose merging Kate's tool here. (No comment on others.) Ingoolemo talk 07:08, 7 November 2005 (UTC) Okay, perhaps its too expensive to move. But, the premise is to have good organisation and neatness. It would be great if there can be Wikipedia:User scripts where all users scripts are stored, also within subpages and point links to user scripts from there. Wikipedia:Scripts currently stores general ones. Wikipedia:Tools stores others. Perhaps, it is a good idea to store the database/repository of scripts and tools in this way. And as mention this project serves as a rallying point. -- Zondor 08:54, 7 November 2005 (UTC)
Updatable JavascriptsI asked in Wikipedia_talk:Tools#updatable_Javascript and they recommended here. I was thinking we should have a centralized place for user scripts to be stored that can be imported into user's profiles (like Lupin's popups, for instance) instead of copied and pasted, which would allow them to be updated in a central location and propagated to everyone. If the pages were protected, this wouldn't be any less secure than having Mediawiki:monobook.js admin-editable. (Speaking of which, couldn't a disgruntled admin write a script on there that would make other admins delete images or other such serious vandalism without their knowledge?) — Omegatron 00:19, 8 November 2005 (UTC)
Picture PopupsI've written a new js tool for images, see User:Zocky/Picture Popups. Testers and comments are welcome. Zocky 04:19, 9 November 2005 (UTC) Add/Remove to side bar?Hello all you programmers! I have a quick question: does anyone know the source of code that removes/adds links in the side bar (i.e. navigation and toolbox)? I've seen it done before, but can't seem to find it now. Thanks! Flcelloguy ( A note? ) 00:07, 12 November 2005 (UTC)
IdeaWhat I think would be the most effective is to create a "Pick and choose" script database, where a user with negligible javascript experience can go and add the features he likes for his own monobook.js, by copying a "standard framework" monobook and adding from there. An example would be: Tabs
Toolbox
Userlinks
That's just my idea... Titoxd(?!?) 02:48, 16 November 2005 (UTC)
install('purge tab'); installe('afd helper', 'afdh_signature=[[user:me|mysig]]');
Newbie helpI cut and paste the demo script into my monobook.js page and reloaded but it does not seem to work (when I go in to edit a page I do not see a 'wikify' tab). My monobook.js page is the only one I have seen without the message bout reloading, so I wonder if I have done something stuid. Any ideas? IanBailey 08:14, 16 November 2005 (UTC)
Ian is right that this is not explained very clearly in Wikipedia:WikiProject User scripts/Tutorial. As User:here says, you need to include the helper functions as well (except that they are also JavaScript, and not CSS). So, User:IanBailey/monobook.js should look like function addlilink(tabs, url, name, id, title, key){ var na = document.createElement('a'); na.href = url; na.appendChild(document.createTextNode(name)); var li = document.createElement('li'); if(id) li.id = id; li.appendChild(na); tabs.appendChild(li); if(id) { if(key && title) { ta[id] = [key, title]; } else if(key) { ta[id] = [key, '']; } else if(title) { ta[id] = ['', title]; } } // re-render the title and accesskeys from existing code in wikibits.js akeytt(); return li; } function addTab(url, name, id, title, key){ var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0]; return addlilink(tabs, url, name, id, title, key); } function addQwikify() { addTab("javascript:doQwikify()", "wikify", "ca-wikify", "Mark for wikification", ""); } function doQwikify() { document.editform.wpTextbox1.value = "{"+"{wikify}}\n\n" + document.editform.wpTextbox1.value; document.editform.submit(); } if (window.addEventListener) window.addEventListener("load", addQwikify, false); else if (window.attachEvent) window.attachEvent("onload", addQwikify); I have no idea why you do not get the message about reloading. Cheers, Jitse Niesen (talk) 12:03, 16 November 2005 (UTC)
ARIN WHOISWho has added a tab to his monobook.js to add a link to ARIN's WHOIS utility. Is there a way someone with more technical ability than me can add it to my Monobook.js? Thanks... Titoxd(?!?) 01:50, 24 November 2005 (UTC) I have an idea for a tool...Hi, I like what you guys are doing here. I hope this is the right place to ask this. I have an idea for a tool that will basically just print a text representation of a tree representation for a given category. You can see what I mean here (this is one I did by hand, it's not great anyway - and it's not consistent). If I am interested in a given topic I find it useful to know what subcats exist without going through them all by hand. I would also find this very useful on commons, for categorising images. For example I would like to run it on commons:Category:China. It would also allow you to more easily see obvious gaps (for example, missing provinces of China). I wrote a brief algorithm for it here: User:Pfctdayelise/Texttreeofcats. But I don't know how to implement it. I don't know javascript (but I suspect it is not quite the right tool for this anyway). I know Python, but I am not (yet) familiar with the pywikipedia stuff. I also suspect it is not quite what I want. Also, I know we are not allowed to run spiders over the wikipedia live; you have to use a database dump, yeah? I guess this is a kind of spider but would I be able to run it live? Since it's not editing pages, and it has definite limits, I don't think it would be that onerous. And I would only run it every now and then, and then save the resulting text tree for reference. So, any advice about implementing this you could give me, would be great. Please reply here or on my Talk page. Thanks! --pfctdayelise 02:29, 26 November 2005 (UTC)
Request for scriptHi. I have a request. When checking my watchlist, the most annoying thing is when several changes to a given article occured in the last say 24 hours. Then doing a diff is not enough, one needs to go to the history, select a range, and see the total diff. My request would be the following. Can one fool the diff button to show not just the last diff, but the diffs in the last 24 hours combined? Or to have several diffs show up one under another on the watchlist? A similar feature exists for recent changes (one needs to enable that one in the preferences), but not for the watchlist. If anybody has any suggestions, that would be very much appreciated (I could do the coding in Javascript or whatever myself, but I don't even know how to start). Oleg Alexandrov (talk) 05:12, 2 December 2005 (UTC)
Ease of useIt seems that we should try to make user scripts easier to use; this is also one of goals of this WikiProject. A plugin system, outlined for example in #Idea, would be a start. In an effort to simplify it further, how about creating a form where the user just clicks the options to be included? I wrote a mock-up at [2]. Do you think that could be useful? At the moment, it just generates the user script. I intended to make another button for uploading the script to Wikipedia. However, this is not so easy. If the uploading is done by a server-side program, the user has to give the Wikipedia password to my site, which many will rightfully find a bit scary. However, it cannot be done by JavaScript because of the Same Origin Policy (a script can only access web pages from the same site as where the script originates). This problem can be avoided by using signed scripts, but that sounds awfully complicated and will only work on Mozilla. Any ideas? -- Jitse Niesen (talk) 00:08, 3 December 2005 (UTC)
Hmm. Anything I can think of requires a lot of cooperation from developers, which will not be that easy to get (besides, I have another thing that I want to push at some point). It might just be possible to do something via the JavaScript that admins can edit, but I can't readily see a way to achieve this in a reasonable safe manner. Do you see a way to do this? On the other hand, I see that almost 500 people have installed your popups (including some IP addresses; I thought they couldn't?), so perhaps it's not too much to ask people to copy the script from the edit box to their monobook.js. By the way, thanks for recommending the O'Reilly book on JavaScript; it's been useful. -- Jitse Niesen (talk) 01:26, 3 December 2005 (UTC)
That might work, yes. I don't want to add a lot of JavaScript to Mediawiki:monobook.js, but we can check whether we're on a special page and pull in the script if we are. -- Jitse Niesen (talk) 14:20, 5 December 2005 (UTC)
Request and helpI want to use this script as a tab to get the title of the page and copy that to my clipboard (for easy pasting) or to maybe make the Location Bar equal the title so I can just highlight that and copy it. Is that possible? I'm not familiar with scripting... Also, is there a script that will search the textarea when I'm editing? Firefox doesn't do it and I only see a replace script. I can't imagine it'd be that difficult, but what do I know. A bookmarklet would also suffice. Thanks, I appreciate any help. BTW, I'm using Firefox. Gflores Talk 18:37, 5 December 2005 (UTC)
monobook.js won't workI used to use my monoboox.js to create a Kate link in the top (with my watchlist, contributions, etc.). That stopped working and when I recently added a new script, it still didn't work. I have no idea of how to write HTML/CSS. Thelb4 17:54, 6 December 2005 (UTC)
My user scripts are acting up. Without making any changes to them, my Kate's tool link and an editing tab appeared and then disappeared. I can't figure out what is wrong. I was wondering if a kind soul would review my monobook.js and see if they could diagnose the problem. Important to surround scripts by <pre> tagsHi all, I just wanted to note that all scripts available for others' uses should be preceded by //<pre> and followed by //</pre> Users that have been copying the text of the google link script, for instance, have been copying title.replace(/("|%22)/g, ) because the internal code was title.replace(/("|%22)/g, '') which then showed without the '' because this was treated as markup. jnothman talk 22:55, 11 December 2005 (UTC)
Logs linkI added a new script, Wikipedia:WikiProject User scripts/Scripts/Logs link. It adds a link to the toolbox which goes to Special:Log for that page. If the page is a user page, user talk page or user subpage, then the link will go to logs for that user. --bainer (talk) 04:04, 23 December 2005 (UTC) Animated sidebar swapperI saw an example of a fade in/out javascript animation somewhere, and got the bright idea that I needed to put something like it somewhere in my Wikipedia interface. The result is a script that turns the Wikipedia logo into a toggle switch that swaps two sets of 'portlet' boxes. Tested in some Mozilla-derivatives, probably breaks in damn near everything else. Written for my myskin.css, which is close enough to Monobook that there shouldn't be any problems dropping it in. See User:Cyrius/myskin.js, SwapColumns() -- Cyrius|✎ 06:58, 6 January 2006 (UTC) Including scriptsWhat is the quickest, most efficient way of including other people's scripts in mine? Lupin's popups uses a piece of code to include it in your js and be updatable, etc. User:Quarl/monobook.js uses a similar thing inside a function to keep his monobook.js very clean: function winc(s) { document.write('<script type="text/javascript" src="' + 'http://en.wikipedia.org/w/index.php?title=' + s + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); } I want to do the same thing for mine, and start putting all my individual functions on different pages, but is this the best way to do that? — Omegatron 16:23, 10 January 2006 (UTC)
{{User:Omegatron/function1.js}} {{User:Omegatron/function2.js}} ...
document.write('<script type="text/javascript" src="' + 'http://en.wikipedia.org/w/index.php?title=User:Omegatron/inclusions.js' + '&action=raw&templates=expand&ctype=text/javascript&dontcountme=s"></script>');
Fixed sidebar
Non-intrusive notificationIs there non-intrusive alternative to the alert() box? Something non-modal? They really annoy me. I guess the background color could be changed or something to at least indicate an error... — Omegatron 07:30, 14 January 2006 (UTC)
document.getElementById('ca-unverified').firstChild.style.backgroundColor = "#ff4444"; document.getElementById('ca-unverified').style.backgroundColor = "#ff4444";
Testing scripts?Hi all. I'm about to start writing a script that makes image tagging easier, and I was looking for some advice on how to test it. I think testing tips would be a valuable addition to the techniques page. ~MDD4696 03:39, 23 January 2006 (UTC) New template for tool installationI've generalised {{navpop}} to give a new template, {{js}} for easy installation of scripts. Lupin|talk|popups 23:48, 25 January 2006 (UTC) Ease of use, part IIFollowing up on #Ease of use, and especially on Lupin's comments (though I still need to study his code to see where mine can be improved), I made another version on Wikipedia. If you want to have a look (and please do), this is what you need to do:
if (location.href == "http://en.wikipedia.org/wiki/User:Jitse_Niesen/Client-side_preferences") { {{subst:js|User:Jitse_Niesen/Client-side_preferences/Main.js}} }
Three warnings: It works in my configuration but it might not work in orther ones, your old user script is overwritten, and the script for the "since" tab does not work for me. I'm curious what you think of it. -- Jitse Niesen (talk) 02:06, 28 January 2006 (UTC) Tracking abuse in recent changesI have recently written a Python script that reads the atom feed of the recent changes and reports whether there were edits containing suspicious words such as '!!!' or 'rulez!'. I have asked Brion about whether this feature is going to be introduced anytime to the recent changes page, and he told me it is on the feature list but not for the near future.
Some helpI tried adding test-n.js into my monobook but it won't work on IE or firefox. Some help? Thanks.--Urthogie 10:50, 1 February 2006 (UTC)
|