MediaWiki talk:Common.js/Archive 14

{{talkarchive}}

{{<nowiki>Link GA</nowiki>}}

I'd like to add the support for a Link GA template, similar to Link FA. All this has already been implemented and tested on the French wiki. (:fr:Modèle:Lien BA) I currently have a bot overthere that is adding the template, and I wanted to do the same here. An example of a GA link in interwikis can be found overthere : :fr:Pi.

In fact you would need to alter LinkFA() into

function LinkFAorGA()

{

if ( document.getElementById( "p-lang" ) ) {

var InterwikiLinks = document.getElementById( "p-lang" ).getElementsByTagName( "li" );

for ( var i = 0; i < InterwikiLinks.length; i++ ) {

if ( document.getElementById( InterwikiLinks[i].className + "-fa" ) ) {

InterwikiLinks[i].className += " FA"

InterwikiLinks[i].title = "This is a featured article in another language.";

}

else if ( document.getElementById( InterwikiLinks[i].className + "-ga" ) ) {

InterwikiLinks[i].className += " GA"

InterwikiLinks[i].title = "This is a good article in another language.";

}

}

}

}

addOnloadHook( LinkFAorGA );

and add into Monobook.css

li.GA {

list-style-image: url("http://upload.wikimedia.org/wikipedia/fr/8/86/Icone_BA.png");

}

(You might need to find another link in en: to that very same image, thought)

Thanks,

NicDumZ ~ 17:46, 20 December 2007 (UTC)

:The template in question was deleted after discussion at Wikipedia:Templates for deletion/Log/2007 October 4#Template:Link GA, and I don't think MediaWiki_talk:Common.js is a good place for a new discussion whether we need this template at all ∴ AlexSm 18:14, 20 December 2007 (UTC)

::Yeah, I know, it was deleted because the function was not supported in the monobook and because it was adding wieird categories on the articles itself: "Category:Good Article in French", etc... It was stupid. Now that this is working on fr:, I'm asking this again.

::And... Where should I ask if not here ? NicDumZ ~ 18:23, 20 December 2007 (UTC)

:::Make a proposal here. Cheers. --MZMcBride (talk) 01:00, 21 December 2007 (UTC)

: This idea has been rejected a few times already. I think the discussions should be somewhere in the archives of this talk page. —Ruud 09:31, 21 December 2007 (UTC)

Edit made without consensus

{{tlx|editprotected}}

