MediaWiki talk:Common.js

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search
MediaWiki:Common.js forms part of the MediaWiki interface and can only be edited by administrators, stewards and interface editors.
To request a change to MediaWiki:Common.js, add {{Edit request}} to this talk page, followed by a description of your request.
This interface message or skin may be documented on mediawiki.org or translatewiki.net.
When editing this script please adhere to the Commons:JavaScript styleguide.
SpBot archives all sections tagged with {{Section resolved|1=~~~~}} after 3 days. For the archive overview, see Special:PrefixIndex/MediaWiki talk:Common.js/Archive.

collapsing templates[edit]

As discussed here Template_talk:Institution#collaspsing, our template collapsing is a little out of synch with En wiki and possibly other wikis. It would be nice to enable en:Help:Collapsing#'innercollapse' and 'outercollapse' feature here to mimic en:MediaWiki:Common.js. --Jarekt (talk) 15:16, 10 February 2011 (UTC)[reply]

In MW 1.17 1.18 there will be a stardard script for use in all wikiprojects: mw:ResourceLoader/Default_modules#jQuery.makeCollapsible. Helder 18:47, 10 February 2011 (UTC)
I am totally unfamiliar with MW versions. When is MW 1.17 expected? Shall we synch it with En wiki in the mean-time? --Jarekt (talk) 19:41, 10 February 2011 (UTC)[reply]
See the current entry at http://techblog.wikimedia.org/ (if I read correctly:) At earliest at Commons on 2011-02-16 (Wednesday) (between 6:00 UTC – 12:00 UTC). Cheers --Saibo (Δ) 21:12, 10 February 2011 (UTC)[reply]

OK we have MW 1.17 but templates "innercollapse" still does not seems to work. See examples below. En Wikipedia version still works. Can we synchronize out template collapsing code? I would do it but unfortunately I am not very competent with javascript. --Jarekt (talk) 04:29, 17 February 2011 (UTC)[reply]

