Jump to content

MediaWiki talk:Common.js/Archive 16

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
Archive 10Archive 14Archive 15Archive 16Archive 17Archive 18Archive 20

Namespace tab

Can the hack that caused the "article" tab to display "main page" on the main page be put back in? Maximillion Pegasus (talk) 00:21, 6 January 2009 (UTC)

No. The hack is unacceptable. If this problem is to be resolved, either move the main page to a namespace with a more appropriate tab or edit MediaWiki:Nstab-main to be less specific. See #Main Page tab above. —Remember the dot (talk) 04:52, 6 January 2009 (UTC)

Shuffle for election candidates

The election was months ago, can the "dshuf" code be removed? —Remember the dot (talk) 17:51, 10 January 2009 (UTC)

Oh dear. How did we forget to remove that? Please do so. (Be sure to remember the addOnloadHook bit as well. :-) --MZMcBride (talk) 22:34, 10 January 2009 (UTC)
Done. I also removed the function name "mainPageAppendCompleteListLink" - since the function should only be called once, there is no point in adding overhead by giving it a name. —Remember the dot (talk) 23:07, 10 January 2009 (UTC)

Modernista revisited

I e-mailed Mike Godwin, the Wikimedia Foundation's general legal counsel, asking him what to do about Modernista's trademark infringement. I suggested using JavaScript to blank any page viewed through Modernista, and he replied "I'm ready to resort to any technical measure." So, I'd like to replace the Modernista referrer with the following code:

if (/modernista\.com/.test(document.referrer)) {
    document.removeChild(document.documentElement)
}

Hopefully that will prompt Modernista to rethink their site. —Remember the dot (talk) 18:11, 10 January 2009 (UTC)

No objection from me. --MZMcBride (talk) 22:26, 10 January 2009 (UTC)
Done. —Remember the dot (talk) 23:08, 10 January 2009 (UTC)
Uhm... what's the problem here, or did I miss something? What they are doing might not be very nice (although I don't really see a problem with it honestly). But does that warrant adding something to the global JavaScript? How many people visit their site anyway? —Ruud 23:52, 11 January 2009 (UTC)
We've had something in the global scripts to react to their site for months now. Previously it just added a warning message, but now we blank the page; it's just a slight escalation, we're not going from scratch. I fully support the idea, and not just because Godwin Said So, although that is a very compelling justification to take action. Happymelon 10:20, 12 January 2009 (UTC)
Yeah, but this modernista.com site just a small website, with an original design, drawing maybe 10 vistors a month. Or are they some big, bad, evil, site that is misusing our good name and confusing billions of visitors? —Ruud 16:49, 12 January 2009 (UTC)
The issue is trademark infringement, and I was never a fan of making special JavaScript for them. A legal recourse seems more appropriate to me, but perhaps that's not feasible for one reason or another. —Remember the dot (talk) 02:43, 14 January 2009 (UTC)

"Remove these lines"

Is there any objection to removing these lines from Common.js?

            Button.style.styleFloat = "right";    //
            Button.style.cssFloat = "right";      // REMOVE THESE LINES
            Button.style.fontWeight = "normal";   // ON 10 FEBRUARY 2008
            Button.style.textAlign = "right";     // 
            Button.style.width = "6em";           //

They seem to have been replaced by

.collapseButton {         /* 'show'/'hide' buttons created dynamically by the        */
    float: right;         /* CollapsibleTables javascript in [[MediaWiki:Common.js]] */
    font-weight: normal;  /* are styled here so they can be customised.              */
    text-align: right;
    width: 3em;

in MediaWiki:Common.css. —Remember the dot (talk) 19:45, 10 January 2009 (UTC)

The code was added today. I'm pretty sure the 2008 bit is a typo (should be 2009). --MZMcBride (talk) 22:31, 10 January 2009 (UTC)
Ah, I see. That makes more sense. —Remember the dot (talk) 23:10, 10 January 2009 (UTC)
Lol, whoops! I knew I was going to get something (else) wrong in that update. Thanks for the spot. Happymelon 10:53, 11 January 2009 (UTC)
Yes, perhaps. I wrote that code and I probably had a good reason for doing it with JS instead of CSS. I think it breaks IE6, but I can't quite remember anymore. —Ruud 23:38, 11 January 2009 (UTC)
Ohw, and the width of the button should really be xem, where x is the number of characters in the caption (including the brackets). —Ruud 23:47, 11 January 2009 (UTC)
That is a misconception; it should match the 6em width of the v·d·e links. EdokterTalk 00:52, 12 January 2009 (UTC)
No, I wrote that code before that v.d.e links stuff ;) So the v.d.e link width should probably match with the width here. —Ruud 01:59, 12 January 2009 (UTC)
It can't; some templates use the long form of 'view·talk·edit' which just fits in 6em. But maybe there should be some mechanism to customize the width of {{tnavbar}}. EdokterTalk 02:38, 12 January 2009 (UTC)
This is discussed above, 6em is massively too wide; what I did in the code I added to Common.css was to make it 3em by default, and add another declaration to override it back to 6em when inside the .navbox class. Isn't that the best solution for everyone? Or are there other instances where it should be 6em? Happymelon 10:17, 12 January 2009 (UTC)
I think it needs to be 6em if you're view Wikipedia using a (nearly) monospaced font. Hmm... actually I seem to be using a wrong definition of Em. My main point was, however, that I think using CSS instead of JS is going to break something. —Ruud 16:52, 12 January 2009 (UTC)
[show]
[show]
[edit]
[edit]
3em is definitely too small for me. The text falls outside the box, even the sans-serif one. —Ruud 17:15, 12 January 2009 (UTC)

[edit]

Of course, what we're actually looking for is width:auto;... :D Happymelon 18:38, 12 January 2009 (UTC)
Tested on IE6, applying styles via CSS works fine. Happymelon 23:35, 12 January 2009 (UTC)

I've restored the code to Common.js. Remember that we still have 30 days decaching time before we can even think about removing the hardcoded styles, so if we find a catastrophic problem before then, well, we should leave how it is now anyway so that people with modern browsers can still style them! If you can remember why you didn't do it with CSS, Ruud, I'd love to hear it, but my suspicion is that you just didn't think of it, which is a perfectly valid reason! Happymelon 11:08, 13 January 2009 (UTC)

I've looked through the edits of November 2006 and while there were some problems with styling and IE6 I don't seem to have tried styling it through the CSS sheet. —Ruud 17:49, 13 January 2009 (UTC)

"please use talk for ALL changes"

I find it somewhat amusing that of my three edits yesterday, the one that made no functionality changes whatsoever was the one to be reverted as "reverted code changes". Does anyone have any actual objections to this edit, which merely realigns the comments sections and moves a few braces around? Happymelon 11:11, 11 January 2009 (UTC)

Strike that, I see that MZ did actually revert all my changes, as well as the ones in Common.css. I accept that there is a balance to be struck between manintaining code integrity here and not being overly bureaucratic, but my opinion is that this is somewhat on the 'bureaucracy' side of that line, especially as MZ reverted changes both here and at Common.css that were to improve readability while making no functional changes whatsoever. Thoughts? Happymelon 12:50, 11 January 2009 (UTC)

Best practices for editing these pages?

I finally took the time to put words on a page vis how I see our Best Practices in editing system messages, particularly the skin files: WP:EI. I don't think we need anything as pretentious as a policy or guideline to control how we work on these files, but it would be nice to have something to point to to ensure we're all reading from the same song sheet. Comments and criticisms would be very welcome. Happymelon 23:06, 11 January 2009 (UTC)

Seems reasonable. Just an observation I've made watching these pages: it's quite pointless in making an undiscussed changes as it always gets reverted. 50% of the time because it's a stupid/pointless/annoying/etc. change that probably has been rejected in that past already. 40% of the time because it's essentially a good change but completely breaks some stuff in a totally unexpected ways. And 10% of time because someone else thinks that it should have been discussed first.
And on a more positive side, pretty much all the scipts added have been significantly improved (faster, better compatibilty, more readable, or just better feature-wise) during the discussion by all the JS savvy people hanging around on this talk page. Looking at it pragmatically, discussing something before making a change in article space is almost always going to be a waste of everybody's time, changing something before discussing it on the interface pages is also almost always going to be a waste of everybody's time. —Ruud 23:36, 11 January 2009 (UTC)

Deleting element without confirming that it exists

{{editprotected}} Line 439:

realTitleBanner.parentNode.removeChild(realTitleBanner)

Should be changed to:

if(realTitleBanner) realTitleBanner.parentNode.removeChild(realTitleBanner);

