|answered=
Hi again!
Could someone make this update too? Helder.wiki 21:59, 28 February 2014 (UTC)
Hi!
Could someone implement a fix for the problem which causes "Uncaught TypeError: Cannot call method 'addMessages' of undefined"? This was reported in 2012... Helder.wiki 21:50, 28 February 2014 (UTC)
importScript
$.getScript
Could someone apply these changes to MediaWiki:Common.js/watchlist.js to stop the warnings on Special:Watchlist:
Use of "$j" is deprecated. Use $ or jQuery instead.
Helder.wiki 13:28, 15 March 2014 (UTC)
Please read and give your input about what you are looking for in the CodeEditor toolbar —TheDJ (talk • contribs) 00:14, 26 March 2014 (UTC)
Could someone apply some changes to the "Collapsible tables" code to make it more similar to the version which is currently on mediawiki.org? This will make it easier for us to keep these two copies, and the other forks (more or less) synced. I made a related suggestion at mw:MediaWiki talk:Gadget-collapsibleTables.js#Update, to add some updates which were made on English Wikipedia but are not on mw.org yet. This new version deprecates the global window.collapseTable. I tested the code on testwiki:Sandbox, and it works exactly as it does on Help:Collapsing. Helder.wiki 14:49, 14 March 2014 (UTC)
window.collapseTable
mw-collapsible
collapseTable
Could someone apply these changes to MediaWiki:Common.js/edit.js? Whithout it, users who disable the toolbar are still downloading the code of the refToolbar. Helder.wiki 23:14, 7 April 2014 (UTC)
if( !mw.user.options.get( 'showtoolbar' ) || window.refToolbarInstalled || $( '#wpTextbox1[readonly]' ).length ){ return; }
if( cond ){ ... }
if( !cond ){ return; } ...
!mw.user.options.get( 'showtoolbar' )
window.refToolbarInstalled === undefined
window.refToolbarInstalled
$( '#wpTextbox1[readonly]' ).length === 0
$( '#wpTextbox1[readonly]' ).length
mw.user.options
$( initializeRefTools );
mw.loader.using( 'user.options', function () { $( initializeRefTools ); } );
mediawiki
mw.loader
mw.Map
mw.config
mw.messages
mw.Message
mw.html
mw.hook
mediawiki.config
mediawiki.html
jquery
mediawiki.user
mediawiki.legacy.wikibits
mw.user
mw.Title
user.options
loader.using
gadget[dependencies=]
mediawiki.
.mw
mw.util
I would like the code of RefToolbar to be moved into a default gadget (as in pt:MediaWiki:Gadget-refToolbar.js), which would be minified and loaded by ResourceLoader. This would also allow users to disable this script, and facilitate debugging (one can easily disable specific gadgets when looking for the cause of a problem).
Is there any reason not to do so? Helder.wiki 18:38, 7 April 2014 (UTC)
mw.loader.load( '//bits.wikimedia.org/en.wikipedia.org/load.php?modules=ext.gadget.EXAMPLE&only=scripts' )
mw.loader.load( '//en.wikipedia.org/w/index.php?title=MediaWiki:Gadget-EXAMPLE.js&action=raw&ctype=text/javascript&smaxage=21600&maxage=86400' )
ext.gadget.EXAMPLE
mw.loader.load( 'ext.gadget.EXAMPLE' )
Shouldn't there be a consensus for this established on some forum such as VPR before it is implemented here? I am requesting that this consensus be reached before implementation. I don't want to have this as a default thing (as IIRC it conflicts with other tools such as wikEd). — {{U|Technical 13}} (t • e • c) 22:04, 7 April 2014 (UTC)
So, Edokter, after testing a gadget version for a while on testwiki:, I believe it is safe to do the following steps on English Wikipedia:
* refToolbar[ResourceLoader|default|dependencies=user.options,mediawiki.legacy.wikibits]|refToolbar.js
* refToolbarBase[ResourceLoader|hidden|rights=hidden]|refToolbarBase.js
window.*
mw.log.warn( '[[w:en:MediaWiki:RefToolbarBase.js]] was moved to [[w:en:MediaWiki:Gadget-refToolbarBase.js]].' );mw.loader.load( '//en.wikipedia.org/w/index.php?title=MediaWiki:Gadget-refToolbarBase.js&action=raw&ctype=text/javascript&smaxage=21600&maxage=86400' );
mw.log.warn( '[[w:en:MediaWiki:RefToolbarBase.js]] was moved to [[w:en:MediaWiki:Gadget-refToolbarBase.js]].' );
mw.loader.load( '//en.wikipedia.org/w/index.php?title=MediaWiki:Gadget-refToolbarBase.js&action=raw&ctype=text/javascript&smaxage=21600&maxage=86400' );
Helder.wiki 18:02, 12 April 2014 (UTC)
So? Helder.wiki 18:43, 19 April 2014 (UTC)
mw.loader.load
Do I need to make anything else to get thes changes implemented so I can move on to the other parts of the script? Helder.wiki 11:58, 30 April 2014 (UTC)
&smaxage=21600&maxage=86400
Most of the code of version 2.0b (dialogs) is inside of a test like this:
// Only execute on edit, unless it is a user JS/CSS page // TODO: Remove tests already done by [[MediaWiki:Gadget-refToolbar.js]] if ( ( mw.config.get('wgAction') === 'edit' || mw.config.get('wgAction') === 'submit' ) && ( ( mw.config.get('wgNamespaceNumber') !== 2 && mw.config.get('wgNamespaceNumber') !== 4 ) || ( mw.config.get('wgPageName').indexOf('.js') === -1 && mw.config.get('wgPageName').indexOf('.css') === -1 ) ) ) { ... }
On the other hand, the highlighted tests are missing on versions 2.0a (no dialogs) and 1.0. (legacy). Is that the desired behavior? Shouldn't all versions be present in the same set of pages/namespaces?
Helder.wiki 21:43, 30 April 2014 (UTC)
In the interest of fixing the linkFA code in 200+ wikis, I would like to move the code to MediaWiki:Gadget-featured-articles-links.js (and its CSS to MediaWiki:Gadget-featured-articles-links.css?), make it translateable, and import that JS file from each other wiki where the feature is used (as happens with HotCat, for example). What do you think? Helder.wiki 13:46, 26 July 2014 (UTC)
@Helder.wiki: What about the images used here? Will it be possible to use other ones in other Wikipedias? Or the old code from Common/Vector/Monobook.css etc. will work? --Edgars2007 (talk/contribs) 23:36, 16 August 2014 (UTC)
Dear sysops. I think something like
if ( document.getElementById( className + '-fl' ) ) { InterwikiLinks[i].className += ' FL'; InterwikiLinks[i].title = 'This is a featured list in this language.';
should be added there. I don't know whether it's perfectly okay, but something like this. Cause you can't compare a FL with a FA. Also FLs are not FAs. So something kinda this should be added. Thanks. --Pratyya (Hello!) 15:02, 2 August 2014 (UTC)
.FL
.FA
.GA
Hi! I want to let you know that in near future badges will be deployed on Wikidata and the Wikipedias. They help us with displaying the good and featured article icons next to the sitelinks and will replace the javascript hack which is used at the moment together with the Link GA and Link FA templates. To avoid an overlap where the current system and the new feature conflict, I will add a minor fix to your Common.js which adds the class names to the interwiki links. This is part of my task as a global edit interface editor for the Wikidata team. Thanks, Bene* (talk) 10:19, 7 August 2014 (UTC)
Since JavaScript has already been disabled for IE 7 and below (gerrit:157774), could we remove else if ( profile.versionNumber <= 7 ) branch? Chmarkine (talk) 04:05, 20 September 2014 (UTC)
else if ( profile.versionNumber <= 7 )
-- [[User:Edokter]] {{talk}}
@Edokter: Thank you! Also I just realized that the ieCSS can be updated too. For the first rule, @media print is not supported by IE 8 and below [1]. So if the "line-height" issue doesn't exist in IE 9 and above, I think we can just remove it, since it won't work on old IE anyway. Also do these bugs apply to latest versions of IE? If not, I suggest we change MediaWiki:Common.js Line 119 from
ieCSS
@media print
if ( $.client.profile().name === 'msie' )
to
if ( ($.client.profile().name === 'msie') && ($.client.profile().versionNumber < 11) )
The "11" can be replaced with the version number where the three bugs do not exist. In this way, some IE users don't have to load one more file if they don't need it. Chmarkine (talk) 04:03, 21 September 2014 (UTC)
I want to remove these domains from Line 35:
Chmarkine (talk) 02:48, 22 September 2014 (UTC)
sub === 'shop'
(for secure new.js)
var m, main, sub, page, query;
if (m = href.match(re1)) {
// could be changed to
var m = href.match(re1), main, sub, page, query;
if (m) {
// if that would be clearer. —PC-XT+ 17:00, 22 September 2014 (UTC)
Magnus Manske has written a replacement for Wikiminiatlas.js called OSM.js. It is a much nicer map interface as you can see by going to es:Los Barrios and clicking "mapa" in the upper-right corner. Can we switch to it? MoreTomorrow (talk) 01:03, 14 February 2015 (UTC)
I'd like to propose that we add the code from User:Jackmcbarn/switcher.js to MediaWiki:Common.js. You can see a demo of it at User:Jackmcbarn/switcher, and one use case for it is described at Wikipedia talk:WikiProject Architecture#Template:Infobox building maps. There's precedent for this sort of code in the similar createCollapseButtons() function, and other Wikipedias (like frwiki, example) already run similar code. Jackmcbarn (talk) 15:01, 10 October 2014 (UTC)
[default|rights=hidden]
ResourceLoader
rights
editinterface
hidden
This edit (@TheDJ:) added the code to insert buttons to collapse content to the wikipage.content-hook, but this hook can be fired multiple times even though only part of the page changes. You can see this behavior on File:Herculano, Alexandre, História da Origem e Estabelecimento da Inquisição em Portugal, Tomo I.pdf. Note that the author entry is collapsed. Now click "next page". You'll find that a second (and when you click more often even more) button to show the author is inserted. The code to add a button to collapse content must only work on the newly added content, not on the whole page. --Schnark (talk) 09:16, 20 January 2015 (UTC)
wikipage.content
@Edokter: TheDJ added that code so that it works for scripts like User:Js/ajaxPreview (now the links do not appear anymore). Helder 00:50, 10 March 2015 (UTC)
HeaderRow.getElementsByTagName( 'th' )[0];
table.getElementsByTagName( 'th' )[0];
th
tr
table
There is an ongoing discussion that watchers of this page may be interested in on Proposal to add global JavaScript and add an extra step for new users to get live IRC help. — {{U|Technical 13}} (e • t • c) 19:33, 28 April 2015 (UTC)
{{U|Technical 13}} (e • t • c)
Hi (ping TheDJ),
I'd like to know why this script exists? It seems MediaWiki (at least nowadays) provides very similar functionality already.
Here's a screenshot of what File:Example.svg looks like. One line providing links by MediaWiki, and another one produced by MediaWiki:Common.js/file.js: http://i.imgur.com/sU56Czt.png.
If we don't like the labels (e.g. "480px" instead of "480 x 480 pixels") that's something we can work on.
Unless reason to otherwise, I'd like to remove this redundant script as soon as possible. Or at least work it into something that isn't loaded with importScript from MediaWiki:Common.js. Krinkle (talk) 20:11, 3 July 2015 (UTC)
I want to make a concerted effort to clean up the mutitude of collapsible code here. Due to ever-increasing evolution, we now have three method for collapsing:
.mw-collapsible
.collapsible
.navFrame
I want to eliminate the latter two as obsolete. This will break certain scenarios, so there are two things to account for:
.autocollapsible
By slashing a good chuck of Common.js (and some css), we make Wikipedia a good deal faster to load. -- [[User:Edokter]] {{talk}} 10:53, 5 July 2015 (UTC)
I am currently not able to use User:Mr.Z-man/closeAFD2.js due to the "close" tab not appearing on the "more" menu. Since the script was working at the beginning of September 15, and has not recently been modified, I believe that recent edits to this page have caused the difficulty. DavidLeighEllis (talk) 00:59, 16 September 2015 (UTC)
In the style of the Dutch Wikipedia (), and as agreed upon here, would somebody implement something along the lines of what I mocked up here (just a translation of the code used on the Dutch Wikipedia). Thanks. Kharkiv07 (T) 18:13, 13 September 2015 (UTC)
What about inserting a piece of code to protect the site against bad mirroring (e.g. like the one in it:voy:MediaWiki:Common.js)? --Andyrom75 (talk) 07:00, 31 August 2015 (UTC)
Any objections to me adding ?withModule support as in mw:Snippets/Load JS and CSS by URL? Legoktm (talk) 17:38, 13 October 2015 (UTC)
Remove: function addAnonToolbarLinks() and all of it's associated code & comments, as this has now been added to MediaWiki core. Kharkiv07 (T) 19:51, 9 December 2015 (UTC)
The guideline for creating tables in articles/lists on Wikipedia is MOS:DTT. That recommends using captions (|+) to annotate tables and provide them with headers, etc. There is a specific exception for collapsible tables, because the code used for collapsing does not support captions. I've been looking at the relevant bit of code in Mediawiki:Common.js and it seems to me that it would be trivial to add it so that this works correctly. It's not a nice little bit of Javascript (it abuses the id property) but it's not complex and this is a fairly simple addition.
|+
id
It would need to go around line 233.
/* only add button and increment count if the table has content */ var HeaderRow = table.getElementsByTagName( 'tr' )[0]; if ( !HeaderRow ) { return; } var Header = table.getElementsByTagName( 'caption' )[0]; if ( !Header ) { Header = table.getElementsByTagName( 'th' )[0]; if ( !Header ) { return; } }
This adds the content to the caption if it exists and to the first th cell if it doesn't, to support the current functionality. I've tried this out and as far as I can tell this works on caption cells as well as it does on th cells. It would be really good if the MOS-recommended tables worked with captions as well.
caption
If we do this, we would also need to add code to determine whether the first row of the table needs collapsing as well. Perhaps something like:
if ( Button.parentNode.parentNode.nodeName.toLowerCase() === 'caption' ) { var i = 0; } else { var i = 1; }
and then change the loop to
for ( ; i < Rows.length; i++ ) {
I'm not familiar with Wikipedia's JS rules/standards or the processes of this page, so I hope I've got it right! Do let me know if I ought to cross-post to WP:VPT or if this is a perennial proposal that I've missed. Relentlessly (talk) 10:48, 9 October 2015 (UTC)
table.setAttribute( 'id', 'collapsibleTable' + tableIndex );
I've started a documentation snippet at Help:Infobox/user style, transcluded into various relevant pages, on how to hide infoboxes with user CSS. It would be useful for many users who don't like infoboxes (and for WP as a whole, to get those people to give it a rest) to have two alternatives to hiding them: a) be able to have infoboxes be collapsible (including collapsed by default for those users if they want it that way), or b) be able to move them to the bottom. I'm not sure what the most effective way to go about this is with Special:MyPage/common.js. One cannot simply try to shunt the infobox to the bottom with pure CSS. This is notoriously impossible without the moved element overlapping other content [2]. It requires one of several methods of injecting additional HTML and CSS into the document strategically [3], but I'm not sure which of these has the lowest impact, or will even work (given the kinds of "don't do certain things" filtering that MW does).
The most common usage is almost certainly going to be to make them collapsible, and for users who don't like them and to have them collapsed by default. This way, their content would still be available in the frequent cases that MOS:INFOBOX has not been complied with and details are in the infobox but not in the main article body. I myself would like to be able to collapse them after skimming them, especially on mobile. But I'm not sure what the lowest-overhead method is to inject the mw-collapsible class (it doesn't work with either of the other two classes for collapsibility). I have to wonder why infoboxes do not already have this class, uncollapsed by default; I would have thought that would have been implemented immediately. (That said, there is for now a minor display bug with making them collapsible, as I've documented and demoed at Template talk:Infobox#Minor bug.)
I suspect that someone has already worked this out, however, given how many people hate infoboxes. (I'm not among them, but the constant activism by some against infoboxes has led to multiple ArbCom cases, and will lead to more of them, because the anti-infobox warring has not abated. The only solution is to make it easy to move them "out of the way" to remove the inspiration for people's "cleanse" infoboxes from WP or from articles particular wikiprojects where these people have gathered are claiming scope.) — SMcCandlish ☺ ☏ ¢ ≽ʌⱷ҅ᴥⱷʌ≼ 13:02, 6 March 2016 (UTC)
@Edokter and TheDJ: Should we remove the following hack:
/** * Fix for Windows XP Unicode font rendering */ if ( navigator.appVersion.search(/windows nt 5/i) !== -1 ) { mw.util.addCSS( '.IPA { font-family: "Lucida Sans Unicode", "Arial Unicode MS"; } ' + '.Unicode { font-family: "Arial Unicode MS", "Lucida Sans Unicode"; } ' ); }
Wikimedia traffic statistics from June 2015 OS Browser:
—Ruud 13:01, 25 March 2016 (UTC)
Isn't a more future-proof solution to just apply "sans-serif" (or "serif") everywhere? Nemo 10:28, 26 March 2016 (UTC)
This currently affects up to 1.1% of users weighted by page views. Shall we wait 2 or 3 more months until Chrome on XP is really dead and this may fall under 1%? —Ruud 20:34, 26 March 2016 (UTC)
As Windows XP is no longer supported, I have removed the font declarations. -- [[User:Edokter]] {{talk}} 18:12, 25 April 2016 (UTC)