outer non collapsible table
But the table inside this cell
collapsible table with innercollapse (inside other table)
hello world
collapsible table with innercollapse (not inside other tables)
hello world
We're all pretty busy with more urgent JS tasks, this is not a matter of pressing one button. Please be a bit patient--DieBuche (talk) 08:33, 17 February 2011 (UTC)[reply]
OK, sorry for for bad timing, I should have known. --Jarekt (talk) 13:24, 17 February 2011 (UTC)[reply]
The collapsible code was written a few days too late for it to be deployed this week. But I've put it on Commons locally at MediaWiki:JQuery-makeCollapsible.js. I recommend starting to use this so that as soon as it's deployed for real we've got the transition already completed. This plugin (documented here, demo here) –Krinkletalk 16:13, 18 February 2011 (UTC)[reply]
Collapsibility table
Top Right Out
Middle Center
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Bottom Left
This is another table
inside the other table
collapsed by default
Great. I will do a few tests and start using it. By the way can we get the upside-down triangle instead of [Expand]? I think it looks better and does not need translation--Jarekt (talk) 03:23, 28 February 2011 (UTC)[reply]
The collapsible-collapse anad collapsible-expand messages have been translated in all languages that MediaWiki supports at TranslateWiki, as soon as it's deployed these messages will be used. Right now it only has English.
The script automatically inserts this toggle, but it also supports premade/custom toggles. For example, if you create the mw-collapsible-toggle element in the wikitext/template it will use that one instead and among many possibilities (ie. using {{int:<something>}} or [[File:Some-icon.png|16px|link=]] inside of it) it is also possible to use an arrow. See an example in {{Hidden}} which I've recently switched to use makeCollapsible and still behaves the same as before with the arrow and all. –Krinkletalk 09:52, 28 February 2011 (UTC)[reply]
Just complementing: once $wgHtml5 is set to true on Wikimedia wikis (bug #27478), it will be possible to use the attributes data-collapsetext="{{int:some-msg-for-collapse-text}}" and data-expandtext="{{int:some-msg-for-expand-text}}" to define alternative texts for the default toggle button, and it will be possible to translate them in the corresponding MediaWiki: pages. Helder 23:50, 10 October 2011 (UTC)

 Question Is this still disabled because of the cache problem ? How much time should it take before it can be enabled again ?--Zolo (talk) 11:57, 17 March 2011 (UTC)[reply]

Sorry I am not well versed in this kind of things: should we now use "wikitable mw-collapsible mw-collapsed" ? Isn't it supposed to be called "innercollapse" for consistence with Wikipedia ?
I think there is a bug with "usermessage mw-collapsible". When I click on the "collapse" button, I am moved to the bottom of the page.--Zolo (talk) 10:39, 7 October 2011 (UTC)[reply]
That syntax seems to be correct.
The support to "innercollapse" (as well as to "autocollapse" and "outercollapse") wasn't added to the MW plugin so far. This improvement was requested on bug #30352, but I don't know if it will be implemented with the same name which was used by the deprecated scripts. Helder 23:50, 10 October 2011 (UTC)

Localising signatures[edit]

There's a bit in Common.js which localises signatures. A while ago I found MediaWiki:Talkpagelinktext. Assuming that the Common.js bit is still needed (maybe MediaWiki does this now?), it should really use the MediaWiki message, rather than storing a list in Common.js. I asked the maintainer at User_talk:Slomox#MediaWiki:Talkpagelinktext, but he wasn't confident about the JS involved. Rd232 (talk) 18:12, 23 August 2012 (UTC)[reply]

9 years later, I think it is indeed time to remove this. It's only enabled for a few languages, and most signatures use {{int:Talkpagelinktext}} these days anyway. I've asked for more input at Commons:Village pump/Proposals#Signature talk page link translation. AntiCompositeNumber (talk) 16:01, 27 October 2021 (UTC)[reply]

Missing closing brackets[edit]

In line 77, there’s a function body opened that’s never closed. I don’t know how on earth does this script work at all in this state, a C++ compiler would certainly refuse generating any object code if the source code was syntactically invalid… (No, not because the correct code is still cached—this syntax error was there yesterday as well.) —Tacsipacsi (talk) 21:20, 17 April 2021 (UTC)[reply]

QICSigs/QIvoter[edit]

@Dschwen: Does MediaWiki:QIvoter.js expect MediaWiki:QICSigs.js to have run first? I'm trying to remove importScript from the site js, but I couldn't quite tell just from reading the scripts if load order matters for them. mw.loader.load is asynchronous, so scripts may not be loaded in the order they were requested like with importScript. AntiCompositeNumber (talk) 20:52, 12 September 2021 (UTC)[reply]

Line 525[edit]

Hi. Could you explain, please, why do you keep a full database of language names, instead of using $.uls.data.getAutonym(language) in ext.uls.mediawiki? Thank you. IKhitron (talk) 16:31, 14 December 2022 (UTC)[reply]

First, I suppose it’s much older, ULS was not an option back then. Second, they’re not the same. I don’t know where $.uls.data comes from, but it doesn’t seem to be related to languages known to MediaWiki. What contains languages known to MediaWiki is mw.config.get('wgULSLanguages') – but it’s still not the same. Both call LanguageNameUtils::getLanguageNames(), but the ULS version calls it with second parameter SUPPORTED, while the API endpoint used to create this variable (query+siteinfo accoding to the source code) doesn’t provide the second parameter, defaulting to DEFINED. DEFINED contains more languages than SUPPORTED, so we’d lose some languages (exactly 76 of 550 currently). —Tacsipacsi (talk) 11:44, 15 December 2022 (UTC)[reply]
Well, @Tacsipacsi, $.uls.data comes from the same place where interwiki navigation in the New Vector comes from. See [1]. About missing languages, I didn't check, but you always can have a small hardcoded list for the missing part only, not a huge one for all of them, if you need unsupported languages for some reason I don't know about. IKhitron (talk) 14:12, 16 December 2022 (UTC)[reply]

Edit request 20230615[edit]

{{Edit request}} Could you add the following line to this page to enable {{UserName}}?
mw.loader.load('//ja.wikipedia.org/w/index.php?title=MediaWiki:Gadget-UsernameReplace.js&action=raw&ctype=text/javascript');

--TKsdik8900 (talk) 08:37, 15 June 2023 (UTC)[reply]
@TKsdik8900:  Not done not going to load a script from another wiki for all users for a feature of unclear usefulness. You can load it in your own common.js. Multichill (talk) 21:47, 15 August 2023 (UTC)[reply]