This is causing javascript errors because certain templates use realTitle successfully enough but do not add the realTitleBanner element. This causes a javascript error which prevents subsequent scripts from running. — CharlotteWebb 17:22, 16 February 2009 (UTC)

Done. --- RockMFR 18:03, 16 February 2009 (UTC)

Two minor changes

I'd like to make two minor changes here. First, removal of the code that is commented with "REMOVE THESE LINES ON 10 FEBRUARY 2009". Second, removal of the comment regarding DisableRealTitle, since this functionality is no longer present. Any objections? --- RockMFR 00:19, 17 February 2009 (UTC)

Just curious, what happened to the disable functionality? --MZMcBride (talk) 00:29, 17 February 2009 (UTC)
checkY Done. DisableRealTitle got dropped when I refactored the code last July. I didn't know it was there, but since nobody even noticed it until now it's probably not much of a loss. —Remember the dot (talk) 01:40, 17 February 2009 (UTC)

AJAX RC

On many, many other wikis I've seen the AJAX code for automatic RC. Why doesn't wikipedia, the most famous Wiki in the world, have it? If nobody knows what I mean, I can go fetch the JavaScript from my home-wiki. Timeroot (talk) 02:38, 18 February 2009 (UTC)

Where do I find MediaWiki:Common.js, for example in LocalSetting.php or config file. Please help. Xxxsacheinxxx (talk) 15:29, 18 February 2009 (UTC)

For all intents and purposes, it's exactly where you linked to it at. Physically, it's in the database. ダイノガイ?!」(Dinoguy1000) 20:23, 18 February 2009 (UTC)
I think he meant to ask where the file in invoked. EdokterTalk 20:56, 18 February 2009 (UTC)

I've added a JS bit to add a link for iPhone, iPod Touch, and Android users to switch to the page on our mobile-optimized gateway at http://en.m.wikipedia.org/

This is our new gateway which is replacing the old http://en.mobile.wikipedia.org/ one, and currently is *much* nicer on higher-end mobile browsers. We're hoping to drive some more test traffic there, and do a bigger announcement in the next couple months. (Currently I've set it to only add the link on 25% of page views.)

Please file bugs in Bugzilla for any problems you encounter if you go exploring there! :)

In the future we'll swap this JS linking out for something more permanent. --brion (talk) 01:04, 19 February 2009 (UTC)

I'd like to tweak the wording from "in" to "on" and add a period after the link (div.appendChild(document.createTextNode("."));). Any objections from anyone? --MZMcBride (talk) 08:11, 19 February 2009 (UTC)
Works for me... I've gone ahead and tweaked that as well as bumping up the probabilistic display so it just always shows the link; no load probs yet. --brion (talk) 19:57, 19 February 2009 (UTC)

Technical restrictions bugfixes

I just fixed two minor problems with the "technical restrictions" code:

  1. The code did not work on pages outside the main namespace or pages in the main namespace that do not contain at least one wikilink.
  2. The code allowed the title bar to display a title completely different from the actual page title. This was particularly a problem for pages like Back and Forth (film), which previously showed up as <---> - Wikipedia, the free encyclopedia. If we can't represent the title properly, let's not pretend to. This is the same sentiment that Brion voiced in bug 12998.

Remember the dot (talk) 21:13, 15 March 2009 (UTC)

Geonotice

There was talk on Wikipedia talk:Geonotice#Restoring geonotice functionality to bring back the unmaintained geonotices in a more community driven way after half a year of disuse. I've implemented it as User:Para/geonotice.js (to be moved into MediaWiki namespace?), which would be called from MediaWiki:Common.js/watchlist.js in two parts:

importScriptURI('http://toolserver.org/~para/cgi-bin/geoip');
importScriptURI('http://en.wikipedia.org/w/index.php?title=User:Para/geonotice.js&action=raw&ctype=text/javascript&maxage=3600');

The first bit inserts the geographical coordinates of the requesting IP in json format in the watchlist page HTML. Hopefully a bit later, the second script compares admin added ranges to the coordinates from the first script and adds the given notice when they fit. There's a possibility for a race condition, but it's not an issue if notices aren't shown on the very first watchlist load. On caching, the geoip tool has max-age 12 hours and the Javascript with the notices has max-age 1 hour. Could people watching this page review? To test, see User:Para/monobook.js --Para (talk) 22:31, 17 March 2009 (UTC)

This looks great, Para. Thanks for your work on this.--Pharos (talk) 18:02, 20 March 2009 (UTC)
I agree. Looking good and will likely be much better maintainable. --TheDJ (talkcontribs) 18:48, 20 March 2009 (UTC)

What happened to Google

Resolved.
This question copied from Wikipedia talk:Searching#What happened to Google.

What's happened to the feature where you could use Google or other external search engines from within Wikipedia? BillMasen (talk) 16:06, 2 April 2009 (UTC)

I checked Special:Search and Bill is right, there are no longer the drop down box where one could choose which search engine to use. So I investigated:
The drop down box is added by MediaWiki:Common.js/search.js which is loaded from MediaWiki:Common.js. None of those pages have been edited lately. But it seems the rendered page code for Special:Search has been changed in such a way that /search.js doesn't work anymore. Since my Firefox error console reports:
(!) lStat.parentNode has no properties
    http://en.wikipedia.org/w/index.php?title=
      MediaWiki:Common.js/search.js&action=raw&ctype=text/javascript
And "lStat.parentNode" is part of the code in /search.js. It seems that is a fatal error since all javascript on the page stops. Unfortunately I am no java guru, so I can't see exactly what needs to be changed in the code so it will work again. But I bet some of you guys who usually edit these pages can fix it.
--David Göthberg (talk) 02:44, 3 April 2009 (UTC)
The reason is because of var lStat = searchForm.fulltext; The current version of Special:Search contains two fields named fulltext in the same form (one hidden field, and the submit button). This causes the browser to return an array of results for this specific code, and an array does not have a parentNode of course. This looks like a bug in the search page, and i dropped a line on IRC. I'll file a real bug tomorrow. --TheDJ (talkcontribs) 03:42, 3 April 2009 (UTC)
Ah yes, I see. Meanwhile, to fix it here without waiting for the devs to fix the page rendering: There is another hidden span tag right before that with name="title", I think we can use that one. So I think we should change this line:
var lStat = searchForm.fulltext;
To this:
var lStat = searchForm.title;
That should work, right?
--David Göthberg (talk) 05:50, 3 April 2009 (UTC)
Yes it should. It sounds like an acceptable work around. --TheDJ (talkcontribs) 09:56, 3 April 2009 (UTC)
bugzilla:18324 --TheDJ (talkcontribs) 11:56, 3 April 2009 (UTC)
Fixed in r49169. So the next software updated (tuesday likely) should restore this functionality. --TheDJ (talkcontribs) 13:16, 4 April 2009 (UTC)
Thanks for checking the code and filing the bug. I have now applied the javascript change I suggested above. Since from what I can see that will still work after they have deployed r49169, and we can't know how long time it till take until they do deploy r49169.
--David Göthberg (talk) 22:54, 4 April 2009 (UTC)

IE bugfix breaking IE?

This discussion is essentially how CollapsibleTables have just broken in IE7, for reasons that are difficult to determine given that IE has a bad crap f***ing awful error console. It's probably been aggravated by this edit, but I don't see anything fundamentally wrong with that particular layout for CollapsibleTables. I can get IE to say that the error is on "line 78" and that the error is "expected identifier"; which of the fifteen loaded JavaScript files it is referring to it neglects to mention. Line 78 of this file is right in the middle of the IE scrollbar fix. Could this be involved? If not, does anyone have any bright ideas what is causing this borkage? Happymelon 21:51, 9 April 2009 (UTC)

