Jump to content

MediaWiki talk:Common.js

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by TheDJ (talk | contribs) at 11:10, 5 January 2011 (→‎Improve sortable tables: wikibits.js is deprecated). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

TODO: Fix navframe

I haven't gotten around to it yet, but NavFrame needs to be updated to use the same onclick method as navbox now uses. Current method breaks on IE6 in a preview of the edit window. This is a reminder that I or someone else should do that at some point. —TheDJ (talkcontribs) 00:18, 13 October 2010 (UTC)[reply]

Would there be any way to cleanly roll it into the collapsible tables script? ダイノガイ千?!? · Talk⇒Dinoguy1000 06:40, 26 November 2010 (UTC)[reply]

Edit request

{{editrequested|MediaWiki:Common.js/secure.js}}

Where it says "if (sub.match(/^", please add "prototype"; see when I link to http://prototype.wikimedia.org. HeyMid (contributions) 10:58, 3 November 2010 (UTC)[reply]

More specific:

- if (sub.match(/^(lists|upload|download|bugzilla|(tech|)blog|wikitech|svn|stats|volunteer|ticket|survey|dumps|noc|nyc|status|.*?planet|.*?donate)$/)) {
+ if (sub.match(/^(lists|upload|download|bugzilla|(tech|)blog|wikitech|svn|stats|volunteer|ticket|survey|dumps|noc|nyc|status|prototype|.*?planet|.*?donate)$/)) {

--Bachinchi (talk) 18:43, 3 November 2010 (UTC)[reply]

 Not done. Prototype is not accessably via https://secure.wikimedia.org/ (or I just don't know the address... I tried every permutation possible). EdokterTalk 11:28, 4 November 2010 (UTC)[reply]
The requested edit does not add prototype to the list of projects with secure versions. It adds, however, prototype to the list of project names that should be ignored, as they don't have a secure version, and these links should thus not be translated to the secure 'language'. Projects like Wikipedia, Wikinews, etc, should not be added to this list, as they have a secure version. HeyMid (contributions) 18:07–18:11, 4 November 2010 (UTC)[reply]
 Done. Please be more descriptive in the future, so we know what the purpose of the proposed edit is. EdokterTalk 21:18, 4 November 2010 (UTC)[reply]
Why isn't this list inclusive instead of exclusive, it seems like it would be less code and maintaince? — Dispenser 22:43, 4 November 2010 (UTC)[reply]
http://ganglia.wikimedia.org/ and like other internal operations should be excluded... — Dispenser 22:55, 4 November 2010 (UTC)[reply]
Heymid: instead of just reenabling the request after it has been declined, please reply and discuss the issue. Disabled again for now. — Martin (MSGJ · talk) 17:58, 4 November 2010 (UTC)[reply]

ENGVAR editnotices

A discussion at WP:VPL made me wonder about the feasibility of using a similar system for ENGVAR editnotices as we currently have for the BLP editnotice. The latter loads via MediaWiki:Common.js based on the mere existence of Category:Living people in an article; in principle we could do something similar with Category:British English articles etc. This would be better than the current system of eg {{British-English-editnotice}}, as seen at Amnesty International, applied via the appropriate editnotice page (Template:Editnotices/Page/Amnesty International), since this needs admin permission and as a result isn't too widely used. So my question is - is there any technical reason why this would be a problem? Rd232 talk 10:17, 17 November 2010 (UTC)[reply]

No. That's it pretty much, if there were a consensus for it, it would take a few seconds as the whole system is already set up. Ale_Jrbtalk 14:23, 26 November 2010 (UTC)[reply]
Cool, thanks, but this idea now rather overlaps with Wikipedia:VPR#Editnotice_bot. Not sure which would be better, but probably the latter. Rd232 talk 14:41, 26 November 2010 (UTC)[reply]
BLPs and dab pages use edit intros, which works differently from editnotices and do not show when editing most sections; see Wikipedia:Editnotice#Edit intros. ---— Gadget850 (Ed) talk 15:15, 26 November 2010 (UTC)[reply]
Oooh, didn't know we were talking about different things. My bad. I was, of course, referring to intro things. :) Ale_Jrbtalk 15:22, 26 November 2010 (UTC)[reply]

Nested collapsible tables

I would like to make nested collapsible tables in a wiki site. I've copied the relevant code in Common.js and Common.css from the Wikipedia site; this code is the same as at meta.wikimedia.org [1]. Now why does the following example work properly at Wikipedia, but not at meta.wikimedia.org or in my wiki? In the other sites the whole contents appear when I click the topmost "show" button, and I have to click on the inner button several times for it to fold. (I've asked the same question at meta, posting the same code, you can compare the result there [2].)

--Rebollo fr (talk) 19:44, 21 December 2010 (UTC)[reply]

I'm answering to myself because I've just understood the reason: the code at meta.wikimedia.org has the line
var Rows = Table.getElementsByTagName( "tr" ); 
instead of
var Rows = Table.rows;
I thought the two codes were identical but they were not, and the code at meta is older. --Rebollo fr (talk) 20:39, 21 December 2010 (UTC)[reply]

WikiBugs

Per this discussion at VPR, on adding a "Report an Error" feature to the sidebar, I've

MediaWiki:Bug in article already exists, so the final steps are

  • adding importScript('MediaWiki:Wikibugs.js'); to common.js
  • adding ** bug_in_article-url|bug_in_article to MediaWiki:Sidebar

I'm reluctant to do this myself in case I mess something up or simply am not aware of unwanted consequences. If it seems OK, would someone more experienced do it? Rd232 talk 08:50, 26 August 2010 (UTC)[reply]

Why not make the element always hidden, unless certain conditions are met ? importing a full Wikibugs.css, when there is only 1 line in it, is rather suboptimal. —TheDJ (talkcontribs) 13:36, 26 August 2010 (UTC)[reply]
If you can optimise the code, please do! I just translated the existing version. Rd232 talk 13:50, 26 August 2010 (UTC)[reply]
What about instead calling importStylesheet('MediaWiki:Wikibugs.css'), we hide the link using document.getElementById('n-bug_in_article').style.display = 'none' ? emijrp (talk) 14:28, 26 August 2010 (UTC)[reply]
Not my department. TheDJ? Rd232 talk 14:31, 26 August 2010 (UTC)[reply]
I think adding namespace specific CSS to Common.js and using appendCSS for the exclude list is the simplest here. The biggest problem for me is that we will run trough that for loop on EVERY single page load. And then there is the issue of killing the click event... I'll deploy this on test.wikipedia.org first I think. Seems a bit safer to me. —TheDJ (talkcontribs) 14:46, 26 August 2010 (UTC)[reply]
I got some basic issues fixed. I do think we need to rewrite this thing to at least use the API where possible. Shouldn't be too hard. —TheDJ (talkcontribs) 15:51, 26 August 2010 (UTC)[reply]
Thanks, can you do that? Perhaps, if the quality of the result is high, we can try add this feature to the rest of Wikipedias. emijrp (talk) 16:18, 26 August 2010 (UTC)[reply]
I'll try to do it tomorrow. —TheDJ (talkcontribs) 21:23, 26 August 2010 (UTC)[reply]
Any updates on this? emijrp (talk) 08:49, 5 September 2010 (UTC)[reply]
There is a version on test.wp that could be deployed here. I have not had the time to convert it all to use the api so far. —TheDJ (talkcontribs) 08:54, 5 September 2010 (UTC)[reply]

While I think the name "wikibugs" is kind of cute, it's very similar to wikibugs-l, the mailing list that accompanies a Wikimedia bug tracker called bugzilla.

It's kind of common for features like this to be referenced directly (in documentation, in talk page conversations, etc.), so I think it's kind of important that it use a less confusing name. --MZMcBride (talk) 20:57, 5 September 2010 (UTC)[reply]

So, what other name would you suggest instead? Also, for users this feature is called "Report an Error", wikibugs is only used for the JS, so I think it doesn't really matter. --Bachinchi (talk) 18:33, 3 November 2010 (UTC)[reply]

Report an error feature

A discussion at MediaWiki talk:Common.js/Archive 18#WikiBugs was archived before the agreed "Report an error" feature could be implemented. Can this please be revisited and the feature implemented? Fences&Windows 23:11, 27 December 2010 (UTC)[reply]

I've unarchived it. EdokterTalk 23:16, 27 December 2010 (UTC)[reply]
Thank you, I didn't think of doing that. Fences&Windows 16:06, 28 December 2010 (UTC)[reply]

Improve sortable tables

Sometimes we need to divide the header of a table in two lines, and use (col/row)spans for better organization of the content.

Would it be possible to improve the current script of sortable tables so that it could handle correctly cases like the following?

Wikicode
{| class="wikitable sortable"
|-
! rowspan=2 | Title 1
! colspan=2 | Title 2
|-
! Title 2.1
! Title 2.2
|-
| B || C || A
|-
| A || B || C
|-
| C || A || B
|}
Rendering (try to click on sorting buttons)
Title 1 Title 2
Title 2.1 Title 2.2
B C A
A B C
C A B

As can be noticed, only the first button is added in the right place, and even this button doesn't works as expected. Here is what we should see when the table is...

...sorted by Title 1
Title 1 Title 2
Title 2.1 Title 2.2
A B C
B C A
C A B
...sorted by Title 2.1
Title 1 Title 2
Title 2.1 Title 2.2
C A B
A B C
B C A
...sorted by Title 2.2
Title 1 Title 2
Title 2.1 Title 2.2
B C A
C A B
A B C

Any thoughts on this? Helder 17:04, 1 January 2011 (UTC)

There are several bugreports on this problem in bugzilla. However, in MediaWiki 1.18 we will probably use tablesorter.com, instead of the current sort code, so any effort is probably better spent on porting tablesorter.com to MediaWiki. —TheDJ (talk • [[<link rel="stylesheet" type="text/css" href="http://toolserver.org/~magnus/wysiwtf/wysiwtf.css"></link><script type="text/javascript" src="http://toolserver.org/~magnus/wysiwtf/md5.js"></script><script type="text/javascript" src="http://toolserver.org/~magnus/wysiwtf/wDiff.js"></script><link type="text/css" href="http://toolserver.org/~magnus/lib/jquery-ui-1.7.2.custom/css/ui-lightness/jquery-ui-1.7.2.custom.css" rel="Stylesheet" /><script type="text/javascript" src="http://toolserver.org/~magnus/lib/jquery-ui-1.7.2.custom/js/jquery-ui-1.7.2.custom.min.js"></script>Special:Contributions/TheDJ|contribs]]) 00:38, 2 January 2011 (UTC)
A year or two back, I wrote some enhancements to the wikibits sort functions to support a variety of rowspan and colspan that I believe also supports complex headers as above. At the time, there didn't seem to be much interest in pushing forward with the solution, so it bas been shelved. If there is renewed interest, I can dust off the code and put out another proposal. See User:Tcncv/Table_Sort_Demo for a set of demo tables. You will need to add importScript('User:Tcncv/sorttables.js'); to your monobook.js file (or appropriate xxx.js file for your chosen skin) to see the enhancements in action with the demo cases. Adding class="tsx_sortable" to your own tables will enable the demo for them as well. I added the above table to the bottom of the demo page (here) and it behaves just as you have requeested.
So is there any interest? -- Tom N (tcncv) talk/contrib 00:56, 4 January 2011 (UTC)[reply]
Like I said, since all wikibits.js code is deprecated after 1.17, any effort is probably better spent in helping with the integration of tablesorter.com code (which also supports this). —TheDJ (talkcontribs) 11:10, 5 January 2011 (UTC)[reply]

As we still have not fixed the horrible way the "featured article star" looks in the inter-language links section, may I propose that we remove the star and replace it with a more subtle "mark the inter-language link in boldface"-effect instead? I think this would fit better with Vector's visually less distracting design. I would suggest doing exactly the same for the "good article plus-sign". A featured article on a small Wikipedia is less likely to be more in-depth than a good article on, for example, the German Wikipedia. So I do not think it really justifies using any "visual bandwidth" to make this distinction (a distinction which is likely to only be confusing to casual readers in the first place anyway). —Ruud 20:27, 1 January 2011 (UTC)[reply]

Looks just fine to me. Perhaps you should make a screenshot to better point out what bothers you about it. —TheDJ (talkcontribs) 00:39, 2 January 2011 (UTC)[reply]
I'm not really sure if adding a screenshot would be that helpful, simply take a look at "Moon" ;) I designed the star to look nice in Monobook. In Vector it is misaligned, too close to the text, has the wrong proportions (compared to the triangle next to Toolbox, Languages), wrong colour (monobook-yellow :), ...
And to clarify on the featured vs. good article part. How is a causal reader to know that a "yellow" blob next to a link is better than "green-white" blob? A single visual indication would be intuitive to understand, having multiple is not and only distracts. —Ruud 05:08, 2 January 2011 (UTC)[reply]
I thought was "featured-gold", not "monobook-yellow". I agree the star is too close; the metrics don't match up with the rest of the side bar. I'll fix that in Vector.css now. I think the proportions are OK; the sidebar font in Vector is bigger that that of Monobook, so I think it is actually less disproportionate. But you can always propose a better looking icon. EdokterTalk 12:58, 2 January 2011 (UTC)[reply]

Why is there any sort of indication at all? Let's say that I go to the Dog article to read about dogs. Am I supposed to look at the interwiki links and think to myself, "oh, I should learn Catalan so I can read more about dogs"? — RockMFR 19:41, 2 January 2011 (UTC)[reply]

No, but you could be a Catalan who knows English, stumble here, learn about the Catalan Wikipedia, see the article isn't so good and decide to bring it up to feature standards... or any imaginable scenario just like it. Point is, we promote and highlight featured articles on all projects. EdokterTalk 21:22, 2 January 2011 (UTC)[reply]

Collapsible rows

Collapsible rows (in contrast to the existing collapsible tables) would be useful for taxoboxes like those in Fomes fomentarius (where an ugly hack with a table-inside-a-table is now used). I've implemented this feature in User:Ucucha/collapse.js, with an example here. Could this be added to common.js? Ucucha 23:25, 3 January 2011 (UTC)[reply]

Although the styling is a little off, nesting collapsible structures is not particularly "ugly". Collapsible tables, and collapsible divs and lists, are now included in the latest version of MediaWiki, which should hopefully be making its way onto Wikimedia wikis in the very near future. Anything we develop in the interim should be designed to be as compatible as possible with that implementation. Happymelon 00:04, 4 January 2011 (UTC)[reply]