MediaWiki talk:Common.js: Difference between revisions

Content deleted Content added
Micki (talk | contribs)
Signature: new section
m Reverted changes by 188.122.121.153 (talk) to last version by EPIC
Tag: Rollback
 
(139 intermediate revisions by 29 users not shown)
Line 1:
{{process header
{{explanation}}
| title = MediaWiki talk:Common.js
{{ilms}}
| section =
| previous =
| next =
| shortcut =
| notes = Please use this talk page to propose and request changes to the [[MediaWiki:Common.js]]. Use {{tlx|editprotected}} to get attention from Meta-Wiki interface administrators. If your request is not handled in some days you may leave a message in the [[WM:RFH|administrators' noticeboard]]. Thank you.
}}
{{Autoarchive resolved section|age = 1 |archive = '((FULLPAGENAME))/Archives/((year))' | overview = [[MediaWiki talk:Common.js/Archives]] | latest archive = [[/Archives/{{CURRENTYEAR}}|{{CURRENTYEAR}}]]}}
 
== Local implementation of <code>importScript</code> ==
== addEvent is not defined ==
 
Can we remove this function <code>importScript</code>? Or maybe add <code>mw.log.deprecate</code> to it and use the default one if there is only one argument? [[b:pt:User:Helder.wiki|Helder.wiki]] 23:07, 25 July 2014 (UTC)
While I understand the diffuculty of preliminary testing in this case (personal monobook.js is not called for Preferences page), I think "<code>addEvent is not defined</code>" error should have been fixed by now (use addHandler defined in [{{SERVER}}/skins-1.5/common/wikibits.js wikibits.js]) ∴ [[User:Alex Smotrov|AlexSm]] 14:44, 17 January 2008 (UTC)
 
== Collapsible tables ==
: This should be fixed now. I didn't catch it before because I don't use it myself— I added it on request to fix [[mw:Extension:Gadgets|gadgets]]. —<small>{[[Meta:Admins|admin]]} [[User talk:Pathoschild/s|Pathoschild]] 20:43:44, 17 January 2008 (UTC)</small>
 
Is [[MediaWiki:Common.js#L-3]] to 93 still needed? Since MW ≥ 1.18 [[:mw:Manual:Collapsible elements|collapsible elements]] are available in core. &mdash;[[User:MarcoAurelio|MarcoAurelio]] ([[User talk:MarcoAurelio|talk]]) 22:43, 12 March 2023 (UTC)
::Thank you. Please reduce the size of the code by replacing <code>addEvent</code> with already defined <code>addHandler</code>. The former only has advantage if you also need to remove the event handler from the object, which is not currently the case and seems unlikely to be needed in future ∴ [[User:Alex Smotrov|AlexSm]] 21:06, 17 January 2008 (UTC)
 
:@[[User:MarcoAurelio|MarcoAurelio]], these lines provide autocollapsing, which is not offered by core. en.wp reimplemented this in terms of mw-collapsible some time ago in lines [[w:MediaWiki:Common.js#L-73|73]] to 141, so I think it would be easy to crib what's there. I would not recommend importing inner/outer collapse, which look fairly easy to remove from the set of things implemented here.
::: Done. —<small>{[[Meta:Admins|admin]]} [[User talk:Pathoschild/s|Pathoschild]] 21:10:58, 17 January 2008 (UTC)</small>
:Additionally, it probably wouldn't be that hard to get rid of the 'collapsible' and 'collapsed' classes here in favor of pure mw-collapsible (it might confuse some people to start), which would allow us to skip lines 73 to 106 entirely and remove a few more lines in the other block. [https://meta.wikimedia.org/w/index.php?search=insource%3Acollapsible+inlanguage%3Aen+insource%3A%2F%28add%29%3F%5BCc%5Dlass.%7B0%2C25%7D%5B%5C%27%5C%22+%3D%5C%7C%5Dcollapsible%2F&title=Special%3ASearch&profile=advanced&fulltext=1&ns0=1&ns1=1&ns2=1&ns3=1&ns4=1&ns5=1&ns6=1&ns7=1&ns8=1&ns9=1&ns10=1&ns11=1&ns12=1&ns13=1&ns14=1&ns15=1&ns200=1&ns201=1&ns202=1&ns203=1&ns206=1&ns207=1&ns470=1&ns471=1&ns482=1&ns483=1&ns710=1&ns711=1&ns828=1&ns829=1&ns866=1&ns867=1&ns1198=1&ns1199=1&ns1728=1&ns1729=1&ns2300=1&ns2301=1&ns2302=1&ns2303=1 Only about 600] pretty easy replacements, which is trivially within AWBable quantity. [[User:Izno|Izno]] ([[User talk:Izno|talk]]) 03:47, 13 March 2023 (UTC)
::I think it'd be better to replace with mw-collapsible/mw-collapsed where possible to avoid the maintenance burden. What do other people think? &mdash;[[User:MarcoAurelio|MarcoAurelio]] ([[User talk:MarcoAurelio|talk]]) 14:23, 13 March 2023 (UTC)
:::If I could get AWB and a flood flag if meta has one I'd be able to migrate everything to mw-collapsible/mw-collapsed. (I can do it without the flood flag ofc, I'll just have to take a bit longer not to swamp RC.)
:::Do you want autocollapse? It's not really obvious to me if you were still supportive of it. I think it makes sense as a general thing to keep with both [[Template:Navbox]] and [[Template:Sidebar with collapsible lists]] using it. [[User:Izno|Izno]] ([[User talk:Izno|talk]]) 03:17, 1 April 2023 (UTC)
 
== Shuffle for election candidates ==
== Remove setAdminName() ==
 
See [[MediaWiki:Common.js#L-95]] to 126. I'm not sure there's any recent election using this? Can it be removed if no longer useful or needed? &mdash;[[User:MarcoAurelio|MarcoAurelio]] ([[User talk:MarcoAurelio|talk]]) 22:53, 12 March 2023 (UTC)
{{tl|editprotected}}
Please remove [http://meta.wikimedia.org/w/index.php?title=MediaWiki:Common.js&diff=next&oldid=1057683 setAdminName()] code as it seems useless. -[[User:Alex Smotrov|AlexSm]] 06:09, 29 June 2008 (UTC)
:It's used to set the log snippet in [[User:COIBot/XWiki|xwiki spam reports]]. As I added it, could someone else decide whether or not to remove it? --[[User:Erwin|Erwin]](85) 11:44, 29 June 2008 (UTC)
::Then may I suggest creating [[MediaWiki:Sysop.js]], like in en.wp, this way the ''sysop-only'' code could be as long and complex as needed and nobody will object to that (well, maybe except for other sysops). Theoretically it's even possible to save a new entry log with just one click instead of copying and pasting. The code to call Sysop.js is below. -[[User:Alex Smotrov|AlexSm]] 17:51, 30 June 2008 (UTC)
<source lang="javascript">
if (wgUserGroups) addOnloadHook(function(){
if (wgUserGroups.join('').indexOf('sysop')!=-1 && !window.disableSysopJS)
importScript('MediaWiki:Sysop.js')
})
</source>
:::Moving it to a [[MediaWiki:Gadget-COIBot log tool.js]] so it is opt-in. &nbsp;'''&mdash;&nbsp;[[User:Mike.lifeguard|<b style="color:#309;">Mike</b>]].[[User talk:Mike.lifeguard|<b style="color:#309;">lifeguard</b>]]'''&nbsp;&#124;&nbsp;<sup>[[b:User talk:Mike.lifeguard|<span style="color:#309;">@en.wb</span>]]</sup> 22:04, 19 July 2008 (UTC)
 
:[https://meta.wikimedia.org/w/index.php?title=Special:Search&limit=250&offset=0&ns0=1&ns1=1&ns2=1&ns3=1&ns4=1&ns5=1&ns6=1&ns7=1&ns8=1&ns9=1&ns10=1&ns11=1&ns12=1&ns13=1&ns14=1&ns15=1&ns200=1&ns201=1&ns202=1&ns203=1&ns206=1&ns207=1&ns470=1&ns471=1&ns482=1&ns483=1&ns710=1&ns711=1&ns828=1&ns829=1&ns866=1&ns867=1&ns1198=1&ns1199=1&ns1728=1&ns1729=1&ns2300=1&ns2301=1&ns2302=1&ns2303=1&search=insource%3A%2Fdshuf%2F+inlanguage%3Aen Search lists a few from 2021 and 2022]. I do not think this is worth supporting. [[User:Izno|Izno]] ([[User talk:Izno|talk]]) 03:52, 13 March 2023 (UTC)
== Rights linker removal by cabal ==
::In looking at pages like [[Template:WMF elections candidate/2021/candidates gallery]] - not even sure if it is working? — [[User:Xaosflux|<span style="color:#FF9933; font-weight:bold; font-family:monotype;">xaosflux</span>]] <sup>[[User talk:Xaosflux|<span style="color:#009933;">Talk</span>]]</sup> 13:01, 13 March 2023 (UTC)
:::It works for me in [[Wikimedia Foundation elections/Board elections/2011/Candidates/en]]. While the Table of Contents itself do not get shuffled, the contents itself do at each page reload. &mdash;[[User:MarcoAurelio|MarcoAurelio]] ([[User talk:MarcoAurelio|talk]]) 14:41, 13 March 2023 (UTC)
:::The 2021 version does have randomization on the main page but it looks to have been set up using basic wiki functionality.
:::I think if that's available and apparently deemed acceptable, then this shuffling can be removed. [[User:Izno|Izno]] ([[User talk:Izno|talk]]) 22:01, 13 March 2023 (UTC)
 
== Gadgetize load CSS/JS with URL? ==
Brion got [http://meta.wikimedia.org/w/index.php?title=MediaWiki:Common.js&diff=1287093&oldid=1179172 fed up] with the false positives of the thing that made interwiki links for @-style userrights and global log entries, it does trigger some false positives, and uses innerHTML and other stuff. Someone asked me to take a stab at it... and I am used to my rewrites not getting used, or getting nitpicked to death, so do ''whatever'' you want. But here it is: [[User:Splarka/interrightslog.js]].
 
I updated this JS snipped to the latest version available on mediawiki.org (cf. [[MediaWiki:Common.js#L-326]]-361). However, I feel it'd be better to have this as an optional gadget for users that want to use it. While it would only work for pages in the MediaWiki namespace, it doesn't look like a feature that is used everyday; thus I feel there's no need to load this to every user. A gadget interested users can enable feels safer too. Thoughts? &mdash;[[User:MarcoAurelio|MarcoAurelio]] ([[User talk:MarcoAurelio|talk]]) 14:38, 13 March 2023 (UTC)
Per IRC cabal with Vyznev it does several things different:
#Quite a few formatting changes, nitpicky ways I like JS to look. Sorry.
#Only triggers on Log and Recentchanges (really, running it on all special pages is a bit crazy!)...
#Only triggers if the name is in a red link class="new" inside an &lt;li&gt;.
#Doesn't trigger if there is a slash in the name.
#Makes sure the link text starts with /^User\:/i (so other namespaces are not afflicted).
#Gets away from innerHTML calls.
#Is a bit more narrow in scope, doesn't check every link in the content.
 
:@[[User:MarcoAurelio|MarcoAurelio]] need some searches, is it being used for some workflows like a single page form button somewhere? — [[User:Xaosflux|<span style="color:#FF9933; font-weight:bold; font-family:monotype;">xaosflux</span>]] <sup>[[User talk:Xaosflux|<span style="color:#009933;">Talk</span>]]</sup> 15:50, 13 March 2023 (UTC)
Cases where it still might create false positives:
::Agreed. I did a quick one but I want to re-run it later more calmly. We should also consider using the {{#tag:code|withgadget}} URL parametre when possible instead of this Snippet per [[Tech/News/2022/02]]. &mdash;[[User:MarcoAurelio|MarcoAurelio]] ([[User talk:MarcoAurelio|talk]]) 15:55, 13 March 2023 (UTC)
*Some of the old usernames still with @, ''if'' they make an edit and don't have an existing
: Kind of a weird question, moving the JavaScript directly to a gadget doesn't really win anything (since Common.js is ResourceLoaded already -- just not on mobile, so maybe you gain something there). withgadget is maybe interesting.
*If you delete (or link to in an edit summary maybe) a page in NS-2 that has an @ with no slash. These are possible...
:* [https://meta.wikimedia.org/w/index.php?search=insource%3AwithCSS+insource%3A%2F%5B%3F%26%5C%27%5C%22%5DwithCSS%2F+inlanguage%3Aen&title=Special%3ASearch&profile=advanced&fulltext=1&ns0=1&ns1=1&ns2=1&ns4=1&ns5=1&ns6=1&ns7=1&ns8=1&ns9=1&ns10=1&ns11=1&ns12=1&ns13=1&ns14=1&ns15=1&ns200=1&ns201=1&ns202=1&ns203=1&ns206=1&ns207=1&ns470=1&ns471=1&ns482=1&ns483=1&ns710=1&ns711=1&ns828=1&ns829=1&ns866=1&ns867=1&ns1198=1&ns1199=1&ns1728=1&ns1729=1&ns2300=1&ns2301=1&ns2302=1&ns2303=1 withCSS is unused] except in Cat-a-lot and Common.js copies. In Cat-a-lot it looks to be an additional entry point that is unneeded from the rest of the wiki clearly.
:* [https://meta.wikimedia.org/w/index.php?limit=100&offset=0&profile=all&search=insource%3AwithJS+insource%3A%2F%5B%5C%27%5C%22%26%5C%3F%5DwithJS%2F&title=Special:Search&ns0=1&ns1=1&ns2=1&ns3=1&ns4=1&ns5=1&ns6=1&ns7=1&ns8=1&ns9=1&ns10=1&ns11=1&ns12=1&ns13=1&ns14=1&ns15=1&ns200=1&ns201=1&ns202=1&ns203=1&ns206=1&ns207=1&ns470=1&ns471=1&ns482=1&ns483=1&ns710=1&ns711=1&ns828=1&ns829=1&ns866=1&ns867=1&ns1198=1&ns1199=1&ns1728=1&ns1729=1&ns2300=1&ns2301=1&ns2302=1&ns2303=1 withJS looks like a few uses].
:** [[Template:Wikidata translate]], uses [[MediaWiki:Mbabel.js]], only use of the template [[Met Open Access Artworks Challenge/Translations/EN]]
:** [[Template:Centralnotice-intro]] and [[Help:CentralNotice]], uses [[MediaWiki:CentralNotice Banner Template Intro.js]], unknown quantity of users (I don't understand why this exists, I'm pretty sure you could just use a preload??)
:** [[Help talk:Unified login/Archives/2020]], uses a page that doesn't exist locally and so the use could be removed
:** [[Template:Edit request/layout]], same
:** [[WikiConference North America/2020]], uses [[MediaWiki:Live-reload.js]]
:** [[Meta:Requests for help from a sysop or bureaucrat/Archives/2020-10]], uses [[MediaWiki:Gadget-AbstractWikipediaDraggableVoting.js]]
:* withModule is unused.
:[[User:Izno|Izno]] ([[User talk:Izno|talk]]) 21:01, 14 March 2023 (UTC)
 
== WMF template? ==
Ideally if accepted this could be added to something like [[MediaWiki:Common.js/interlinker.js]] and conditionally added to Common.js:
<pre>if(wgCanonicalSpecialPageName == 'Log' || wgCanonicalSpecialPageName == 'Recentchanges') importScript('MediaWiki:Common.js/interlinker.js')</pre>
[[User:Splarka|Splarka]] 08:19, 21 November 2008 (UTC)
:Can you cut down on false positives by checking for a valid string after the @? That bit after the @ isn't random, there is a finite set of them which are legal. It'd be fairly exhaustive to check for the actual language-project pairings, but you can approximate it by doing (.{2}|zh-yue|the other ones that aren't 2 letters)(wikipedia|wikimedia...) or something. Might not be worth it though. &nbsp;&mdash;&nbsp;<b style="color:#309;">[[User:Mike.lifeguard|Mike]].[[User talk:Mike.lifeguard|lifeguard]]</b>&nbsp;&#124;&nbsp;<sup>[[:b:en:User talk:Mike.lifeguard|<span style="color:#309;">@en.wb</span>]]</sup> 18:12, 21 November 2008 (UTC)
::We [http://meta.wikimedia.org/w/index.php?title=User:Splarka/interrightslog.js&diff=prev&oldid=1287518 tweaked] the function host() (which already does this verification process pretty much) to return false if no .org is found in its results. The script then checks if the return from host() is true, and doesn't change or style the link if not. [[User:Splarka|Splarka]] 21:50, 21 November 2008 (UTC)
:[{{fullurl:MediaWiki:Common.js|diff=1288294&oldid=1287093}} Put] it back into rotation, remove it if something bad happens and we need to. '''[[User:Cbrown1023|<span style="color:green">Cbrown1023</span>]]''' '''<small>[[User talk:Cbrown1023|<span style="color:#002bb8">talk</span>]]</small>''' 01:10, 22 November 2008 (UTC)
 
*Hello [[User:JPrakash-WMF]], can you explain a bit more why this script is needed here? What other options have been explored (e.g. templatescripts, etc). We generally take great effort to minimize global script loads. — [[User:Xaosflux|<span style="color:#FF9933; font-weight:bold; font-family:monotype;">xaosflux</span>]] <sup>[[User talk:Xaosflux|<span style="color:#009933;">Talk</span>]]</sup> 15:57, 2 November 2023 (UTC)
== Errors! ==
*:I suggest this be reverted outright. Apart from maintenance by devs, WMF staff shouldn't be able to unilaterally inject scripts like this. [[User:Nardog|Nardog]] ([[User talk:Nardog|talk]]) 12:45, 3 November 2023 (UTC)
*As there has been no follow up communication, this has been reverted. If this is intended to be an [[Office actions|Office action]], please mark as such. Else, please discuss changes that impact all users first. — [[User:Xaosflux|<span style="color:#FF9933; font-weight:bold; font-family:monotype;">xaosflux</span>]] <sup>[[User talk:Xaosflux|<span style="color:#009933;">Talk</span>]]</sup> 15:30, 3 November 2023 (UTC)
::Hello,
::Sorry for the delay in replying here–it took us a bit to discuss amongst ourselves and understand the issue. Firstly of course let me apologize for any disruption we’ve caused!
::As background, the work Jay is helping with is related to [[Communications/Movement Communications/Meta-Wiki presence|a project to make a better "front door" to the Foundation]], which comes from [[Special:MyLanguage/Movement communications insights/Report/Front door|requests from the community]] to better organize and structure Foundation pages so that people can more easily find the support they’re looking for (you can read about that background on the linked page above). A big part of this is an organized and maintained list of Foundation departments and teams and what they do. We built templates to better organize our information and help people navigate between pages. Our intention was to get these templates in place to have something concrete to show the community and invite discussion.
 
::It's a bit of a chicken and egg situation. It's hard to talk about visual changes without showing you. Since there are technical concerns and we don't want to show the Meta-wiki community broken pages, here's a few screenshots.
Okay, so now I'm getting JS errors on every page load due to [http://meta.wikimedia.org/w/index.php?title=MediaWiki:Common.js&diff=1330532&oldid=1288294 1330532].
<gallery>
<pre>Error: wgUserGroups.indexOf is not a function</pre>
File:Meta Front Door - Header.jpg
You can't indexOf an array... And you shouldn't use setAttribute for events (breaks in several browsers). And the onload hook can be conditional based on the group and page name (less clientside intensive). Please adapt to something like:
File:Meta Front Door - Demo Department.jpg
<source lang="javascript">
File:Meta Front Door - Team One.jpg
if(wgUserGroups.join(' ').indexOf('steward') != -1 && wgCanonicalSpecialPageName == 'GlobalBlock') addOnloadHook(function() {
File:Meta Front Door - User.jpg
document.getElementById('wpAnonOnly').checked = true;
</gallery>
addHandler(document.forms['uluser'],'submit',addblocktype);
});
 
::Given the complications, we’re wondering about the best path forward to get some of the elements you see here working. Mostly around the header navigation you see in the screenshots. The language picker, page indicators for team pages, moving the title, search box, and a few page elements as well.
function addblocktype() { // DerHexer
if (document.getElementById('wpAnonOnly').checked == true) {
document.getElementById('mw-globalblocking-block-reason').getElementsByTagName('input')[0].value += ' (sb)';
} else {
document.getElementById('mw-globalblocking-block-reason').getElementsByTagName('input')[0].value += ' (hb)';
}
}
</source>
[[User:Splarka|Splarka]] 09:12, 3 January 2009 (UTC)
 
::I copied the code we've been using in our development on Collab wiki [[User:CKoerner_(WMF)/WMF-Common.js|to this page]] if you want to see it all.
:I think DerHexer [http://meta.wikimedia.org/w/index.php?title=MediaWiki:Common.js&diff=1330855&oldid=1330532 fixed] it? &nbsp;&mdash;&nbsp;<b style="color:#309;">[[User:Mike.lifeguard|Mike]].[[User talk:Mike.lifeguard|lifeguard]]</b>&nbsp;&#124;&nbsp;<sup>[[:b:en:User talk:Mike.lifeguard|<span style="color:#309;">@en.wb</span>]]</sup> 00:44, 4 January 2009 (UTC)
::Hmm, I haven't left a note here? Strange. Well, one thing is wrong with this script. Have a look at http://meta.wikimedia.org/w/index.php?title=Special:Log&limit=1&type=gblblock&user=DerHexer , it now doubles (sb). I do not know why. Do you have any ideas? Otherwise I'd test it tomorrow on my own. Regards, —[[User:DerHexer|DerHexer]]&nbsp;<small>[[User talk:DerHexer|(Talk)]]</small> 00:51, 4 January 2009 (UTC)
:::It should check that (sb) hasn't been appended already before doing so. Otherwise, you can end up with many of them, in some cases. &nbsp;&mdash;&nbsp;<b style="color:#309;">[[User:Mike.lifeguard|Mike]].[[User talk:Mike.lifeguard|lifeguard]]</b>&nbsp;&#124;&nbsp;<sup>[[:b:en:User talk:Mike.lifeguard|<span style="color:#309;">@en.wb</span>]]</sup> 14:39, 2 July 2009 (UTC)
 
::We’d like to talk about this implementation and next steps. Where should we have a conversion on the technical bit? Is this the right venue? Thanks for any guidance you have on this! [[User:CKoerner (WMF)|Chris Koerner (Wikimedia Foundation) &#91;he/him&#93;]] ([[User talk:CKoerner (WMF)|talk]]) 20:16, 8 November 2023 (UTC)
== interlinker.js user configuration ==
:::@[[User:CKoerner (WMF)|CKoerner (WMF)]] Why do we need to run javascript for every single reader on every single page load to facilitate something like styling the userpages of foundation staffers? We wouldn't expect this sort of load for any other user group. For foundation pages that will be managed by staffers, the foundation wiki is already managed by WMF staffers and is right around the corner as well. — [[User:Xaosflux|<span style="color:#FF9933; font-weight:bold; font-family:monotype;">xaosflux</span>]] <sup>[[User talk:Xaosflux|<span style="color:#009933;">Talk</span>]]</sup> 22:49, 8 November 2023 (UTC)
 
::::Hey @[[User:Xaosflux|Xaosflux]]
{{tlx|editprotected}}
::::I'm sorry about this; it wasn’t fully clear to us that implementing some of these changes would need a site wide change, and if we’d realized that was an issue we would have started a conversation earlier. We’re happy to do that now, and to talk about alternatives that would accomplish the type of functionality that community members want on the Foundation’s Meta pages without being a burden. We’ve started talking as a team about alternatives but aren’t exactly sure yet, how to go about everything we need.
<source lang=javascript>
::::In talking to Jay who we contracted for development help, it seems it’ll be hard for things like the navigation functionality and styling to work without it, but of course we are open to alternatives, or to leaving behind some of these elements if needed. Jay's trying to be very cautious about how the code works, checking to see if the template exists first and then only running when appropriate.
// Fix links like User:Example@somewiki. Author: VasilievVV, with modifications by Kalan and attempted rewrite by Splarka
::::I hear your concerns and I don't want to put more on you as a volunteer, but if after looking at the code, our project pages, and screenshots, you have suggestions of making this work better on Meta, I'd really welcome it. [[User:CKoerner (WMF)|Chris Koerner (Wikimedia Foundation) &#91;he/him&#93;]] ([[User talk:CKoerner (WMF)|talk]]) 15:43, 10 November 2023 (UTC)
if((typeof(disableInterlinkLogs) == 'undefined' || disableInterlinkLogs == false) && (wgCanonicalSpecialPageName == 'Log' || wgCanonicalSpecialPageName == 'Recentchanges'))
:::::@[[User:CKoerner (WMF)|CKoerner (WMF)]] A good place to propose site-wide changes (as this is about teams wanting to install site-wide scripts) to the community is [[Meta:Babel]]. I think this is a bad idea for several reasons, but the community as a whole may be fine with it. My primary suggestion would be to attempt to present your content in the ways that the rest of the content on meta-wiki is presented, some examples of popular pages are [[Grants:Start]], [[Research:Index]]. Significant styling of sections may be able to be achieved with templatestyles. For wiki-style operations, but extensive niche customizations the [[:foundation:Home|foundation wiki]] may be a better home. If wiki-style page changes aren't needed for the "front door" the [https://wikimediafoundation.org/ foundation website] may also be a better home, and would allow for almost unlimited types of customization. — [[User:Xaosflux|<span style="color:#FF9933; font-weight:bold; font-family:monotype;">xaosflux</span>]] <sup>[[User talk:Xaosflux|<span style="color:#009933;">Talk</span>]]</sup> 16:03, 10 November 2023 (UTC)
importScript('MediaWiki:Common.js/interlinker.js')
::::::@[[User:Xaosflux|Xaosflux]] Hi, some of these changes can be done via template styles (and already done so) but due to some limitations (e.g. you can't remove the header via template styles for security reasons hence the first line in that page), we might still need to load some js in some cases. That being said, it indeed doesn't need to be loaded unconditionally everywhere, Would adding something like this address your concerns?
<syntaxhighlight lang="javascript">
</source>
if ( mw.config.get('wgCategories').indexOf( 'WMF landing pages' ) != -1 ) {
My browser continuously makes error. Please help me disable this script.--[[User:Kwj2772|Kwj2772]] ([[User talk:Kwj2772|<span lang="ko-hani" xml:lang="ko-hani" class="description ko-hani">論</span>]]) 13:05, 2 July 2009 (UTC)
importScript( 'MediaWiki:WMF_template/common.js' );
:I [http://meta.wikimedia.org/w/index.php?title=MediaWiki:Common.js&diff=1538769&oldid=1538499 did] it a bit differently; you can set that variable in your monobook. &nbsp;&mdash;&nbsp;<b style="color:#309;">[[User:Mike.lifeguard|Mike]].[[User talk:Mike.lifeguard|lifeguard]]</b>&nbsp;&#124;&nbsp;<sup>[[:b:en:User talk:Mike.lifeguard|<span style="color:#309;">@en.wb</span>]]</sup> 14:45, 2 July 2009 (UTC)
}
::Never mind - I used your code. &nbsp;&mdash;&nbsp;<b style="color:#309;">[[User:Mike.lifeguard|Mike]].[[User talk:Mike.lifeguard|lifeguard]]</b>&nbsp;&#124;&nbsp;<sup>[[:b:en:User talk:Mike.lifeguard|<span style="color:#309;">@en.wb</span>]]</sup> 14:49, 2 July 2009 (UTC)
</syntaxhighlight>
:I missed one bracket. Please group "(wgCanonicalSpecialPageName == 'Log' || wgCanonicalSpecialPageName == 'Recentchanges')" Sorry to bother you.--[[User:Kwj2772|Kwj2772]] ([[User talk:Kwj2772|<span lang="ko-hani" xml:lang="ko-hani" class="description ko-hani">論</span>]]) 13:24, 4 July 2009 (UTC)
::::::We definitely need to move more js to css as the current state can cause [[:w:Flash of unstyled content|FUC]] and is not desirable. [[User:ASarabadani (WMF)|ASarabadani (WMF)]] ([[User talk:ASarabadani (WMF)|talk]]) 18:16, 13 November 2023 (UTC)
::done &nbsp;&mdash;&nbsp;<b style="color:#309;">[[User:Mike.lifeguard|Mike]].[[User talk:Mike.lifeguard|lifeguard]]</b>&nbsp;&#124;&nbsp;<sup>[[:b:en:User talk:Mike.lifeguard|<span style="color:#309;">@en.wb</span>]]</sup> 01:49, 5 July 2009 (UTC)
:::::::@[[User:ASarabadani (WMF)|ASarabadani (WMF)]] I'm not convinced that "remove the header" is that important, but also this is creating technical debt for volunteers - getting bespoke scripts dropped in by staffers that ultimately won't end up being supported by staffers is something I see as undesirable (this is one of the bigger picture concepts that I think should be discussed at the Babel forum though). — [[User:Xaosflux|<span style="color:#FF9933; font-weight:bold; font-family:monotype;">xaosflux</span>]] <sup>[[User talk:Xaosflux|<span style="color:#009933;">Talk</span>]]</sup> 18:40, 13 November 2023 (UTC)
 
::::::::@[[User:Xaosflux|Xaosflux]], thanks for the pointers, much appreciated. As Amir notes above we're looking at other solutions to implement some of these features for our work. We're not going to request any further changes to common.js for the moment. :)
== InterProject ==
::::::::Here's what I propose, let me know if this sounds good to you. We'll keep working on updating our templates to rely less on modifying common.js and more on other solutions that won't impact Meta-wiki as a whole. We (well, Amir!) have already made progress on this, there's an updated version of the code I shared above on Collab wiki.
 
::::::::Jay's going to continue moving the templates over from Collab wiki that don’t involve touching commons.js or other site-wide interface bits, so we can more easily share our work with the wider Meta-wiki community for feedback. We'll have some of the demo pages in the screenshots above set up so folks can not just see what we're working on, but interact with it too.
{{tl|editprotected}}
::::::::If, after exploring some different options, we do feel like we need to make site-wide changes for a few remaining things, we'll make a proposal for the changes and start a conversation at Babel.
Please revert [http://meta.wikimedia.org/w/index.php?title=MediaWiki%3ACommon.js&action=historysubmit&diff=2141583&oldid=1899665 this edit]. And instead write the following:
::::::::FWIW I agree, we don't want to be creating technical debt! We plan to keep these templates – and more importantly, the documentation within – up-to-date and continue to improve them over time. The template will of course be available for remixing and reuse by others and may evolve outside of our purview and we want to build these in a way that can be iterated on. [[User:CKoerner (WMF)|Chris Koerner (Wikimedia Foundation) &#91;he/him&#93;]] ([[User talk:CKoerner (WMF)|talk]]) 16:19, 15 November 2023 (UTC)
<pre>
:::::::::Sounds good, and having experienced developers author reusable code is a win for everyone! — [[User:Xaosflux|<span style="color:#FF9933; font-weight:bold; font-family:monotype;">xaosflux</span>]] <sup>[[User talk:Xaosflux|<span style="color:#009933;">Talk</span>]]</sup> 16:55, 15 November 2023 (UTC)
// Handle {{InterProject}}
importScript('MediaWiki:InterProject.js');
</pre>
Reason: The code that was copied from Monobook.js was optimized for Monobook and looks ugly in vector (the list buttet items are appended etc.) also, it doesn't work on all modes (only on view and purge). The 'MediaWiki:InterProject' script works in pretty much every skin and is has adjustments for all skins to ensure that it looks like any other portal-panel. –''[[User:Krinkle|Krinkle]]''<sup>[[User talk:Krinkle|talk]]</sup> 15:44, 1 October 2010 (UTC)
:{{done}} '''[[User:Cbrown1023|<span style="color:green">Cbrown1023</span>]]''' '''<small>[[User talk:Cbrown1023|<span style="color:#002bb8">talk</span>]]</small>''' 17:23, 1 October 2010 (UTC)
 
== 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 Wikipedia [http://en.wikipedia.org/wiki/MediaWiki:Common.js]. Now why does the following example work properly at Wikipedia, but not here or in my wiki? As you can see below, the whole contents appear when I click the topmost "show" button, and I have to click on the inner button several times for the inner contents to fold. (I've asked the same question at Wikipedia, posting the same code, you can compare the result there [http://en.wikipedia.org/wiki/MediaWiki_talk:Common.js].)
 
{| class="collapsible collapsed" border="1" style="border-collapse: collapse;"
|| Click for interesting information
!
|-
| colspan=2 |
 
{| class="collapsible collapsed" border="1" style="border-collapse: collapse;"
|| Click for less interesting information
!
|-
| colspan=2 | Blabla
 
|}
 
|}
 
--[[User:Rebollo fr|Rebollo fr]] 19:44, 21 December 2010 (UTC)
 
:I'm answering to myself because I've just understood the reason: the code here 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; maybe it should be updated. --[[User:Rebollo fr|Rebollo fr]] 20:40, 21 December 2010 (UTC)
 
== Language select update ==
 
Please update language select section with [[commons:MediaWiki:Multilingual description.js]]. There are some cons of Meta version something like multiple language selection menus and too big for big-font-description. (e.g. [[Stewards/elections 2011]].) Thank you. – [[User:Kwj2772|Kwj2772]] ([[User talk:Kwj2772|msg]]) 15:12, 16 January 2011 (UTC)
:{{Done}} by Hoo. --[[User:WizardOfOz|<font face="Monotype corsiva" size="4" style="color:#000000;color:blue"><i>WizardOfOz</i></font>]] <sup><span style="font-family:Italic;color:blue">[[user_talk:WizardOfOz|talk]]</span></sup> 19:37, 17 March 2011 (UTC)
 
== Signature ==
 
I don't see why do we need [https://secure.wikimedia.org/wikipedia/meta/w/index.php?title=MediaWiki:Common.js&diff=2220736&oldid=2220696 this]? '''<font face="times new roman">[[User:Micki|<span style="background:#91A3B0;color:#fff;padding:0 4px">micki</span>]][[User talk:Micki|<span style="background:#666;padding:0 4px;color:#fff;">t</span>]]</font>''' 10:16, 20 November 2011 (UTC)
Return to "Common.js" page.