Is there a sandbox where the affected code can be tested? I have the IE DevToolbar which may tell me more. EdokterTalk 22:22, 9 April 2009 (UTC)
I reverted the code on the main banner, but the sandbox is still running it; Template:WPBannerMeta/testcases has several examples of the sandbox code. I now think the "line 78" error is a separate issue; it occurs on every page I load on IE7 with "disable debugging" turned off, whether or not there's a collapsible table/WikiProject banner on the page. Happymelon 22:25, 9 April 2009 (UTC)
I see the problem; The Collapsible button code lookes for the first instance of a table header in the first instance of table row of the table to place the button in, as well as to hook the entire table on so it can hide it. In the sandbox code, the <TH> is chucked away as the last cell of a row, so it is no longer the first element in the first row. That is why the collapsible table no longer works. So you're going to have to make sure the the <TH> is the first element to appear in the table. EdokterTalk 22:39, 9 April 2009 (UTC)
It's a bit easier in IE 8 to find the location of the error. Press F12 to bring up the Developer window then select the Script tab and press the Start Debugging button. The error occurs at Header.insertBefore( Button, Header.childNodes[0] ); in the createCollapseButtons function. -- WOSlinker (talk) 22:41, 9 April 2009 (UTC)
That seems a seperate issue; IE6 is not giving any error. EdokterTalk 22:46, 9 April 2009 (UTC)
I think the problem is that the change to fix {{WPBannerMeta/core}} in Safari included this line: "<th style="padding-right:0.3em;"><!--SHOW/HIDE GOES HERE--></th>". IE7 seems to be failing when it tries to add the collapse button to the empty header cell. I think that the header cell needs to be non-empty or we need to change the collapsible table code to fix this for IE. I did some tests with Special:ExpandTemplates and if you put anything in the header cell then the JavaScript code works (of course whatever you add to the cell screws up the template, but at least we know where the error is coming from). --CapitalR (talk) 02:10, 10 April 2009 (UTC)
Edokter: Navbox sometimes doesn't have the header cell as the first cell in the row and it still works (see Template:US state navigation box). The JavaScript looks for the first header cell in the row, not the first element in the row, so I'm pretty sure that part of the code is okay. --CapitalR (talk) 02:13, 10 April 2009 (UTC)
So I just tested this out, and if we replace the line "<th style="padding-right:0.3em;"><!--SHOW/HIDE GOES HERE--></th>" with "<th style="padding-right:0.3em;"><div style="display:none;">blah</div></th>" then the new template seems to work fine in IE. This is a pretty dumb trick, so hopefully someone can think of something a little cleverer. --CapitalR (talk) 02:28, 10 April 2009 (UTC)
Change that line mentioned above to Header.insertBefore( Button, Header.firstChild );? Anomie 11:42, 10 April 2009 (UTC)
(←) OK, so there needs to be something in the header. Try a non-breaking space. But why not use the header what it was intended for; to contain the header text? EdokterTalk 14:12, 10 April 2009 (UTC)
We wanted the centres of the headers to line up, and also for the two components of the header (the project name and any taskforces, and the "rated X-Class") to linewrap separately (pretty example). Essentially, they need to be in separate table cells. WPBM's outer table only has two rows; it was just two cells - a header that didn't collapse, and the body cell has a nested table that contains all the content. So I put another nested table in the header cell for the header block, which sort of worked. But you can't give the table explicit 100% width (or it linewraps to underneath the floating show/hide button) and without the explicit width Safari and Chrome screw up big time. The solution is, of course, to put the header block and the show/hide button in separate cells, but since the CollapsibleTables code puts the button in the first header cell it finds, we have to make all the other cells in the row normal cells, so there is only one header cell for it to plop the button into. Does that all make sense?
So, is it possible to fix the CollapsibleTables code, or do we need to put something in the header cell? Anomie's solution looks good at first glance. Happymelon 17:44, 10 April 2009 (UTC)

Disambig vs. disambigbox

When disambiguation pages are edited the {{disambig editintro}} is shown above them. It is code in MediaWiki:Common.js that detects when the CSS id "disambig" is present on a page and then makes it so the {{disambig editintro}} is loaded if/when the page is edited.

But we want to deprecate the "disambig" id. So I would like to change the CSS id used for the triggering to "disambigbox". But during the 31 days decaching time we must trigger on both ids.

So I would like to change this code:

    if (document.getElementById('disambig'))
      addEditIntro('Template:Disambig_editintro');

To this:

    if ( document.getElementById('disambig') || document.getElementById('disambigbox') )
      addEditIntro('Template:Disambig_editintro');

Background and details:

The disambig id is also used in MediaWiki:Common.css to declare some of the old styles for the disambig boxes. However using the id for styling is now deprecated since all disambig boxes nowadays use the {{dmbox}} meta-template, which instead uses the dmbox and mbox-* classes for its styles. But to keep triggering the {{disambig editintro}} we had to use the disambig id in {{dmbox}} too.

I dislike that the id was used for both styling and triggering, and I find the id name too generic to be clear. We have other things that are disambig related such as dablinks that do not (and should not) trigger the {{disambig editintro}}. Also, when {{dmbox}} is used for set index article boxes, then it instead sets the id "setindexbox" so it doesn't trigger the {{disambig editintro}}. But the id name "disambig" does not match with the id name "setindexbox".

So I want to change the id used in {{dmbox}} to "disambigbox". That is, the triggering of the {{disambig editintro}} is based on the presence of a disambiguation box, so "disambigbox" is clearer.

We of course have to wait 31 days after we have changed the javascript here, before we can change the id used in {{dmbox}}. Then we can remove the usage of "disambig" in the javascript here.

--David Göthberg (talk) 01:26, 16 April 2009 (UTC)

Makes sense. Might as well do this right away. --- RockMFR 02:54, 16 April 2009 (UTC)
Thanks. Yeah, I guess this was an obvious non-controversial addition.
And while I am at it, I just want to share a thought: I prefer to ask about almost all changes I do to these files for four reasons: It means I can write a full explanation why I do the change, which is good for future reference, since edit comments and code comments are often not enough to explain it properly. And writing it down often makes me realise things I had not realised, thus preventing some bugs or making my code better. And surprisingly often people come up with some improvements or additions even for "simple obvious" fixes like these. And sometimes we even screw up with simple code, so it is good to have a sanity check of ones code before deploying it.
--David Göthberg (talk) 09:33, 16 April 2009 (UTC)

IE PNG fixes break browser semantics and certain UI actions

In short, the current IE alpha transparency fix for IE <7 disrupts image semantics, which means that alt and title attributes are lost, image actions (save, print, e-mail) are missing from the context menu, and copying-and-pasting a selection that contains such a fixed image is broken.

My initial report of the problem (in which I was told to post on this talk page instead): Bugzilla:18470

My (simple) proposed fix: 18470 attachment

A demo showing an alpha transparency fix in IE that does not break the context menu, copy-and-paste, etc.: http://code.kliu.org/misc/fixiepng/demo.html

Kliu0x52 (talk) 11:45, 16 April 2009 (UTC)

