Page MenuHomePhabricator

Redirect [[User:Name/skin.js]] to current skin's JS page (e.g. [[User:Name/vector.js]])
Closed, DeclinedPublic

Description

This is one of the features mentioned on T71550 which are currently implemented by means of a JavaScript hack in MediaWiki:Common.js of each wiki:
https://www.mediawiki.org/wiki/Snippets/Redirect_skin.js

A similar redirect should exist for Special:MyPage/skin.css.

Details

Reference
bz69555

Event Timeline

bzimport raised the priority of this task from to Low.Nov 22 2014, 3:30 AM
bzimport set Reference to bz69555.
bzimport added a subscriber: Unknown Object (MLST).
He7d3r created this task.Aug 14 2014, 5:44 PM

I don't think we should make it impossible to create a user subpage literally named "skin.js" or "skin.css". Perhaps a better, more consistent way to do it would be to implement another special page like Special:MyPage that would redirect to the .js/.css user subpage for current skin? I bet someone smart who wants this done can figure it out :)

I think a special page for this is a huge case of over-engineering and would unnecessarily complicate this.

Currently English Wikipedia seems to think that User:jdlrobson/skin.js should
redirect to the right place.

Sure it makes it impossible to create a user subpage called User:Jdlrobson/skin.js but really.. we care about that one single page? :-) I mean.. on English Wikipedia this is pretty much the case already.

If you truly do it can be configurable e.g. $wgSkinJavaScriptRedirects and set it to true on English Wikipedia and any other project that wants it.

I like Bartosz idea. I agree that we don't lose much if skin.js isn't accessible anymore, but that's a hack, which means poor quality code and potential problems.

A special page can be localized, something that could be more difficult to do with what looks a legitimate subpage.

For me, it would require more engineering time to do that hack and be prepared to many unexpected results, some of them that come to my mind without digging too much:

  • What if that page gets transcluded
  • Ways to prevent editing that page (through API, through URL manipulation (action=edit)
  • Ways to prevent any page to be renamed to /skin.js
  • Existing pages with that name that may exist on the wiki that will become unavailable

Also, I think we agree this is an enhancement

Shouldn't we just encourage people to use their common.js/css instead of skin specific ones?

(In reply to Kunal Mehta (Legoktm) from comment #4)

Shouldn't we just encourage people to use their common.js/css instead of
skin specific ones?

Yeah, probably.

MC8 added a subscriber: MC8.May 24 2015, 7:53 PM
MC8 added a comment.May 24 2015, 8:03 PM

User subpages of /skin.js or /skin.css occur 61 times on English Wikipedia alone -- we should probably do something about that before we implement this :)

Bawolff closed this task as Declined.Jan 19 2016, 8:23 AM
Bawolff claimed this task.
Bawolff added a subscriber: Bawolff.

Shouldn't we just encourage people to use their common.js/css instead of skin specific ones?

I agree.

Doing something like Special:MySkinJS -> User:Me/MyCurrentSkin.js would have probably made sense in the pre common.js days, but now that we have a /common.js, I don't really see why we would do this.

I'm going to mark this bug WONTFIX. I don't feel super strongly about it though, so other developers should feel free to revert that if they feel this request would make a good feature.

If I'm reading the js from enwiki's common.js correctly, it looks like they now have it so that you can still get to the skin.js page if it exists, so maybe this can be re-opened?

/**
 * Redirect User:Name/skin.js and skin.css to the current skin's pages
 * (unless the 'skin' page really exists)
 * @source: http://www.mediawiki.org/wiki/Snippets/Redirect_skin.js
 * @rev: 2
 */
if ( mw.config.get( 'wgArticleId' ) === 0 && mw.config.get( 'wgNamespaceNumber' ) === 2 ) {
	var titleParts = mw.config.get( 'wgPageName' ).split( '/' );
	/* Make sure there was a part before and after the slash
	   and that the latter is 'skin.js' or 'skin.css' */
	if ( titleParts.length == 2 ) {
		var userSkinPage = titleParts.shift() + '/' + mw.config.get( 'skin' );
		if ( titleParts.slice( -1 ) == 'skin.js' ) {
			window.location.href = mw.util.getUrl( userSkinPage + '.js' );
		} else if ( titleParts.slice( -1 ) == 'skin.css' ) {
			window.location.href = mw.util.getUrl( userSkinPage + '.css' );
		}
	}
}

This is done in English Wikipedia, that's fine, but it doesn't mean it should be part of MediaWiki core. See previous discussions about drawbacks. If you ask me, I'll say it should even be set as a gadget, to allow users enable/disable it and prevent legitimate uses of /skin.js or /skin.css subpages render inaccessible.

TerraCodes added a comment.EditedMar 24 2018, 11:17 AM

allow users enable/disable it and prevent legitimate uses of /skin.js or /skin.css subpages render inaccessible.

They already do that?

unless the 'skin' page really exists