Currently, the "d" shortcut has two uses: (un)deleting pages and "show changes" on edit pages. I find this pretty confusing, so I turned off the first use in my personal Javascript. Perhaps this should be done site-wide, or one of them should be moved (e.g., "-" for delete)? -- [[User:Jitse Niesen|Jitse Niesen]] ([[User talk:Jitse Niesen|talk]]) 11:40, 20 August 2005 (UTC)
:I would love to have d moved to something else, like "-". I frequently use alt-d to access my address bar. — [[User:Xaosflux|<b><fontbig colorstyle="color:#FF9933"; face="font-family:monotype"><big>xaosflux</big></font></b>]] <sup>[[User_talk:Xaosflux|<fontspan colorstyle="color:#00FF00">Talk</fontspan>]]</sup> 23:12, 30 June 2006 (UTC)
== How about putting the FA stars after the language names? ==
;Caveats
:Variables are set before the included script is run. Developers of tools should take care to check whether variables have been set by the user and set defaults only where necessary; use something like <tt>{{mono|1=optionvar==undef && optionvar=defaultvalue;</tt>}}
;Issues
*The name should maybe be changed to something like <tt>{{mono|install_tool()</tt>}}.
*Using globals for this doesn't sound like a good idea. Maybe options for all tools should be stored in an array, something like <tt>{{mono|tools_options[]</tt>}}.
;Source
::Stylesheet? I'm confused... can you execute Javascript from a stylesheet? —[[User:This user has left wikipedia|This user has left wikipedia]] 19:09 [[2006-01-30]]
:The above works great for me on IE6. Why can't this be included in the main sheet? I've heard quite a few complaints about SVG backgrounds in IE, and having this by default would help a lot. Would it break non-MS browsers? <TT>{{mono|[[User:Crotalus horridus|Crotalus horridus]] <SMALL>([[User talk:Crotalus horridus|TALK]] • [[Special:Contributions/Crotalus horridus|CONTRIBS]])</SMALL></TT>}} 06:16, 31 January 2006 (UTC)
::It shouldn't mess up non-IE browsers as the code above detects IE before doing anything (so non-MS browsers with an unmodified user-agent should ignore it). This is assuming the window.attachEvent code is universal of course. —[[User:Locke Cole|Locke Cole]] • [[User talk:Locke Cole|t]] • [[Special:Contributions/Locke Cole|c]] 06:36, 31 January 2006 (UTC)
I guess I wasn't paying attention when I wrote "style sheet". I don't think everyone should be served up an extra 1.4 kB of code because Microsoft won't support PNG transparency. This belongs in the MSIE-specific javascript at /skins-1.5/common/IEFixes.js, but I have no idea where to edit that (maybe it's part of the MediaWiki software?). Also, many people do set their browser strings to MSIE so that they can use ignorant banking sites, etc. which don't want to support other browsers—will this script try to execute for these users? ''—[[User:Mzajac |Michael]] [[User talk:Mzajac |Z.]] <small>2006-01-31 16:04 Z</small>''
:Sadly, 70% or so of Internet users are running IE. I think that having 1.4 kB of code served to users of standards-compliant browsers is a lesser evil than 70% of our users seeing PNGs (and SVGs, too, due to the way these are converted) rendered with an ugly blue background instead of transparency. Maybe I can cut down on the code by removing comments, shortening variable names, etc. <TT>{{mono|[[User:Crotalus horridus|Crotalus horridus]] <SMALL>([[User talk:Crotalus horridus|TALK]] • [[Special:Contributions/Crotalus horridus|CONTRIBS]])</SMALL></TT>}} 17:28, 31 January 2006 (UTC)
:I've only checked in firefox, but I'd expect the test for document.body.filters to exclude browsers which are just pretending to be IE. [[User:Lupin|'''Lupin''']]|[[User_talk:Lupin|talk]]|[[Wikipedia:Tools/Navigation popups|popups]] 16:52, 31 January 2006 (UTC)
:::Yes, I've been very confused by the strange appearances in the edittools box. I figured it must be this because it wasn't edittools, and I got month-lag looking at the history here. Apologies. -[[User:Splash|Splash]]<small><sup>[[User talk:Splash|talk]]</sup></small> 13:59, 17 February 2006 (UTC)
==Broken templates - why?==
[http://en.wikipedia.org/w/index.php?title=MediaWiki:Monobook.js&diff=43742428&oldid=42136540 This change] broke a '''whole freakin’ ''lot''''' of templates.( See [[Wikipedia:Village pump (technical)]] [[Wikipedia:Village pump (technical)#NavHead css? - Template:Half-Life series|here]] and [[Wikipedia:Village pump (technical)/Archive 132#Templates - What the heck!?|here]] for details.)<br>
Why was this change made? Can that value ''please'' be changed back from 0 to 1? In fact, rather a lot of users would be happy to see it changed to 2 or even 3. -- [[User:WikidSmaht|WikidSmaht]] ([[User_talk:WikidSmaht|talk]]) 04:59, 16 March 2006 (UTC)
==Suggest removing tooltips==
The tooltips serve little purpose and take up a couple KB of the file. I suggest removing them. — <small><sub>[[User_talk:Brian0918|<fontspan colorstyle="color:#444444">0918</fontspan>]]</sub><sup><span style="position: relative; left:-24px; margin-right:-24px;">[[User:Brian0918|<b><fontspan colorstyle="color:#222222">BRIAN</fontspan></b>]]</span></sup> • 2006-03-30 13:03</small>
:What a usability improvement! especially because all icons are really self-explaining...like this [[:Image:Button_redirect.png|#R]] --[[User:Elian|Elian]] <sup>[[:de:Benutzer Diskussion:Elian|Talk]]</sup> 09:37, 25 April 2006 (UTC)
== Main page ==
I know this is minor, but I think the main page tab should say "main page" and not "article", I've changed my JS so it says that, but want to ask around first before fooling with this one. I just don't think that the main page is really an "article". It links to many articles, and previews a few, but "main page" is not an article in itself.'''[[User:Voice of All|<fontspan colorstyle="color:blue">Voice</fontspan><fontspan colorstyle="color:darkblue">-of-</fontspan><fontspan colorstyle="color:black">All</fontspan>]]'''<sup>[[user_talk:Voice_of_All|<fontspan colorstyle="color:blue">T</fontspan>]]|[[Special:Emailuser/Voice of All|@]]|[[Wikipedia:Esperanza|<fontspan colorstyle="color:darkgreen">ESP]]</fontspan>]]</sup> 03:39, 13 April 2006 (UTC)
:It is in the article namespace.[[User:Geni|Geni]] 17:26, 13 April 2006 (UTC)
::Technically, it is in "article" namespace, since there is no "main page" namespace. Still, the URL just sais Wiki/ so nothing seems contradictory there. Also articles are named based on their title, there is no article called "main page"...it does not explain "main pages"...it ''is'' one, so it should be considered "Main Page" and not "article" I suppose.'''[[User:Voice of All|<fontspan colorstyle="color:blue">Voice</fontspan><fontspan colorstyle="color:darkblue">-of-</fontspan><fontspan colorstyle="color:black">All</fontspan>]]'''<sup>[[user_talk:Voice_of_All|<fontspan colorstyle="color:blue">T</fontspan>]]|[[Special:Emailuser/Voice of All|@]]|[[Wikipedia:Esperanza|<fontspan colorstyle="color:darkgreen">ESP]]</fontspan>]]</sup> 23:19, 13 April 2006 (UTC)
:I'm fine either way. I don't mind the way it is now, but I would also be fine with changing it.--[[User:Alhutch|Alhutch]] 17:27, 13 April 2006 (UTC)
:It's not a big deal, and just like Alhutch, I don't mind either way. Thanks! [[User:Flcelloguy|Flcelloguy]] <small>([[User talk:Flcelloguy|A <fontspan colorstyle="color:brown">note?</fontspan>]])</small> 19:21, 14 April 2006 (UTC)
== Redirect edit button ==
== Move/rename ==
I think the name "move", while technically correct, is not the exact right choice to use. From what I get, the page history is moved to the other page, but it is basically renaming—and would be a simpler concept for new users to grasp, no? Would people be opposed to calling it "'''rename'''", or something along those lines? -[[User:My/sig|<fontspan colorstyle="color:black">Mysekurity</fontspan>]]<sup>[[m:Wikimania 2006|<fontspan style="background:black"; color=":white"> ['''m!''']</fontspan>]]</sup> 02:15, 18 April 2006 (UTC)
:Renaming is "moving" pretty much. However moving is slighty more general. Moving from place to place in one namespace is like renaming. "Userfying" or any other namespace to namespace change is more like a "move". Still, I don't care much either way.'''[[User:Voice of All|<fontspan colorstyle="color:blue">Voice</fontspan><fontspan colorstyle="color:darkblue">-of-</fontspan><fontspan colorstyle="color:black">All</fontspan>]]'''<sup>[[user_talk:Voice_of_All|<fontspan colorstyle="color:blue">T</fontspan>]]|[[Special:Emailuser/Voice of All|@]]|[[Wikipedia:Esperanza|<fontspan colorstyle="color:darkgreen">ESP]]</fontspan>]]</sup> 07:18, 28 April 2006 (UTC)
::I made a simple script that renames it to "rename" for all article namespace pages. I would support that.'''[[User:Voice of All|<fontspan colorstyle="color:blue">Voice</fontspan><fontspan colorstyle="color:darkblue">-of-</fontspan><fontspan colorstyle="color:black">All</fontspan>]]'''<sup>[[user_talk:Voice_of_All|<fontspan colorstyle="color:blue">T</fontspan>]]|[[Special:Emailuser/Voice of All|@]]|[[Wikipedia:Esperanza|<fontspan colorstyle="color:darkgreen">ESP]]</fontspan>]]</sup> 22:27, 11 May 2006 (UTC)
:::Thanks for responding. Maybe take this to the Village Pump (things usually get lost there unless you have concrete ideas). -[[User:My/sig|<fontspan colorstyle="color:black">Mysekurity</fontspan>]]<sup>[[m:Wikimania 2006|<fontspan style="background:black"; color=":white"> ['''m!''']</fontspan>]]</sup> 00:48, 12 May 2006 (UTC)
::::I think this can also be changed by editing the text at [[MediaWiki:Move]]. That's probably a cleaner solution than a script, but it does change it for everybody. -- [[User:Jitse Niesen|Jitse Niesen]] ([[User talk:Jitse Niesen|talk]]) 01:13, 12 May 2006 (UTC)
:::::I guess I just like tradition, but I prefer "move" better, and I'm not sure why. Perhaps it's the tone, or the monosyllabic appeal, but I like "move" better than "rename", though I don't mind either way. Thanks! [[User:Flcelloguy|Flcelloguy]] <small>([[User talk:Flcelloguy|A <fontspan colorstyle="color:brown">note?</fontspan>]])</small> 01:38, 12 May 2006 (UTC)
:::::The purpose of a script would be that non-article space pages would have different text for those accustomed to it (like how article space pages say Article, the Main Page says Main Page, MW pages say Message, and WP namespace pages say Project on their tabs). I know you guys are all apathetic, and I care only slightly, but I think it'd be a good step towards more usability. When one right-clicks (or alt-clicks for our Mac bretheren) on an icon within their operating system, it says "rename". It would only be right to have this apply to WP as well. -[[User:My/sig|<fontspan colorstyle="color:black">Mysekurity</fontspan>]]<sup>[[m:Wikimania 2006|<fontspan style="background:black"; color=":white"> ['''m!''']</fontspan>]]</sup> 01:49, 12 May 2006 (UTC)
:::::Certainly, IMO, rename seems more clear to newbies. I already use the script myself just to see what it is like.'''[[User:Voice of All|<fontspan colorstyle="color:blue">Voice</fontspan><fontspan colorstyle="color:darkblue">-of-</fontspan><fontspan colorstyle="color:black">All</fontspan>]]'''<sup>[[user_talk:Voice_of_All|<fontspan colorstyle="color:blue">T</fontspan>]]|[[Special:Emailuser/Voice of All|@]]|[[Wikipedia:Esperanza|<fontspan colorstyle="color:darkgreen">ESP]]</fontspan>]]</sup> 02:01, 12 May 2006 (UTC)
::::::I agree that "rename" is clearer. Mysekurity, do I understand you correctly that you want different texts depending on the namespace? If so, could you please explain? It seems rather confusing to me to use different descriptions for the same function. -- [[User:Jitse Niesen|Jitse Niesen]] ([[User talk:Jitse Niesen|talk]]) 02:10, 12 May 2006 (UTC)
:::::::The script I made would make articles have a "rename" tab, where as project, help and portal pages (where moves are more serious (like AfD) and likely to result in double redirects and confusion and should not likely be moved by newbies anyway). Renaming articles is more likely a spelling/formality thing that for things like MediaWiki (where moving is really like file moving) and Images (when moving is supported).'''[[User:Voice of All|<fontspan colorstyle="color:blue">Voice</fontspan><fontspan colorstyle="color:darkblue">-of-</fontspan><fontspan colorstyle="color:black">All</fontspan>]]'''<sup>[[user_talk:Voice_of_All|<fontspan colorstyle="color:blue">T</fontspan>]]|[[Special:Emailuser/Voice of All|@]]|[[Wikipedia:Esperanza|<fontspan colorstyle="color:darkgreen">ESP]]</fontspan>]]</sup> 02:55, 12 May 2006 (UTC)
::::::You seem to have forgotten the end of the first sentence, but I assume that your script does not change the name of the tab for project, help and portal pages. That would be confusing, in my opinion. You make a good point for MediaWiki name space, but that's a very special case: how often are those pages moved? -- [[User:Jitse Niesen|Jitse Niesen]] ([[User talk:Jitse Niesen|talk]]) 06:44, 14 May 2006 (UTC)
:::::::Rename is more clear and suggest that is is somewhat more minor that move. Project/portal pages are the true ___location of their topic, so renaming them is like moving them, and it creates a ton of double redirects, guarenteed. Articles are about a topic, but they are not the topic, there are usually 1 or a few correct possible titles. Articles are just articles, were as other namespaces either have serious technical effects to moving (MediaWiki, user JS, Images when they support it) or have a sense of ___location. WP:PP ''is'' at WP:PP, George Bush is not ''at'' Wikipedia's George Bush page. At any rate, new users shouldn't be moving projects anyway.'''[[User:Voice of All|<fontspan colorstyle="color:blue">Voice</fontspan><fontspan colorstyle="color:darkblue">-of-</fontspan><fontspan colorstyle="color:black">All</fontspan>]]'''<sup>[[user_talk:Voice_of_All|<fontspan colorstyle="color:blue">T</fontspan>]]|[[Special:Emailuser/Voice of All|@]]|[[Wikipedia:Esperanza|<fontspan colorstyle="color:darkgreen">ESP]]</fontspan>]]</sup> 06:54, 14 May 2006 (UTC)
::::::::I personally disagree. To me, "move" is more clear, as that's how I visualise it: the article being sort of pushed to a new ___location, leaving a redirect trail. IMHO, "rename" sounds like the article sort of stays in the same place, which it doesn't. Also, I guess I like "move" for historical reasons. I'm not diehard opposed to the change, but I certainly prefer "move" for my own preferences as well as being clearer.
:::::::: As a further note, I don't really understand the logic of not having the tab be the same for all pages. Isn't that even less newbie friendly than it is now? "Why do I have these two different tabs for different pages? They seem to do the same thing, but they must be different because the label is different, etc..." In addition, you'd have to have another MediaWiki page, one that said "rename page" for the articlespace, one that said "move page" for everything else. I don't really get why we'd want that. [[User:Snoutwood|Snoutwood]] [[User talk:Snoutwood|(talk)]] 07:21, 14 May 2006 (UTC)
:::::::: Oh, another note: If this goes through, don't forget to change the other skins to the new version as well. [[User:Snoutwood|Snoutwood]] [[User talk:Snoutwood|(talk)]] 07:22, 14 May 2006 (UTC)
:::My small script also changes "history" to "revisions" for articles, since that makes it more clear.'''[[User:Voice of All|<fontspan colorstyle="color:blue">Voice</fontspan><fontspan colorstyle="color:darkblue">-of-</fontspan><fontspan colorstyle="color:black">All</fontspan>]]'''<sup>[[user_talk:Voice_of_All|<fontspan colorstyle="color:blue">T</fontspan>]]|[[Special:Emailuser/Voice of All|@]]|[[Wikipedia:Esperanza|<fontspan colorstyle="color:darkgreen">ESP]]</fontspan>]]</sup> 19:10, 13 May 2006 (UTC)
*Move sounds more approriate to me. I'd support implmentation of a Rename function, but would want to limit it's use to admins as the potential for vandalism would be high with it. Page moving may not be the most newbie friendly function, but it is also a function that can cause signifigant problems when done incorrectly, maybe it shouldn't be as friendly as the ''edit'' button. — [[User:Xaosflux|<b><fontbig colorstyle="color:#FF9933"; face="font-family:monotype"><big>xaosflux</big></font></b>]] <sup>[[User_talk:Xaosflux|<fontspan colorstyle="color:#00FF00">Talk</fontspan>]]</sup> 11:27, 14 May 2006 (UTC)
**Page moves really should be like 95% semi rather than 99% of users, that would avoid much page moving nonsense. If anything is to be less freindly, it would be page moves for project pages/portals/help ect...that would cause even more trouble than the usual article move.'''[[User:Voice of All|<fontspan colorstyle="color:blue">Voice</fontspan><fontspan colorstyle="color:darkblue">-of-</fontspan><fontspan colorstyle="color:black">All</fontspan>]]'''<sup>[[user_talk:Voice_of_All|<fontspan colorstyle="color:blue">T</fontspan>]]|[[Special:Emailuser/Voice of All|@]]|[[Wikipedia:Esperanza|<fontspan colorstyle="color:darkgreen">ESP]]</fontspan>]]</sup> 19:36, 14 May 2006 (UTC)
*The rename is fine by me. [[User:BrokenSegue|''B''roken]][[User talk:BrokenSegue|''S''egue]] 18:23, 14 May 2006 (UTC)
::I prefer "move", perhaps because I am used to it, but... [[User:Prodego|<fontspan colorstyle="color:darkgreen">''Prodego''</fontspan>]] <sup>[[User talk:Prodego|<fontspan colorstyle="color:darkgreen">talk</fontspan>]]</sup> 21:30, 14 May 2006 (UTC)
:::I would keep "move" per Prodego, but I'd be in support of a rename function to be given to admins only which would be equivalent to a move w/o a redirect trail (or a move + deletion of the created redirects). I think this would be useful most espically in the case of userfication. --[[User:Charlie_Huggard|Charlie]]<sup>([http://cirl.missouri.edu/wiki/User:Charlie @CIRL] | [[User_Talk:Charlie_Huggard|talk]])</sup> 23:56, 14 May 2006 (UTC)
::::Perhaps...but I would see "move" as the one that one that created no redirects, "moving" a templatate would make inline refs to it break and become red, whereas renaming them would just make the redirect work so it still shows inline. "Renaming" an article will make redirects to its new name; moving it would break links IMO. Either way, this is even more complicated than my original idea, which is what I would like to stick to. "Rename" for naming things that talk ''about'' things and can only have certain correct names, "Move" for pages that ''are'' their topic and ''are'' the ___location of the topic, that we at Wikipedia can rename, and that moving is more even likely to cause double redirects (try moving WP:AFD).'''[[User:Voice of All|<fontspan colorstyle="color:blue">Voice</fontspan><fontspan colorstyle="color:darkblue">-of-</fontspan><fontspan colorstyle="color:black">All</fontspan>]]'''<sup>[[user_talk:Voice_of_All|<fontspan colorstyle="color:blue">Talk</fontspan>]]</sup> 03:17, 20 May 2006 (UTC)
:::::*shrugs* It seems to be simply a matter of intrepretation on how to define the terms at this point. Thinking abstractly about these actions, I think of "Rename" being an action where the article (file) has stayed in one place, just changed names, whereas "move" actually moves the article to a new ___location (therefore should create a pointer to the new ___location). Regards [[User:Charlie_Huggard|Charlie]]<sup>([http://cirl.missouri.edu/wiki/User:Charlie @CIRL] | [[User_Talk:Charlie_Huggard|talk]])</sup> 04:41, 20 May 2006 (UTC)
I support renaming it "rename". "Move" implies relocating something in physical space, which is a decent UI metaphor for the process, but "rename" is direct, not metaphorical, and in my opinion provides for a more intuitive user interface. — [[User:Philwelch|Phil Welch]] ([[User_talk:Philwelch|t]]) ([[Special:Contributions/Philwelch|c]]) 11:44, 15 May 2006 (UTC)
I'm not sure how easy of a hack this would be, but I think it would be a really cool feature if when viewing diffs instead of having a single (slightly ambiguous) "edit this page", we could have an "edit left version" and "edit right version". I would find it very helpful espically when viewing diffs for fighting vandalism. Thoughts/Comments? [[User:Charlie_Huggard|Charlie]]<sup>([http://cirl.missouri.edu/wiki/User:Charlie @CIRL] | [[User_Talk:Charlie_Huggard|talk]])</sup> 04:46, 20 May 2006 (UTC)
:And perhaps a revert to this version of the current (good for diffs where several editors vandalized)...I was thinking about this for a while...but just used popups....I'll get to work on the script (though it would be a personal thing), I will also make an edit button, (not just revert).'''[[User:Voice of All|<fontspan colorstyle="color:blue">Voice</fontspan><fontspan colorstyle="color:darkblue">-of-</fontspan><fontspan colorstyle="color:black">All</fontspan>]]'''<sup>[[user_talk:Voice_of_All|<fontspan colorstyle="color:blue">Talk</fontspan>]]</sup> 04:50, 20 May 2006 (UTC)
::Awesome! You rock --[[User:Charlie_Huggard|Charlie]]<sup>([http://cirl.missouri.edu/wiki/User:Charlie @CIRL] | [[User_Talk:Charlie_Huggard|talk]])</sup> 05:15, 20 May 2006 (UTC)
</nowiki></pre>
::::Is this similar to what you were looking for? -- [[User:Jitse Niesen|Jitse Niesen]] ([[User talk:Jitse Niesen|talk]]) 06:07, 20 May 2006 (UTC)
:::::I've finished a script that adds "edit this version" and "restore" to the older version (left side) for all admins. I would like to implement this in MediaWiki.'''[[User:Voice of All|<fontspan colorstyle="color:blue">Voice</fontspan><fontspan colorstyle="color:darkblue">-of-</fontspan><fontspan colorstyle="color:black">All</fontspan>]]'''<sup>[[user_talk:Voice_of_All|<fontspan colorstyle="color:blue">Talk</fontspan>]]</sup> 18:07, 20 May 2006 (UTC)
It would IMHO be preferable to implement this directly in MediaWiki rather than by JavaScript. I've submitted a patch for this at [[bugzilla:6125]]. —[[User:Ilmari Karonen|Ilmari Karonen]] <small>([[User talk:Ilmari Karonen|talk]])</small> 22:24, 28 May 2006 (UTC)
});
</pre>
(Other ___location: [[User:Kylu/userlog.js]]) <b><i><fontspan colorstyle="color:#FF00FF">~Kylu ([[User:Kylu|u]]|[[User talk:Kylu|t]]) </fontspan></i></b> 04:31, 27 June 2006 (UTC)
*</s>'''Strong Oppose''' - [[User:GeorgeMoney|GeorgeMoney]] <sup>([[User talk:GeorgeMoney|talk]]) ([[User:GeorgeMoney/Help Me Improve|Help Me Improve!]])</sup> 18:18, 29 June 2006 (UTC)</s>
** Why? [[:m:Voting is evil|Voting is evil]], especially when there's no comments to indicate why you don't like it. [[User:Titoxd|Tito]][[Wikipedia:Esperanza|<span style="color:#008000;">xd</span>]]<sup>([[User talk:Titoxd|?!?]])</sup> 22:33, 30 June 2006 (UTC)
*** <s>Why?. Because a) if we really wanted to do a user log thing, we should integrate it into mediawiki just like the "user contributions" link. b) this is really useful, yes (and I have a different version in my monobook), but some people might not like it; if we keep putting "useful" stuff in the global js file, then there will be so many scripts running, that it will be useless. c) I really don't get this "coded by bookofjude, requested by kylu" business; First of all, "requested by anyone" is not very important and it should be removed; also, i'm sure that not only bookofjude could have written that; for example, I could go ask any of the JS programmers here "can you make a script that adds a user log button to the toolbox" and they would be able to do it, and if I added "requested by GeorgeMoney" it would kinda seem like an easy way to get my name into the global js file; it would be like saying "1/342 of the code was written by bob", completely irrelevant. d) if people disable js in their browser, then they won't be able to use this; like I said before, we don't want the entire project running on JS. --[[User:GeorgeMoney|GeorgeMoney]] <sup>([[User talk:GeorgeMoney|talk]]) ([[User:GeorgeMoney/Help Me Improve|Help Me Improve!]])</sup> 00:42, 1 July 2006 (UTC)</s>
::#I requested it, so while it's my responsibility, I don't quite understand it all (the regexes give me trouble, I'm sad to say.)
:: It's convenient, but not strictly needed. If it doesn't fly with people in this discussion (it's not a vote), the code's still sitting here and people are free to copy-paste into their own monobook and use it.
:: <b><i><fontspan colorstyle="color:#FF00FF">~Kylu ([[User:Kylu|u]]|[[User talk:Kylu|t]]) </fontspan></i></b> 05:34, 2 July 2006 (UTC)
*'''Whatever; support'''. [[User:GeorgeMoney|GeorgeMoney]] <sup>([[User talk:GeorgeMoney|talk]]) ([[User:GeorgeMoney/Help Me Improve|Help Me Improve!]])</sup> 06:01, 2 July 2006 (UTC)
:* It's still not a vote, but thanks. c.c;; Hey, George, if you've got a similar script, maybe we could take a peek at it, hey? Drop a direct link so the lazy among us don't have to dig through your monobook. :) <b><i><fontspan colorstyle="color:#FF00FF">~Kylu ([[User:Kylu|u]]|[[User talk:Kylu|t]]) </fontspan></i></b> 23:06, 2 July 2006 (UTC)
***The script was in my monobook until I installed lupin's antivandal tool, and that added 4 more links to the toolbox, so I had to remove it, and remove some links through CSS. [[User:GeorgeMoney|GeorgeMoney]] <sup>([[User talk:GeorgeMoney|talk]])</sup> 01:45, 4 July 2006 (UTC)
*'''Oppose''' - I'm changing back to oppose, because it adds an extra link to the toolbox, and the only "benefit" is that it saves '''1''' less click. All you have to do is press the "user contributions" link, and then press the "logs" link at the top. I really don't think we have to sacrifice an entire space, to save a click. Also, nobody added any id's to it, so people can't make it disappear through CSS even if they wanted to. [[User:GeorgeMoney|GeorgeMoney]] <sup>([[User talk:GeorgeMoney|talk]])</sup> 01:45, 4 July 2006 (UTC)
:* Okay George, you don't like it. It probably won't get included, then. You're good at this CSS/JS stuff, so can you show some changes so those of us who do like it can make it better? I seem to recall you said something about you having your own version of it, but atm I can't check. (wikipedia'ing instead of working! :D ) Thanks! <b><i><fontspan colorstyle="color:#FF00FF">~Kylu ([[User:Kylu|u]]|[[User talk:Kylu|t]]) </fontspan></i></b> 16:39, 4 July 2006 (UTC)
:** My version is somewhere on [[User talk:GeorgeMoney/monobook.js|the talk page]] of my monobook. [[User:GeorgeMoney|GeorgeMoney]] <sup>([[User talk:GeorgeMoney|talk]])</sup> 21:18, 4 July 2006 (UTC)
* Something like this would be extremely useful, and I already added it to my own monobook script file. The only thing is that a user's monobook doesn't load until after all the text and images have loaded, unlike the site-wide script, so it should be added there if possible. [[User:Titoxd|Tito]][[Wikipedia:Esperanza|<span style="color:#008000;">xd</span>]]<sup>([[User talk:Titoxd|?!?]])</sup> 22:33, 30 June 2006 (UTC)
* As an early reviewwer, I think this is a great idea, and have added it to my personal script for now. — [[User:Xaosflux|<b><fontbig colorstyle="color:#FF9933"; face="font-family:monotype"><big>xaosflux</big></font></b>]] <sup>[[User_talk:Xaosflux|<fontspan colorstyle="color:#00FF00">Talk</fontspan>]]</sup> 23:07, 30 June 2006 (UTC)
* When I tried adding this, I got double the [[Wikipedia:WikiProject_User_scripts/Scripts/User_tabs|User Tabs]] at the top. [[User:Gimmetrow|Gimmetrow]] 01:15, 1 July 2006 (UTC)
:* Happened the first time I used it also, I've not quite figured that out, but on a hard refresh the problem went away and hasn't come back. Suggestions welcome. :) <b><i><fontspan colorstyle="color:#FF00FF">~Kylu ([[User:Kylu|u]]|[[User talk:Kylu|t]]) </fontspan></i></b> 05:34, 2 July 2006 (UTC)
*I don't support this because it will cause all kinds of people's user scripts to mess up or have duplicates. What I would support is making custom JS more accessable to new users, like having a good centralized place for all major scripts, and what they do, kind of like the nagivation popups project page.'''[[User talk:Voice of All|<fontspan colorstyle="color:blue">Voice</fontspan><fontspan colorstyle="color:darkblue">-of-</fontspan><fontspan colorstyle="color:black">All</fontspan>]]''' 03:18, 5 July 2006 (UTC)
:*I still like the idea of having an inc(); function available globally, myself. I know the security concerns, but think people should be responsible for their own js security. Worst case scenario, they log out and post anonymously that their js is broken? <b><i><fontspan colorstyle="color:#FF00FF">~Kylu ([[User:Kylu|u]]|[[User talk:Kylu|t]]) </fontspan></i></b> 18:00, 7 July 2006 (UTC)
== Dynamic Navigation Bars ==
[obsolete code removed by [[User:Gimmetrow|Gimmetrow]]]
:Playing with it now, I'll get back to you on it. <b><i><fontspan colorstyle="color:#FF00FF">~Kylu ([[User:Kylu|u]]|[[User talk:Kylu|t]]) </fontspan></i></b> 05:51, 2 July 2006 (UTC)
::Cool. Just so it's clear, I want to be able to have a line that looks like:
Also, it would be nice to be able to specify some NavBars as shown, others as hidden. The current code hides all if there are more than one. This seems slightly odd, because a NavBox could be designed with one toggle intending text to be shown by default, but if it is used on a page with an unrelated NavBox it will be hidden by default. One way of doing this is to create another tag, <nowiki><span class="NavShow"> </span></nowiki>, that indicates the code to toggle this NavBox, but it would have to be ignored (or treated as a "hide") when there is only one NavBox on the page. [[User:Gimmetrow|Gimmetrow]] 13:25, 4 July 2006 (UTC)
:I'm afraid I had to disable it. I'm not sure why, but for some reason it seemed to slow down my browsing considerably. Perhaps it doesn't like some of my other scripting? I didn't leaktest it yet, but will check soon. <b><i><fontspan colorstyle="color:#FF00FF">~Kylu ([[User:Kylu|u]]|[[User talk:Kylu|t]]) </fontspan></i></b> 16:20, 4 July 2006 (UTC)
::What do you mean by "it"? What can we do? I've tested the code given above mostly using a local version with different function names - if anything is slower this should be noticeable as it creates a different type of navbox. Didn't notice anything substantial on two different systems. I've made some changes that reduce the amount of string processing, which might help. If you want to try my local version, see [[User:Gimmetrow/dynabars.js]] Test samples at [[User:Gimmetrow/sand]] [[User:Gimmetrow|Gimmetrow]] 16:39, 4 July 2006 (UTC)
:Sorry I wasn't more clear: I meant "it" as in my local copy of the script I was playing with. Considering I'm loading around 1.2MB in scripting (yes, seriously) across three domains (last I checked) while wikibrowsing, I imagine it may well be more of this being the straw that broke the camel's back, rather than anything actually wrong with the scripting. I'll retest the script later, thanks! <b><i><fontspan colorstyle="color:#FF00FF">~Kylu ([[User:Kylu|u]]|[[User talk:Kylu|t]]) </fontspan></i></b> 17:08, 4 July 2006 (UTC)
:: No, it is probably the getAttribute calls, I just didn't think this would be that much worse than what the code already does. I will work on a different approach over the next few days. [[User:Gimmetrow|Gimmetrow]] 03:06, 5 July 2006 (UTC)
:::Trying a different approach. Could you give [[User:Gimmetrow/dynabars.js]] a try and let me know if it still causes a major slowdown? Also, is there an easy way to identify popup windows so the dynabar code not try to process them? [[User:Gimmetrow|Gimmetrow]] 16:45, 7 July 2006 (UTC)
::::Will do. As far as Popups goes, I know Lupin uses a custom css for popups... [[User:Lupin/navpop.css]] I think? There's also a "development" version of the css, though, and I don't recall where it is. I figure, check and see if his css tags are extant in the window, and if so, don't use the dynabars. I'm css-retarded, so will let you figure out what I'm trying to say. Oh, you might want to talk to him too. :D <b><i><fontspan colorstyle="color:#FF00FF">~Kylu ([[User:Kylu|u]]|[[User talk:Kylu|t]]) </fontspan></i></b> 18:05, 7 July 2006 (UTC)
Another thing that would be great if we can 'expand/collapse' certain things with a + and - instead of show/hide. [[User:GeorgeMoney|GeorgeMoney]] <sup>([[User talk:GeorgeMoney|talk]])</sup> 18:45, 9 July 2006 (UTC)
Then every hide/show box will use these texts. As far as I know, with the current code there is no way to have these texts vary with different navboxes. This is another feature supported by my test code as shown above. However, using a specific text for hide/show in a navbox would prevent users from choosing different language texts. Although this is an English wikipedia, such a feature may not be desirable. [[User_talk:Gimmetrow|''Gimmetrow'']] 18:44, 17 July 2006 (UTC)
:Just FYI, the new code seems to work fine. Figured I'd let you know. (Testing off-wikipedia, btw) <b><i><fontspan colorstyle="color:#FF00FF">~Kylu ([[User:Kylu|u]]|[[User talk:Kylu|t]]) </fontspan></i></b> 23:24, 5 August 2006 (UTC)
== Where can I find out more ==
Where can I learn more about my Monobook.js file, such as neat tools I can install and how to write my own? --[[User:Ideogram|Ideogram]] 06:28, 3 July 2006 (UTC)
:Check out [[WP:JS]]. <b><i><fontspan colorstyle="color:#FF00FF">~Kylu ([[User:Kylu|u]]|[[User talk:Kylu|t]]) </fontspan></i></b> 07:02, 3 July 2006 (UTC)
::Oooh, cool. I have a lot of reading to do :-). --[[User:Ideogram|Ideogram]] 07:43, 3 July 2006 (UTC)<span id="63323112674" ></span>
== {{Link GA}} ==
I'd like to add the support for a {{tl|Link GA}} template, similar to {{tl|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
<source lang=javascript>
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 );
</source>
and add into Monobook.css
<source lang=css>
li.GA {
list-style-image: url("http://upload.wikimedia.org/wikipedia/fr/8/86/Icone_BA.png");
}
</source>
<small>(You might need to find another link in en: to that very same image, thought)</small>
Thanks,
[[User:NicDumZ|NicDumZ]] <font color="red">[[User_talk:NicDumZ|~]]</font> 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 ∴ [[User:Alex Smotrov|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 ? [[User:NicDumZ|NicDumZ]] <font color="red">[[User_talk:NicDumZ|~]]</font> 18:23, 20 December 2007 (UTC)
:::Make a proposal [[WP:VPR|here]]. Cheers. --[[User:MZMcBride|MZMcBride]] ([[User talk: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. —''[[User:Ruud Koot|Ruud]]'' 09:31, 21 December 2007 (UTC)
<span id="63324535214" ></span>
== 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. —[[User:Remember the dot|Remember the dot]] <sup>([[User talk:Remember the dot|talk]])</sup> 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. <span style="font-family: verdana;"> — [[User:Edokter|<span style="color: #008;">'''''E''dokter'''</span>]] • [[User_talk:Edokter|<span style="color: #080;">Talk</span>]] • </span> 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. —[[User:Remember the dot|Remember the dot]] <sup>([[User talk:Remember the dot|talk]])</sup> 21:49, 29 December 2007 (UTC)
;Proposal
*Change <code>if (img.useMap)</code> to <code>if (img.useMap || img.className == "tex")</code>
*<s>Take out <code>outerSpan.title = img.title...</code></s> Done.
<tt>img.title</tt> is ''always'' empty anyway. Also, the <tt>img.classname</tt> lookup seems to have no speed impact at all (probably because it is cached). <span style="font-family: verdana;"> — [[User:Edokter|<span style="color: #008;">'''''E''dokter'''</span>]] • [[User_talk:Edokter|<span style="color: #080;">Talk</span>]] • </span> 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. —[[User:Remember the dot|Remember the dot]] <sup>([[User talk:Remember the dot|talk]])</sup> 02:25, 31 December 2007 (UTC)
:You have a point about <code>outerSpan.title = img.title...</code> and I wouldn't mind if you removed this statement. —[[User:Remember the dot|Remember the dot]] <sup>([[User talk:Remember the dot|talk]])</sup> 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. <span style="font-family: verdana;"> — [[User:Edokter|<span style="color: #008;">'''''E''dokter'''</span>]] • [[User_talk:Edokter|<span style="color: #080;">Talk</span>]] • </span> 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. —[[User:Remember the dot|Remember the dot]] <sup>([[User talk:Remember the dot|talk]])</sup> 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. <span style="font-family: verdana;"> — [[User:Edokter|<span style="color: #008;">'''''E''dokter'''</span>]] • [[User_talk:Edokter|<span style="color: #080;">Talk</span>]] • </span> 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:
<pre>
/* 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)
}
</pre>
:::::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. —[[User:Remember the dot|Remember the dot]] <sup>([[User talk:Remember the dot|talk]])</sup> 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. <span style="font-family: verdana;"> — [[User:Edokter|<span style="color: #008;">'''''E''dokter'''</span>]] • [[User_talk:Edokter|<span style="color: #080;">Talk</span>]] • </span> 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. —[[User:Remember the dot|Remember the dot]] <sup>([[User talk:Remember the dot|talk]])</sup> 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. <span style="font-family: verdana;"> — [[User:Edokter|<span style="color: #008;">'''''E''dokter'''</span>]] • [[User_talk:Edokter|<span style="color: #080;">Talk</span>]] • </span> 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. —[[User:Remember the dot|Remember the dot]] <sup>([[User talk:Remember the dot|talk]])</sup> 20:40, 2 January 2008 (UTC)
<span id="63324727874" ></span>
== Hide "user page" link for anonymous users ==
{{tlx|editprotected}}
I proposed this at [[Wikipedia:Village pump (proposals)#Hide "user page" link for anonymous users]] and there were no serious objections, so I'd like to have this code added to the site-wide JavaScript. If this causes a revolt then just remove it. If people like it then we can ask the developers to provide a way to do this more elegantly through CSS.
<pre style="overflow:scroll">
/** Automatically hide "user page" link for anonymous users that do not have user pages
* Created by Remember_the_dot
*/
function hideAnonUserPageLink()
{
var userPageLink = document.getElementById("ca-nstab-user")
if (!window.hideAnonUserPageLinkDisabled && userPageLink.className == "new")
{
document.getElementById("ca-nstab-user").style.visibility = "hidden"
}
}
if (wgPageName.search(/^(User_talk:(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))$/) == 0)
{
window.addOnloadHook(hideAnonUserPageLink)
}
</pre>
I can also make a gadget to disable this behavior if there is demand for it. —[[User:Remember the dot|Remember the dot]] <sup>([[User talk:Remember the dot|talk]])</sup> 01:48, 4 January 2008 (UTC)
:No please. Good suggestion, however, some of them have user pages. Also, this adds a few lines of code with no real net gain. Regards, [[User:Mercury|<b style="color:#8b7b8b;font-family:Verdana">M<font color="#000">ercury</font></b>]] 02:25, 4 January 2008 (UTC)
::It would only hide links to ''nonexistant'' user pages. —[[User:Remember the dot|Remember the dot]] <sup>([[User talk:Remember the dot|talk]])</sup> 03:00, 4 January 2008 (UTC)
:Not done. This code makes a change that is arguably deceptive; there's a standard that tabs exist, regardless of page existence, and adding this code would change that expected behavior. I also fear that it would lead to a lot of confusion among the community. In addition, there are legitimate reasons for wanting to post to an anonymous user's user page, and this code change would make it more difficult. It also adds more code to an already lengthy file, with little net gain, and very likely net losses. However, you're free of course to add it to your personal subpage. Also, it could be made into a gadget for users to choose to enable or not, however, the default should be off. Cheers. --[[User:MZMcBride|MZMcBride]] ([[User talk:MZMcBride|talk]]) 02:30, 4 January 2008 (UTC)
::What are the legitimate reasons for putting anything on an IP user page? IP user pages are never linked to, in fact if you type "User:78.86.150.44" into the search box and hit "Go", it will take you to the contributions page. —[[User:Remember the dot|Remember the dot]] <sup>([[User talk:Remember the dot|talk]])</sup> 03:00, 4 January 2008 (UTC)
:::For one, it is common to place (shared) IP information and blocked sock templates on an IP's userpage, which would be hard to do if there is no tab. <span style="font-family: verdana;"> — [[User:Edokter|<span style="color: #008;">'''''E''dokter'''</span>]] • [[User_talk:Edokter|<span style="color: #080;">Talk</span>]] • </span> 12:15, 4 January 2008 (UTC)
::::That information is almost always given on the IP's talk page where people will see it. —[[User:Remember the dot|Remember the dot]] <sup>([[User talk:Remember the dot|talk]])</sup> 18:00, 4 January 2008 (UTC)
You can estimate how often IP user pages are used with about 200 searches like [[Special:Prefixindex/User:78.]]. It seems like not very often, most are redirects to talk pages. I agree that this kind of script is a hack and instead we need either a MediaWiki fix or a policy which would say "only use user_talk: for IPs" ∴ [[User:Alex Smotrov|AlexSm]] 16:40, 4 January 2008 (UTC)
:The idea was that if people liked the change, we could get the MediaWiki software to allow us to do this through CSS, which would be a much more elegant solution. I would much prefer CSS to JavaScript. —[[User:Remember the dot|Remember the dot]] <sup>([[User talk:Remember the dot|talk]])</sup> 18:00, 4 January 2008 (UTC)
If we could do this through CSS, and the CSS only changed the link's color from red to gray instead of removing it entirely, would you support the change? —[[User:Remember the dot|Remember the dot]] <sup>([[User talk:Remember the dot|talk]])</sup> 18:57, 4 January 2008 (UTC)
I've filed [[:bugzilla:12509|bug 12509]] about doing this more elegantly with CSS. —[[User:Remember the dot|Remember the dot]] <sup>([[User talk:Remember the dot|talk]])</sup> 02:11, 5 January 2008 (UTC)
<span id="63324898574" ></span>
== 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 <code>return</code> immediately after <code>watchlistMessage.style.display = "none"</code> ∴ [[User:Alex Smotrov|AlexSm]] 01:36, 7 January 2008 (UTC)
<span id="63325068734" ></span>
== 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. --[[User:MZMcBride|MZMcBride]] ([[User talk:MZMcBride|talk]]) 06:22, 7 January 2008 (UTC)
<source lang="javascript">
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<redir.length;i++) {
if(talka.href.search(redir[i])!=-1) {
talka.href = talka.href.replace(redir[i],'').replace(/action\=edit/i,'action=view');
talk.className = '';
}
}
}
</source>
:Wouldn't it be better to submit a bug report? (rather than link-munge) [[User:Gracenotes|<span style="color:#960;">Grace</span><span style="color:#000;">notes</span>]]<sup>[[User talk:Gracenotes|<span style="color:#960;">T</span>]]</sup> <span title="MediaWiki talk:Common.js">§</span> 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. [[User:Gracenotes|<span style="color:#960;">Grace</span><span style="color:#000;">notes</span>]]<sup>[[User talk:Gracenotes|<span style="color:#960;">T</span>]]</sup> <span title="MediaWiki talk:Common.js">§</span> 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. --[[User:MZMcBride|MZMcBride]] ([[User talk: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 – [[User talk:Gurch|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; [[Marie Antoinette|let them have red tabs]]. --[[User:MZMcBride|MZMcBride]] ([[User talk: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? – [[User talk:Gurch|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. –[[User talk:Pomte|Pomte]] 00:52, 9 January 2008 (UTC)
<span id="63326030054" ></span>
== 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? [[User:Grutness|Grutness]]...''<small><font color="#008822">[[User_talk:Grutness|wha?]]</font></small>'' 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 <code><nowiki>var Rows = Table.rows;</nowiki></code> to <code><nowiki>var Rows = Table.getElementsByTagName( "tr" );</nowiki></code>. Thanks. [[User:Anomie|Anomie]][[User talk:Anomie|⚔]] 13:33, 19 January 2008 (UTC)
::Has this been tested that it does not break other browsers? <span style="font-family: verdana;"> — [[User:Edokter|<span style="color: #008;">'''''E''dokter'''</span>]] • [[User_talk:Edokter|<span style="color: #080;">Talk</span>]] • </span> 14:35, 19 January 2008 (UTC)
:::The other function implementing this feature, <code>createCollapseButtons</code>, uses <code>getElementsByTagName</code> 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. [[User:Anomie|Anomie]][[User talk:Anomie|⚔]] 14:46, 19 January 2008 (UTC)
::::<s>{{Done}}</s> <span style="font-family: verdana;"> — [[User:Edokter|<span style="color: #008;">'''''E''dokter'''</span>]] • [[User_talk:Edokter|<span style="color: #080;">Talk</span>]] • </span> 15:02, 19 January 2008 (UTC)
:::::D'oh! I see you rightly reverted it as it caused unrelated problems. [[User:Anomie|Anomie]][[User talk: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. <span style="font-family: verdana;"> — [[User:Edokter|<span style="color: #008;">'''''E''dokter'''</span>]] • [[User_talk:Edokter|<span style="color: #080;">Talk</span>]] • </span> 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. [[User:Anomie|Anomie]][[User talk:Anomie|⚔]] 03:54, 20 January 2008 (UTC)
<span id="63328753334" ></span>
== 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. -[[User:Pan Sola|Pan Sola]] ([[User talk:Pan Sola|talk]]) 09:31, 27 January 2008 (UTC)
:This is a known issue yes. Adding <code><nowiki> if (document.createStyleSheet) document.createStyleSheet( theurl );
else { our current code }</nowiki></code> should take care of it according to various websources.... --[[User:TheDJ|TheDJ]] ([[User talk:TheDJ|talk]] • [[Special:Contributions/TheDJ|contribs]]) 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 <code>document.createStyleSheet</code> seems to be the best option ∴ [[User:Alex Smotrov|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. <span style="font-family: verdana;"> — [[User:Edokter|<span style="color: #008;">'''''E''dokter'''</span>]] • [[User_talk:Edokter|<span style="color: #080;">Talk</span>]] • </span> 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. -[[User:Pan Sola|Pan Sola]] ([[User talk: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. --[[User:TheDJ|TheDJ]] ([[User talk:TheDJ|talk]] • [[Special:Contributions/TheDJ|contribs]]) 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? -[[User:Pan Sola|Pan Sola]] ([[User talk: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. <sub>→[[User:AzaToth|<span style="color:#773">Aza</span>]][[User_talk:AzaToth|<span style="color:#359">Toth</span>]]</sub> 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. --[[User:TheDJ|TheDJ]] ([[User talk:TheDJ|talk]] • [[Special:Contributions/TheDJ|contribs]]) 16:22, 21 February 2008 (UTC)
<span id="63327168614" ></span>
== 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:
# Those not using IE (who consequently do not need the IE scripts) would not have to waste time downloading them
# 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:|
<pre style="overflow:scroll">
/* 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]='<a href="http://en.wikipedia.org/wiki/Wikipedia:Researching_with_Wikipedia" title="Wikipedia:Researching with Wikipedia">Learn more about using Wikipedia for research</a>';
messageEdu[1]='<a href="http://en.wikipedia.org/wiki/Wikipedia:Ten_things_you_may_not_know_about_Wikipedia" title="Wikipedia:Ten things you may not know about Wikipedia">Ten things you may not know about Wikipedia</a>';
messageEdu[2]='<a href="http://en.wikipedia.org/wiki/Wikipedia:Ten_things_you_may_not_know_about_images_on_Wikipedia" title="Wikipedia:Ten things you may not know about images on Wikipedia">Ten things you may not know about images on Wikipedia</a>';
messageEdu[3]='<a href="http://en.wikipedia.org/wiki/Wikipedia:Citing_Wikipedia" title="Wikipedia:Citing Wikipedia">Learn more about citing Wikipedia</a>';
messageEdu[4]='Have questions? <a href="http://en.wikipedia.org/wiki/Wikipedia:Questions" title="Wikipedia:Questions">Find out how to ask questions and get answers.</a>';
messageEdu[5]='<a href="http://en.wikipedia.org/wiki/Wikipedia:Basic_navigation" title="Wikipedia:Basic navigation">Find out more about navigating Wikipedia and finding information</a>';
messageEdu[6]='<a href="http://en.wikipedia.org/wiki/Wikipedia:Contributing_to_Wikipedia" title="Wikipedia:Contributing to Wikipedia">Interested in contributing to Wikipedia?</a>';
var whichMessageEdu = Math.floor(Math.random()*(messageEdu.length));
/** document.getElementById("contentSub").innerHTML +='<div style="position:absolute; z-index:100; right:100px; top:0px;" class="metadata" id="anontip"><div style="text-align:right; font-size:87%">• <i>' + messageEdu[whichMessageEdu] + '</i> •</div></div>';
*/
}
}));
/**
* 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";');
</pre>
}}
{{hidden|Please create [[MediaWiki:Common IE6.js]] with:|
<pre style="overflow:scroll">
/**
* 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)
</pre>}}
{{hidden|And finally, change [[MediaWiki:Common.js]] to:|
<pre style="overflow:scroll">
/** 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 *************************************
*
* Description: Uses regular expressions and caching for better performance.
* Maintainers: [[User:Mike Dillon]], [[User:R. Koot]], [[User:SG]]
*/
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 *********************************************************
*
* Description: Allows tables to be collapsed, showing only the header. See
* [[Wikipedia:NavFrame]].
* Maintainers: [[User:R. Koot]]
*/
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) *************************************
*
* Description: See [[Wikipedia:NavFrame]].
* Maintainers: UNMAINTAINED
*/
// 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 ******************************************************
*
* Description: UNDOCUMENTED
* Maintainers: [[User:MarkS]]?, [[User:Voice of All]], [[User:R. Koot]]
*/
//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 <code>mwCustomEditButtons = [];<code> 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": "<s>",
"tagClose": "</s>",
"sampleText": "Strike-through text"};
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://upload.wikimedia.org/wikipedia/en/1/13/Button_enter.png",
"speedTip": "Line break",
"tagOpen": "<br />",
"tagClose": "",
"sampleText": ""};
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://upload.wikimedia.org/wikipedia/en/8/80/Button_upper_letter.png",
"speedTip": "Superscript",
"tagOpen": "<sup>",
"tagClose": "</sup>",
"sampleText": "Superscript text"};
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://upload.wikimedia.org/wikipedia/en/7/70/Button_lower_letter.png",
"speedTip": "Subscript",
"tagOpen": "<sub>",
"tagClose": "</sub>",
"sampleText": "Subscript text"};
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://upload.wikimedia.org/wikipedia/en/5/58/Button_small.png",
"speedTip": "Small",
"tagOpen": "<small>",
"tagClose": "</small>",
"sampleText": "Small Text"};
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://upload.wikimedia.org/wikipedia/en/3/34/Button_hide_comment.png",
"speedTip": "Insert hidden Comment",
"tagOpen": "<!-- ",
"tagClose": " -->",
"sampleText": "Comment"};
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://upload.wikimedia.org/wikipedia/en/1/12/Button_gallery.png",
"speedTip": "Insert a picture gallery",
"tagOpen": "\n<gallery>\n",
"tagClose": "\n</gallery>",
"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": "<blockquote>\n",
"tagClose": "\n</blockquote>",
"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": "<ref>",
"tagClose": "</ref>",
"sampleText": "Insert footnote text here"};
}
/*</nowiki>*/
/** 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 = /</.test(realTitleHTML); // contains ANY HTML
var containsTooMuchHTML = /</.test( realTitleHTML.replace(/<\/?(sub|sup|small|big)>/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: [[User:Ruud Koot|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('<script type="text/javascript" src="http://tools.wikimedia.de/~gmaxwell/cgi-bin/geonotice.py"><\/script>')}));
/** Sysop Javascript *******************************************************
*
* Description: Allows for sysop-specific Javascript at [[MediaWiki:Sysop.js]].
* Created by: [[User:^demon]]
*/
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 );
/** WikiMiniAtlas *******************************************************
*
* Description: WikiMiniAtlas is a popup click and drag world map.
* This script causes all of our coordinate links to display the WikiMiniAtlas popup button.
* The script itself is located on meta because it is used by many projects.
* See [[Meta:WikiMiniAtlas]] for more information.
* Created by: [[User:Dschwen]]
*/
document.write('<script type="text/javascript" src="'
+ 'http://meta.wikimedia.org/w/index.php?title=MediaWiki:Wikiminiatlas.js'
+ '&action=raw&ctype=text/javascript&smaxage=21600&maxage=86400"></script>');
</pre>
}}
—[[User:Remember the dot|Remember the dot]] <sup>([[User talk:Remember the dot|talk]])</sup> 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. <span style="font-family: verdana;"> — [[User:Edokter|<span style="color: #008;">'''''E''dokter'''</span>]] • [[User_talk:Edokter|<span style="color: #080;">Talk</span>]] • </span> 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 tags<![endif]-->, that are much more efficient. In both IE and Firefox, JavaScript files must be downloaded before page content after it displays, and chaining JS file downloads like that could produce a delay of a couple of seconds before page display with fast connections. Submitting bug reports for [http://en.wikipedia.org/w/skins-1.5/common/IEFixes.js files like this] is a good idea. [[User:Gracenotes|<span style="color:#960;">Grace</span><span style="color:#000;">notes</span>]]<sup>[[User talk:Gracenotes|<span style="color:#960;">T</span>]]</sup> <span title="MediaWiki talk:Common.js">§</span> 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. —[[User:Remember the dot|Remember the dot]] <sup>([[User talk:Remember the dot|talk]])</sup> 23:20, 2 February 2008 (UTC)
::[[bugzilla:12766]]. --[[User:Splarka|Splarka]] ([[User_talk:Splarka|rant]]) 08:10, 3 February 2008 (UTC)
<span id="63327890354" ></span>
== 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 <code>addOnloadHook()</code> 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 ∴ [[User:Alex Smotrov|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. <span style="font-family: verdana;"> — [[User:Edokter|<span style="color: #008;">'''''E''dokter'''</span>]] • [[User_talk:Edokter|<span style="color: #080;">Talk</span>]] • </span> 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 ∴ [[User:Alex Smotrov|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]. —[[User:Remember the dot|Remember the dot]] <sup>([[User talk:Remember the dot|talk]])</sup> 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 ∴ [[User:Alex Smotrov|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. —[[User:Remember the dot|Remember the dot]] <sup>([[User talk:Remember the dot|talk]])</sup> 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. —[[User:Dinoguy1000|<span style="color: blue;">Dino</span>]][[User_talk:Dinoguy1000|<span style="color: green;">guy</span>]][[Special:Contributions/Dinoguy1000|<span style="color: orange;">1000</span>]] 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". —[[User:Ilmari Karonen|Ilmari Karonen]] <small>([[User talk:Ilmari Karonen|talk]])</small> 21:23, 8 February 2008 (UTC)
::::Not always: I answered in details on [[User talk:Ilmari Karonen/watchfilter.js]]. / [[User:Alex Smotrov|AlexSm]] 16:39, 11 February 2008 (UTC)
<span id="63335147654" ></span>
== 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 [[User:Timneu22|Timneu22]] ([[User talk:Timneu22|talk]]) 13:31, 11 February 2008 (UTC)
:Did you also copy the relevant collapsible class from [[common.css]]? <span style="font-family: verdana;"> — [[User:Edokter|<span style="color: #008;">'''''E''dokter'''</span>]] • [[User_talk:Edokter|<span style="color: #080;">Talk</span>]] • </span> 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 <code>hasClass()</code> function / [[User:Alex Smotrov|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 [[User:Timneu22|Timneu22]] ([[User talk: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! [[User:Timneu22|Timneu22]] ([[User talk: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):
<pre>
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 );
</pre>
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. —[[User:Dinoguy1000|<span style="color: blue;">Dino</span>]][[User_talk:Dinoguy1000|<span style="color: green;">guy</span>]][[Special:Contributions/Dinoguy1000|<span style="color: orange;">1000</span>]] 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! :) [[User:Timneu22|Timneu22]] ([[User talk: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 - [[Special:Contributions/61.8.101.1|61.8.101.1]] ([[User talk:61.8.101.1|talk]]) <small>—Preceding [[Wikipedia:Signatures|comment]] was added at 07:09, 20 February 2008 (UTC)</small><!--Template:Undated--> <!--Autosigned by SineBot-->
: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'''. —[[User:Dinoguy1000|<span style="color: blue;">Dino</span>]][[User_talk:Dinoguy1000|<span style="color: green;">guy</span>]][[Special:Contributions/Dinoguy1000|<span style="color: orange;">1000</span>]] 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). [[User:Timneu22|Timneu22]] ([[User talk:Timneu22|talk]]) 21:45, 24 February 2008 (UTC)
Can I get it to work with MediaWiki: 1.6.10 ??
Andrew <small>—Preceding [[Wikipedia:Signatures|unsigned]] comment added by [[Special:Contributions/124.186.76.93|124.186.76.93]] ([[User talk:124.186.76.93|talk]]) 16:34, 5 May 2008 (UTC)</small><!-- Template:UnsignedIP --> <!--Autosigned by SineBot-->
<span id="63332822654" ></span>
== line-spacing with sub & sup ==
As discussed on [[MediaWiki talk:Common.css#line-spacing with sub & sup|MediaWiki talk:Common.css]]. It is proposed (final idea by [[User:Alex Smotrov|AlexSm]]) to add the following:
<source lang="javascript">
/* 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;}');
}
</source>
We all wish there was a better way, but alternatives do not seem to exist. --[[User:TheDJ|TheDJ]] ([[User talk:TheDJ|talk]] • [[Special:Contributions/TheDJ|contribs]]) 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. —[[User talk:Random832|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. -- [[User:Quiddity|Quiddity]] ([[User talk:Quiddity|talk]]) 18:44, 8 April 2008 (UTC)
<span id="63329032754" ></span>
== 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! [[User:Timneu22|Timneu22]] ([[User talk:Timneu22|talk]]) 21:48, 24 February 2008 (UTC)
:Look for "Geo-targeted watchlist notice" and disable the function underneath it. <span style="font-family: verdana;"> — [[User:Edokter|<span style="color: #008;">'''''E''dokter'''</span>]] • [[User_talk:Edokter|<span style="color: #080;">Talk</span>]] • </span> 21:53, 24 February 2008 (UTC)
:: Indeed... thanks [[User:Timneu22|Timneu22]] ([[User talk:Timneu22|talk]]) 21:59, 24 February 2008 (UTC)
<span id="63331873694" ></span>
== "Show/Hide" link div width on collapsible tables ==
Something that recently struck me is how excessive the width on the div element for the show/hide link in collapsible tables is. From what I've seen, 6 em is actually far more than is needed in most cases, and I would like to see it cut. However, at this point there are a lot of templates that use it under the assumption that it will be 6em wide, so an outright change would be unacceptable. Therefore, I was wondering if it would be possible to make the exact width configurable, with the default remaining 6em. However, I'm not sure how it might be implemented (except maybe by adding another name to the "class" attribute), and I'd like to hear others' opinions on it as well. —[[User:Dinoguy1000|<span style="color: blue;">Dino</span>]][[User_talk:Dinoguy1000|<span style="color: green;">guy</span>]][[Special:Contributions/Dinoguy1000|<span style="color: orange;">1000</span>]] 18:13, 26 March 2008 (UTC)
:Yes, it could easily be reduced to 4em, but it would have to be done in conjunction with changing it in {{tl|navbox}} (and possibly other templates). <span style="font-family: verdana;"> — [[User:Edokter|<span style="color: #008;">'''''E''dokter'''</span>]] • [[User_talk:Edokter|<span style="color: #080;">Talk</span>]] • </span> 19:41, 26 March 2008 (UTC)
::That's great to know, but not exactly what I was asking. I was wanting to know if code could be added which would allow the exact width to be specified by someone using the collapsible class, while leaving a default width of 6em. For instance, if I were to want to cut its width to 3.5em, or increase it to 16em in one particular usage for whatever reason (not that I know what that reason would be, I'm just throwing a couple of examples out there). —[[User:Dinoguy1000|<span style="color: blue;">Dino</span>]][[User_talk:Dinoguy1000|<span style="color: green;">guy</span>]][[Special:Contributions/Dinoguy1000|<span style="color: orange;">1000</span>]] 18:01, 27 March 2008 (UTC)
:::Ah, I see! I'm afraid that's not possible, as the show/hide link is added dynamically by this very script, so there is no way to account for it in the templates. <span style="font-family: verdana;"> — [[User:Edokter|<span style="color: #008;">'''''E''dokter'''</span>]] • [[User_talk:Edokter|<span style="color: #080;">Talk</span>]] • </span> 18:05, 27 March 2008 (UTC)
::::I figured as much, though I did think about the possibility of allowing it via the '''class''' attribute. But that goes off into a whole other realm of sticky issues. —[[User:Dinoguy1000|<span style="color: blue;">Dino</span>]][[User_talk:Dinoguy1000|<span style="color: green;">guy</span>]][[Special:Contributions/Dinoguy1000|<span style="color: orange;">1000</span>]] 19:08, 27 March 2008 (UTC)
<span id="63331846694" ></span>
== 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.--[[User:Pharos|Pharos]] ([[User talk:Pharos|talk]]) 05:07, 27 March 2008 (UTC)
:OK, I've restored it.--[[User:Pharos|Pharos]] ([[User talk: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 ) --[[User:TheDJ|TheDJ]] ([[User talk:TheDJ|talk]] • [[Special:Contributions/TheDJ|contribs]]) 11:38, 27 March 2008 (UTC)<span id="63335337396" ></span>
== pageview counter ==
Does anyone know what the "pageview counter" code does? I left a [[:de:Benutzer Diskussion:Leon#pageview counter|message on its author's talk page]], but he hasn't gotten back to me. —[[User:Remember the dot|Remember the dot]] <sup>([[User talk:Remember the dot|talk]])</sup> 19:40, 7 May 2008 (UTC)
I've tracked down its insertion to [http://en.wikipedia.org/w/index.php?title=MediaWiki%3ACommon.js&diff=71983634&oldid=71478135 August 26, 2006], but I still don't know what it's supposed to do. —[[User:Remember the dot|Remember the dot]] <sup>([[User talk:Remember the dot|talk]])</sup> 20:29, 7 May 2008 (UTC)
:It causes one in 6000 article views to be logged on the toolserver for the purpose of having approximate page view stats. I think this may be obsolete now that we have http://stats.grok.se/ [[User:Dragons flight|Dragons flight]] ([[User talk:Dragons flight|talk]]) 20:35, 7 May 2008 (UTC)
::OK, I've removed it per [http://en.wikipedia.org/w/index.php?title=User_talk:Remember_the_dot&oldid=210880645#pgcounter]. I think that [http://dammit.lt/wikistats/ this site] contains raw statistics collected by the Squid servers if we want to do page view statistics in the future. —[[User:Remember the dot|Remember the dot]] <sup>([[User talk:Remember the dot|talk]])</sup> 20:38, 7 May 2008 (UTC)
::Ah, http://stats.grok.se/ gets their statistics from http://dammit.lt/wikistats/. Interesting. —[[User:Remember the dot|Remember the dot]] <sup>([[User talk:Remember the dot|talk]])</sup> 20:39, 7 May 2008 (UTC)
:::The sad part, some projects already copied this part to their Common.js and probably banging toolserver with useless requests. —[[User:Alex Smotrov|AlexSm]] 20:42, 7 May 2008 (UTC)
(unindent) Just a bit of clarification. dammit.lt is the personal website of one of the Wikimedia sysadmins, [[User:Midom]] (who is also now a Board member). It counts page counts based on squid hits (or something). [[User:Henrik]] runs stats.grok.se, which pulls its data from Domas' (Midom). stats.grok.se now has an API to pull data, if anyone is interested. --[[User:MZMcBride|MZMcBride]] ([[User talk:MZMcBride|talk]]) 21:16, 7 May 2008 (UTC)
|