Oh oh, now we need to find Windows users with IE6 installed :D If it works, i think it is a good suggestion btw. --TheDJ (talkcontribs) 11:57, 16 April 2009 (UTC)
I originally closed the bug report on Bugzilla. I have already tested the patch in my monobook.js, but unfortunaltely, it makes by browser hang completely (using IE6.0.2900 on Windows 2000). So we need some more testing if this is going to work. EdokterTalk 12:17, 16 April 2009 (UTC)
Kliu0x52: The demo at http://code.kliu.org/misc/fixiepng/demo.html works fine in my very old IE 5.5. I see transparency, and I can right click and save the images correctly. I haven't tested your code version for MediaWiki:Common.js/IE60Fixes.js yet.
--David Göthberg (talk) 12:44, 16 April 2009 (UTC)
I tested the demo code on IE 6 in XP (I don't have Win2K to play with), but the demo code (which is something that I had written earlier for use on my own site) is obviously different than my proposed patch for Wikipedia. For starters, the demo hooks things up via a HTC behavior; but the general principle is still the same in both cases. Is there a way to test things here in Wikipedia, like some sort of a sandbox for JS changes? Kliu0x52 (talk) 13:08, 16 April 2009 (UTC)
Each user has their own monobook.js to play with; Special:Mypage/monobook.js. Here's my version that overrides the main script in IE6fixes.js. That is where I applied the patch, which resulted in hanging. I'll copy my version to your monobook.js, so you can experiment with the main script safely disabled. EdokterTalk 13:26, 16 April 2009 (UTC)
Thanks! I'll play around with this later today, and make any fixes/adjustments to my proposed patch as necessary. Kliu0x52 (talk) 13:30, 16 April 2009 (UTC)
There is also a testpage here. If you experience a hang like I did, you need to disable javascript in your browser (or use Firefox) to revert the change, then purge your monobook.js and try again. EdokterTalk 13:32, 16 April 2009 (UTC)

I seem to recall in the original discussion that someone mentioned there being far simpler ways to correct PNG transparency in IE via CSS or PHP. Am I just imagining things, or are there actually ways to do this, and if so, why aren't we looking at switching over to them (even if any PHP fix would require a bug report)? ダイノガイ?!」(Dinoguy1000) 18:24, 16 April 2009 (UTC)

As I recall, none of those methods proved to be usable due to most images using borders, and javascript is the only way to account for that. EdokterTalk 18:52, 16 April 2009 (UTC)
There's an IE6/pngfix method here (using javascript) that uses VML instead of AlphaImageLoader. I know AlphaImageLoader hasn't been explicitly mentioned above as a problem, but since the method seems fairly radically different, it may not have the problems mentioned above (breaking of semantics and performance) though I've not examined it at length of yet. ɹəəpıɔnı 17:20, 18 April 2009 (UTC)
Sounds interesting, but it's a big script (7KB). Still, might be worth investigating it's performance. EdokterTalk 23:00, 18 April 2009 (UTC)

topicon part deux

OK, several things have become apparent.

  1. IE6 does not like our bodyContent relative (See VP/T)..... So we need to disable the loading of the script on IE6 and just have it broken for those users (we can do little more i guess).
  2. action=purge does not load the script and it seems to confuse people a bit.
  3. {{userpageinfo}} is not really supported, because it targets the coordinates position... We might consider adding a "general" class for this position as well

Next we need to plan forward. All this JS just sucks. I see some folks above already have some very nice discussions about dynamically ordering all the icons and stuff. I'm not sure, but I remember some editors being a bit against that in the past. However, dynamically moving the items to the place where they need to be in the DOM, does solve some important issues (inconsistent font-size of the coordinates for instance). It's a tradeoff situation, but this problem with sitenotices is annoying as well, because it keeps returning, and during sitenotices even with the new CSS, people with 45px topicons are simply frelled. --TheDJ (talkcontribs) 22:48, 7 November 2008 (UTC)

If it can be fixed without disabling it, the better. Right now, scrolling in IE6 a grinding due to the script firing up on each action. IE6's fault or not, that needs to be fixed or disabled. Still 30%+ of readers use IE6. EdokterTalk 22:54, 7 November 2008 (UTC)
the reason it grinds to a halt is because IE6 is apparently very stupid when it comes to calculating the position of relative elements. It has nothing to do with a script, the script just loads the CSS. --TheDJ (talkcontribs) 23:00, 7 November 2008 (UTC)
A simple check for IE6 -> navigator.userAgent.indexOf("MSIE 6")>=0 --TheDJ (talkcontribs) 23:19, 7 November 2008 (UTC)
It usually has no problem with relative positions, but it might trip over absolute positioned elements relative to the screen (ie. fixed objects like static backgrounds). EdokterTalk 23:37, 7 November 2008 (UTC)

I see some issues with the current code for this fix:

  • wgAction == 'edit' is not covered; and why check wgAction at all?
  • \n seems to be completely useless inside CSS
  • since Monobook.js is loaded after Sitenotice (at least the central one), I wonder if the code could apply CSS immediately, so the icons don't jump after the page is loaded

AlexSm 19:09, 13 November 2008 (UTC)

The icons do jump. I see no way how you could ever avoid that. Like I said on IRC, this is nothing more than a "patch" for one ugly wound. It will take years to fix this issue in a "consistent" way. We should decide WHERE we want those icons, and just make sure the official HTML and skins support them. --TheDJ (talkcontribs) 19:29, 13 November 2008 (UTC)
Again: since Monobook.js is loaded after Sitenotice, something like this below would apply fix immediately in most situations and fallback to addOnloadHook in case the browser doesn't execute scripts in the specified order (I'm not even sure this ever happens).
if (window.wgNotice) applyCSSFix() 
else addOnloadHook(function(){
  if(document.getElementById('siteNotice')) applyCSSFix()
})
AlexSm
  • wgAction is checked because you do not see icons on anything but preview/view/purge.
  • \n is just for visual breakage if someone views the rendered source, no harm having it there.
  • "Monobook.js is loaded after Sitenotice (at least the central one)", but not the default one. The onloadhook is needed for that one which is inside the <body>. In fact, when this code was drafted, the central notice global was being loading inside the <body> too. As soon as the fundraising ends, the problem will persist every time there is a sitenotice, so it'd be nice to have at least the current fix there 31 days before that happens (and since it is there now, and works if jumpily, why mess with it?) *shrug* --Splarka (rant) 08:04, 14 November 2008 (UTC)
  1. Preferences - Edit - "Show preview on first edit".
  2. I have no idea where exactly I might be able to see this "visual breakage" (Firefox or Opera), so let's not make the code convinient for your particular environment at the cost of others.
  3. Removing jumping while retaining full functionality would still be a nice thing.
AlexSm 18:59, 14 November 2008 (UTC)

(unindent) If you put some code here, I'll happily sync it. :-) I agree that removing the wgAction is probably fine. --MZMcBride (talk) 19:39, 14 November 2008 (UTC)

protected icon

The lock icon of pp-meta now has the topicon class as well. So all important topicons will now have the same CSS class, and we no longer need

.topicon, #protected-icon

--TheDJ (talkcontribs) 17:26, 25 November 2008 (UTC)  Done --TheDJ (talkcontribs) 22:39, 26 April 2009 (UTC)

Now to disable

The notice is no longer up, but the sitenotice hack is still active, because the sitenotice "div" is still present. I'm asking devs if this is gonna be the new "permanent" situation. --TheDJ (talkcontribs) 15:20, 14 January 2009 (UTC)

< Marybelle> Splarka: You noticed that the anonbanner hasn't returned?
< Splarka> Marybelle: that's because centralnotice isn't actually disabled, just blank, IIRC
< Marybelle> brion: Are there plans to completely disable the banner code (i.e., remove it from the page source)?
< brion> Splarka, Marybelle: we'll be using centralnotice for the announce for the steward election, btw
< Splarka> true... brion: can you actually remove CentralNotice? it's screwing up with the code we anticipated for to swap back in the anon ads on en.wp
< brion> Splarka: no.
< Splarka> bah
 * Marybelle seconds the bah motion.
