Wikipedia talk:User scripts/Archive 4
My Scripts have stopped workingI was assessing articles using Outriggr's script when my scripts suddenly stopped working. Here is my monobook.js file: http://en.wikipedia.org/wiki/User:Oneworld25/monobook.js Can anyone help me? Oneworld25 19:57, 20 June 2007 (UTC)
To add a linkIs there a script with which I can add a link and/or links to the 'navigation' or 'interaction' boxes? ~ thesublime514 • talk • sign 19:00, July 2, 2007 (UTC)
addOnloadHook(function(){
addPortletLink ('p-interaction', 'http://…', 'mylinkname');
})
UnwatchIt seems the "unwatch" script stopped working (at least for me). I think the Watchlist special page itself has been upgraded a bit. Can anyone fix it? Thanks, — thesublime514 • talk • 00:46, July 11, 2007 (UTC)
Removing "Dependencies" columnI'm planning to do a little cleanup on the "Scripts" page, and I would like to remove "Dependencies" column. It's mostly empty or outdated (e.g. for wikEd and CloseAFD.js) or just says "see doc". If you have any objections - please share them now ∴ Alex Smotrov
Regex replacing toolI have given Gerbrant.edit.regexReplace (documentation) a bit of an overhaul. Most changes are cosmetic, but nevertheless should improve the workflow a bit. I hope I didn't introduce new bugs. Shinobu 12:17, 25 July 2007 (UTC) Special:Contributions ScriptIs there a script that allows me to see a user's S:C page? Possibly like a tab at the top of the page that would take me directly to that user's S:C page? Thanks. MilkTaco 18:25, 10 October 2007 (UTC)
Go and Search buttons in Chick skinPlease excuse the cross posting -- not sure where this belongs. The Go and Search buttons on the Chick skin spill over into the edit box (in which I am currently typing). Could they be moved beneath the Search box (directly above the Toolbox label). Robert Greer (talk) 14:01, 11 December 2007 (UTC) Java ScriptIs there a java script which allows you to see which user has been on your userpage and subpages. SKYNET X7000 (talk) 12:34, 16 December 2007 (UTC)
RecommendationWhich monobook would recommend for a firefox user? --Nemissimo 09:52, 18 September 2007 (UTC)
<:: If you want a whole bunch of scripts at once, try installing User:Pyrospirit/scriptpackage.js. It contains 20 various scripts all in one page, with editing, tagging, interface, meta-data and anti-vandalism scripts. The individual scripts it uses can be found in this WikiProject. However, if you want more customized scripts, just look around and find which ones look useful. I'd personally recommend wikEd and Twinkle. Pyrospirit (talk · contribs) 19:47, 14 October 2007 (UTC) Scripts misread by MediaWikiI've noticed quite a few cases of scripts not taking into account MediaWiki's interpretation of the script. See Special:Whatlinkshere/" + target + " for what I mean. Since I'm not an admin, I can't do anything about those, but someone should really fix these things with
New version of hidePane.jsGood news for those of us who have limited screen real estate, or who simply like to use it more efficiently. I've updated User:Gerbrant/hidePane.js - instead of the ugly (although functional) gutter on the left hand side it now shows a series of pull down menu's at the top. This is also useful if you are primarly a Wikipedia reader, since all the space used by the left pane that contains the navigation, interaction, etc. portlets will be available for the actual article content. Of course the downside is that actions that normally take one click, now require you to open the appropriate menu. Perhaps in the future I'll add a way to active the most commonly used menu items in one click. Compatible with Safari (although wrapping doesn't work, but that's not my fault), IE and Firefox. If you have any feedback, please let me know. Shinobu 04:51, 4 November 2007 (UTC) Regarding the to-do list...
Updated edit top scriptGerbrant.edit.top has been updated; I hope I didn't break anything. I fixed a bug, tried to make it more robust and also gave it a minor facelift. Shinobu 13:26, 12 November 2007 (UTC)
Admit? It isn't like I ever denied it. :-) But your script doesn't seem to show an [edit] link for pages containing only the introduction. An [edit] link on such pages may be superfluous for most users, but it's still inconsistent. To solve this, you would need no have some extra checks in the case no existing [edit] link is found, not unlike mine. I do think your solution is more elegant, but for my needs my version works better, even if it is ugly. Shinobu 07:19, 13 November 2007 (UTC) AfDsorting script help?I'm working on a script to add a sort link to the top of the edit page for Articles for Deletion. When editing such an article, the sort button asks for a category code and a reason for sorting (sorting as whatever), then produces the appropriate template and code, adds the reason to the edit summary, and submits the edit. I've based it on Digitalme's AIV Helper, paring down the function to just one button. However, three problems exist. First, I can't get it to automatically take the single-letter code for the category (per CAT:AFD and generate an automatic edit summary. Second, the sorting template (REMOVE WHEN CLOSING THIS AFD) is generally placed on the second line, under the heading for the debate. I can't get the script to place the template anywhere other than the end of the page. This means that the existing template must be deleted by hand. Third, I don't know how to have the script remove any existing sorting templates (such as nominator unsure, for example). The script in its current form may be found here. Thanks in advance for any advice you can provide. ZZ Claims ~ Evidence 20:16, 15 November 2007 (UTC) If this request goes elsewhere, please let me know. Thanks! ZZ Claims ~ Evidence 20:17, 15 November 2007 (UTC)
if(t.value.split("===").length>=3)
{
var a=t.value.split("===");
a[2]="\nTEXT TO ADD HERE"+a[2];
t.value=a.join("===");
}
t.value=t.value.split("{{REMOVE THIS TEMPLATE WHEN CLOSING THIS AfD|").join("{{ns:0|");
Adding user scripts to Special:PreferencesOne of the problems that WP:US faces at the moment is that it isn't as widely known as maybe it ought to be, and that the method of installing scripts isn't intuitive and involves editing a personal scripts page, even if the user in question doesn't have an interest in developing scripts but only wanted to use them. Advances like {{subst:js}} are only so effective in this regard; but now, it seems that a better option is available. There is an extension mw:Extension:Gadgets that adds user scripts stored in MediaWiki: space as options in Special:Preferences; that way, we can have several users (probably mostly WP:US members, although there would be no reason to restrict the people who could check) check various scripts to see if they were safe to add as user preferences, and then an admin could edit MediaWiki space accordingly to add the script as a preference that users could easily access, install and uninstall, a sort of WP:US/S that's officially sanctioned by the software. Normally, this sort of project is the sort of thing that just gathers a bit of support on WP:VPR and then dies because nobody wants to implement it; however, the code has already been written, and reviewed by developers, and it is currently live on the German Wikipedia (if you have an account on dewiki, go to de:Special:Preferences and click on the rightmost tab to see the new code in action). This makes it seem much more likely that if their is community consensus, that extension will be installed. At the moment, I'm just posting this suggestion here, to see if people interested in user scripts think that this is a good idea; if the conversation here seems encouraging, I'll link it from VPR and we can have a proper attempt to gain consensus here to make a request to devs to enable this feature. Does anyone else think this is a good (or bad) idea? I'm trying to gauge consensus, so even a 'me too' is useful here if you agree. --ais523 14:39, 19 November 2007 (UTC)
Stub types scriptHi, I have a script installed (I'm pretty sure it was written by ais523) that easily allows me to add in a stub type simply by typing in the name of it. Anyway, what I would like to add to it (maybe I would only use it, or maybe it would be helpful to others) is a dropdown box with some stub types so that I don't have to keep typing the same ones in over and over. I can add in the types myself, I would just like to know how to add in the dropdown box. Thanks jj137 (Talk) 17:44, 23 November 2007 (UTC)
Gadgets extension now liveIt's now possible to add scripts to Special:Preferences (navigation popups is already there). I've started a new page at Wikipedia:WikiProject User scripts/Gadgets to try to decide which scripts should or should not be added (I know most about my own scripts, so they currently have some of the most detailed comments). Anyone who sees this, feel free to help reject/accept/test the scripts on the list! --ais523 09:20, 4 December 2007 (UTC) Turn off scripts?Is there an area an admin can edit other than monobook.js that prevents a user from using a particular script? I'm curious as I have suddenly and mysteriously lost all Twinkle functions without any kind of warning or reasoning (ie: no admin has told me and no changes have been made to the way my Firefox is setup that would prevent only 1 out of the several scripts I use from working). So, at the risk of offending admins, I want to know if this is possible and the admin that may have done this didn't tell me? -- ALLSTARecho 13:53, 20 December 2007 (UTC)
BotHi. I have created around 14,000 articles on wikipedia, higher than anybody, and am currently adding Frebnch communes at bot speed around 6 a minute and have requested that my new articles are automatically filtered but noone seems to be concerned. I have addressed this to several people but no one has taken it seriously when I said I was concerned about clogging up new pages even when I am adding general content. I refused adminship long ago but surely I am respected enough to be regarded as admin level in editing. I always add valuable content and most of my articles are referenced except such stubs. Isn't it time somebody made a decision to help new page patrollers by helping them. I;ve contributed tens times more than many adminstrators on wikipedia (107,000 edits) who automatically have their page unmarked -shouldn't mine be the same on a permanent basis? I consistenly add new content to wikipedia which is generally referenced and useful content. Deforestation in Brazil is what I am capable of. It would help patollers a lot. Any idea if you can help me receive permanent clearance? ♦ Sir Blofeld ♦ Talk? 23:00, 29 January 2008 (UTC)
Using Scripts on other wikisIs it possible to use some of these scripts on other wikis? RT | Talk 22:19, 17 January 2008 (UTC)
document.write('<script type="text/javascript" src="' + 'http://en.wikipedia.org/w/index.php?title=Script_page' + '&action=raw&ctype=text/javascript"></scr' + 'ipt>');
SuggestionI would like to suggest for someone to make user script that will add dropdown menu on edit toolbar (like on BG and HE wikis) with you can insert templates for infoboxes and other templates. SasaStefanovic • 09:26, 26 February 2008 (UTC) structured gadget pagesHalló! I created stuctured gadget pages via sections at s:yi: w:yi: wikt:yi:. During the first trials I used spaces in the sections. Then I could see that w:en: is using « - » while w:fr: does not. The clue is to define « MediaWiki:Gadget-section-foo-bar » . Maybe such examples should be illustrated.
Need help cleaning out my monobook.jsWould someone be willing to help me clean up monobook.js. I can't figure out what is what anymore. I don't know javascript, and I really didn't add things there neatly. I would like to use some of the tools made by others, but before I do, my monobook.js really needs to be cleaned up. Please? - LA @ 00:48, 25 February 2008 (UTC)
importScript('User:Interiot/Tool2/code.js'); importScript('User:Splarka/dabfinder.js'); importScript('User:Pilaf/instaview.js');
watchlistSorterI have just created a new watchlistSorter because the existing one no longer works. I think this could become an gadget candidate and I would like to hear your opinion to improve the script. See the script's page under User:Cacycle/watchlistSorter and the code under User:Cacycle/watchlistSorter.js. Сасусlе 05:45, 25 February 2008 (UTC) Disappearing AfD tab?Hi, could someone advise on my monobook page? It has been working fine with the extra tabs from Twinkle up until I got my extra admin buttons. Now there doesn't seem to be enough room at the top of the page and on many page views, the AfD tab is missing. It does appear on some pages (when not all the other tabs are present) and also on some other monitors I use; but on my home monitor (a small one set to 1024 x 768 pixels) the AfD tab is almost always missing. I'm a total beginner when it comes to all this business, so advice in words of one syllable, please! Kim Dent-Brown (Talk) 20:57, 27 February 2008 (UTC) Smart quotes scriptAttention all pedants, I made a script. smartQuotes.js replaces typewriter (ASCII) quotation marks with proper (Unicode) quotation marks ("smart quotes", see quotation mark glyphs) on any page you view. For example: The Smashing Pumpkins’ Billy Corgan described Surfer Rosa as “the one that made me go, ‘holy shit’. It was so fresh. It rocked without being lame.” The Smashing Pumpkins’ Billy Corgan described Surfer Rosa as “the one that made me go, ‘holy shit’. It was so fresh. It rocked without being lame.” This script will not affect the editing window, so you won't need to worry about tainting your edits with odd glyphs. I know this is irrelevant to pretty much everyone (there is no difference whatsoever at small sizes if you're using Arial), but for the oddballs like me (who use serif fonts and aren't getting laid) it's available. If you're ever printing out a Wikipedia article for academic usage or something, you might consider applying this script for that extra professional touch. I've only tested this in Firefox 2.0. It may or may not work in any other browsers.—Werson (talk) 03:48, 27 March 2008 (UTC) "Replaced by addPortletLink" helpHello. Recently, whenever I go to a page, I am greeted by a JavaScript alert which says: "Replaced by addPortletLink". Could someone help me with this problem? Thanks! archanamiya · talk 21:10, 4 April 2008 (UTC)
Link checker in JSONI've extend the my checklinks script to output its results in JSON and created a reference JavaScript implementation. It also output the headers it retrieves, which could be useful for some scripts. — Dispenser 00:51, 20 April 2008 (UTC) Deprecate syntax highlighter and inclusion scriptsWikipedia:WikiProject User scripts/Scripts/Syntax highlighter seems to be deprecated by the site's built-in highlighter now. Also, the first part of Wikipedia:WikiProject User scripts/Scripts/Inclusion is mostly deprecated by importScript. I suppose the synchronization part could be, too? The synchronization across wikis cannot be deprecated by importScript, nor can importScript deprecate the other inclusion script, simply because importScript does not exist on the other wikis. Also, the reason why winc allows brackets inside the link winc('[[User:SOMEONE/monobook.js]]'); /* Comment about what the script does */ Is because I had another script User:Omegatron/monobook.js/autolinker.js which turned bracketed text in the monobook.js display into links. I think this should be worked into something better that can be used by everyone. — Omegatron 01:46, 4 April 2008 (UTC) Request for scriptSimple English I see that there is a bilingual script that can display the interwiki pages side-by-side, and I had a similar idea for a Simple English option that displays the Simple version of a page if it exists. Maybe there is a tab on top of the page that switches to the Simple English or has a side-by-side comparison if [[Simple:*]] is present? Does that seem feasible? I don't know if anyone else is interested in that, but I would like it because I could see what really needs work on Simple and it would help me port over information from en.wp. Thanks. -Justin (koavf)❤T☮C☺M☯ 20:31, 8 April 2008 (UTC)
Here's the en version: addOnloadHook(function() {
addPortletLink('p-cactions', 'http://simple.wikipedia.org/wiki/' + encodeURIComponent(wgPageName), 'simple')
});
And the simple version: addOnloadHook(function() {
addPortletLink('p-cactions', 'http://en.wikipedia.org/wiki/' + encodeURIComponent(wgPageName), 'en')
});
If you need any further modifications to the functionality please ask. GracenotesT § 01:53, 9 April 2008 (UTC)
Hide talk page templates scriptI just wrote a script that hides all those annoying yellow talk page templates in a single collapsed table. I went ahead and added it to the list, though it does not work in Internet Explorer (I'm not sure why). Anyone who knows more about IE can check it out if you'd like. — Bob • (talk) • 00:46, 10 April 2008 (UTC)
Multiple scriptsIs adding a couple of scripts into one .js page going to screw up or should I create new .js pages for each script? --staka (T ・C) 23:38, 17 April 2008 (UTC)
Safe IE edit links scriptFollowing a discussion on WP:VPT, another user wrote a script that converts all links on edit and preview pages to open in new windows (or tabs, given your browser configuration) in Internet Explorer, since it has a bad habit of chucking changed form data should you accidentally click something you shouldn't have. Following that, I asked User:Alex Smotrov for some advice on improving the script, and he subsequently rewrote it for me, after which I made one addition. In its current form, the script runs when you click on a link while editing or previewing, and if the link is not part of the user interface (tabs at top, sidebar, footer, etc.) or a script-generated link (show/hide link on collapsible tables, primarily), the script changes it to open in a new window. I was wondering if the script could be listed here? Also, could anyone take a look and tell me if it'll work in any skins besides Monobook? —Dinoguy1000 18:45, 26 July 2008 (UTC)
Monobook.js ?What is a monobook.js ? I would like to add a script but I have no idea of how. I know that you have to save a script somehow, but nothing on wiki tells you how. It says that you have to save it to your monobook.js....which is....?Think about this. Once Bread becomes toast, you can't make it back into bread. (talk) 23:46, 26 August 2008 (UTC)
Position of Personal LinksOK, so I want to add a link to my personal links. I figured out how to get the link up there (well, someone else figured it out for me, anyway!), but how can I change its position? --Alinnisawest, Dalek Empress (extermination requests here) 04:51, 28 August 2008 (UTC) red link removalI found that red link removal is cumbersome when dealing with more than three bad links in a very big section would someone make a script for me that would delete a bad link by hovering the mouse over the link.Hintss (talk) Suggestion to avoid script incompatibilityI discovered a while back that scripts on Wikipedia have the rather annoying property that function names and global variables are shared between any scripts that run on the same page. This can often cause incompatibilities between scripts, such as where one script defines a global variable and another script uses a global variable of the same name as a user-defined setting; in such a case, the second script would use—and possibly change—the first script's value for the global variable, likely crashing one or both scripts. I ran into a version of this issue when one of my scripts stopped working after I installed another script, the reason being that they both had a function named What I suggest is that user scripts under this project include a global wrapper function around the script's functions and variables to avoid situations like this. Doing so would make the script's contents local to that one script and thus protected from unintentional access by another script. To give an example, if there was a script named if ( typeof ( FooScriptVariable ) === 'undefined' ) {
var FooScriptVariable = 'default value';
}
function FooScript () {
var foo = FooScriptVariable;
function bar (baz) {
// some code here
}
function spam () {
// more code
}
addOnloadHook(spam);
}
FooScript();
The nice thing about this construction is that only So, does this seem like a good idea for more frequent use, or is there something that I've missed or doesn't work the way I think it does? This might be a good way of making Wikipedia script structure more standardized as well. Pyrospirit (talk · contribs) 02:07, 5 June 2008 (UTC)
(function(){
var foo = FooScriptVariable;
function bar (baz) {
// some code here
}
function spam () {
// more code
}
addOnloadHook(spam);
})();
var FooScript = {
foo : 'default value',
bar : function (baz) {
// some code here
},
spam : function () {
// more code
}
};
if ( typeof ( FooScriptVariable ) != 'undefined' ) {
FooScript.foo = 'default value';
// Alternatively, if you can move the setting of "FooScriptVariable" to after
// the include of this script, you could just set FooScript.foo directly.
}
if(doneOnloadHook) FooScript.spam();
else addOnloadHook(FooScript.spam);
Script suggestionI've got an idea for a script, maybe someone could work on it - basically what it does is allows you to right click on a (user/wikipedia/article) talk page section and it adds a link-to-that-section to a user subpage of your choosing, to remind you to return to threads you're need to check back on. Whaddyathink? –xeno (talk) 13:17, 16 July 2008 (UTC) Query.php alertBrion sentenced query.php to die on 25 August. Please make sure that your scripts are migrated to api.php! I'm especially worried about popups, which is largely unsupported and uses query.php in million places. MaxSem(Han shot first!) 07:07, 31 July 2008 (UTC) Assessment sciptIs there an existing script in assessing song-related and album-related articles. --Efe (talk) 05:30, 1 August 2008 (UTC) Proposal to promote User scripts via User boxesUser scripts can bring many benefits to users, and I suggest that they should be better known. One way to promote them is to encourage users of a script to say that they use it, on their user page, using user boxes. This would enable a virtuous circle ("I see that you use it, so I might use it as well").
This would also allow to look at how many users are using a particular script by looking at what pages link to that script page. It would then become possible to list scripts by their popularity. Any thoughts on this ? Any suggestions for a graphical design ? Pcarbonn (talk) 17:24, 30 August 2008 (UTC)
Any suggestions for replacement scriptI have been using a script called User:Outriggr/metadatatest.js to tag and assess articles for various WikiProjects without having to open the talk page first. Unfortunately, the creator has decided to discontinue this script and I would like to know if anybody can recommend a similar script to me? __meco (talk) 15:36, 13 September 2008 (UTC)
How do I Activate this scriptHow do I use this JS? /*
* A JavaScript implementation of the RSA Data Security, Inc. MD5 Message
* Digest Algorithm, as defined in RFC 1321.
* Version 2.2-alpha Copyright (C) Paul Johnston 1999 - 2005
* Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
* Distributed under the BSD License
* See http://pajhome.org.uk/crypt/md5 for more info.
*/
/*
* Configurable variables. You may need to tweak these to be compatible with
* the server-side, but the defaults work in most cases.
*/
var hexcase = 0; /* hex output format. 0 - lowercase; 1 - uppercase */
var b64pad = ""; /* base-64 pad character. "=" for strict RFC compliance */
/*
* These are the functions you'll usually want to call
* They take string arguments and return either hex or base-64 encoded strings
*/
function hex_md5(s) { return rstr2hex(rstr_md5(str2rstr_utf8(s))); }
function b64_md5(s) { return rstr2b64(rstr_md5(str2rstr_utf8(s))); }
function any_md5(s, e) { return rstr2any(rstr_md5(str2rstr_utf8(s)), e); }
function hex_hmac_md5(k, d)
{ return rstr2hex(rstr_hmac_md5(str2rstr_utf8(k), str2rstr_utf8(d))); }
function b64_hmac_md5(k, d)
{ return rstr2b64(rstr_hmac_md5(str2rstr_utf8(k), str2rstr_utf8(d))); }
function any_hmac_md5(k, d, e)
{ return rstr2any(rstr_hmac_md5(str2rstr_utf8(k), str2rstr_utf8(d)), e); }
/*
* Perform a simple self-test to see if the VM is working
*/
function md5_vm_test()
{
return hex_md5("abc") == "900150983cd24fb0d6963f7d28e17f72";
}
/*
* Calculate the MD5 of a raw string
*/
function rstr_md5(s)
{
return binl2rstr(binl_md5(rstr2binl(s), s.length * 8));
}
/*
* Calculate the HMAC-MD5, of a key and some data (raw strings)
*/
function rstr_hmac_md5(key, data)
{
var bkey = rstr2binl(key);
if(bkey.length > 16) bkey = binl_md5(bkey, key.length * 8);
var ipad = Array(16), opad = Array(16);
for(var i = 0; i < 16; i++)
{
ipad[i] = bkey[i] ^ 0x36363636;
opad[i] = bkey[i] ^ 0x5C5C5C5C;
}
var hash = binl_md5(ipad.concat(rstr2binl(data)), 512 + data.length * 8);
return binl2rstr(binl_md5(opad.concat(hash), 512 + 128));
}
/*
* Convert a raw string to a hex string
*/
function rstr2hex(input)
{
var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef";
var output = "";
var x;
for(var i = 0; i < input.length; i++)
{
x = input.charCodeAt(i);
output += hex_tab.charAt((x >>> 4) & 0x0F)
+ hex_tab.charAt( x & 0x0F);
}
return output;
}
/*
* Convert a raw string to a base-64 string
*/
function rstr2b64(input)
{
var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
var output = "";
var len = input.length;
for(var i = 0; i < len; i += 3)
{
var triplet = (input.charCodeAt(i) << 16)
| (i + 1 < len ? input.charCodeAt(i+1) << 8 : 0)
| (i + 2 < len ? input.charCodeAt(i+2) : 0);
for(var j = 0; j < 4; j++)
{
if(i * 8 + j * 6 > input.length * 8) output += b64pad;
else output += tab.charAt((triplet >>> 6*(3-j)) & 0x3F);
}
}
return output;
}
/*
* Convert a raw string to an arbitrary string encoding
*/
function rstr2any(input, encoding)
{
var divisor = encoding.length;
var remainders = Array();
var i, q, x, quotient;
/* Convert to an array of 16-bit big-endian values, forming the dividend */
var dividend = Array(input.length / 2);
for(i = 0; i < dividend.length; i++)
{
dividend[i] = (input.charCodeAt(i * 2) << 8) | input.charCodeAt(i * 2 + 1);
}
/*
* Repeatedly perform a long division. The binary array forms the dividend,
* the length of the encoding is the divisor. Once computed, the quotient
* forms the dividend for the next step. We stop when the dividend is zero.
* All remainders are stored for later use.
*/
while(dividend.length > 0)
{
quotient = Array();
x = 0;
for(i = 0; i < dividend.length; i++)
{
x = (x << 16) + dividend[i];
q = Math.floor(x / divisor);
x -= q * divisor;
if(quotient.length > 0 || q > 0)
quotient[quotient.length] = q;
}
remainders[remainders.length] = x;
dividend = quotient;
}
/* Convert the remainders to the output string */
var output = "";
for(i = remainders.length - 1; i >= 0; i--)
output += encoding.charAt(remainders[i]);
return output;
}
/*
* Encode a string as utf-8.
* For efficiency, this assumes the input is valid utf-16.
*/
function str2rstr_utf8(input)
{
var output = "";
var i = -1;
var x, y;
while(++i < input.length)
{
/* Decode utf-16 surrogate pairs */
x = input.charCodeAt(i);
y = i + 1 < input.length ? input.charCodeAt(i + 1) : 0;
if(0xD800 <= x && x <= 0xDBFF && 0xDC00 <= y && y <= 0xDFFF)
{
x = 0x10000 + ((x & 0x03FF) << 10) + (y & 0x03FF);
i++;
}
/* Encode output as utf-8 */
if(x <= 0x7F)
output += String.fromCharCode(x);
else if(x <= 0x7FF)
output += String.fromCharCode(0xC0 | ((x >>> 6 ) & 0x1F),
0x80 | ( x & 0x3F));
else if(x <= 0xFFFF)
output += String.fromCharCode(0xE0 | ((x >>> 12) & 0x0F),
0x80 | ((x >>> 6 ) & 0x3F),
0x80 | ( x & 0x3F));
else if(x <= 0x1FFFFF)
output += String.fromCharCode(0xF0 | ((x >>> 18) & 0x07),
0x80 | ((x >>> 12) & 0x3F),
0x80 | ((x >>> 6 ) & 0x3F),
0x80 | ( x & 0x3F));
}
return output;
}
/*
* Encode a string as utf-16
*/
function str2rstr_utf16le(input)
{
var output = "";
for(var i = 0; i < input.length; i++)
output += String.fromCharCode( input.charCodeAt(i) & 0xFF,
(input.charCodeAt(i) >>> 8) & 0xFF);
return output;
}
function str2rstr_utf16be(input)
{
var output = "";
for(var i = 0; i < input.length; i++)
output += String.fromCharCode((input.charCodeAt(i) >>> 8) & 0xFF,
input.charCodeAt(i) & 0xFF);
return output;
}
/*
* Convert a raw string to an array of little-endian words
* Characters >255 have their high-byte silently ignored.
*/
function rstr2binl(input)
{
var output = Array(input.length >> 2);
for(var i = 0; i < output.length; i++)
output[i] = 0;
for(var i = 0; i < input.length * 8; i += 8)
output[i>>5] |= (input.charCodeAt(i / 8) & 0xFF) << (i%32);
return output;
}
/*
* Convert an array of little-endian words to a string
*/
function binl2rstr(input)
{
var output = "";
for(var i = 0; i < input.length * 32; i += 8)
output += String.fromCharCode((input[i>>5] >>> (i % 32)) & 0xFF);
return output;
}
/*
* Calculate the MD5 of an array of little-endian words, and a bit length.
*/
function binl_md5(x, len)
{
/* append padding */
x[len >> 5] |= 0x80 << ((len) % 32);
x[(((len + 64) >>> 9) << 4) + 14] = len;
var a = 1732584193;
var b = -271733879;
var c = -1732584194;
var d = 271733878;
for(var i = 0; i < x.length; i += 16)
{
var olda = a;
var oldb = b;
var oldc = c;
var oldd = d;
a = md5_ff(a, b, c, d, x[i+ 0], 7 , -680876936);
d = md5_ff(d, a, b, c, x[i+ 1], 12, -389564586);
c = md5_ff(c, d, a, b, x[i+ 2], 17, 606105819);
b = md5_ff(b, c, d, a, x[i+ 3], 22, -1044525330);
a = md5_ff(a, b, c, d, x[i+ 4], 7 , -176418897);
d = md5_ff(d, a, b, c, x[i+ 5], 12, 1200080426);
c = md5_ff(c, d, a, b, x[i+ 6], 17, -1473231341);
b = md5_ff(b, c, d, a, x[i+ 7], 22, -45705983);
a = md5_ff(a, b, c, d, x[i+ 8], 7 , 1770035416);
d = md5_ff(d, a, b, c, x[i+ 9], 12, -1958414417);
c = md5_ff(c, d, a, b, x[i+10], 17, -42063);
b = md5_ff(b, c, d, a, x[i+11], 22, -1990404162);
a = md5_ff(a, b, c, d, x[i+12], 7 , 1804603682);
d = md5_ff(d, a, b, c, x[i+13], 12, -40341101);
c = md5_ff(c, d, a, b, x[i+14], 17, -1502002290);
b = md5_ff(b, c, d, a, x[i+15], 22, 1236535329);
a = md5_gg(a, b, c, d, x[i+ 1], 5 , -165796510);
d = md5_gg(d, a, b, c, x[i+ 6], 9 , -1069501632);
c = md5_gg(c, d, a, b, x[i+11], 14, 643717713);
b = md5_gg(b, c, d, a, x[i+ 0], 20, -373897302);
a = md5_gg(a, b, c, d, x[i+ 5], 5 , -701558691);
d = md5_gg(d, a, b, c, x[i+10], 9 , 38016083);
c = md5_gg(c, d, a, b, x[i+15], 14, -660478335);
b = md5_gg(b, c, d, a, x[i+ 4], 20, -405537848);
a = md5_gg(a, b, c, d, x[i+ 9], 5 , 568446438);
d = md5_gg(d, a, b, c, x[i+14], 9 , -1019803690);
c = md5_gg(c, d, a, b, x[i+ 3], 14, -187363961);
b = md5_gg(b, c, d, a, x[i+ 8], 20, 1163531501);
a = md5_gg(a, b, c, d, x[i+13], 5 , -1444681467);
d = md5_gg(d, a, b, c, x[i+ 2], 9 , -51403784);
c = md5_gg(c, d, a, b, x[i+ 7], 14, 1735328473);
b = md5_gg(b, c, d, a, x[i+12], 20, -1926607734);
a = md5_hh(a, b, c, d, x[i+ 5], 4 , -378558);
d = md5_hh(d, a, b, c, x[i+ 8], 11, -2022574463);
c = md5_hh(c, d, a, b, x[i+11], 16, 1839030562);
b = md5_hh(b, c, d, a, x[i+14], 23, -35309556);
a = md5_hh(a, b, c, d, x[i+ 1], 4 , -1530992060);
d = md5_hh(d, a, b, c, x[i+ 4], 11, 1272893353);
c = md5_hh(c, d, a, b, x[i+ 7], 16, -155497632);
b = md5_hh(b, c, d, a, x[i+10], 23, -1094730640);
a = md5_hh(a, b, c, d, x[i+13], 4 , 681279174);
d = md5_hh(d, a, b, c, x[i+ 0], 11, -358537222);
c = md5_hh(c, d, a, b, x[i+ 3], 16, -722521979);
b = md5_hh(b, c, d, a, x[i+ 6], 23, 76029189);
a = md5_hh(a, b, c, d, x[i+ 9], 4 , -640364487);
d = md5_hh(d, a, b, c, x[i+12], 11, -421815835);
c = md5_hh(c, d, a, b, x[i+15], 16, 530742520);
b = md5_hh(b, c, d, a, x[i+ 2], 23, -995338651);
a = md5_ii(a, b, c, d, x[i+ 0], 6 , -198630844);
d = md5_ii(d, a, b, c, x[i+ 7], 10, 1126891415);
c = md5_ii(c, d, a, b, x[i+14], 15, -1416354905);
b = md5_ii(b, c, d, a, x[i+ 5], 21, -57434055);
a = md5_ii(a, b, c, d, x[i+12], 6 , 1700485571);
d = md5_ii(d, a, b, c, x[i+ 3], 10, -1894986606);
c = md5_ii(c, d, a, b, x[i+10], 15, -1051523);
b = md5_ii(b, c, d, a, x[i+ 1], 21, -2054922799);
a = md5_ii(a, b, c, d, x[i+ 8], 6 , 1873313359);
d = md5_ii(d, a, b, c, x[i+15], 10, -30611744);
c = md5_ii(c, d, a, b, x[i+ 6], 15, -1560198380);
b = md5_ii(b, c, d, a, x[i+13], 21, 1309151649);
a = md5_ii(a, b, c, d, x[i+ 4], 6 , -145523070);
d = md5_ii(d, a, b, c, x[i+11], 10, -1120210379);
c = md5_ii(c, d, a, b, x[i+ 2], 15, 718787259);
b = md5_ii(b, c, d, a, x[i+ 9], 21, -343485551);
a = safe_add(a, olda);
b = safe_add(b, oldb);
c = safe_add(c, oldc);
d = safe_add(d, oldd);
}
return Array(a, b, c, d);
}
/*
* These functions implement the four basic operations the algorithm uses.
*/
function md5_cmn(q, a, b, x, s, t)
{
return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s),b);
}
function md5_ff(a, b, c, d, x, s, t)
{
return md5_cmn((b & c) | ((~b) & d), a, b, x, s, t);
}
function md5_gg(a, b, c, d, x, s, t)
{
return md5_cmn((b & d) | (c & (~d)), a, b, x, s, t);
}
function md5_hh(a, b, c, d, x, s, t)
{
return md5_cmn(b ^ c ^ d, a, b, x, s, t);
}
function md5_ii(a, b, c, d, x, s, t)
{
return md5_cmn(c ^ (b | (~d)), a, b, x, s, t);
}
/*
* Add integers, wrapping at 2^32. This uses 16-bit operations internally
* to work around bugs in some JS interpreters.
*/
function safe_add(x, y)
{
var lsw = (x & 0xFFFF) + (y & 0xFFFF);
var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
return (msw << 16) | (lsw & 0xFFFF);
}
/*
* Bitwise rotate a 32-bit number to the left.
*/
function bit_rol(num, cnt)
{
return (num << cnt) | (num >>> (32 - cnt));
}
Thisisatest247 (talk) 21:27, 23 August 2008 (UTC)
Friendly / TwinkleHello. I recently translated friendly and twinkle into Romanian, but when the script wants to post the edit (for the both scripts), FireBug says: form is null if( !tagRe.exec( form.wpTextbox1.value ) ) { The scripts are here: ro:User:Firilacroco/friendly.js and ro:User:Firilacroco/twinkle.js, but I think that the problem isn't here ... it's somewhere else. I installed this script on Wikia and it work fine. Thank you in advance. Daniel Message 11:09, 19 September 2008 (UTC) Script documentationI am currently trying two different ways of documenting user scripts. I would like feedback from the rest of you what you think about the two different approaches:
So what do you guys think? --David Göthberg (talk) 14:37, 21 September 2008 (UTC)
AJAX frameworkHello. I created the AJAX framework to make AJAX programming effortless, and expanded the WikiProject's AJAX guide. (You can compare programming with and without the framework by looking at "Edit a page and other common actions" in the guide.) If you have suggestions for more functions, please post them here. —{admin} Pathoschild 04:20:05, 27 September 2008 (UTC) Canonical namespace change coming: Image: -> File:Brion has just announced on the wikitech-l list that he's planning to (finally) change the canonical name of the "Image:" namespace to "File:". This will affect any scripts that check for The recommended fix is to test for More details at bugzilla:44. —Ilmari Karonen (talk) 02:35, 7 October 2008 (UTC) Popup translations done in end999's monobook.jsI managed to do an ajax call to google's translation api. So I have popup translations for 23 languages on my monobook.js file: User:Endo999/monobook.js It functions much like the google toolbar translation feature. You position the cursor over a word for a second or two and the foreign language translation pops up. You move the cursor away and the popup goes away. 23 languages supported right now. Because my login does not survive going to, say, pt.wikipedia.org (the Portuguese wikipedia) I cannot surf into other language wikipedias and keep my login (and thus the monobook.js file). It would be good if I could do this, as I could read foreign language wikipedias this way. I am a monoglot English speaker trying to extend my intermediate French and Spanish reading abilities, and I find the tool to be quite helpful in this regard, as I can read whole articles in Spanish and French without having to lookup a dictionary. The Google toolbar does not translate from French to English (only English to French) except for whole pages. Endo999 (talk) 21:27, 15 October 2008 (UTC)
addOnloadHookHey, I'm fairly new to Wikipedia, and I just have one small question about userscripts. Does anyone know when the
Who's using my script?Having, newly posted a script for others to use, I don't suppose there's any way to tell what level of use it's getting, is there? —Largo Plazo (talk) 12:35, 17 November 2008 (UTC)
Split-screen edit previewI just wrote a gadget to load the preview in a resizable panel on the right-hand side of the screen. It's available by adding Rollback scripts?I've been trying to find some scripts that I can use for other wikis that would provide me with a rollback button (as I am only a rollbacker here). I've tried out numerous scripts on meta, from godmode-light to twinkle, and none have worked. Anybody know a functional script I could use? Inferno, Lord of Penguins 02:11, 7 February 2009 (UTC) So what's this?I was cleaning through my monobook, I had copied a few scripts staright instead of importing them. I ran across the following:
var cwwpajax;
// From [[WP:US]] mainpage (wpajax renamed to cwwpajax)
cwwpajax={
download:function(bundle) {
// mandatory: bundle.url
// mandatory: bundle.async
// optional: bundle.onSuccess (xmlhttprequest, bundle)
// optional: bundle.onFailure (xmlhttprequest, bundle)
// optional: bundle.otherStuff OK too, passed to onSuccess and onFailure
var x = window.XMLHttpRequest ? new XMLHttpRequest() // Firefox, Safari, Opera, IE7
: window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") // IE6
: false;
if (x) {
x.onreadystatechange=function() {
x.readyState==4 && cwwpajax.downloadComplete(x,bundle);
};
x.open("GET",bundle.url,bundle.async);
x.send(null);
}
return x;
},
downloadComplete:function(x,bundle) {
x.status==200 && ( bundle.onSuccess && bundle.onSuccess(x,bundle) || true )
|| ( bundle.onFailure && bundle.onFailure(x,bundle) || alert(x.statusText));
}
};
// Example:
// function dlComplete(xmlreq, data) {
// alert(data.message + xmlreq.responseText);
// }
// cwwpajax.download({url:'http://en.wikipedia.org/w/index.php?title=Thresher&action=raw',
// onSuccess: dlComplete, message: "Here's what we got:\n\n" });
// End of [[WP:US]] quote
//<!--[[Category:Wikipedia scripts]]-->
Does anybody here know what this matches up to or what it's doing? Thanks a lot. Stepshep (talk) 02:04, 20 November 2008 (UTC)
Advertising/changing a script linkI have produced an update to "Hide top contributions" that isn't broken for redirects, and also recovers to continue hiding remaining entries if there is any other type of link not matched by either regex. Should I just be bold and change the link in here /Scripts#Contributions to point to my version, or is there a less anarchic procedure not documented here or on the project page. I have already mentioned my change on the script's talk page. Mark Hurd (talk) 14:09, 1 April 2009 (UTC)
Batch Edits?I'm looking for a way to edit many pages at once without opening each in a new browser tab. Is there a user script to edit pages in a batch? Submit a list of page names and a list of all edit textareas for the pages opens with one save button. No need to load the toolbar for each. --Subfader (talk) 16:52, 3 March 2009 (UTC)
Snippet Manager ScriptI wrote a snippet manager script, for holding complex signatures, templates, or just plain pieces of text. Works with wikiEd (and TW/HW)
Upcoming features:
--Odie5533 (talk) 05:58, 13 March 2009 (UTC) I just updated the script to include full drop-down menu support. I've added a handful of templates to it and you can either recommend some and I can add them or add them via the customization option in your monobook.js file. The buttons also support simple evaluations and the Show refs and Ref errors buttons are hooked into another script. --Odie5533 (talk) 16:05, 19 March 2009 (UTC) I made a page with installation instructions at User:Odie5533/SnipManager. --Odie5533 (talk) 17:26, 19 March 2009 (UTC) Help!I was recently informed that my new script, User:Drilnoth/assessortags.js (see documentation) works in practically no browsers other than Firefox 3. I'm still kind of new to scripting, so it would be much appreciated if someone could take a look at the code and see what the problem is... other scripts based on the MoreBits library work find in many browsers that this one just isn't showing up in. Please discuss this problem at User talk:Drilnoth/assessortags.js. Thank you! –Drilnoth (T • C) 16:13, 25 March 2009 (UTC)
Capitalize First letter onlyHi, I'm looking for a user script that adds a new button to the toolbar to Capitalize The First Letters in marked text. I tested the wikEd editor (works fine, but too many other features and not as single button) and User:Zocky/Search Box (only lower or UPPER case). Any hints? Thanks. --Subfader (talk) 23:07, 26 April 2009 (UTC) js not workingThe answer to this is probably something really stupid, but since I added a new script to my monobook.js page, it's stopped working (not only is the new script having no effect, but the buttons I'd previously added have stopped appearing as well. I've refreshed the cache, logged out, restarted, everything I could think of, but still no luck. Any ideas?--Kotniski (talk) 08:34, 8 May 2009 (UTC)
Most Frequestly Used scripts sectionwould ^^that be possible? Kwiki (talk) 07:51, 10 May 2009 (UTC) Please test my NICE interface modificationI've been working on a tool with some of my lab-mates. It makes a minor modification to the Wikipedia:UNDO interface. We are trying to do a proper study of it to see if it actually helps or not. If you would be willing to give it a try, you can find more information here. If you have questions, suggestions or comments, please feel free to contact me. --EpochFail (talk|contribs) 18:50, 5 June 2009 (UTC) wiki gold trophy article votinghow do you include the voting system in an article ? —Preceding unsigned comment added by 92.143.4.107 (talk) 15:10, 6 June 2009 (UTC) JS on user pageThis may be naive/stupid since I know next to nothing about actually implementing javascript, but I gotta ask - is there anything stopping me from writing a bar.js page and importing that into my user page only, for example? There are the obvious ethical reasons concerning malicious scripts and other visitors, but is there a technical reason it just doesn't happen? Again, sorry if this is dumb, just checking. ~ Amory (talk) 21:40, 6 June 2009 (UTC)
Are these only compatible with Wikipedia or can they be used with other Wikis too?Can these be used with other wikis that are not part of the Wikimedia Foundation? Xhaoz Talk • Contribs 23:07, 27 June 2009 (UTC)
Quick Preview / QPreviewIs the linked version not superseded by user:js/ajaxPreview? The linked version was last edited in 2007, the Js version was edited in April 2009. --Ysangkok (talk) 15:41, 19 July 2009 (UTC) Reword scriptI made a script to make direct in-article edits of short phrases. A slightly better explanation can be found at User:M/Reword. Feedback would be appreciated, since I haven't tested it enough. Where should this script be added? I've also seen some errors where it seems that the scripts are being loaded out of order. How do I ensure correct loading order using importScript? M 23:30, 20 July 2009 (UTC) Script working in areasWould someone mind, please, figuring out how to get User:MarkS/extraeditbuttons.js working in other namespaces besides User and User talk? That's the only 2 places it will work currently. 09:01, 9 August 2009 (UTC) Historical text highlighting wiki gadgetI'm sure many of you caught the news article about Adler and Alfaro's research in wiki trustability being applied to live Wikipedia. It just so happens that I have been working on a similar problem from a completely different direction during my research and am ready to share this work with the community. I have designed and implemented a user script modification that I call HAPPI and am currently running a non-profit/academic analysis of its usefulness. The script adds a couple of new controls that will appear over the edit pane. These controls will allow you to toggle the highlighting of wiki text while you edit it (like WikEd), but rather than syntax highlighting, HAPPI's highlighting gives you insight into how content has persisted through the history of the article. If you'd like to give it a try, please see the documentation page for more information. --EpochFail (talk|contribs) 17:51, 23 September 2009 (UTC)
How-to install user scripts page and maybe template neededI think user script pages all need a friendly - for help installing user scripts please see ___ which sends them to a basic page on how users can install them. An example is here. Similar to the documentation for how to use a template. It seems basic to those writing these but I think may inspire more users to try using them. A template covering multiple issue may be best and could have a drop down list of all active scripts or even a link to a list of them as well as including many of the links on the project page. -- Banjeboi 23:17, 26 November 2009 (UTC)
Script documentationWe are about to deploy automatic detection of script documentation pages. All .js and .css pages will automatically show a box with a link to their doc page, if a doc page exists. See MediaWiki talk:Clearyourcache#Script documentation, {{script doc auto}} and Template talk:Script doc auto if you want to discuss this. --David Göthberg (talk) 15:02, 14 December 2009 (UTC) Script request?I was wondering if it would be possible to write a script with the purpose of closing Requested move discussions. Could anyone familiar with that page let me know if it can be done? –Juliancolton | Talk 01:37, 17 January 2010 (UTC)
Deleted code won't go awayI have a clock on the corner of all pages similar to User:Davidgothberg/clock. Thing is, my monobook.js has been blank since August. I've purged it a few times and nothing's happened. It even shows up on other computers. I like having it there, but I want to change it slightly and can't figure out how it's showing up. What can I do to make it go away so I can replace it with the slightly modified clock I want? — User:ACupOfCoffee@ 18:55, 21 February 2010 (UTC)
My extension to Navigation popupsCan somebody please try my "History reviewer", if it might be usefull to other users? Thanks.. 2aprilboy talk 11:06, 6 February 2010 (UTC) editing links at the topI'm trying to edit the links at the top of my monobook on wikisource (not here, yet)—see s:User:Spangineer/monobook.js. For example, change "my talk" to "talk", add links to frequently used user pages, etc. I have code in my wikipedia monobook that does this, but after removing some things that I didn't need I couldn't get it to work again. I looked on this page but didn't see a script that does what I want; can I get some help? --Spangineerws (háblame) 05:40, 16 February 2010 (UTC) Good news for devsWikipedia_talk:WikiProject_User_scripts#Script_purger_for_developers Could someone add this nice "back to top" script to the list?I stumbled upon this and liked it very much, I think it should be on this list. WP:Back to top. But I don't know anything about .js so I am not comfortable making the edit myself. Thanks. Andrew Gradman talk/WP:Hornbook 05:32, 25 April 2010 (UTC)
Can someone take a crack at this? user:Agradman, editing for today as 160.39.222.133 (talk) 16:46, 28 April 2010 (UTC) Smart quotesSince the majority can’t be convinced to prefer typographic quotation marks in WP:MoS, I’m now using a slightly adapted version of User:Werson/smartQuotes.js to autoconvert straight quotes for display. Although it seems to work so far, perhaps someone can come up with a cleaner version. — Christoph Päper 21:28, 2 March 2010 (UTC) Project tagging user scriptHi, I posted at Wikipedia:Bot_requests#Project_tagging_userscript about a project tagging user script; perhaps someone who knows about user scripts could respond there? Rd232 talk 16:48, 16 March 2010 (UTC) Script purger for developersI've created a script at User:Manishearth/purger, which allows developers to put the scripts that they want to test in "Purge mode", where the script will be forcibly fetched from the servers, bypassing the cache. This saves devs the time and bandwidth of bypassing their entire cache and re-downloading the Wikipedia scripts and CSS. ManishEarthTalk • Stalk 04:36, 24 March 2010 (UTC) MenubookI've created a new script that modifies the default Monobook skin by moving all of the navigation features to drop down menus at the top of the page. I'm looking for beta testers and for general feedback. You can check it out at User:Bradv/Scripts/Menubook. Brad 17:36, 17 April 2010 (UTC)
I have recently written the above script, which adds back-and-forth links to the top of each page similar to mw:Extension:Back-and-Forth, which is already used on at least one Wikipedia fork. It is based on User:PleaseStand/wikiapi.js, yet another API wrapper, which I hope I can eventually develop into a usable bot and user script framework. No problem with Firefox, but I doubt that it is compatible with Chrome because the order of an object's properties is not guaranteed, showing incorrect links if the current page does not exist. To me, this represents a serious shortcoming of the JSON output when used with a standard JSON parser or JavaScript interpreter. Is there any better way to fix this than alphabetically comparing the returned page titles to see which one is closer if the current page does not exist? Also, is it OK to combine the two queries, making use of allpages as both a generator and a list, and then encoding the URL on the client side? Of course, I could query allpages twice as a list and encode the URL client-side. I would like a second opinion to make sure I am not missing something. PleaseStand (talk) 23:06, 3 May 2010 (UTC)
Fix delsort to work on Vector skinCould an admin please fix Wikipedia:WikiProject Deletion sorting/delsort.js per User talk:John Vandenberg#Fix delsort to work on Vector skin before tomorrow's Vector rollout? PleaseStand (talk) 11:12, 12 May 2010 (UTC)
Subpage searchWhy does my script User:PleaseStand/Subpage search not work correctly with the new search box? It works perfectly when the button is clicked, but it doesn't when the return key is used. PleaseStand (talk) 02:20, 31 May 2010 (UTC)
Page ViewsExcuse me if this is an easily answered question, but is there a script that allows one to add a "Page views" link to the toolbox section in the left sidebar? User:Dr pda/prosesizebytes.js adds a "Page size" link over there, so I know adding a link is possible, but I haven't been able to find any page view scripts from this WikiProject.. http://stats.grok.se/ shows page view statistics for any page on Wikipedia, so I was wondering if it was possible to tap into this system with a script. --Dudemanfellabra (talk) 20:56, 14 June 2010 (UTC)
// this adds a 'Page views' link to the toolbox bar
addOnloadHook(function () {
url = "http://stats.grok.se/en/201006/" + wgPageName;
addPortletLink("p-tb", url, "Page views", "pt-logs");
});
You're on your own for getting the month to update dynamically ;p –xenotalk 21:05, 14 June 2010 (UTC)
function PageViews() {
var currentTime = new Date()
var month = currentTime.getMonth() + 1
if (month<10) {
month = "0" + month
}
var year = currentTime.getFullYear()
url = "http://stats.grok.se/en/" + year + month + "/" + wgPageName;
addPortletLink("p-tb", url, "Page views", "pt-logs");
}
AddOnloadHook(PageViews); //Adds "Page views" to Toolbox section
Extra Toolbar ButtonsI created a new script that adds strike, horizontal line, HTML comment, and math buttons to the enhanced editing toolbar. The script is here and the documentation is here. I was wondering if the project would find it useful. ~NerdyScienceDude (✉ • ✐) 19:02, 17 June 2010 (UTC)
I just added blockquote and transclude buttons to the script. Any objections to adding it to the script page? If there aren't, I will add it. ~NerdyScienceDude (✉ • ✐) 00:45, 25 June 2010 (UTC)
On a side note, is enabling "Enable navigable table of contents" supposed to do anything? I don't see anything different in the edit page when enabling that and hard refreshing. Gary King (talk) 23:17, 17 June 2010 (UTC) Reduce edit page clutter?Is there a script which cleans up the disclaimer text and other junk on the Edit page? I know this is in the development pipeline for the usability update, Citron, but I figured someone might have cleaned up the page themselves. Thanks>> Ocaasi (talk) 03:39, 24 June 2010 (UTC) Batch processorHello. Does JavaScript possess capabilities to implement batch processing of articles? I have interest is tasks such as: for all pages from given category follow the language interwiki and add there given new category (as in HotCat). Semi-automated processing would be especially useful. Incnis Mrsi (talk) 13:31, 20 June 2010 (UTC)
SecurityIsn't importing scripts a security risk? An attacker who compromised a user script developer's account could change the Javascript to sneakily change parts of the Mediawiki UI, to, for example, direct you to a phishing site. (Not sure what the potential damages of this are.)--greenrd (talk) 08:09, 30 September 2010 (UTC)
12-hour clockPardon me if I'm asking in the wrong place, but does anyone know how I might be able to view revision-history pages with a 12-hour clock, rather than the standard 24? -- WikHead (talk) 00:36, 28 November 2010 (UTC)
Thank you very kindly Bility! This script flawlessly performs the exact function outlined in my original post (above), and does so using an entirely different browser. I'm impressed :) -- WikHead (talk) 18:35, 7 April 2011 (UTC)
"Is a gadget?" columnI added an "Is a gadget" column to the main table, which has been reverted. The idea was that if someone decides they just want to install one or two scripts which happen to be gadgets, there is then a very easy way to do that. It is not meant to promote the idea that all user scripts should become gadgets. I can see that using red and green colours for the yes and no boxes does kind of imply this, but that was not my intention. Would it be acceptable without the colours?--greenrd (talk) 16:06, 2 October 2010 (UTC)
Here comes another toolbar script...This one is more complex than the first one. It's EmoteToolbar, a script I just made. It adds an Emoticons section to the enhanced editing toolbar. Just like the other one, vector is not required to use it. Does anyone think it would make a great addition to the user scripts page? ~NerdyScienceDude (✉ • ✐ • ✍) 20:56, 30 June 2010 (UTC)
No |
I have recently created a set of javascript tools for showing different right-click menus on Wikipedia pages and the edit textareas. One of the useful component of it is a way to identify the wiki-text corresponding to selected text on a Wikipedia article. This has enabled making of the menu item "edit this text", clicking which upon selecting a portion of an article text opens up the edit form with the corresponding text in the textarea selected. This also has let to direct query of selected text on WikiBlame. The menu on right-clicking textarea can also show a floating and dragble panel with customizable murkups & symbols. A couple of screenshots attached.
The complete documentation: User:Subh83/JavaScriptTools/RightclickMenus
Before I add this script to the list on this page, it will be good to have some feedback on the script, and also suggestion regarding the appropriate category under which to add the script.
- Subh83 (talk | contribs) 21:05, 19 May 2011 (UTC)
- Added it under "Links/shortcuts" section. - Subh83 (talk | contribs) 15:00, 20 May 2011 (UTC)
common.js
The script page Special:MyPage/common.js, which is always loaded regardless of which skin you have as your default, was introduced with MediaWiki 1.17 but appears not to be mentioned. In particular, it is important to know whether code on this page is executed before or after the skin-specific code at Special:MyPage/skin.js. --Redrose64 (talk) 22:12, 18 July 2011 (UTC)
- Common code is always executed before the skin-specific code. — Edokter (talk) — 00:22, 19 July 2011 (UTC)
Time between diffs
I just wrote User:Dudemanfellabra/diffs.js, using User:Gary King/minutes later for diff.js as a source. Gary King's script only works if the time between diffs is less than one hour, but my script will display the time out to days. It inserts a bolded, red span above the new diff containing the time. I've never written a script here before, so I don't really know where to add it or whatever I need to do with it. Thanks! --Dudemanfellabra (talk) 20:57, 2 July 2010 (UTC)
Editing pages with API
Hi. I think this section of the Techniques needs an update since now it can be done in much more elegant way using the API. I would also recommend importing to Wikipedia this wrapper. Editing a page with it is as simple as:
//initialise the API
var api = JsMwApi("/w/api.php");
//get the page object
var page = api.page("Wikipedia:Sandbox");
page.edit(function(text, save_function, res) {
//process the wikitext of the page
text = text + '|';
save_function(
text,
{summary: 'edit summary', minor: true},
function(res) {
if(res && res.edit && res.edit.result && res.edit.result == 'Success')
//saved successfully
alert('Success');
else
//handle the error
alert('ERROR');
}
);
});
No iframes, just GETs and POSTs. I think it could be useful to many script authors. Lampak (talk) 11:36, 6 August 2010 (UTC)
- That section in the guide seems pretty outdated. You can use Ajax to edit a page now; no iframe necessary. Gary King (talk · scripts) 17:21, 6 August 2010 (UTC)
- So I've marked the section clearly as outdated. Lampak (talk) 08:23, 24 August 2010 (UTC)
Fork of Friendly
Hi, could someone help me? I need a fork for Esperanto Wikipedia of Friendly, but it should have a box in which type an argument. Then, the inserted template should be: {{Example|argument|date}}
or also {{Example|temo = argument|dato = date}}
. Could someone help me? Thank you! --→ Airon 09:45, 24 August 2010 (UTC)
jQuery and custom user scripts
I see that at least the vector skin loads jQuery, is it possible to write a custom script which uses jQuery functions? And if so which ones? Can I use $(document).ready? -- Eraserhead1 <talk> 22:56, 18 September 2010 (UTC)
- Monobook seems to use jQuery, too. I never noticed this. Is this new? Gary King (talk · scripts) 05:24, 19 September 2010 (UTC)
- jQuery is live at least since October (bugzilla:25419). Helder 20:10, 19 November 2010 (UTC) —Preceding unsigned comment added by Helder.wiki (talk • contribs)
- This query was made before October :) Gary King (talk · scripts) 01:45, 20 November 2010 (UTC)
- Good thing I checked back :). I'll give it another shot sometime. -- Eraserhead1 <talk> 20:43, 27 November 2010 (UTC)
- This query was made before October :) Gary King (talk · scripts) 01:45, 20 November 2010 (UTC)
- jQuery is live at least since October (bugzilla:25419). Helder 20:10, 19 November 2010 (UTC) —Preceding unsigned comment added by Helder.wiki (talk • contribs)
Discussion at Wikipedia talk:Spoiler may be of interest to scripters
At the moment there is an RFC at the spoiler guideline talk page that may be of interest to scripters because it's a proposal to make a small change to the layout of the Vector skin, probably to insert a link to the site Disclaimers into the sidebar so that it will be more prominent--currently it's only linked from the page bottom.
I expect that this would be achieved by having Mediawiki:Vector.js inject the link into the appropriate place. This may (or may not) have implications for scripts that make assumptions about the layout of the vector skin. --TS 23:07, 7 October 2010 (UTC)
Enhanced toolbar dialog help
On Wikisource I've been fiddling around with an attempt to make a script which automatically links pages in indices here. I've made a pared down copy of the link tool, the source of which can be found here. But it isn't appearing, and on closer inspection with webkit inspector, it has
style="display: none"
applied to it. I would guess that there's some sort of test suite which causes that on failure. Haven't been able to find anything about it though. Anyone know any more? Prosody (talk) 19:45, 19 November 2010 (UTC)
- Nevermind, I was looking at a way older version of jquery.wikiEditor.toolbar.js. Prosody (talk) 23:00, 19 November 2010 (UTC)
Still: How to use user script?
Could anyone explain it in the most simple way? I carefully read all relevant docs but still didn't get a clue.
Having a page 1: http://ru.wikipedia.org/wiki/Участник:Neolexx/MyCopyrightLawyer.js with a single code line window.alert('OK');
Having a page 2: http://ru.wikipedia.org/wiki/Участник:Neolexx/MyCopyrightLawyer
How to make the page 2 to display 'OK' message onload? NeoLexx (talk) 20:21, 27 November 2010 (UTC)
Country demonym navbox generators
If someone knowledgeable about how to work template coding could help fix the country demonym navbox generators, it would be greatly appreciated. At the moment, the existing country demonym navbox generators are Template:African topic, Template:Asian topic, Template:European topic, and Template:South American topic, but Template:North American topic and Template:Oceanian topic should be created as well. Template:Asian topic is currently up for deletion because it duplicates the functionality of Template:Asia topic even though that is not what it is supposed to do. The country demonym navbox generators are supposed to be the demonym counterparts of the country name navbox generators (ie. Template:Africa topic, Template:Asia topic, Template:North America topic, Template:South America topic, Template:Oceania topic, and Template:Africa topic). While the country name navbox generators create navboxes that create strings like "History of Canada" and "Culture of Iraq", the country demonym navbox generators are supposed to create navboxes that create strings like "Canadian literature" and "Iraqi cuisine". Nonetheless, the country demonym navbox generators have never worked because no one knowledgeable about the code has ever fixed them. If anyone would be willing to take on this task, it would be greatly appreciated. These navbox generators have the potential to make a substantial improvement to navigation between related articles on international topics. Neelix (talk) 16:01, 13 December 2010 (UTC)
Member activity
What is going here? Please remove members there are not anymore here in Wikipedia. Who response the script requests? --Perhelion (talk) 22:48, 3 January 2011 (UTC)
- Anyone can write any script they want - sometimes, helpful people will write scripts on behalf of people who post here. No one is obliged to either way. Ale_Jrbtalk 19:38, 4 January 2011 (UTC)
Regex problem
I wrote the script User:Jujutacular/closeFPC to close featured picture candidates. I'm currently having a problem with one my regular expressions. I'm using the code:
var regexTransclusion = new RegExp("{{"+closeFPC_PageName+"}}\n");
FPClist = FPClist.replace(regexTransclusion,'');
The code should remove the transclusion of the nomination from the list at WP:FPC. Normally the code works fine, but whenever the nomination page title includes parentheses, the code fails. Anyone know why this may be happening? (P.S. I'm not very experienced in scripts, so my apologies if this is a dumb question) Jujutacular talk 22:13, 4 January 2011 (UTC)
- Parentheses are used in JavaScript regexes to denote capturing groups. If you only need to replace the first occurrence of a text string case-sensitively (as your example seems to suggest), you could just use
FPClist.replace('{{' + closeFPC_PageName + '}}\n', '');
If you need a case insensitive search, the ability to replace multiple instances of the substring, or something else regex offers, you could try the approach used by Lupin's tool (search forrecent2.processSysops =
) or one that lists the specific characters to be escaped, and then set the appropriate flags ("g", "i", or "gi" as documented at MSDN). PleaseStand (talk) 00:24, 5 January 2011 (UTC)- Thank you, that works perfectly. Jujutacular talk 01:17, 5 January 2011 (UTC)
Firebug console doesn't work here - why?
Hello, I'm trying to start making a user script. To begin doing that, I'd like to try out some parts in the Firebug console. But anything I try, even alert("Hello");, has no effect. It works on other sites, but not here. What is Wikipedia doing to prevent Firebug from working, and how can I fix it?
Thanks! -- Ken_g6 (factors | composites) 23:26, 8 January 2011 (UTC)
- It works here. I just tested it. Gary King (talk · scripts) 23:40, 8 January 2011 (UTC)
- OK, I just disabled a bunch of add-ons and now it works. Now I gotta track down which one it was...(edit) and it's NoScript, even though all scripts are enabled. Time to file a bug or something. -- Ken_g6 (factors | composites) 06:29, 9 January 2011 (UTC)
- And resetting the settings fixed it. Thanks for the non-bug report! -- Ken_g6 (factors | composites) 06:47, 9 January 2011 (UTC)
HideTopContrib in all skins and IE works
Just a note to mention User:Markhurd/hidetopcontrib.js now works for all skins (so it is safe to put
importScript('User:Markhurd/hidetopcontrib.js');
in your common.js) and the problem Internet Explorer had with new pages has been fixed. Mark Hurd (talk) 06:01, 7 February 2012 (UTC)
OpenOffice.org Calc to MediaWiki
Is there any way to convert OpenOffice.org Calc spreadsheets into MediaWiki format? Most of the tools I've seen on Wikipedia are for OpenOffice.org Writer. Allen (talk) 01:52, 16 March 2012 (UTC)
[Wikitech-l] [ResourceLoader] JavaScript may break on your wiki: Fix it before that happens
Cross posting this from the mailing lists. the wub "?!" 10:16, 12 February 2011 (UTC)
Greetings,
As you may know, the Wikimedia tech team has started to upgrade MediaWiki on some wikis. MediaWiki is the software that runs all Wikimedia wikis.
The most visible change for Wikimedia users will be the deployment of ResourceLoader.
ResourceLoader optimizes the use of JavaScript in MediaWiki, speeding up its delivery by compressing it sometimes, and cutting down on the amount of unused JavaScript that gets delivered to the browser in the first place. The installation of ResourceLoader may cause compatibility issues with existing JavaScript code.
Trevor Parscal and Roan Kattouw, the main developers of ResourceLoader, will be available on IRC on Monday, February 14th, at 18:00 (UTC) (all timezones), to answer questions and help fix issues related to ResourceLoader.
If you maintain JavaScript code on your home wiki, please attend. Don't wait until your wiki's JavaScript is all broken.
Please spread this information as widely as possible; it's critical to reach as many local JavaScript maintainers as possible.
Logs of the session will be published publicly.
-- Guillaume Paumier Product manager - Wikimedia Foundation
- Is this going to effect maintainers of gadgets? Are gadgets going to load correctly or do they have to be changed in order to continue loading?
- Is this going to effect vector.js javascript code? Is this code going to load correctly or do we have to change it in order to continue loading?
Endo999 (talk) 21:20, 12 February 2011 (UTC)
Infobox adder?
Is there any script or tool that allows one to add an infobox by just filling in fields with the code being generated automatically? – Connormah (talk) 01:21, 18 September 2012 (UTC)
- That would be great. However, I don't know of anything that can do this. David1217 What I've done 21:22, 23 September 2012 (UTC)
Talkback
Message added 22:19, 4 May 2013 (UTC). You can remove this notice at any time by removing the {{Talkback}} or {{Tb}} template.
Not directly a talkback, but please add a comment. ;-) mabdul 22:24, 4 May 2013 (UTC)
My new articles script
Since the MediaWiki software doesn't seem to have anything to list the pages created by a user without hours of sorting through pages and pages Special:Contributions and past what can be found of what they created in the last month using Special:NewPages, does anyone know of a current userscript that does this? If not, I'd be happy to make one (and suggest some kind of incorporation on bugzilla into special:contribs). Thanks. Technical 13 (talk) 22:40, 15 May 2013 (UTC)
- if you peek at the bottom of Special:Contributions, you'll notice a link "Articles created". there is no need to spend hours, and no need to write a new script. (it's not a part of mediawiki software - it's a toolserver tool). peace - קיפודנחש (aka kipod) (talk) 23:57, 15 May 2013 (UTC)
- The only problem with that I have is the fact that Toolserver is only running at about 60% reliability based on my attempts to use it. :( Technical 13 (talk) 00:32, 16 May 2013 (UTC)
- Toolserver really isn't too reliable. -- (T) Numbermaniac (C) 00:50, 16 May 2013 (UTC)
- you are both correct, but i think it's a good assumption that these issues are temporary and will be fixed - most probably by migrating most of the functionality to media lab. if the suggestion is for helping with migrating this tool to medialab then all the power to you, but if the suggestion is to try and write some javascript tool that will sift through user contribution and distill "page creation" events out of it, i don't think it's the right thing to do. just my $.02, of course. peace - קיפודנחש (aka kipod) (talk) 15:14, 16 May 2013 (UTC)
- I was thinking more along the lines of requesting it as a feature request to be added to Special:Contributions actually. Apparently, others thought it worthy of a bug report as well (tracked above). In the meantime, I'm going try to write up a little userscript that will show up under "user contributions" labeled "user statistics" that will open up special:contributions for the user with only N pages showing. Technical 13 (talk) 15:55, 16 May 2013 (UTC)
- you are both correct, but i think it's a good assumption that these issues are temporary and will be fixed - most probably by migrating most of the functionality to media lab. if the suggestion is for helping with migrating this tool to medialab then all the power to you, but if the suggestion is to try and write some javascript tool that will sift through user contribution and distill "page creation" events out of it, i don't think it's the right thing to do. just my $.02, of course. peace - קיפודנחש (aka kipod) (talk) 15:14, 16 May 2013 (UTC)
- Toolserver really isn't too reliable. -- (T) Numbermaniac (C) 00:50, 16 May 2013 (UTC)