Please undo [http://en.wikipedia.org/w/index.php?title=MediaWiki%3ACommon.js&diff=180825319&oldid=178421778 this recent edit]. This edit does not have consensus. The TeX markup was not intended to be displayed in the tooltips of images, and if we are going to make a change to display the markup in image tooltips, the change should be made for all browsers, not just Internet Explorer. —Remember the dot (talk) 21:26, 29 December 2007 (UTC)

:I restored Internet Explorer's default behaviour in this respect. The tooltips were showing before PngFix, and now they do again, as expected. Just because they are not supposed to show, does not mean we should not respect IE's default behaviour. IE shows alt tags as tooltips, and is not a matter that shoud be "fixed", even if it "breaks" HTML standards. EdokterTalk 21:41, 29 December 2007 (UTC)

::If IE has quirky behavior and we can't fix it, that's one thing. But where IE has quirky behavior, and it's fixable (and it was fixed), that's another. Your change actually decreases performance on Internet Explorer for no other reason than to re-introduce one of Internet Explorer's quirks. If you think that we should make the TeX markup show up in tooltips, then that change needs to be made for all browsers, not just Internet Explorer. —Remember the dot (talk) 21:49, 29 December 2007 (UTC)

;Proposal

  • Change if (img.useMap) to if (img.useMap || img.className == "tex")
  • Take out outerSpan.title = img.title... Done.

img.title is always empty anyway. Also, the img.classname lookup seems to have no speed impact at all (probably because it is cached). EdokterTalk 17:06, 30 December 2007 (UTC)

:If you want to make the TeX markup show in the tooltips, make it appear there for users of all browsers, not just Internet Explorer. —Remember the dot (talk) 02:25, 31 December 2007 (UTC)

:You have a point about outerSpan.title = img.title... and I wouldn't mind if you removed this statement. —Remember the dot (talk) 02:26, 31 December 2007 (UTC)

::The script does not touch any other browser, so I can't make the tooltips appear in any other browser here; that requires a change in TeX or MediaWiki. But the change would restore IE default behaviour. EdokterTalk 12:21, 31 December 2007 (UTC)

:::Make another script that copies TeX alt attributes into TeX title attributes, and do not restrict that script to any one browser. —Remember the dot (talk) 19:29, 31 December 2007 (UTC)

::::I'm not restricting anything; IE displays alt as tooltips, as it has always done (even Netscape did so). If you want other browsers to do the same, you're welcome to write s script that does so. EdokterTalk 20:36, 1 January 2008 (UTC)

:::::Thank you for altering common.js appropriately. Here is code you can use for displaying the alt attribute in the tooltip:

/* Use alt attribute as the tooltip text, for example with TeX-generated images.

The MediaWiki software never adds title attributes to images anyway, so there is no danger of

overwriting an existing tooltip. */

function useAltForTooltips()

{

var documentImages = document.images

for (var i = 0; i < documentImages.length; i++)

{

var img = documentImages[i]

img.title = img.alt

}

}

if (!window.useAltForTooltipsDisabled)

{

window.addOnloadHook(useAltForTooltips)

}

:::::I don't have a strong opinion on whether we should use this code or not, so you can do what you like. Just try to keep the experience consistent across all browsers. —Remember the dot (talk) 22:06, 1 January 2008 (UTC)

::::::My intention was simply to restore IE's default behaviour, which I do not regard as a bug. If you want TeX-tooltips to display in other browsers as well, I suggest asking the community first (on WP:VPT) to see if non-IE users want the tooltips. In that case, a change should be made to TeX rather then add yet another script. I do intend to implement the other change listed above; that would at least speed up pages with TeX rendering. EdokterTalk 22:46, 1 January 2008 (UTC)

:::::::Sure, go ahead and make the other change. As long as the squid servers don't kill themselves again it should be fine. And feel free to ask the community about whether or not TeX markup should show up in tooltips. The major issue that I have is making it show up in the tooltips only for Internet Explorer, which results in inconsistency between browsers. —Remember the dot (talk) 23:19, 1 January 2008 (UTC)

::::::::My point is just that it is an inconsistency that has always existed, and therefor not something that should be 'fixed'. People using IE expect certian behaviuour, users using ohter browser expect other behaviour. But I am dubbing over the squid issue... It does make me wonder why the [http://upload.wikimedia.org/wikipedia/en/1/18/Monobook-bullet.png standard monobook bullet] doesn't kill the squids. EdokterTalk 23:59, 1 January 2008 (UTC)

:::::::::IE has all sorts of inconsistencies that have always existed that cause all sorts of problems. Just because it's always been there doesn't mean that it's worth keeping there. The casual user knows nothing of all this, of course. They might actually wonder why Wikipedia shows tooltips on TeX images in IE7 but not in IE6, Firefox, Opera, Safari, etc. The answer is that there's not a good way to keep IE7 from displaying them, but there is in the other browsers. But, if we decide that having those tooltips there is a good thing, then we can make the change, and make it for all browsers. —Remember the dot (talk) 20:40, 2 January 2008 (UTC)

class,IPA

The {{tl|IPA}} template which is based on class.IPA forces Firefox to display the IPA correctly, but adding to a table class="IPA" or class="IPA wikitable", which are based on the same class, does not. Instead, it displays with Arial Unicode, which is defective in its IPA range. How do we fix this? kwami (talk) 07:06, 3 January 2008 (UTC)

:The IPA class is never intended to be used directly; It should only be used by the several Unicode templates in order to display Unicode characters. EdokterTalk 13:52, 3 January 2008 (UTC)

::So are you saying it cannot work as a custom HTML class in tables? kwami (talk) 16:47, 3 January 2008 (UTC)

:::That is correct. EdokterTalk 17:11, 3 January 2008 (UTC)

::::I was under impression that IPA class is here only to fix IE shortcomings. I wish someone could write a detailed help page on this topic ∴ AlexSm 01:36, 7 January 2008 (UTC)

:::::There are two problems in FF: One, if you don't format all IPA with a specific font, you get the browser's default font for letters it covers, which often doesn't match and looks very unprofessional. Two, whenever the font includes replacement pairs, such as IPA tone letters or Indic akshara, a simple class="wikitable" table doesn't force them to combine. However, a class="wikitable" style="text-align:center" table displays them properly. I have no idea why the behavior is so odd, but suspect it's a bug in Wikipedia coding. kwami (talk) 02:02, 7 January 2008 (UTC)

:::::I was able to compensate by adding ".IPA { font-family: Gentium, Charis SIL !important; }" to my monobook.css, but something like this should be automatic. kwami (talk) 19:42, 26 May 2008 (UTC)

:::::The problem with decomposed ligatures and akshara was due to setting my prefs to justified text. Once I aligned it left, the issue disappeared. So there is a bug in the code. Is it possible to have proper ligature rendering and justified text? kwami (talk) 19:44, 26 May 2008 (UTC)

addDismissButton in Opera

I don't think addDismissButton() should continue after it finds out that the cookie is set to hide the message. There is no point to create [dismiss] link after that. Besides, for some reason this link is still visible in Opera (9.25) while the whole message is hidden (probably Opera's fault, but still...). In other words, we need a return immediately after watchlistMessage.style.display = "none"AlexSm 01:36, 7 January 2008 (UTC)

On subpages and tabs

Currently, when you're at a subpage, e.g., Template:Infobox Election/doc, the "discussion" tab links to the /doc talk page rather than the main talk page. I asked User:Splarka if there was a JavaScript way to fix this, and he wrote the code found below. It changes the tab to blue and links it to the main talk page if the tab is already non-existent. It's currently written to only work on /doc and /sandbox pages. Would there be any objections to implementing it site-wide? It would save a lot of unnecessary redirects. Improvements are, of course, welcome. Cheers. --MZMcBride (talk) 06:22, 7 January 2008 (UTC)

if(wgPageName.indexOf('/')!=-1 && (wgNamespaceNumber % 2)==0) addOnloadHook(redirSubpageTalk)

function redirSubpageTalk() {

var redir = [

/\/doc/i,

/\/sandbox/i

]

var talk = document.getElementById('ca-talk')

if(talk.className.indexOf('new')==-1) return;

var talka = talk.getElementsByTagName('a')[0];

for(var i=0;i

if(talka.href.search(redir[i])!=-1) {

talka.href = talka.href.replace(redir[i],'').replace(/action\=edit/i,'action=view');

talk.className = '';

}

}

}

:Wouldn't it be better to submit a bug report? (rather than link-munge) GracenotesT § 16:38, 7 January 2008 (UTC)

::On second note, I'm not sure this is a good idea, given that it violates the principle of least astonishment – users shouldn't have to check the status bar to see where a user interface link leads. it would make a good user script, however. GracenotesT § 18:21, 7 January 2008 (UTC)

:::Yeah, I thought about that; however, the code stops if the /doc talk page actually exists, and I think it would be justifiable to do this if the result was easier accessibility. Currently, people are creating redirects, which simply seems kinda silly. --MZMcBride (talk) 21:31, 7 January 2008 (UTC)

::::Why is it silly? Creating redirects is the way in which redirection is meant to be handled in MediaWiki wikis, not with kludgy javascript. Adding the above code would be very annoying; I'd have to disable javascript on Wikipedia and manually copy the rest of the scripts from various different places into a local file and use that, which would be a lot of fuss – Gurch 22:10, 7 January 2008 (UTC)

:::::It's silly because the pages are never going to be used for anything other than redirects to the target they should go to. And even if there is legitimate content, the script takes that into account and shuts down. Currently, most of the /doc talk subpages aren't redirects and the interface is just a little clunkier. Instead of being able to just click the tab and go to the page that they intended, users either have to create redirects or go back and then go to the talk page. Meh. I'll probably just enable it for myself; let them have red tabs. --MZMcBride (talk) 02:51, 8 January 2008 (UTC)

::::::That is proof only that the /doc subpage system was a stupid idea in the first place. There was nothing wrong with having the documentation on the discussion page – and avoiding all that silly meta-templating on the template page itself – but it just had to be changed, didn't it? – Gurch 18:34, 8 January 2008 (UTC)

:If people are competent enough to edit doc pages, why would they ever click the red link or think a redirect would be intuitive rather than misplaced? That's like making a redirect in articlespace to correspond with every talk archive. A trivial solution would be to add a link to the talk page to {{tl|Documentation}}, if it's likely to be noticed. –Pomte 00:52, 9 January 2008 (UTC)

Problems with collapsible shells and older safari browsers

Hi - I've just realised that the reason so many navigation templates and WikiProject banners seem to have disappeared from Wikipedia in the last few months is that they haven't gone - I've just been unable to see them. With the combination of browser and platform I (and presumably other) WP editors use (Mac OS 10.2.8/ Safari 1.0.3) the shell renders all templates within it as thin, unexpandable lines. Is there any way to fix this so that I don't have to physically edit the article to see what templates are on it? There's some discussion of this already at Template_talk:WikiProjectBannerShell, which is where I first raised this issue, but the suggestion there is that this is the place to come. As an example of what I mean, here's how the top of Talk:Algeria looks to me:

Image:Shellprob.jpg

User:Anomie suggests that: " If that is the case, I suspect the problem is on line 126 of the current version as I remember hearing that particularly old versions of Safari do not correctly support the table "rows" collection."

Any possible way of fixing the problem? Grutness...wha? 23:21, 18 January 2008 (UTC)

:{{tlx|editprotected}}

:We've done some experimentation, and it seems I was correct as overriding the function in Grutness's monobook.js with a fixed version has fixed the problem. Please change line 126 from var Rows = Table.rows; to var Rows = Table.getElementsByTagName( "tr" );. Thanks. Anomie 13:33, 19 January 2008 (UTC)

::Has this been tested that it does not break other browsers? EdokterTalk 14:35, 19 January 2008 (UTC)

:::The other function implementing this feature, createCollapseButtons, uses getElementsByTagName to get the list of table rows, so if this would break anything then it is already broken. I suppose to be 100% safe you should use lower-case "tr" instead of "TR"; I have edited the request accordingly. Anomie 14:46, 19 January 2008 (UTC)

::::{{Done}} EdokterTalk 15:02, 19 January 2008 (UTC)

:::::D'oh! I see you rightly reverted it as it caused unrelated problems. Anomie 15:12, 19 January 2008 (UTC)

I have had to revert this change, unfortunately. It broke functionality in nested tables in that they automatically expanded (and still showing the [show] link) when the main table is expanded. This needs more testing. EdokterTalk 15:12, 19 January 2008 (UTC)

:Ok, I have another attempt at User:Anomie/Sandbox.js. The code there can be copied into a monobook.js for testing, I'm not going to be so hasty this time ;) So far, it seems to work for Grutness in the old Safari version and me in Firefox 2.0.0.11. Anomie 03:54, 20 January 2008 (UTC)

smaxage=0

Due to persistent caching of user/site scripts and stylesheets, what do you think of temporarily modifying the following two lines from importScript and importStylesheet?

+ '&action=raw&ctype=text/javascript';

+ '&action=raw&ctype=text/css";'

to include &smaxage=0 so as to reduce the server-side cache to as low a number as possible? Eg:

+ '&action=raw&smaxage=0&ctype=text/javascript';

+ '&action=raw&smaxage=0&ctype=text/css";'

Notes:

  • In practice, this still seems to take up to 5 minutes.
  • This is not a drastic change or server bombing, client side caching is still up to 31 days by default.
  • If the devs don't like it, they can fix the bugs hampering meaningful script development! Grr, arg.

Please reach consensus before implementing (if at all?). An implement/revert/implement/revert battle over this, coupled with the caching bugs, would be worse than no action taken at all. --Splarka (rant) 05:27, 21 January 2008 (UTC)

:r27456 --Splarka (rant) 06:15, 22 January 2008 (UTC)

::What exactly did that change do? Will I have caching problems now when I try to rewrite and debug a script? —Remember the dot (talk) 18:14, 22 January 2008 (UTC)

:::I didn't analyze that PHP change, but I do have caching problems when developing scripts for WikiMedia projects. Despite purging, clearing my local cache, and forcing reloads, it takes currently between 5 to 10 minutes until changes are seen. This is behavior that I didn't see formerly. If I understand Splarka's suggestion right, setting maxage to zero should resolve this by forcing the server to serve always the latest version of a script, not some cached one. Lupo 07:23, 23 January 2008 (UTC)

:Followup: A dev has disabled the cache server hack that was ignoring a "Pragma: No-cache" from the browsers. This apparently makes it possible to [reload] a page and re-request new raw CSS/JS. With some minimum testing it seems to work again (for now). --Splarka (rant) 08:02, 1 February 2008 (UTC)

=import*() better?=

A secondary request is to have these functions able to import scripts/styles from elsewhere, for example:

  • importScript('User:Foo.js') would grab the page as normal
  • importScript('http://en.wikipedia.org/w/index.php?title=User:Zocky/SearchBox.js&action=raw&ctype=text/javascript&dontcountme=s') would see 'http:' and load the path as absolute.
  • importScript('file:///c:/foo.bar.js','mediawiki') would see the local path and load it as absolute.

This would only take a quick if() block around the URL generator, eg for importScript something like... (the css version would be similar):

if(page.indexOf('http://') == 0 || page.indexOf('https://') == 0 || page.indexOf('file://') == 0) {

var url = page;

} else {

var url = wgScript + '?title=' + encodeURIComponent( page.replace( / /g, '_' ) )

+ '&action=raw&ctype=text/javascript';

}

Note: You may be tempted to ask for an tertiary interwiki feature, eg to m:User:Foo/bar.js but this would be... very hard to implement, as well as support, while the above modification would be relatively easy if done properly.

Thoughts? --Splarka (rant) 05:27, 21 January 2008 (UTC)

:One potential issue is that people might grab script files off other sites, when really everything should be hosted on Wikimedia servers. I think the [http://www.mediawiki.org/wiki/API API] might be able to enable interwiki imports. A quick Ajax request to the API to grab the URL (no more than a kilobyte or two round trip), and off you go. But overall, it might be more trouble than it's worth. —Remember the dot (talk) 06:17, 21 January 2008 (UTC)

::Well, the problem of people trying to load JS from external sites can be solved easily enough by just allowing the "absolute path" import only if the server is *.wikipedia.org or *.wikimedia.org. Could even add the "&action=raw&ctype=text/javascript&dontcountme=s" part automatically. Lupo 07:33, 21 January 2008 (UTC)

:::Well, anyone can import local or remote scripts in their user js already, with a document.write or function similar to importScript(). Perhaps it could just be limited to logged in users? ... if(wgUserName) --Splarka (rant) 08:13, 21 January 2008 (UTC)

I have made versions of import* that do this for myself so that I can test them: See [http://en.wikipedia.org/w/index.php?title=User:TheDJ/monobook.js&diff=prev&oldid=193047166 my diff]. I agree that there is a risk for increased usage of external scripts, but I'm not sure wether that is a real problem. It is already happening with some of our most profound scripts (Lupin's tools, mini atlas, and CH2 all use commons and local servers for scripts). I don't really see the added danger, but; we could check for something like if(page.indexOf( wgServer ) == 0 || page.indexOf( 'http://meta.wikimedia.org') ==0 || page.indexOf('http://commons.wikimedia.org') ==0 || page.indexOf('file://') == 0) which is probably quicker than hitting the API with an ajaxreq. and still suit most of our problems. Lastly, perhaps its about time we re-discuss including scripts from other users. The Gadgets are a good first step, and I wouldn't want to loose the current ability to load scripts from other users because its just too damn easy, but I was thinking that perhaps having a bot look at our .js pages for any URL changes might be a good idea to prevent issues. --TheDJ (talkcontribs) 16:20, 21 February 2008 (UTC)

Problem with importStylesheet on Internet Explorer

{{tlx|edit protected}}

I mainly use Firefox, but I write some javascript that I want IE users to be able to use too. With Internet Explorer 7, I can't do appendChild on a STYLE element, nor can I set the innerHTML (both gives me errors). Thus, the importStylesheet() function here does not work with IE7 (though it does work fine with Firefox, Opera, and Safari). Instead, IE can use the document.createStyleSheet() function. -Pan Sola (talk) 09:31, 27 January 2008 (UTC)

:This is a known issue yes. Adding if (document.createStyleSheet) document.createStyleSheet( theurl );

else { our current code } should take care of it according to various websources.... --TheDJ (talkcontribs) 14:17, 27 January 2008 (UTC)

::There are also other ways to fix this for IE, like using cssText property, or creating <link> element (instead of <style> with @import), but I agree that document.createStyleSheet seems to be the best option ∴ AlexSm 14:27, 27 January 2008 (UTC)

Is there a specific edit that needs to be done? If not, please do not use the editprotected template as a general call for help. EdokterTalk 15:15, 27 January 2008 (UTC)

:Sorry I wasn't clear. I would like to advocate for the importStylesheet() function defined here to incorporate the IE check and calls document.createStyleSheet() from within, so that other javascripts needing to import stylesheets does not have to deal with the browser detection. Alternately, if for some reason importStyle() should not be modified to work on Internet Explorer, then I would advocate a note in the comments for the function here warning people that it will not work on Internet Explorer. -Pan Sola (talk) 21:23, 27 January 2008 (UTC)

Here is the [http://en.wikipedia.org/w/index.php?title=User%3ATheDJ%2Fimport.js&diff=187335361&oldid=187332544 diff] that would do this. --TheDJ (talkcontribs) 22:10, 27 January 2008 (UTC)

:Hmm, the {{tlx|edit protected}} says it's for requesting immediate edit. Should I use it if I believe the edit should be made but without any urgency? -Pan Sola (talk) 20:37, 31 January 2008 (UTC)

::It's a good question, perhaps the template should be able to be used to get admin attention about a request, even if a clear edit proposal is finish. AzaToth 20:52, 31 January 2008 (UTC)

See also #import.2A.28.29_better.3F, but this createStylesheet() implementation is currently active in my private implementation of the import*() functions. --TheDJ (talkcontribs) 16:22, 21 February 2008 (UTC)

Big performance improvement

{{tl|editprotected}}

It's been suggested before that we factor out all the IE fixes, but nobody actually took the time to do it. Were this done, we would see two improvements:

  1. Those not using IE (who consequently do not need the IE scripts) would not have to waste time downloading them
  2. Only one check would need to be made to see whether the browser is IE or not

So, I went through and came up with the code necessary to do it. The scripts will all continue to work as before, but users will see an improvement in page load time. Since this doesn't involve an appreciable change in behavior, we should be able to just go ahead and do it.

{{hidden|Please create MediaWiki:Common IE.js with:|

/* Import fixes specific to Internet Explorer 6.0 *****************************/

if (navigator.appVersion.substr(22, 1) == "6")

{

importScript("MediaWiki:Common IE6.js")

}

/** Internet Explorer bug fix **************************************************

  • Description: Fixes IE horizontal scrollbar bug
  • Maintainers: User:Tom-?
  • /

if (document.compatMode == "CSS1Compat")

{

var oldWidth;

var docEl = document.documentElement;

function fixIEScroll()

{

if (!oldWidth || docEl.clientWidth > oldWidth)

doFixIEScroll();

else

setTimeout(doFixIEScroll, 1);

oldWidth = docEl.clientWidth;

}

function doFixIEScroll() {

docEl.style.overflowX = (docEl.scrollWidth - docEl.clientWidth < 4) ? "hidden" : "";

}

document.attachEvent("onreadystatechange", fixIEScroll);

attachEvent("onresize", fixIEScroll);

}

/** IE 6 Z-index bug workaround for anonnotice **************************

*

* Description: This implements a work around for the Z-index bug found in Internet Explorer.

* It correctly places the anon notice on the page, even under IE6.

* See this Google search for more information about the bug:

* http://www.google.com/search?hl=en&client=firefox-a&rls=org.mozilla%3Aen-US%3Aofficial&hs=q74&q=z-index+ie6+bug&btnG=Search

* Created by: User:Gmaxwell

*/

addOnloadHook((function (){

if (wgUserName == null) {

var messageEdu=new Array();

messageEdu[0]='Learn more about using Wikipedia for research';

messageEdu[1]='Ten things you may not know about Wikipedia';

messageEdu[2]='Ten things you may not know about images on Wikipedia';

messageEdu[3]='Learn more about citing Wikipedia';

messageEdu[4]='Have questions? Find out how to ask questions and get answers.';

messageEdu[5]='Find out more about navigating Wikipedia and finding information';

messageEdu[6]='Interested in contributing to Wikipedia?';

var whichMessageEdu = Math.floor(Math.random()*(messageEdu.length));

/** document.getElementById("contentSub").innerHTML +='

';

  • /

}

}));

/**

* Remove need for CSS hacks regarding MSIE and IPA.

*/

if (document.createStyleSheet) {

document.createStyleSheet().addRule('.IPA', 'font-family: "Doulos SIL", "Charis SIL", Gentium, "DejaVu Sans", Code2000, "TITUS Cyberbit Basic", "Arial Unicode MS", "Lucida Sans Unicode", "Chrysanthi Unicode";');

}}

{{hidden|Please create MediaWiki:Common IE6.js with:|

/**

* Correctly handle PNG transparency in Internet Explorer 6.

* http://homepage.ntlworld.com/bobosola. Updated 18-Jan-2006.

*

* Adapted for Wikipedia by Remember_the_dot and Edokter.

*

* http://homepage.ntlworld.com/bobosola/pnginfo.htm states "This page contains more information for

* the curious or those who wish to amend the script for special needs", which I take as permission to

* modify or adapt this script freely. I release my changes into the public domain.

*/

function PngFix()

{

try

{

if (!document.body.filters)

{

window.PngFixDisabled = true

}

}

catch (e)

{

window.PngFixDisabled = true

}

if (!window.PngFixDisabled)

{

var documentImages = document.images

var documentCreateElement = document.createElement

var funcEncodeURI = encodeURI

for (var i = 0; i < documentImages.length;)

{

var img = documentImages[i]

var imgSrc = img.src

if (imgSrc.substr(imgSrc.length - 3).toLowerCase() == "png" && !img.onclick)

{

if (img.useMap)

{

img.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + encodeURI(imgSrc) + "')"

img.src = "http://upload.wikimedia.org/wikipedia/commons/c/ce/Transparent.gif"

i++

}

else

{

var outerSpan = documentCreateElement("span")

var innerSpan = documentCreateElement("span")

var outerSpanStyle = outerSpan.style

var innerSpanStyle = innerSpan.style

var imgCurrentStyle = img.currentStyle

outerSpan.id = img.id

outerSpan.title = img.title

outerSpan.className = img.className

outerSpanStyle.backgroundImage = imgCurrentStyle.backgroundImage

outerSpanStyle.borderWidth = imgCurrentStyle.borderWidth

outerSpanStyle.borderStyle = imgCurrentStyle.borderStyle

outerSpanStyle.borderColor = imgCurrentStyle.borderColor

outerSpanStyle.display = "inline-block"

outerSpanStyle.fontSize = "0"

outerSpanStyle.verticalAlign = "middle"

if (img.parentElement.href) outerSpanStyle.cursor = "hand"

innerSpanStyle.width = "1px"

innerSpanStyle.height = "1px"

innerSpanStyle.display = "inline-block"

innerSpanStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + funcEncodeURI(imgSrc) + "')"

outerSpan.appendChild(innerSpan)

img.parentNode.replaceChild(outerSpan, img)

}

}

else

{

i++

}

}

}

}

window.attachEvent("onload", PngFix)

}}

{{hidden|And finally, change MediaWiki:Common.js to:|

/** Import module *************************************************************

  • Description: Includes a raw wiki page as javascript or CSS,
  • used for including user made modules.
  • Maintainers: User:AzaToth
  • /

importedScripts = {}; // object keeping track of included scripts, so a script ain't included twice

function importScript( page ) {

if( importedScripts[page] ) {

return;

}

importedScripts[page] = true;

var url = wgScriptPath

+ '/index.php?title='

+ encodeURIComponent( page.replace( / /g, '_' ) )

+ '&action=raw&ctype=text/javascript';

var scriptElem = document.createElement( 'script' );

scriptElem.setAttribute( 'src' , url );

scriptElem.setAttribute( 'type' , 'text/javascript' );

document.getElementsByTagName( 'head' )[0].appendChild( scriptElem );

}

function importStylesheet( page ) {

var sheet = '@import "'

+ wgScriptPath

+ '/index.php?title='

+ encodeURIComponent( page.replace( / /g, '_' ) )

+ '&action=raw&ctype=text/css";'

var styleElem = document.createElement( 'style' );

styleElem.setAttribute( 'type' , 'text/css' );

styleElem.appendChild( document.createTextNode( sheet ) );

document.getElementsByTagName( 'head' )[0].appendChild( styleElem );

}

/** Internet Explorer fixes ***************************************************/

if (navigator.appName == "Microsoft Internet Explorer")

{

importScript("MediaWiki:Common IE.js")

}

/** Test if an element has a certain class *************************************

var hasClass = (function () {

var reCache = {};

return function (element, className) {

return (reCache[className] ? reCache[className] : (reCache[className] = new RegExp("(?:\\s|^)" + className + "(?:\\s|$)"))).test(element.className);

};

})();

/** Interwiki links to featured articles ***************************************

  • Description: Highlights interwiki links to featured articles (or
  • equivalents) by changing the bullet before the interwiki link
  • into a star.
  • Maintainers: User:R. Koot
  • /

function LinkFA()

{

if ( document.getElementById( "p-lang" ) ) {

var InterwikiLinks = document.getElementById( "p-lang" ).getElementsByTagName( "li" );

for ( var i = 0; i < InterwikiLinks.length; i++ ) {

if ( document.getElementById( InterwikiLinks[i].className + "-fa" ) ) {

InterwikiLinks[i].className += " FA"

InterwikiLinks[i].title = "This is a featured article in another language.";

}

}

}

}

addOnloadHook( LinkFA );

/** Collapsible tables *********************************************************

var autoCollapse = 2;

var collapseCaption = "hide";

var expandCaption = "show";

function collapseTable( tableIndex )

{

var Button = document.getElementById( "collapseButton" + tableIndex );

var Table = document.getElementById( "collapsibleTable" + tableIndex );

if ( !Table || !Button ) {

return false;

}

var Rows = Table.rows;

if ( Button.firstChild.data == collapseCaption ) {

for ( var i = 1; i < Rows.length; i++ ) {

Rows[i].style.display = "none";

}

Button.firstChild.data = expandCaption;

} else {

for ( var i = 1; i < Rows.length; i++ ) {

Rows[i].style.display = Rows[0].style.display;

}

Button.firstChild.data = collapseCaption;

}

}

function createCollapseButtons()

{

var tableIndex = 0;

var NavigationBoxes = new Object();

var Tables = document.getElementsByTagName( "table" );

for ( var i = 0; i < Tables.length; i++ ) {

if ( hasClass( Tables[i], "collapsible" ) ) {

/* only add button and increment count if there is a header row to work with */

var HeaderRow = Tables[i].getElementsByTagName( "tr" )[0];

if (!HeaderRow) continue;

var Header = HeaderRow.getElementsByTagName( "th" )[0];

if (!Header) continue;

NavigationBoxes[ tableIndex ] = Tables[i];

Tables[i].setAttribute( "id", "collapsibleTable" + tableIndex );

var Button = document.createElement( "span" );

var ButtonLink = document.createElement( "a" );

var ButtonText = document.createTextNode( collapseCaption );

Button.style.styleFloat = "right";

Button.style.cssFloat = "right";

Button.style.fontWeight = "normal";

Button.style.textAlign = "right";

Button.style.width = "6em";

ButtonLink.style.color = Header.style.color;

ButtonLink.setAttribute( "id", "collapseButton" + tableIndex );

ButtonLink.setAttribute( "href", "javascript:collapseTable(" + tableIndex + ");" );

ButtonLink.appendChild( ButtonText );

Button.appendChild( document.createTextNode( "[" ) );

Button.appendChild( ButtonLink );

Button.appendChild( document.createTextNode( "]" ) );

Header.insertBefore( Button, Header.childNodes[0] );

tableIndex++;

}

}

for ( var i = 0; i < tableIndex; i++ ) {

if ( hasClass( NavigationBoxes[i], "collapsed" ) || ( tableIndex >= autoCollapse && hasClass( NavigationBoxes[i], "autocollapse" ) ) ) {

collapseTable( i );

}

}

}

addOnloadHook( createCollapseButtons );

/** Dynamic Navigation Bars (experimental) *************************************

// set up the words in your language

var NavigationBarHide = '[' + collapseCaption + ']';

var NavigationBarShow = '[' + expandCaption + ']';

// shows and hides content and picture (if available) of navigation bars

// Parameters:

// indexNavigationBar: the index of navigation bar to be toggled

function toggleNavigationBar(indexNavigationBar)

{

var NavToggle = document.getElementById("NavToggle" + indexNavigationBar);

var NavFrame = document.getElementById("NavFrame" + indexNavigationBar);

if (!NavFrame || !NavToggle) {

return false;

}

// if shown now

if (NavToggle.firstChild.data == NavigationBarHide) {

for (

var NavChild = NavFrame.firstChild;

NavChild != null;

NavChild = NavChild.nextSibling

) {

if ( hasClass( NavChild, 'NavPic' ) ) {

NavChild.style.display = 'none';

}

if ( hasClass( NavChild, 'NavContent') ) {

NavChild.style.display = 'none';

}

}

NavToggle.firstChild.data = NavigationBarShow;

// if hidden now

} else if (NavToggle.firstChild.data == NavigationBarShow) {

for (

var NavChild = NavFrame.firstChild;

NavChild != null;

NavChild = NavChild.nextSibling

) {

if (hasClass(NavChild, 'NavPic')) {

NavChild.style.display = 'block';

}

if (hasClass(NavChild, 'NavContent')) {

NavChild.style.display = 'block';

}

}

NavToggle.firstChild.data = NavigationBarHide;

}

}

// adds show/hide-button to navigation bars

function createNavigationBarToggleButton()

{

var indexNavigationBar = 0;

// iterate over all < div >-elements

var divs = document.getElementsByTagName("div");

for(

var i=0;

NavFrame = divs[i];

i++

) {

// if found a navigation bar

if (hasClass(NavFrame, "NavFrame")) {

indexNavigationBar++;

var NavToggle = document.createElement("a");

NavToggle.className = 'NavToggle';

NavToggle.setAttribute('id', 'NavToggle' + indexNavigationBar);

NavToggle.setAttribute('href', 'javascript:toggleNavigationBar(' + indexNavigationBar + ');');

var NavToggleText = document.createTextNode(NavigationBarHide);

for (

var NavChild = NavFrame.firstChild;

NavChild != null;

NavChild = NavChild.nextSibling

) {

if ( hasClass( NavChild, 'NavPic' ) || hasClass( NavChild, 'NavContent' ) ) {

if (NavChild.style.display == 'none') {

NavToggleText = document.createTextNode(NavigationBarShow);

break;

}

}

}

NavToggle.appendChild(NavToggleText);

// Find the NavHead and attach the toggle link (Must be this complicated because Moz's firstChild handling is borked)

for(

var j=0;

j < NavFrame.childNodes.length;

j++

) {

if (hasClass(NavFrame.childNodes[j], "NavHead")) {

NavFrame.childNodes[j].appendChild(NavToggle);

}

}

NavFrame.setAttribute('id', 'NavFrame' + indexNavigationBar);

}

}

}

addOnloadHook( createNavigationBarToggleButton );

/** Main Page layout fixes *********************************************************

  • Description: Various layout fixes for the main page, including an
  • additional link to the complete list of languages available
  • and the renaming of the 'Article' to to 'Main Page'.
  • Maintainers: User:AzaToth, User:R. Koot, User:Alex Smotrov
  • /

function mainPageRenameNamespaceTab() {

try {

var Node = document.getElementById( 'ca-nstab-main' ).firstChild;

if ( Node.textContent ) { // Per DOM Level 3

Node.textContent = 'Main Page';

} else if ( Node.innerText ) { // IE doesn't handle .textContent

Node.innerText = 'Main Page';

} else { // Fallback

Node.replaceChild( Node.firstChild, document.createTextNode( 'Main Page' ) );

}

} catch(e) {

// bailing out!

}

}

if ( wgTitle == 'Main Page' && ( wgNamespaceNumber == 0 || wgNamespaceNumber == 1 ) ) {

addOnloadHook( mainPageRenameNamespaceTab );

}

if ( wgTitle == 'Main Page' && wgNamespaceNumber == 0 ) {

addOnloadHook( mainPageAppendCompleteListLink );

}

function mainPageAppendCompleteListLink() {

addPortletLink('p-lang', 'http://meta.wikimedia.org/wiki/List_of_Wikipedias',

'Complete list', 'interwiki-completelist', 'Complete list of Wikipedias')

}

/** Extra toolbar options ******************************************************

//This is a modified copy of a script by User:MarkS for extra features added by User:Voice of All.

// This is based on the original code on Wikipedia:Tools/Editing tools

// To disable this script, add mwCustomEditButtons = []; to Special:Mypage/monobook.js

if (mwCustomEditButtons) {

mwCustomEditButtons[mwCustomEditButtons.length] = {

"imageFile": "http://upload.wikimedia.org/wikipedia/en/c/c8/Button_redirect.png",

"speedTip": "Redirect",

"tagOpen": "#REDIRECT [[",

"tagClose": "]]",

"sampleText": "Insert text"};

mwCustomEditButtons[mwCustomEditButtons.length] = {

"imageFile": "http://upload.wikimedia.org/wikipedia/en/c/c9/Button_strike.png",

"speedTip": "Strike",

"tagOpen": "",

"tagClose": "",

"sampleText": "Strike-through text"};

mwCustomEditButtons[mwCustomEditButtons.length] = {

"imageFile": "http://upload.wikimedia.org/wikipedia/en/1/13/Button_enter.png",

"speedTip": "Line break",

"tagOpen": "
",

"tagClose": "",

"sampleText": ""};

mwCustomEditButtons[mwCustomEditButtons.length] = {

"imageFile": "http://upload.wikimedia.org/wikipedia/en/8/80/Button_upper_letter.png",

"speedTip": "Superscript",

"tagOpen": "",

"tagClose": "",

"sampleText": "Superscript text"};

mwCustomEditButtons[mwCustomEditButtons.length] = {

"imageFile": "http://upload.wikimedia.org/wikipedia/en/7/70/Button_lower_letter.png",

"speedTip": "Subscript",

"tagOpen": "",

"tagClose": "",

"sampleText": "Subscript text"};

mwCustomEditButtons[mwCustomEditButtons.length] = {

"imageFile": "http://upload.wikimedia.org/wikipedia/en/5/58/Button_small.png",

"speedTip": "Small",

"tagOpen": "",

"tagClose": "",

"sampleText": "Small Text"};

mwCustomEditButtons[mwCustomEditButtons.length] = {

"imageFile": "http://upload.wikimedia.org/wikipedia/en/3/34/Button_hide_comment.png",

"speedTip": "Insert hidden Comment",

"tagOpen": "",

"sampleText": "Comment"};

mwCustomEditButtons[mwCustomEditButtons.length] = {

"imageFile": "http://upload.wikimedia.org/wikipedia/en/1/12/Button_gallery.png",

"speedTip": "Insert a picture gallery",

"tagOpen": "\n\n",

"tagClose": "\n",

"sampleText": "Image:Example.jpg|Caption1\nImage:Example.jpg|Caption2"};

mwCustomEditButtons[mwCustomEditButtons.length] = {

"imageFile": "http://upload.wikimedia.org/wikipedia/en/f/fd/Button_blockquote.png",

"speedTip": "Insert block of quoted text",

"tagOpen": "

\n",

"tagClose": "\n

",

"sampleText": "Block quote"};

mwCustomEditButtons[mwCustomEditButtons.length] = {

"imageFile": "http://upload.wikimedia.org/wikipedia/en/6/60/Button_insert_table.png",

"speedTip": "Insert a table",

"tagOpen": '

class="wikitable"\n
\n',

"tagClose": "\n

",

"sampleText": "! header 1\n! header 2\n! header 3\n|-\n| row 1, cell 1\n| row 1, cell 2\n| row 1, cell 3\n|-\n| row 2, cell 1\n| row 2, cell 2\n| row 2, cell 3"};

mwCustomEditButtons[mwCustomEditButtons.length] = {

"imageFile": "http://upload.wikimedia.org/wikipedia/commons/7/79/Button_reflink.png",

"speedTip": "Insert a reference",

"tagOpen": "",

"tagClose": "",

"sampleText": "Insert footnote text here"};

}

/**/

/** pageview counter ***********************************************************

  • Description: Please talk to de:User:LeonWeber before changing anything or
  • if there are any issues with that.
  • Maintainers: :de:User:LeonWeber?
  • /

// this should be adjusted to a good value.

// BE CAREFUL, you will break zedler if it's too low!

// And then DaB. will kill Leon :-(

var disable_counter = 0;

var counter_factor = 6000;

function pgcounter_setup()

{

if(disable_counter == 0)

{

var url = window.location.href;

if(Math.floor(Math.random()*counter_factor)==42) // the probability thing

{

if(wgIsArticle==true || wgArticleId==0) // do not count history pages etc.

{

var pgcountNs = wgCanonicalNamespace;

if(wgCanonicalNamespace=="")

{

pgcountNs = "0";

}

var cnt_url = "http://pgcount.wikimedia.de/index.png?ns=" + pgcountNs + "&title=" + encodeURI(wgTitle) + "&factor=" + counter_factor +"&wiki=enwiki";

var img = new Image();

img.src = cnt_url;

}

}

}

}

// Do not use aOnloadFunctions[aOnloadFunctions.length] = pgcounter_setup;, some browsers don't like that.

pgcounter_setup();

/** "Technical restrictions" title fix *****************************************

  • Description:
  • Maintainers: User:Interiot, User:Mets501, User:Freakofnurture
  • /

//

// For pages that have something like Template:Lowercase, replace the title, but only if it is cut-and-pasteable as a valid wikilink.

// (for instance iPod's title is updated. But C# is not an equivalent

// wikilink, so C Sharp doesn't have its main title changed)

// Likewise for users who have selected the U.K. date format ("1 March") the

// titles of day-of-the-year articles will appear in that style. Users with any

// other date setting are not affected.

//

// The function looks for a banner like this:

// <div id="RealTitleBanner"> ... <span id="RealTitle">title</span> ... </div>

// An element with id=DisableRealTitle disables the function.

//

var disableRealTitle = 0; // users can set disableRealTitle = 1 locally to disable.

if (wgIsArticle) { // don't display the RealTitle when editing, since it is apparently inconsistent (doesn't show when editing sections, doesn't show when not previewing)

addOnloadHook(function() {

try {

var realTitleBanner = document.getElementById("RealTitleBanner");

if (realTitleBanner && !document.getElementById("DisableRealTitle") && !disableRealTitle ) {

var realTitle = document.getElementById("RealTitle");

if (realTitle) {

var realTitleHTML = realTitle.innerHTML;

realTitleText = pickUpText(realTitle);

var isPasteable = 0;

//var containsHTML = /

var containsTooMuchHTML = //gi, "") ); // contains HTML that will be ignored when cut-n-pasted as a wikilink

// calculate whether the title is pasteable

var verifyTitle = realTitleText.replace(/^ +/, ""); // trim left spaces

verifyTitle = verifyTitle.charAt(0).toUpperCase() + verifyTitle.substring(1, verifyTitle.length); // uppercase first character

// if the namespace prefix is there, remove it on our verification copy. If it isn't there, add it to the original realValue copy.

if (wgNamespaceNumber != 0) {

if (wgCanonicalNamespace == verifyTitle.substr(0, wgCanonicalNamespace.length).replace(/ /g, "_") && verifyTitle.charAt(wgCanonicalNamespace.length) == ":") {

verifyTitle = verifyTitle.substr(wgCanonicalNamespace.length + 1);

} else {

realTitleText = wgCanonicalNamespace.replace(/_/g, " ") + ":" + realTitleText;

realTitleHTML = wgCanonicalNamespace.replace(/_/g, " ") + ":" + realTitleHTML;

}

}

// verify whether wgTitle matches

verifyTitle = verifyTitle.replace(/[\s_]+/g, " "); // underscores and multiple spaces to single spaces

verifyTitle = verifyTitle.replace(/^\s+/, "").replace(/\s+$/, ""); // trim left and right spaces

verifyTitle = verifyTitle.charAt(0).toUpperCase() + verifyTitle.substring(1, verifyTitle.length); // uppercase first character

if ( (verifyTitle == wgTitle) || (verifyTitle == wgTitle.replace(/^(.+)?(January|February|March|April|May|June|July|August|September|October|November|December)\s+([12]?[0-9]|3[0123])([^\d].*)?$/g, "$1$3 $2$4") )) isPasteable = 1;

var h1 = document.getElementsByTagName("h1")[0];

if (h1 && isPasteable) {

h1.innerHTML = containsTooMuchHTML ? realTitleText : realTitleHTML;

if (!containsTooMuchHTML)

realTitleBanner.style.display = "none";

}

document.title = realTitleText + " - Wikipedia, the free encyclopedia";

}

}

} catch (e) {

/* Something went wrong. */

}

});

}

// similar to innerHTML, but only returns the text portions of the insides, excludes HTML

function pickUpText(aParentElement) {

var str = "";

function pickUpTextInternal(aElement) {

var child = aElement.firstChild;

while (child) {

if (child.nodeType == 1) // ELEMENT_NODE

pickUpTextInternal(child);

else if (child.nodeType == 3) // TEXT_NODE

str += child.nodeValue;

child = child.nextSibling;

}

}

pickUpTextInternal(aParentElement);

return str;

}

//fix edit summary prompt for undo

//this code fixes the fact that the undo function combined with the "no edit summary prompter" causes problems if leaving the

//edit summary unchanged

//this was added by User:Deskana, code by User:Tra

addOnloadHook(function () {

if (document.location.search.indexOf("undo=") != -1

&& document.getElementsByName('wpAutoSummary')[0]) {

document.getElementsByName('wpAutoSummary')[0].value='1';

}

})

/** Add dismiss button to watchlist-message *************************************

  • Description: Hide the watchlist message for one week.
  • Maintainers: Ruud Koot
  • /

function addDismissButton() {

var watchlistMessage = document.getElementById("watchlist-message");

if ( watchlistMessage == null ) return;

var watchlistCookieID = watchlistMessage.className.replace(/cookie\-ID\_/ig,'');

if ( document.cookie.indexOf( "hidewatchlistmessage-" + watchlistCookieID + "=yes" ) != -1 ) {

watchlistMessage.style.display = "none";

}

var Button = document.createElement( "span" );

var ButtonLink = document.createElement( "a" );

var ButtonText = document.createTextNode( "dismiss" );

ButtonLink.setAttribute( "id", "dismissButton" );

ButtonLink.setAttribute( "href", "javascript:dismissWatchlistMessage();" );

ButtonLink.setAttribute( "title", "Hide this message for one week" );

ButtonLink.appendChild( ButtonText );

Button.appendChild( document.createTextNode( "[" ) );

Button.appendChild( ButtonLink );

Button.appendChild( document.createTextNode( "]" ) );

watchlistMessage.appendChild( Button );

}

function dismissWatchlistMessage() {

var e = new Date();

e.setTime( e.getTime() + (7*24*60*60*1000) );

var watchlistMessage = document.getElementById("watchlist-message");

var watchlistCookieID = watchlistMessage.className.replace(/cookie\-ID\_/ig,'');

document.cookie = "hidewatchlistmessage-" + watchlistCookieID + "=yes; expires=" + e.toGMTString() + "; path=/";

watchlistMessage.style.display = "none";

}

addOnloadHook( addDismissButton );

/** Main Page deletion image *******************************************************

*

* Description: If the Main Page does not exist (i.e., it's been deleted) then insert an image

* instead of showing the "page does not exist" text.

* Created by: User:Mark, with invaluable help from User:Pathoschild

*/

function MainPageDeletedImage() {

try {

//If the article does not exist and it is the Main Page, proceed

if ( document.getElementById( "noarticletext" ) && wgTitle == 'Main Page' ) {

// Insert a protected commons image at the end of the document explaining it.

var contentbox = document.getElementById('content');

var newimg = document.createElement('img');

newimg.setAttribute('src','http://upload.wikimedia.org/wikipedia/commons/9/99/WikipediaTechnical.png');

contentbox.appendChild(newimg);

// Hide the article-does-not-exist text

var NoArticleMessage = document.getElementById('noarticletext');

NoArticleMessage.style.display="none";

// Hide the edit button

var EditThisPageButton = document.getElementById('ca-edit');

EditThisPageButton.style.display="none";

}

} catch(e) {

// In case it does not work, do nothing

return;

}

}

addOnloadHook( MainPageDeletedImage );

/** Change Special:Search to use a drop-down menu *******************************************************

*

* Description: Change Special:Search to use a drop-down menu, with the default being

* the internal MediaWiki engine

* Created and maintained by: User:Gracenotes

*/

if (wgPageName == "Special:Search") {

var searchEngines = [];

addOnloadHook(SpecialSearchEnhanced);

}

function SpecialSearchEnhanced() {

var createOption = function(site, action, mainQ, addQ, addV) {

var opt = document.createElement('option');

opt.appendChild(document.createTextNode(site));

searchEngines[searchEngines.length] = [action, mainQ, addQ, addV];

return opt;

}

var searchForm = document.forms['search'];

var selectBox = document.createElement('select');

selectBox.id = 'searchEngine';

searchForm.onsubmit = function() {

var optSelected = searchEngines[document.getElementById('searchEngine').selectedIndex];

searchForm.action = optSelected[0];

searchForm.lsearchbox.name = optSelected[1];

searchForm.title.value = optSelected[3];

searchForm.title.name = optSelected[2];

}

selectBox.appendChild(createOption('MediaWiki search', wgScriptPath + '/index.php', 'search', 'title', 'Special:Search'));

selectBox.appendChild(createOption('Google', 'http://www.google.com/search', 'q', 'sitesearch', 'en.wikipedia.org'));

selectBox.appendChild(createOption('Yahoo', 'http://search.yahoo.com/search', 'p', 'vs', 'en.wikipedia.org'));

selectBox.appendChild(createOption('Windows Live', 'http://search.live.com/results.aspx', 'q', 'q1', 'site:http://en.wikipedia.org'));

selectBox.appendChild(createOption('Wikiwix', 'http://www.wikiwix.com/', 'action', 'lang', 'en'));

selectBox.appendChild(createOption('Exalead', 'http://www.exalead.com/wikipedia/results', 'q', 'language', 'en'));

searchForm.lsearchbox.style.marginLeft = '0px';

var lStat = document.getElementById('loadStatus');

lStat.parentNode.insertBefore(selectBox, lStat);

}

/** Geo-targeted watchlist notice *******************************************************

*

* Description: Allows for geographic targeting of watchlist notices. See Wikipedia:Geonotice for more information.

* Created by: User:Gmaxwell

*/

if (wgPageName == "Special:Watchlist")

addOnloadHook((function (){document.write('');

}}

Remember the dot (talk) 21:54, 2 February 2008 (UTC)

=Section break=

I don't know... it seems that relatively little IE-specific code (less then 7KB) is moved out of common.js, so I'm not convinced of the performance benefits. The file is cached locally and on the squids anyway. Plus it would further fragment all the javascript in MediaWiki. But we could consolidate all version checks into one function at the bottom, and load the rest from there. EdokterTalk 22:37, 2 February 2008 (UTC)

I doubt it's a performance gain for IE users. IE supports special conditions, such as <!--[if IE X]>IE-version-X-specific tagsGracenotesT § 23:14, 2 February 2008 (UTC)

:OK. I've disabled the {{tl|editprotected}} request for now. Perhaps we could create a variable such as "isIE" instead to at least centralize the checks for Internet Explorer. —Remember the dot (talk) 23:20, 2 February 2008 (UTC)

::bugzilla:12766. --Splarka (rant) 08:10, 3 February 2008 (UTC)

Optimization: call functions only when needed

Preamble: last night I was debugging my new little script, which sorts watchlist entries by namespace and then alphabetically. For some reason it did not work in IE6, I spent countless minutes rechecking my code, and finally created a loop to display all DOM nodes. Of course, what I found was a SPAN where I expected to see an IMG.

The question is: why do I need PngFix script in my watchlist, where all used images are 256-color and thus do not need transparency fix? Why do I also need Wikiminiatlas, collapsible Tables and Divs on all special pages?

Proposal: move all addOnloadHook() calls to the bottom of the file, after checking some basic conditions, mostly for the current namespace. This should make Wikipedia pages a bit faster to respond after loading. This should also allow to remove several existing checks that are right now inside the functions.

For an example please look at the bottom of ru:MediaWiki:Common.js where I implemented this approach a long time ago ∴ AlexSm 17:06, 6 February 2008 (UTC)

:The proposal has some merit, except a PNG image can appear in any namespace. Begs the question though, why are you quering images on your watchlist, which doesn't have images? Or does your script display images inline? In any case, setting PngFixDisabled to True in your script should also fix the problem. EdokterTalk 17:25, 6 February 2008 (UTC)

::256-color PNGs should be used for system messages, even if only for IE6 users with JavaScript disabled. As for my script, with "Enhanced recent changes" the watchlist structure is a bit complex, and to find the end of the row you have to traverse the DOM nodes until you find IMG or SPAN#RCMxx; of course, now that I finally figured the problem, I could get around it, but I would rather tell IE6 users that my script doesn't work because of PngFix, which is doing something to watchlist it's not supposed to. Back to proposal: the main purpose is not to "fix my script" but rather to avoid running any scripts when they are not needed ∴ AlexSm 18:22, 6 February 2008 (UTC)

:::There's a better solution here. You could simply add "PngFixDisabled = true" to your script and include a modified PngFix function that meets your script's particular needs. Failing that, many of the people still using IE6 can [http://www.microsoft.com/windows/downloads/ie/getitnow.mspx upgrade to IE7] or use a different browser such as [http://www.mozilla.com/en-US/firefox/ Firefox] or [http://www.opera.com/ Opera]. —Remember the dot (talk) 18:39, 6 February 2008 (UTC)

::::1) This was already suggested above; 2) The proposal is not about fixing my script; 3) I don't see why do you insist on running PngFix in watchlist where it only slows things down ∴ AlexSm 19:45, 6 February 2008 (UTC)

:::::I like your proposal for functions that only run in a specific namespace. However, it's possible to put transparent images on the watchlist via JavaScript where PngFix should get to them. As it stands, the PngFix script is very fast and flexible, being able to handle even unusual cases like this, and I don't want to diminish either of those qualities. —Remember the dot (talk) 19:53, 6 February 2008 (UTC)

::::::Would it be possible to add a user-defined variable (similar to the one you can use to deactivate the whole script) that would allow individual users to decide whether the script should run on pages such as watchlists? This makes more sense to me than either method of running the script on every page or preventing it from ever running on certain pages, and this way, because most visitors will never see a watchlist with a PNG image in it, those who consider it important enough can activate it via their Common.js. —Dinoguy1000 21:46, 7 February 2008 (UTC)

:::I realize that the purpose of your complaint above isn't just to "fix my script", but I'd just like to note that, for parsing the extended-mode watchlist (or recentchanges, for that matter), it's probably better to look for the BR elements at the end of each line rather than the IMG elements at the beginning. See User:Ilmari Karonen/watchfilter.js for an (unfortunately rather sparsely commented) example of a script that works on both watchlist variants; look in particular for the case marked with "// enhanced mode". —Ilmari Karonen (talk) 21:23, 8 February 2008 (UTC)

::::Not always: I answered in details on User talk:Ilmari Karonen/watchfilter.js. / AlexSm 16:39, 11 February 2008 (UTC)

Can't get it to work

I've copied the appropriate code to my wiki, but I cannot get collapsible tables to work. Ideas? Note that my system doesn't have a common.js file, so I just added it and put it under mediawiki\skins\common.

Any assistance is appreciated. Thanks Timneu22 (talk) 13:31, 11 February 2008 (UTC)

:Did you also copy the relevant collapsible class from common.css? EdokterTalk 15:22, 11 February 2008 (UTC)

::"Collapsible" class does not have any extra CSS. Even if it did (like NavFrame), CSS has nothing to do with the collapsing functionality. Timneu22: please use Opera or Firefox, open error console and check for JavaScript errors. It;s possible e.g. you did not copy required hasClass() function / AlexSm 16:39, 11 February 2008 (UTC)

::: Sorry (and don't hurt me!), but I only have IE. How can I tell if there are errors? Also, I'm not sure how it will "just work" by creating this file:

:::# Common.js didn't exist

:::# I added it to mediawiki\skins\common

:::# How does any skin know to use it? I cannot imagine it will "just work" without me doing something else.

::: Thanks again Timneu22 (talk) 00:16, 12 February 2008 (UTC)

Sorry for some stupidity, I see that I needed to add this to my own MediaWiki:Common.js page. Done.

However, I'm having a problem now, where [hide] shows twice:

----------------------------------------------

- Some title [hide] [hide] -

----------------------------------------------

Ideas? Thanks AGAIN! Timneu22 (talk) 11:59, 12 February 2008 (UTC)

: Finally, looks like I got it right. I commented out the following (because it is unneeded on my wiki):

function sysopFunctions() {

if ( wgUserGroups && !window.disableSysopJS ) {

for ( var g = 0; g < wgUserGroups.length; ++g ) {

if ( wgUserGroups[g] == "sysop" ) {

importScript( "MediaWiki:Sysop.js" );

break;

}

}

}

}

addOnloadHook( sysopFunctions );

That function which you commented out isn't actually part of the collapsible tables code (it actually enables a seperate JS file for sysops only), and can be safely deleted. —Dinoguy1000 18:14, 13 February 2008 (UTC)

: Yeah, I knew it had nothing to do with tables. I just commented (as opposed to deleting) for the possibility that I will need it in the future. Thank you for your comment! I'm glad everything is working for my wiki! :) Timneu22 (talk) 23:57, 13 February 2008 (UTC)

= I Can't get it to work, either =

I am also having trouble getting common.js to give me a collapsible table.

I have copied the entire source of the common.js page into my own Mediawiki:Common.js area. I am using MediaWiki 1.6.7, could that have something to do with it? I am uncertain what to do, and would appreciate any assistance. Damian - 61.8.101.1 (talk) —Preceding comment was added at 07:09, 20 February 2008 (UTC)

:Hello, the reason MediaWiki:Common.js isn't working on your wiki is because it wasn't enabled in MediaWiki until version 1.10. Unless you care to upgrade your wiki software, you'll have to make do with MediaWiki:Monobook.js. —Dinoguy1000 18:41, 20 February 2008 (UTC)

:: I don't believe that last statement is true. I'm on 1.9.3 and it works (at least the collapsible tables part that I need). Timneu22 (talk) 21:45, 24 February 2008 (UTC)

Can I get it to work with MediaWiki: 1.6.10 ??

Andrew —Preceding unsigned comment added by 124.186.76.93 (talk) 16:34, 5 May 2008 (UTC)

line-spacing with sub & sup

As discussed on MediaWiki talk:Common.css. It is proposed (final idea by AlexSm) to add the following:

/* Function to add simple style blocks. */

/* Use sparsely and larger blocks of CSS should be loaded by importStylesheet() */

function appendCSS(text){

var s = document.createElement('style');

s.setAttribute('type', 'text/css');

if (s.styleSheet)

s.styleSheet.cssText = text; //IE

else

s.appendChild(document.createTextNode(text));

document.getElementsByTagName('head')[0].appendChild(s);

return s;

}

/* This avoids breaking the linespacing when using sup and sub elements */

/* No solution for IE currently exists */

/* See also http://en.wikipedia.org/w/index.php?title=MediaWiki_talk:Common.css&oldid=193038464#line-spacing_with_sub_.26_sup */

if( is_opera || is_safari || is_gecko) {

appendCSS('sup, sub {line-height:0;}');

}

We all wish there was a better way, but alternatives do not seem to exist. --TheDJ (talkcontribs) 14:52, 21 February 2008 (UTC)

It has not been shown that the line-height:0 causes a problem on IE - the problem that was observed still occurs if it is absent. —Random832 04:10, 24 February 2008 (UTC)

:Seems to be resolved, per MediaWiki talk:Common.css#Space between paragraphs please (References), and specifically [http://en.wikipedia.org/w/index.php?title=MediaWiki%3ACommon.css&diff=200205701&oldid=196707950 this change to MediaWiki:Common.css]. Thanks. -- Quiddity (talk) 18:44, 8 April 2008 (UTC)

Other Wikis - unwanted messages

Hello, I have the "meetup message" appearing on my own wiki:

The next New York City meetup is Sunday March 16th.

You're invited! [hide]

What part of Common.js do I need to comment so these always go away? Thank you! Timneu22 (talk) 21:48, 24 February 2008 (UTC)

:Look for "Geo-targeted watchlist notice" and disable the function underneath it. EdokterTalk 21:53, 24 February 2008 (UTC)

:: Indeed... thanks Timneu22 (talk) 21:59, 24 February 2008 (UTC)

Geonotice temporarily removed

I've temporarily removed the geonotice feature because Wikipedia:Wikipedia Takes Manhattan has been postponed a week to April 4, and the geonotice was advertising the wrong date. Wikipedia Takes Manhattan was the only geonotice active at this time, so there's no collateral damage. I'm waiting for Gmaxwell (or whoever else is technically able) to update the geonotice date ASAP, so that we can restore it. Thanks.--Pharos (talk) 05:07, 27 March 2008 (UTC)

:OK, I've restored it.--Pharos (talk) 05:56, 27 March 2008 (UTC)

::I would like to point out that due to browser caching, there is little chance that this actually had any effect for anyone. As a matter of fact for the people who DID actually download this "disabled" version, we might now end up with people who won't have this active for quite a while (not sure what the caching on this page is, but for Common.css its 30days ) --TheDJ (talkcontribs) 11:38, 27 March 2008 (UTC)

Modernista referrer

I put in this notice as prepared by Random832, and it seems to do the job nicely, except for one thing. It's placed above the title so as to appear distinct from the article, which I think is a good thing, but it also means that part of the notice is obscured by the Modernista navigation frame. Could somebody fix the notice so it's just a bit lower down? --Michael Snow (talk) 23:50, 19 April 2008 (UTC)

:The code was [http://en.wikipedia.org/w/index.php?title=MediaWiki:Common.js&diff=209765911&oldid=206809772 removed] since then. —AlexSm 18:42, 6 May 2008 (UTC)

::Right, it was removed with a comment, "as it's not legal for them to do what they do, report them instead", which makes no sense to me. What's that supposed to mean, report them? To whom? I've restored the notice. --Michael Snow (talk) 16:56, 16 May 2008 (UTC)

I don't agree with this addition. It goes against the spirit of Wikipedia:No disclaimers in articles. I also don't see why this site is getting special treatment. Who cares if they display Wikipedia in a frame? Really, why does it matter? --- RockMFR 19:17, 16 May 2008 (UTC)

:I also don't like this addition. Let's just worry about making the encyclopedia and not bloat the code worrying about how other people re-use it. —Remember the dot (talk) 00:08, 17 May 2008 (UTC)

::Agreed. It is bloat and should be removed. Such cases are much better handled using referrer filtering (but that requires a dev tinkering with Apache). EdokterTalk 08:52, 17 May 2008 (UTC)

:::OK, I've [http://en.wikipedia.org/w/index.php?title=MediaWiki%3ACommon.js&diff=213076511&oldid=212868139 removed] it again. —Remember the dot (talk) 17:36, 17 May 2008 (UTC)

::::It was approached in this fashion specifically because a developer said any administrator could take care of the issue, which is what we did. It has the same effect as referrer filtering. Is it somehow more bloating to do it here than in Apache?

::::Regarding "Let's just worry about making the encyclopedia" - this doesn't affect the encyclopedia in any way. It's not a disclaimer about an article, on Wikipedia the article displays normally, it's specifically about the Modernista site and only displays there. Regarding "Who cares if they display Wikipedia in a frame?" - the use potentially confuses visitors to their site about the source of the text, obscures the Wikipedia trademark and logo, and objections have been made to the company and on Talk:Modernista!. For who cares, I could give you Florence Devouard, Jimmy Wales, and Mike Godwin, to start with. --Michael Snow (talk) 04:08, 19 May 2008 (UTC)

:::::Since nobody has presented an alternative, and the objections are unpersuasive ("I don't like it", as opposed to actually rebutting the need for this), I've restored the referrer code. --Michael Snow (talk) 19:36, 23 May 2008 (UTC)

Michael, I'd appriciate if you didn't go interpret our silence as a "agree by non-resistence", because it's not. Our arguments are valid; we don't need this code bloating up the main script repository that handles the entire site; It slows down page loading and is only used in maybe 0.0001% of all page loads. Plus it is not effective in any way... if you want to be effective, we'd redirect the referrer page to Internet fraud or something like that. EdokterTalk 23:02, 23 May 2008 (UTC)

:All of our content is either freely licensed or fair use. This means that Modernista has the right to do whatever it wants with it. Why are we adding a disclaimer when people do something that we've tried so hard to enable them to do? —Remember the dot (talk) 02:11, 24 May 2008 (UTC)

::It is one thing to use our content freely, but to copy an entire site pretending to be Wikipedia is infringing trademark. If there is to be any code, it should be effective. EdokterTalk 08:26, 24 May 2008 (UTC)

:::They don't pretend to be Wikipedia as far as I can tell...they just show Wikipedia with a Modernista banner laid on top. —Remember the dot (talk) 20:52, 24 May 2008 (UTC)

::::The issue, from what I've been told / read, is that their "logo" is covering Wikipedia's. I have to say that I sort of agree with Michael here, if only slightly. Really, getting caught up in every byte is a bit silly. The one thing that will not happen is an edit war here. What it looks like right now is that more outside opinions are needed. Perhaps post to a pump or noticeboard asking for input? Else, I'd suggest leaving the code. --MZMcBride (talk) 00:48, 25 May 2008 (UTC)

:::::It's really not that bad - [http://www.modernista.com/7/index.php take a look] at their site and you'll see that the Wikipedia logo is very clearly visible despite the Modernista banner.

:::::I'm not trying to remove every byte possible from common.js; that would make the file unreadable. I just prefer to keep the common JavaScript to a minimum for reasonable performance and clarity, and also (though this doesn't apply to this thread) because I don't like having to use JavaScript to fix issues that would be better fixed by configuration changes etc. —Remember the dot (talk) 01:28, 25 May 2008 (UTC)

I'm against this code in Common.js. It's unreasonable to append this code just for a very tiny percentage of visitors (which was even lower before someone brought our attention to this "issue"). If another small company does the same trick, are you going to add the second warning for referrers from another website? —AlexSm 02:47, 25 May 2008 (UTC)

:I'm not interpreting silence as consent, but nobody has presented an alternative. The discussion has a variety of guesswork about whether this is a legitimate trademark concern (Wikimedia officials in a position to judge that have indicated that it is) and about whether the "bloat" is a significant detriment (considering that a developer said this was something any administrator could handle, it seems like they had this page in mind; if someone who actually deals with system resources came and said it's a problem, then I'd look at it differently). The decision should be based on information, not speculation and opinion. I would be happy to find there's some other option, but this is already a compromise from someone's earlier attempt to have the notice directly in the article itself. --Michael Snow (talk) 17:56, 25 May 2008 (UTC)

::Who said it was a trademark infringement, and if it is, why aren't we just blocking access to the site entirely until they stop the infringement? —Remember the dot (talk) 16:27, 26 May 2008 (UTC)

:::Mike Godwin said it was a trademark issue. As for what steps to take in response, as you pointed out yourself, the text is freely licensed, so there's a balance to be struck in dealing with this. If you think we should block Modernista's access entirely, feel free to persuade the people who would need to implement that. --Michael Snow (talk) 04:57, 28 May 2008 (UTC)

::::We could use the exact same kind of JavaScript to blank every Wikipedia page viewed through Modernista, leaving behind only a message about trademark infringement. But before we do that, could you point me to what Mike Godwin said about the issue? —Remember the dot (talk) 01:14, 29 May 2008 (UTC)

:::::No, I can't point you there, it comes from an email discussion. --Michael Snow (talk) 22:14, 29 May 2008 (UTC)

::::::Should I just e-mail Mike Godwin and ask him to repeat his response for me? I'd like to hear all the gory details of why this is a trademark infringement. —Remember the dot (talk) 00:39, 30 May 2008 (UTC)

:::::::He didn't give a lot of gory details, he simply encouraged Jimmy Wales in contacting Modernista to object to this particular use because it raised trademark issues. As they've failed to respond appropriately, that leaves us to find alternative ways of protecting Wikipedia's brand. You're welcome to email Mike and see if he would like to give a more elaborate explanation. --Michael Snow (talk) 16:10, 30 May 2008 (UTC)

:::::If we're going in that direction, it would probably be better to just bust out of the Modernista iframe rather than to blank the page. But I'm not really convinced either is a good idea; if they want to use Wikipedia as a backdrop for their site, why not let them? It's not like they're making it hard to get rid of the banner, anyway. —Ilmari Karonen (talk) 22:45, 29 May 2008 (UTC)

::::::So, you'd also like to simply eliminate the Modernista code? —Remember the dot (talk) 00:39, 30 May 2008 (UTC)

:::::::I don't really mind having it there if others feel it's needed, but no, I don't personally see much point in it. You may put my opinion down as a resounding "Meh." —Ilmari Karonen (talk) 02:43, 30 May 2008 (UTC)

PngFix() breaking "no pictures" option

Looks like PngFix makes all PNG images to appear despite unchecked "Show pictures" option in IE6. In other words, it breaks the functionality for users who disabled pictures (usually to to save traffic). One possible way to fix this is to check .complete image attribute. —AlexSm 18:42, 6 May 2008 (UTC)

:Got code? --MZMcBride (talk) 19:52, 6 May 2008 (UTC)

::I don't have time, so I was hoping the code author could thoroughly test this or maybe have some better ideas. —AlexSm 20:54, 6 May 2008 (UTC)

:Although I cannot image that anyone in 2008 would not want to see any images, I will have a look. But how does ".complete" into play? I cannot find any references to in online. However, if it only applies to IMG elements, it won't get us anywhere; PNG are converted to DIVs which may not have that attribute. EdokterTalk 23:50, 6 May 2008 (UTC)

:::I found this property using JS shell, but here's an official link for you: http://msdn.microsoft.com/en-us/library/ms533688(VS.85).aspx ; as for convertion (into SPAN), that's the whole point: if an image is not "complete" by the time the script is executed, this might mean that all images are disabled, so you do not convert the image. Again, there might be a better way... —AlexSm 13:03, 7 May 2008 (UTC)

:::I already received a message on my talk page to "upgrade to IE7". Well, I don't use IE at all (except for compatibility testing) so I guess I'll explain how the issue started. We copied the PngFix code to ru.wp, and a couple of days ago one user complained that he cannot turn PNG images off on IE6. He is using GPRS, which is kind of slow, and he is probably paying for each megabyte of traffic. In any case, if this can be fixed easily, it should be fixed. And if you want all users to upgrade to IE7, then there is no need for IE6 fix (which all users have to download, by the way). —AlexSm 15:53, 7 May 2008 (UTC)

::::The IE6 fix is there to limit the problems IE6 causes. Unfortunately, we can't entirely eliminate them from our end. It'd be best if users just stopped using IE6. Users using GPRS and paying by the megabyte could actually save money by using a different browser because many web sites (including Wikipedia) have to send extra CSS files to Internet Explorer to make it work right. —Remember the dot (talk) 16:14, 7 May 2008 (UTC)

:::::Partly I was hinting at the (failed for some reason) proposal to move the code into separate MediaWiki:IEFixes.js (as in ru:MediaWiki:IEFixes.js). —AlexSm 16:18, 7 May 2008 (UTC)

::::::After I proposed that the comments made me realize that the HTTP header required to send an extra file would be significant compared to the small amount of IE-specific code we send out, so it's probably not worth it. —Remember the dot (talk) 16:22, 7 May 2008 (UTC)

My first thought was: why fix a problem here that only happens on ru.wiki? But then again, you have a point. Anyway, I tested the .complete check and it works without any performance hit. Change the following line:

if (imgSrc.substr(imgSrc.length - 3).toLowerCase() == "png" && !img.onclick)

to

if (imgSrc.substr(imgSrc.length - 3).toLowerCase() == "png" && img.complete && !img.onclick)

Now, should we implement it here as well? EdokterTalk 23:04, 7 May 2008 (UTC)

:If there are no further objection, the .complete check is going in. EdokterTalk 17:05, 16 May 2008 (UTC)

::Fine by me (though I can't test it, not having IE available here). I thought for a moment it might break on slow connections where the images might not have finished loading by the time the code runs, but since it's deferred using window.attachEvent("onload") (rather than the usual addOnloadHook(), which somewhat confusingly runs earlier), that shouldn't be a problem: any images that are going to be loaded should be complete by the time the onload event fires. —Ilmari Karonen (talk) 17:13, 16 May 2008 (UTC)

Donation banner code changes

Using code written by Splarka, I've updated the donation banner code to detect the skin name and only work on Monobook. It's clear that the banners were laid out specific to Monobook, as they look God-awful in the other skins. Also, the new code moves the onload (making it more efficient). Let me know if there are any issues. Cheers. --MZMcBride (talk) 01:16, 7 May 2008 (UTC)

:Hmm... what's wrong with using MediaWiki:Monobook.js for that code? —AlexSm 01:56, 7 May 2008 (UTC)

::[skinname].js pages are deprecated. They still work in MediaWiki for backwards compatibility purposes. --MZMcBride (talk) 03:05, 7 May 2008 (UTC)

:::They're not deprecated at all! They're 100% appropriate for code that's actually skin-specific. --brion (talk) 19:28, 3 June 2008 (UTC)

::::bugzilla:4178#c17 is where it indicates that it was deprecated. Perhaps something changed or he was simply mistaken? --MZMcBride (talk) 20:19, 3 June 2008 (UTC)

:::::Mistaken. I've removed the deprecation notices. :) While indeed it's possible to do skin-specific JS by adding checks for skin names, IMHO that's kind of lame as it forces everyone to load all skin-specific JS. --brion (talk) 20:38, 3 June 2008 (UTC)

OTRS has been receiving messages lately from unregistered readers that Wikipedia content sometimes gets replaced with a donation request. No browser information yet, and the "sometimes" makes it hard to reproduce too, but there were complaints about this last year as well. Is it the restored anontip[http://en.wikipedia.org/w/index.php?title=MediaWiki:Common.js&diff=210352235&oldid=209765911] or the change[http://en.wikipedia.org/w/index.php?title=MediaWiki:Common.js&diff=210705470&oldid=210352235] that's problematic? Is the use of writeln necessary? --Para (talk) 09:59, 29 May 2008 (UTC)

:Ah. probably Safari users. I think writeln (just like document.write) can be dangerous on Safari. Better to use DOM editing. --TheDJ (talkcontribs) 17:35, 29 May 2008 (UTC)

::TheDJ: Can you take a look at the code in the section directly below and see what needs to be changed, as I plan to make that code live sometime in the next week or two? Thanks! --MZMcBride (talk) 18:11, 29 May 2008 (UTC)

:::Of course. I'm about to run out, but i'll do that in an hour or 6. --TheDJ (talkcontribs) 18:40, 29 May 2008 (UTC)

:I've [http://en.wikipedia.org/w/index.php?title=MediaWiki:Common.js&diff=216893662&oldid=215371900 removed the document.writeln]. [http://msdn.microsoft.com/en-us/library/ms536783(VS.85).aspx MSDN docs] warn that at least on IE, use of write/writeln after the document is loaded can break, and requires blanking the entire page. This is consistent with the descriptions we've gotten (and finally a screenshot!) from people reporting that Wikipedia was "requiring donations to read" -- pages coming up, then blanking and showing only a donation request link.

:This onload handler _should_ be getting run just before the completion of the tag, but presumably there are mysterious circumstances where it's getting triggered late, or something. I haven't been able to repro it myself though. --brion (talk) 18:28, 3 June 2008 (UTC)

::We were already preparing something like this. But thx brion. --TheDJ (talkcontribs) 18:43, 3 June 2008 (UTC)

:::In light of today, would someone please change the document.write(0 in MediaWiki:Common.js/watchlist.js to importScriptURI() ? --TheDJ (talkcontribs) 00:20, 4 June 2008 (UTC)

Ok, made [http://en.wikipedia.org/w/index.php?title=MediaWiki:Common.js&diff=217143882&oldid=216919747 one more tweak] which works around the Internet Explorer failures. To summarize:

  • MSIE throws an "operation aborted" error dialog, then throws away the page when you click "OK" iff:
  • # the offending JS code is run from a