< brion> you'll want to fix your code i guess :)
< Splarka> nope
< Splarka> we'll see who rusts first
< brion> :D
< Splarka> we have a 30 day cache to fight, you don't
< Marybelle> brion: Using the watchlist for steward elections seems far more sensible, TBH.
< Splarka> why can't you just disable it until the stew?
< Splarka> mm, brion: possible to not have any centralnotice stuff in the source for anon viewers at least?
< brion> Splarka: not with its current architecture. but you can check the class on the notice
< Marybelle> Hrmph. So we need to go fix that code.
< Splarka> if(wgUserName == null) addOnloadHook((function (){
< Splarka>     if(document.getElementById('siteNotice') || window.siteNoticeValue || window.wgNotice) return
< Splarka> that's the logic...
< Splarka> can't you just make wgNotice = false instead of '' ?
< Marybelle> brion: The anon tips banner should be reactivated, right?

So, what shall we do ? --TheDJ (talkcontribs) 00:02, 15 January 2009 (UTC)

Tear at our hair and lament to the heavens? =D ダイノガイ?!」(Dinoguy1000) 01:54, 15 January 2009 (UTC)

Requested change to Monobook skin

{{Editprotected}} I am requesting that external link icons do not appear next to links with the "http://en.wikipedia.org" prefix or any other prefix in the interwiki table. -- IRP 23:33, 14 April 2009 (UTC)

I strongly oppose this measure, as I like having the external link icons for some links. For example, when someone posts a diff, I like to see that clicking on the link is not just a regular English Wikipedia page, but rather is something else. Also, it would be quite confusing the click on what looks like a regular internal English Wikipedia link and instead be redirected to another language, another wiki (Meta, Wikitionary, etc.), or something completely different like this, this, or this. --CapitalR (talk) 00:41, 15 April 2009 (UTC)
The result, like this, is quite different to an "internal English Wikipedia link". We have three types of link, not two: proper internal links (red and blue); interwiki, interlanguage and other links that remain within Wikimedia; and proper 'exernal' links. Links to enwiki do not belong in the third category, IMO.
This change could probably be accomplished with CSS, at least for modern browsers. Happymelon 09:11, 15 April 2009 (UTC)
The Monobook skin is what adds it in the first place. All that needs to be done is the addition of a code that tells it not to automatically insert the icon after a link containing a prefix listed in the interwiki table. -- IRP 21:04, 15 April 2009 (UTC)
Not all interwiki links remain within Wikimedia: AcronymFinder, MeatBall, etc. - see the Interwiki map. ダイノガイ?!」(Dinoguy1000) 18:38, 15 April 2009 (UTC)
This is caused because the MediaWiki software designates such a link as "external". In my opinion if you want that changed, you should file a bugreport in bugzilla:, though there likely already is one for this. --TheDJ (talkcontribs) 18:56, 15 April 2009 (UTC)
In fact, the proposal has already been made at bugzilla almost two years ago and it still hasn't been fulfilled. The code that has to be inserted is available on a bugzilla post. See bugzilla:11477#c6. -- IRP 20:31, 15 April 2009 (UTC)
Oppose the change for default settings, but perhaps a gadget could be provided for those who want it. –xeno talk 16:13, 18 April 2009 (UTC)
Agreed, this would be better served by an opt-in gadget, rather than a blanket change that would cause a fair amount of confusion. EVula // talk // // 16:21, 18 April 2009 (UTC)
An opt-in for those who want the correct link types? I would assume that nobody wants to see incorrect link types. Why would we want an opt-in for correct link types? -- IRP 05:01, 19 April 2009 (UTC)
I think its fine... I prefer to know I'm going to a constructed, rather than a strictly [[double square bracket]], address. But again, to each their own. –xeno talk 05:03, 19 April 2009 (UTC)
You can tell if you are going to a constructed or double square bracket address by observing the link types. This is a constructed external address. This is a constructed internal address. This is a double square bracket address. You should notice that all three of them are different. However, they are very often used inconsistently. The idea of this proposal is to ensure that all of the link types are used consistently. -- IRP 21:09, 19 April 2009 (UTC)
Um, you are throwing in that span class plainlinks so obviously thats not the current behaviour. I think confusion would be too widespread, but if this change goes through please include a gadget so I can keep things the way they are. Looking for the little diff icon is just too convenient when looking at a dramaboard discussion and you want to get quickly to the evidence. The slight difference in bluity isnt enough imo. –xeno talk 21:20, 19 April 2009 (UTC)
The reason why I put that in is because I am demonstrating the way it's supposed to be. The icon is named "external.svg" for a reason. Its intended purpose is to be used on a link that leads to a third party site. If it is used on a link that does not lead to a third party site, such as a diff link or an edit link, then it is not being used for its intended purpose. Because I am one of the few users who knows its intended purpose and was not misguided by its long term incorrect use, I don't use it unless it actually belongs on the link. If I'm not explaining it well enough, then ask User:Happy-melon, as that user could probably explain the concept in a better way. -- IRP 21:57, 19 April 2009 (UTC)
Yes, I understand, and my position remains the same. –xeno talk 22:22, 19 April 2009 (UTC)
For what reason? You said that you want to be able to identify the links by glancing at them, however, this will not be possible unless it is reconfigured so the link types will automatically be made the correct type. All I see, is that it appears you are contradicting yourself. Please clarify your point. -- IRP 23:32, 19 April 2009 (UTC), modified 23:38, 19 April 2009 (UTC)
I like the little arrowy box that identifies a diff as a diff. Whether it is "incorrectly used" (in terms of its technical name) or not. I'm sure I'm not alone on this. –xeno talk 01:04, 20 April 2009 (UTC)
Oppose as no improvement. It's more important for me to distinguish between regular Wikimedia links and links to diffs etc. However, it would be great to have a more convenient way to link to diffs that works transparently both with the normal and the secure servers. Such as [diff:title=MediaWiki_talk%3ACommon.js&diff=284637187&oldid=284635855]. The current system of using external links for diffs occasionally leads me to the secure server when I don't want to go there, and always leads me to the normal server when I am working on the secure server. (As I had to, during the Virgin Killer affair.) --Hans Adler (talk) 16:25, 18 April 2009 (UTC)
I assume that you are not aware that there are three different link types, not two. An external link looks like this. A diff link, etc. looks like this. An article link looks like this. Do you see the differences? -- IRP 05:01, 19 April 2009 (UTC)
No, I had never noticed that the diff links don't have the icon at the end. Looking at the interwiki table, I come up with two examples
  • Wikibooks Main Page vs. Wikibooks Main Page – This is inconsistent. Unfortunately it produces exactly the same (http:, not https:) links whether logged in on the normal or the secure server. The first link, when seen on the secure server, should go to Wikibooks on the secure server. Then the difference in appearance would make sense. I suspect that the served pages on the secure/non-secure servers come from the same cache; therefore I don't know if what I am proposing is feasible (Perhaps with JavaScript choosing a variant link on the client side?)
  • Doom on a lottery machine vs. Doom on a lottery machine – This is inconsistent, but in this case I think the icon should be present on both links.
Still a weak oppose because of the second example. --Hans Adler (talk) 08:08, 19 April 2009 (UTC)
You seem to be addressing that they are used inconsistently. That's the idea of this proposal. To recode part of the skin to where it will render your two examples given just above this post in the same way. The idea of this proposal was for the skin not to add the icon after a link containing a prefix listed in the interwiki table (except for the Google prefixes, which I have proposed that they be removed, as Google is not a wiki. We should use {{Google}} to link to Google instead). The purpose of the external link icon is to mark links that do not contain prefixes listed in the interwiki table as external. It has now been used so inconsistently for so long that people have forgotten the intended purpose of the external link icon. Many users seem to be misguided by that and think its purpose is to indicate that its target is not a Wikipedia article. Its actual purpose is to indicate that the link goes to a completely third party website. Diff links of course do not lead to third party websites. -- IRP 20:32, 19 April 2009 (UTC)
Oppose. I was even quite surprised to find out that the <span class="plainlinks"> hack existed, I don't see the point, if anything it undermines this brilliant feature. ɹəəpıɔnı 17:04, 18 April 2009 (UTC)
The external link icon feature is for external websites. The <span class="plainlinks"></span> feature is to suppress the appearance of external link icons on links like this. -- IRP 05:01, 19 April 2009 (UTC)
Oh I'm well aware of its purpose, there's just no preclusion to its use for external links. I would view the necessity to use single brackets for the latter as a technical limitation. Plainlinks is an inelegant hack to compensate for that limitation - necessary but undesirable. ɹəəpıɔnı 17:22, 19 April 2009 (UTC)
The idea of this proposal was to allow the Monobook skin to automatically decide whether the external link icon belongs in place or not. That way, we could deprecate the <span class="plainlinks"></span> feature and avoid inconsistencies in link types. -- IRP 20:32, 19 April 2009 (UTC)
Which would make them indistinguishable from standard internal wiki links. ɹəəpıɔnı 21:16, 19 April 2009 (UTC)
How could that possibly make them look just like standard internal wiki links? All three link types are different. The only problem is that they are being used inconsistently and that's why this was already proposed almost two years ago, and there was already consensus for the change. It is just that nobody was responsible enough to implement the change. -- IRP 21:57, 19 April 2009 (UTC)
OK this is where I get a little confused. It's quite possible I'm misinterpreting the request somewhat, I was under the impression you were essentially talking about the plainlinks hack being automatically applied to all links prefixed with en.wikipedia.org and others (listed in the interwiki table), which to my mind would make them indistinguishable (and could cause confusion as it would be contrary to what people now expect).ɹəəpıɔnı 00:56, 20 April 2009 (UTC)
That's not true. Standard links (such as links to Wikipedia articles and Wikipedia project pages (like the one you're currently viewing)) appear in blue (and in violet after they are visited). Non-standard links, such as links to the history of a page appear in cornflower blue. External links appear in cornflower blue, however, have the following icon appear after them:. The icon is named "File:External.svg" for a reason. That is: Because it is intended to be used to be used indicate that the link leads to a site that is not in the interwiki table (and it wouldn't wrap all links that contain prefixes listed in the interwiki table in "<span class="plainlinks"></span>". It would just change the way the Monobook skin renders such links. The Monobook skin (and a few others) is what adds it in the first place. If you switch to another skin (a skin that does not have the external link icon feature), the external link icon will not appear on this link. If you switched to the other skin using the link, click here to switch back. -- IRP 01:58, 20 April 2009 (UTC)
OK, so fair enough, cornflower blue is not completely indistinguishable from blue. Barely distinguishable I should have said. I suppose I would support an alternative icon if one were proposed - i.e. two separate icons for single bracket links to distinguish external from internal, but I don't see it as mission critical. ɹəəpıɔnı 06:04, 20 April 2009 (UTC)

OK, so how about green links for diffs, edit screens, etc. -- IRP 20:42, 20 April 2009 (UTC)

Neutral I'd rather see an enhancement to the wiki-link syntax to support old version references, diffs and the like. -- Tcncv (talk) 21:24, 18 April 2009 (UTC)
Oppose In my opinion, we'd better look into getting better support for link tagging in the mediawiki software. The current classes: external,extiw etc are used too inconsistently with what they should syntactically mean. --TheDJ (talkcontribs) 21:32, 18 April 2009 (UTC)
It was already proposed almost two years ago at bugzilla:11477, however, nobody was responsible enough to implement the change. If you think that there needs to be a change in the software (and it appears that there was already consensus for the change at bugzilla:11477), then the best idea is to contact a developer. -- IRP 05:01, 19 April 2009 (UTC)
Just because there was a bug filed does not mean there was consensus. There's no discussion linked, so one can only assume that there was none. In any case, a consensus on the English Wikipedia is mostly irrelevant to changing the skin in MediaWiki, it would only be relevant for a change to the skin on the English Wikipedia through CSS or JS. Mr.Z-man 02:49, 20 April 2009 (UTC)
There was consensus for the change at Bugzilla. -- IRP 03:40, 20 April 2009 (UTC)
Among the what? 4 or 5 people who commented on it? There's now at least 5 people opposing it here. Mr.Z-man 04:42, 20 April 2009 (UTC)
The only reason why people here are opposing it is because they don't understand the purpose of it. At bugzilla:11477 (where people do this stuff all the time and have an understanding of the concept), everyone understood its purpose and everyone seemed to support it. -- IRP 20:58, 20 April 2009 (UTC), modified 20:59, 20 April 2009 (UTC)
I fully understand the purpose. I just fear change. –xeno talk 21:02, 20 April 2009 (UTC)
So if their opinion is worthless, why did you ask for it? Mr.Z-man 21:08, 20 April 2009 (UTC)
Because I am not a future seer. I of course cannot know what people are going to say until they say it, and based the reasons they gave for their opposition of the request, it appears they did not understand it. I can tell that this is so because Lucideer said "OK this is where I get a little confused. It's quite possible I'm misinterpreting the request somewhat...". Also, Hans Adler changed his position to "weak oppose" after I deciphered my request. (Both can be seen above). -- IRP 22:14, 20 April 2009 (UTC)
Neutral I also would rather see an enhancement to the wiki-link syntax to support old version references, diffs ect. Agathoclea (talk) 21:44, 19 April 2009 (UTC)
Support for links in http://en.wikipedia.org/ and https://secure.wikimedia.org/wikipedia/en/; it's not by the link icon that you tell that a link is a diff. We already take away the link icon for these kinds of links on project pages (like Wikipedia:Upload), it's only out of laziness that we don't remove it on talk pages etc. —Remember the dot (talk) 03:53, 20 April 2009 (UTC)
Comment: It's a little confusing how IRP repeatedly says "A diff link, etc. looks like this", when they currently don't – it's how IRP propose request  they should look. I agree it would be better if true external links and non-wikilink internal links looked clearly different by default, but I think non-wikilink internal links should also look more different to (internal) wikilinks than just the current small nuance in colour. --83.253.240.46 (talk) 23:05, 22 April 2009 (UTC)
Because a diff link is supposed to look like that (and it does when it is formatted correctly). The only reason why it doesn't is because many people are too lazy to format their links correctly (that's why this proposal was made; so the interface will automatically format the links correctly. Also, I wasn't the one who proposed this. It was already proposed a while back at Bugzilla:11477, however, the change was not implemented because the proposal has been forgotten about). See Remember the dot's post just above yours. -- IRP 01:48, 23 April 2009 (UTC), modified 01:54, 23 April 2009 (UTC) and 02:02, 23 April 2009 (UTC)
I would hardly call not wanting to add an extra 32 characters every time they post a diff just to remove a tiny little icon "laziness." Even if you use the automated thing in the edit tools, its still adding 2 or 3 more steps (switch to wiki markup tools, set the position in the edit window, click the link) to a process that's otherwise only 3 or 4 steps (open bracket, paste link, add text, close bracket). No, adding the span is not a lot of work, but its still 50-100% more work than it is without using the extra formatting. Mr.Z-man 02:05, 23 April 2009 (UTC)
That was the point of this proposal (which I did not even make). The point was for the software not to mark it as external even when it is not wrapped in <span class="plainlinks"></span> (as long as the link contains a prefix that is listed in the interwiki table. -- IRP 02:18, 23 April 2009 (UTC)
Surely the class="plainlinks" markup is obscure and unknown to very many regular editors (I just now noticed that it is in the "Wiki markup" section below the text editing pane). To have some editors applying it, and some or most not doing it, obviously results in inconsistency. But anyway, I consider the non-Wikimedia sites in the Interwiki map to be external, and don't like having links to them look the same as Wikipedia-internal diff links. --83.253.240.46 (talk) 09:10, 23 April 2009 (UTC)

Using templates

I was hoping I could get some help for my own common.js file. I wanted to add toolbar buttons and in the code i want to add a template code. The regular code is:

   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://www.koreanwikiproject.com/wiki/skins/common/images/Button_lang.png",
     "speedTip": "Insert language list",
     "tagOpen": "{{",
     "tagClose": "}}",
     "sampleText": "Languages|PAGENAME"};

However I want to change PAGENAME to {{PAGENAME}} but the fact it has those brackets it breaks the code. What can I do to include {{PAGENAME}} without breaking the code? Thanks --Bluesoju (talk) 02:15, 29 April 2009 (UTC)

Use one slash: "{\{PAGENAME}}" or two strings: "{"+"{PAGENAME}}". P.S. Please use "new section" tab on top to start a new section.AlexSm 02:53, 29 April 2009 (UTC)
Thanks Alex, worked perfectly! --Bluesoju (talk) 00:12, 30 April 2009 (UTC)

null-collapsible tables idea

based loosely on this discussion here, I had a thought that I thought I'd toss out for consideration. a modification to the 'collapseTable()' function can allow collapsing of empty rows only (making the table more readable without actually hiding meaningful data). just for proof of concept, the following code hides any rows in a collapsible table in which the second column is 0 or has no data:

    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++ ) {
            var CellData = Rows[i].cells[1].firstChild.data;
            if ( CellData==0 || CellData=='' || CellData==null ) {
                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;
    }

I've tested this on the collapsable table in the above discussion, just to make sure it works as advertised.

This would require, of course, a new 'nullCollapsible' table class (basically a copy of the current collapsible table class, with minor changes), and some more thought needs to be put into the details (e.g. there should be some hook for users to specify which row(s) are used in determining what gets collapsed, and possibly for setting collapse conditions more generally), but basically I just wanted to show that it could work, and see if the idea was interesting enough for further investigation. what do you all think? --Ludwigs2 16:25, 29 April 2009 (UTC)

I think this would encourage the out-of-sight-out-of-mind mentality that is so disadvantageous to users without JS, or who for whatever other reason can't hide the cells. It would encourage users to leave the cells in and just hide them with this JS, when in fact for accessibility they should be not putting them in in the first place.
And what happens if the second cell is empty but the third cell is not? :D Happymelon 16:50, 29 April 2009 (UTC)
yeah, I know, the concept would need a lot more work to be functional. the specific problem on this page, though, was that they had a table that notes confirmed swine-flu cases and suspected swine flu cases, and the second list was/is long and takes up a lot of page space. they wanted to collapse the 'suspected-only' rows without deleting them from the list. the only current solution is to make two tables (which is what they did), but that's kind of hacky, and might be more confusing to people using non-visual browsers (I'v enever used a non-visual browser, so I don't know how something like that would get rendered). and there are distinct problems with collapsible tables in general, true... --Ludwigs2 17:04, 29 April 2009 (UTC)

Notices again

We need to look at this again, it's a mess (not totally our fault). The current logic no longer works, because basically the devs have stated that they will always leave centralnotice "active". So figured, we can adapt right? but....

  • getElementById( 'centralNotice' ) && hasClass( expanded ) - Centralnotice is inserted into the DOM and "open"
    • Does not work, because also inserted if anons have no centralnotice, and users have not. :(
  • getElementById('mw-dismissible-notice') a MediaWiki:Sitenotice is present
    • Reliable.
  • No identifying element for MediaWiki:Anonnotice
    • But we could add these ourselves of course. (should we ? )

All in all, this is just a mess. Very depressing indeed. --TheDJ (talkcontribs) 13:25, 29 April 2009 (UTC)

I propose removing
if(document.getElementById('siteNotice') || window.siteNoticeValue || window.wgNotice) return
, because it will always return atm. (we can see about the donation banner during the next donation drive).
I also propose changing the topicon code to the following:
if((navigator.userAgent.indexOf("MSIE 6")==-1) && (wgAction == 'submit' || wgAction == 'view')) addOnloadHook(function() {
    var cnote = document.getElementById('centralNotice');
    if( document.getElementById('mw-dismissible-notice') || (cnote && hasClass(cnote, 'expanded'))) {
      appendCSS('#bodyContent { position:relative; } \n.topicon { position:absolute; top:-2em !important;}\n#coordinates{ position:absolute; top:1px !important; }');
    }
})

Again so that we will have cases where at least this check isn't pointless even though still not perfect. We can see how we will progress from there. --TheDJ (talkcontribs) 13:45, 29 April 2009 (UTC)

 Done We should now have the "ads" for anonusers again. And the topicons are now only "corrected" if really needed for normal users, and always corrected for anonusers. I consider that at least an improvement. —TheDJ (talkcontribs) 10:09, 30 April 2009 (UTC)

TopNavboxMargin

I need to know what's wrong with this code; IE throws an 'Object expected' on "line 5" (which could be anywhere):

(Old code removed)

EdokterTalk 16:39, 5 May 2009 (UTC)

I assume that there actually are tables on the page? Would adding a return-if-no-tables check fix the issue? I know the loop should not iterate at all, but it is IE... :D Happymelon 17:23, 5 May 2009 (UTC)
wow, that was confusing. I responded here, did some other stuff, and suddenly noticed that my post had turned into Happy-melon's post. Not that I'd mind turning into Happy-melon - he's a smart cookie - but... caught in a cross-post; myohmy. --Ludwigs2 17:58, 5 May 2009 (UTC)
It's working (forgot the document.getElementsByTagName Thanks Ludwigs!). Combined with a CSS declaration for table.navbox#first-navbox, I now have a working solution for spacing the top navbox in IE6. It could probably use some refinement to act the same way as the CSS selectors now in place (ie. div + table.navbox). EdokterTalk 19:03, 5 May 2009 (UTC)

Big changes coming to JS core

Change is coming. The idea is the following:

  1. jsQuery will become the "main" backend utility engine
  2. All current *.js files (wikibits.js, mwsuggest, watchlist, the gadgets, Common.js and monobook.js) will be grouped into a singly .js file by the software.
  3. This "grouped" file will be tinified and gzip'ed and have a unique request key.
  4. Conversion to jsQuery (incl. that of wikibits.js) will come after deployment. It's a multistage approach
  5. The code is already done in a branch and awaiting review merging. Michael hopes to have it on test.wp next week

In my opinion, this is good news. Lets hope our JS tools will all be converted soon so they can become as lean and mean as possible. --TheDJ (talkcontribs) 15:22, 17 April 2009 (UTC)

If I'm reading things correctly, this means there will be no decaching time for JS files? Happymelon 15:53, 17 April 2009 (UTC)
Yes, the idea would indeed be that if any of the files changes, the request key changes, and automatically you bypass any caching. --TheDJ (talkcontribs) 15:59, 17 April 2009 (UTC)
Ooh, sounds like fun. =) With this, the admins (aka pretty much everyone watching this page but me, it seems like) won't have to be quite *so* afraid of breaking something. *starts wondering how this might affect my scripts, few and basic that they are* ダイノガイ?!」(Dinoguy1000) 20:32, 17 April 2009 (UTC)
Yes... Instead of breaking something in 30 days, it will break immediately :) EdokterTalk 22:25, 17 April 2009 (UTC)
Yep, and instead of having to wait 30 days for a fix for said breakage to hit everyone, it'll hit immediately. =) ダイノガイ?!」(Dinoguy1000) 00:43, 18 April 2009 (UTC)
Yes, and instead of breaking something only a few people would notice, you would break it for each and every visitor coming to Wikipedia ;) —Ruud 09:54, 18 April 2009 (UTC)
So what's new? There are plenty of other things we can break around here that will be immediately and painfully obvious to every visitor... :D The big question is, can they (or we?) come up with a way to treat CSS in the same way? Happymelon 10:59, 18 April 2009 (UTC)
Damn you Happy-melon, why do you ask so good questions? You made me think about this. Yes, we admins can do a very simple hack that means we can have a special CSS file that has no or much shorter caching time. And no javascript needed, so should work for pretty much all users. If/when we need a style to decache faster we can put it in that file. I will do some more testing and thinking and then I'll explain the details over at MediaWiki talk:Common.css.
--David Göthberg (talk) 23:39, 19 April 2009 (UTC)

