MediaWiki talk:Common.js

Latest comment: 3 months ago by Tacsipacsi in topic Main Page

Obsolete code (and proper attribution) edit

{{Edit request}}

Could you please indicate precisely where this "collapsible" code was copied from and update it to its most recent version? (it is different from current English Wikipedia version, for example)

Also, is it really necessary here on Wikidata? Can't we simple use the default "jQuery.makeCollapsible" module provided by MediaWiki? Helder 14:36, 11 March 2013 (UTC)

If I were to guess, I would say it's from meta. That said, I would agree that we should use the default makeCollapsible here. The jQuery prettiness makes me want to wretch though. :)

On the other hand, I'm also disagreeable to "mw-collapsible" et al rather than the slightly less disambiguous "collapsible" et al. --Izno (talk) 23:32, 24 March 2013 (UTC)Reply

It's from en-wiki. --Stryn (talk) 17:01, 26 March 2013 (UTC)Reply

The collapsing code is redundant to jQuery.makeCollapsible and therefore obsolete. The few usages of Template:Collapse should be replaced by the mw-collapsible and the code in MediaWiki:Common.js should be removed. --Fomafix (talk) 10:25, 5 December 2013 (UTC)Reply

localize talk links in signatures edit

Can we have a javascript signature talk page link localizer like the one active on Commons: commons:MediaWiki:Common.js (look for the 'localizeSignature' code)? --Slomox (talk) 15:24, 5 April 2013 (UTC)Reply

Remove watchlist part edit

Hey :)

The bugfix for pages not being added to the watchlist has been fixed and the workaround here should probably be removed. --Lydia Pintscher (WMDE) (talk) 21:42, 17 May 2013 (UTC)Reply

The server-based implementation is good and reliable. The local JavaScript-based implementation doesn’t trigger always. For example there is no trigger by pressing enter. But the JavaScript-based implementation has the advantage that it generates an animation and indicates that you are now watching this item. Without the JavaScript-based implementation you see the change of the state only if you reload the page. Is it possible to indicate the change of the state even with the server-based implementation? --Fomafix (talk) 14:58, 19 May 2013 (UTC)Reply
That's probably possible. Can you report a bug on bugs.wikimedia.org for it? --Lydia Pintscher (WMDE) (talk) 10:00, 21 May 2013 (UTC)Reply

The code doesn’t work anymore, because of class name changes. The following code should reactivate the function:

$( function () {
	// trigger watch on edit through js interface
	if( mw.user.options.get( 'watchdefault' ) === '1' && $( 'li#ca-watch a' ).length > 0 ) {
		$( document ).on( 'click', '.wikibase-toolbareditgroup-savebutton:not(.wikibase-toolbarbutton-disabled), .wikibase-toolbareditgroup-removebutton:not(.wikibase-toolbarbutton-disabled)', function( e ) {
			$( 'li#ca-watch a' ).trigger( 'click' );
		} );
	}
} );

--Fomafix (talk) 15:16, 5 October 2013 (UTC)Reply

I created bug 58534. --Fomafix (talk) 14:16, 16 December 2013 (UTC)Reply

I removed the workaround. (diff) --Fomafix (talk) 07:31, 17 December 2013 (UTC)Reply

Fix multiple inclusions of the Commons linking script breaking all the links edit

{{Edit protected}} The changes requested at w:MediaWiki talk:Gadget-imagelinks.js#Fix paths (diff) should be made here as well, for the same reason (or this script should just be changed to pull that one, instead of duplicating it). Jackmcbarn (talk) 01:03, 4 September 2013 (UTC)Reply

Remove English variants from available languages edit

{{editprotected}}

Please remove "en-ca":"Canadian English","en-gb":"British English". Upstream is correct, but until bugzilla:37459 is fixed in Wikibase the consequences are undesirable, see Andrew Gray. We don't update this frequently, so we can afford local changes. --Nemo 07:14, 4 May 2014 (UTC)Reply

Removed. Vogone (talk) 11:11, 4 May 2014 (UTC)Reply
Thanks, Vogone & Nemo! Andrew Gray (talk) 14:53, 4 May 2014 (UTC)Reply

commons:MediaWiki:AnonymousI18N.js breaks some UI feature edit

I removed the inclusion of commons:MediaWiki:AnonymousI18N.js and the corresponding variable wpAvailableLanguages because it breaks some user interface features.

Steps to reproduce:

→ For a short moment the edit mode of the page is visible then the https://www.wikidata.org/wiki/Special:SetLabelDescriptionAliases/Q4115189/de?uselang=de is loaded.

AnonymousI18N may be added again when this bug is fixed. But I think AnonymousI18N is not necessary for Wikidata because the ULS is also available. --Fomafix (talk) 19:37, 22 July 2015 (UTC)Reply

Recent fix for T107861 edit

@Ladsgroup:: Re your recent edit: if ( $('.wb-monolingualtext-language-name' ) ) { will always go through, regardless of whether .wb-monolingualtext-language-name exists, because jQuery will return an empty array (truthy) in those cases. This doesn't really affect things, since $( '.wb-monolingualtext-language-name' ).attr( 'dir', 'ltr' ); doesn't break in either case, so even the condition itself isn't completely necessary. --Yair rand (talk) 22:45, 2 March 2016 (UTC)Reply

That's strange. I just tested it and it worked but I tested it somewhere else and it returned error. OK. I remove it. Thanks for telling me Amir (talk) 22:51, 2 March 2016 (UTC)Reply

Add realTitleBanner and sous_titre_h1 edit

{{Edit request}} I would like to have the functions realTitleBanner and sous_titre_h1 added to this common.js (see implementation here). The first one allows changing the title completely, unlike {{DISPLAYTITLE}}, and makes {{Correct title}} work properly. The second one adds sub-titles under the titles. I want to use both to create more faithful mockups of an actual Q-item page, along with {{Statement+}}. There's no gravely important use-case for this, it's mostly for fun. But at the same time, I don't think adding these two functions would cause problems. NMaia (talk) 08:23, 27 August 2020 (UTC)Reply

This can't be done without discussion/consensus — Martin (MSGJ · talk) 11:58, 10 February 2022 (UTC)Reply

Main Page edit

  It is requested that an edit or modification be made to this protected page.

The page has been added to Category:Wikidata protected edit requests.

Administrators: Please apply <nowiki> or {{Tl}} to the tag after the request is fulfilled.

Since there are some users viewing [[Main Page]], such code may be useful:

if ( mw.config.get( 'wgPageName' ) === 'Main_Page' || mw.config.get( 'wgPageName' ) === 'Main_page' )
{
window.location.replace("/")
}

GZWDer (talk) 12:09, 21 December 2023 (UTC)Reply

Couldn’t Wikibase handle this somehow? Even if not, at the very least, the usual ?redirect=no parameter should be honored. —Tacsipacsi (talk) 11:24, 22 December 2023 (UTC)Reply
Return to "Common.js" page.