Domas just mentioned on IRC that he has enabled gz compression for css/js.

<@domas> brion: I enabled compression for css/js
< Splarka> sweet, just got wikbits.js gz'd
< Splarka> before: 29.63 KB (30339 bytes), after: 9.7 KB (9931 bytes)

Rolling out trough all the servers as we speak. —TheDJ (talkcontribs) 17:21, 7 May 2009 (UTC)

StackTables

/**
  * Find the top navboxes in a stack and assign margin-top: 0.5em;
  * Stack navboxes and amboxes by assinging margin-top: -1px;
  */

function StackTables()
{
    var documentTables = document.getElementsByTagName("table")
    for (var i = 0; i < documentTables.length; i++)
    {
        var table = documentTables[i]
        var tableStyle = table.style
        var prevElement = table.previousSibling
        if (prevElement)
        {
            if (hasClass (table, "navbox") && hasClass (prevElement, "navbox"))
            {
                tableStyle.marginTop = "-1px"
                continue
            }
            if (hasClass (table, "ambox") && hasClass (prevElement, "ambox"))
            {
                tableStyle.marginTop = "-1px"
            }
        }
    }
}

window.attachEvent("onload", StackTables)

This code finds all navboxes and amboxes, and merges the top and bottom if two of the same are stacked, simulating the CSS code in Common.css which is not supported by IE6. It also assigns a margin of 0.5em to the top navbox in any stack, simulating similair CSS. You can test the code by placing it in your monobook.js and see it in action at Template:Navbox/testcases and Template:Ambox/testcases. I would like to place this code in IE6Fixes.css to comlement the CSS doing the same in Common.css... (OR maybe replace the CSS alltogether to have one uniform solution to the problem.) Thoughts? EdokterTalk 11:38, 7 May 2009 (UTC)

I have no problem with this in MediaWiki:Common.js/IE60Fixes.js. I see no reason to use JS in favor of CSS however. —TheDJ (talkcontribs) 17:05, 6 May 2009 (UTC)
But the global CSS uses 1em doesn't it ? —TheDJ (talkcontribs) 20:58, 6 May 2009 (UTC)
Yes, but I requested that to be changed to 0.5em as well on Common.css, as that is the standard spacing between any two block elements. EdokterTalk 21:15, 6 May 2009 (UTC)
I have added 3 checks for possibly undefined items in the script. Hope you agree. —TheDJ (talkcontribs) 12:41, 7 May 2009 (UTC)
Actually, no. Those are redundant. If there are no tables, the documentTable array is empty, not undifined, and .length simply returns zero. Also it is safe to asume that table.previousSibling is never empty, and the hasClass function already traps undefined elements. EdokterTalk 13:15, 7 May 2009 (UTC)
Per TheDJ; I approve of this being in IE60Fixes.js; but I can't see any reason to duplicate or replace CSS functionality with JS. CSS is clearer, more widely (if more haphazardly) supported, is unlikely to be disabled by security-conscious users, and is AFAIK easier on browser processing time. We can achieve (for most users) the same effect in 50 characters as this achieves in 850. Except for browsers which do not support CSS, this is totally unnecessary. For browsers that don't support CSS, this is very valuable. Happymelon 14:09, 7 May 2009 (UTC)
Actually, you were right about one check; table.previousSibling can be null, so that check is back in. EdokterTalk 16:42, 9 May 2009 (UTC)
Let's see what hapens to the navbox margin being replaced by UL and OL margins, in which case we would not need this code at all (except for stacking, but hat isn't pressing). EdokterTalk 19:08, 7 May 2009 (UTC)
plus Added. Removed the top margin code from above code now that CSS has been fixed. The stacking functionality was sort of a bonus. I added it anyway, unless there are any objections. EdokterTalk 23:43, 8 May 2009 (UTC)

Custom buttons don`t work at all

Hello.

I try to add this custom buttons to my standalone Mediawiki(1.13.5) but it seems to not work at all. I add it inside a MediaWiki:Common.js.

Whats wrong and how can I fix it? —Preceding unsigned comment added by Oloremo (talkcontribs) 12:45, 15 May 2009 (UTC)

fixIEScroll not compatible with MSIE 8.0 ?

Some posting on the VPT suggests that possibly, our fixIEScroll is not compatible or no longer needed, icw MSIE 8.0. If such proves to be the case, we probably need to change some more stuff for our Javascript code. Initially, i propose the following change: [1]. —TheDJ (talkcontribs) 12:52, 18 May 2009 (UTC)

It's trivial to filter out IE8, but I assure you it is definitely needed for IE6 & 7. EdokterTalk 17:22, 18 May 2009 (UTC)

BLP editintro

{{editprotected}}

After discussion at Wikipedia:Village_pump_(proposals)#Editnotice_for_all_blps, it appears that there is consensus to use an edit intro (Template:BLP editintro) for all blps. The method employed is similar to what has been done for disambiguation pages. Could someone familiar with Common.js please add the code from User:RockMFR/blpeditintro.js to it. It has been tested and works fine. Incidentally, if someone has an idea on how to make it appear for section edit, it would be much appreciated. Thanks, Cenarium (talk) 22:07, 8 February 2009 (UTC)

I've put the two editintro scripts together at User:RockMFR/editintros.js. I've only tested this in Firefox, so whoever adds this please make sure it gets tested in all major browsers :) --- RockMFR 05:51, 9 February 2009 (UTC)
/** Magic editintros ****************************************************
 *
 *  Description: Adds editintros on disambiguation pages and BLP pages.
 *  Maintainers: [[User:RockMFR]]
 */
 
function addEditIntro(name) {
    var el = document.getElementById('ca-edit');
    if (!el) return;
    el = el.getElementsByTagName('a')[0];
    if (el){
        el.href += '&editintro=' + name;
    }
}
 
if (wgNamespaceNumber == 0){ addOnloadHook( function(){

    //Disambiguation pages
    if (document.getElementById('disambig')){
        addEditIntro('Template:Disambig_editintro');
    }

    //Biographies of Living People
    var catlinks = document.getElementById('catlinks');
    if (!catlinks) return;
    catlinks = catlinks.getElementsByTagName('a');
    if (!catlinks) return;
    for (var i = 0; i < catlinks.length; i++) {
        if (catlinks[i].title == 'Category:Living people') {
            addEditIntro('Template:BLP_editintro');
            break;
        }
    }
})}

I've brought RockMFR's code over here and tweaked it a bit; assuming I haven't broken anything it looks good to me. Happymelon 12:27, 9 February 2009 (UTC)

Disabled editprotected request. Plenty of admins looking at this page. And this code should probably reviewed a bit more. Also, should we consider creating a new .js subpage? --MZMcBride (talk) 18:44, 9 February 2009 (UTC)

There isn't really any benefit to doing so since this code is for use on action=view. Everyone has to load it. --- RockMFR 20:37, 9 February 2009 (UTC)

The above code does not take into account cases where ca-edit or catlinks are not present, which can happen. --- RockMFR 20:31, 9 February 2009 (UTC)

Hmn, I was expecting it to fail softly... never mind, restored your more robust checks. Happymelon 20:49, 9 February 2009 (UTC)
Unless I'm mistaken, the addEditIntro() function in HM's last version would always break because there was no parameter name being passed to it (although there was a template parameter...). I went ahead and fixed this. Also, I see no point in running the script unless wgAction == 'view' (which should cover both ordinary article views and diffs), unless I'm missing something here. ダイノガイ?!」(Dinoguy1000) 05:25, 10 February 2009 (UTC)
IMO it should run whenever there is the possibility that it might succeed; it's a delicate enough process as it is, we don't want to make it more so. Happymelon 14:08, 10 February 2009 (UTC)

I'm going to replace the current disambig editintro code with User:RockMFR/editintros.js tomorrow unless there are any objections. --- RockMFR 01:40, 14 April 2009 (UTC)

Now added. --- RockMFR 05:19, 15 April 2009 (UTC)
The BLP editintro seems to work only when editing the entire page; editing sections doe no bring up the editintro. ---— Gadget850 (Ed) talk 21:14, 11 May 2009 (UTC)
It behaves the same on dabpages - compare editing Springfield versus Springfield#Australia. Direct edit links also don't get the notice (example), but this is probably unavoidable. ダイノガイ?!」(Dinoguy1000) 06:05, 12 May 2009 (UTC)
The only other way would be to ajax-query if the currently edited page is in Category:Living people, e.g. [2]. That would require one additional request for every page edit though (unless it's optimized using the current addEditIntro method, by providing a parameter when we needn't bother). I don't think it's worth it. Amalthea 08:17, 12 May 2009 (UTC)
It also doesn't work if you access the edit page via any means at all other than the "edit this page" link at the top of the page when viewing the page – if you click said link while viewing the page history, or a diff, or enter it manually, or follow an edit link on a page, or any other way at all, you don't get it. Why can't this javascript run on the edit page itself rather than when viewing the page, and insert the notice if the text in the edit box contains "[[category:living people"? Gurch (talk) 13:55, 15 May 2009 (UTC)
That doesn't work with section edits. The only reliable way is through the API, as far as I can tell, which needs a query. Amalthea 14:24, 15 May 2009 (UTC)
Well, the current code doesn't work with section edits either, so this would at least be better than that. What you guys really need is software support for the whole "biography of living persons" concept, but I can't see the developers implementing that. Gurch (talk) 11:06, 17 May 2009 (UTC)

{{sudo}}

Should make this check for Category:Possibly living people too; until subjects are known to be dead the same rules apply to articles in that category. – GurchBot (talk) 17:49, 27 May 2009 (UTC)

OK. Amalthea 11:08, 28 May 2009 (UTC)

Might be the wrong place to ask...

... but what is the add-on that allows the search box to suggest pages as I type? I want to add this to my wikis; I thought this was a Common.js thing but I'm not sure. Timneu22 (talk) 15:57, 4 June 2009 (UTC)

I think it is mw:Extension:Lucene-search, which is included in MediaWiki 1.5+. ---— Gadget850 (Ed) talk 16:12, 4 June 2009 (UTC)
I'm on 1.9 and I don't have it. I guess it requires configuration, then. Timneu22 (talk) 16:18, 4 June 2009 (UTC)
The feature is MWsuggest, which is available in core since 1.13 and disabled by default, it doesn't require Lucene - mw:Manual:$wgEnableMWSuggest. Mr.Z-man 17:09, 4 June 2009 (UTC)
Thanks- that wasn't obvious to me. ---— Gadget850 (Ed) talk 17:22, 4 June 2009 (UTC)

Windows Live Search replaced by Bing

Windows Live Search has now been replaced entirely by Bing; searches through search.live.com redirect there. The name and URL in MediaWiki:Common.js/search.js should be updated to reflect this. Gurch (talk) 14:14, 11 June 2009 (UTC)

Done. —Ruud 14:52, 11 June 2009 (UTC)

Technical restrictions code ready to be removed

Hi all, the "Technical restrictions" JavaScript has now been replaced by new and improved DISPLAYTITLE code in MediaWiki itself. I've replaced all calls to the old JavaScript backend that I could find, so we should now be ready to remove the supporting JavaScript entirely. —Remember the dot (talk) 01:34, 17 June 2009 (UTC)

Which of these templates does the new magic word replace? Locos epraix ~ Beastepraix 18:25, 17 June 2009 (UTC)
Hmm, I guess it is kind of confusing to determine which template to use:
So, to answer your question, most of the templates are staying as hatnotes, and only {{downsize}} has been entirely obsoleted by this change.
Because all the calls to the JavaScript backend that I could find have been removed without complaint, I have removed the JavaScript backend entirely. If you come across a page or template I missed, please update it as instructed above. —Remember the dot (talk) 01:21, 18 June 2009 (UTC)
It seems there is redundancy with those templates, some of them can be TFD'ed. Locos epraix ~ Beastepraix 01:50, 18 June 2009 (UTC)

Just a thought. After you replace most of these these templates with direct DISPLAYTITLE calls, there will be no easy way to count how often this magic word is used, and no easy way to fix things in the case developers decide to change something about this magic word. In other words, it might be beneficial to use DISPLAYTITLE only through templates. — AlexSm 20:08, 18 June 2009 (UTC)

There is a precedent in {{NOINDEX}}. ---— Gadget850 (Ed) talk 00:05, 19 June 2009 (UTC)

Nested tables problem

{{editprotected}} I was told that I could ask here for a problem in the meta-wiki:
The problem is that nested collapsible tables (two or more) have an error while collapsing/uncollapsing (something that doesn´t happen on the english wikipedia). With the parameter "class="collapsible collapsed"", the content of a table becomes hidden, but if one of the cells of that table contains another table with the same parameter (a second table also with hidden content), the hidden secondary content is forcefully shown, even when the collapse caption indicates it as hidden. Here´s an example (note that a table within another generates this error; the sub-hidden content is no longer hidden and you have to click several times on the collapse caption to manually collapse it!). Here´s how it works fine here in the wikipedia (english):

I wish to know if someone can help me telling me how to fix this (maybe with some other parameter or implementing it to meta-wiki directly). In case that it will need to be inserted in the interface, I posted the {{editprotected}} template also. Should i post it here also or instead?
Thaks for the attention.
Discussion originally posted here. - Damërung ...ÏìíÏ..._Ξ_ . --  18:16, 2 July 2009 (UTC)