MediaWiki:ProfileIcons.js

/** @name: ProfileIcons * @author: Unai *	@desc: Prepends a WDS icon to each user page tab **/ (function ($, mw) {	'use strict';	var conf = mw.config.get([ 'wgNamespaceNumber', 'skin' ]);	if (conf.skin != 'oasis' || conf.wgNamespaceNumber != 2 || $('.profile-icons').exists) {		return;	}	var ProfileIcons = {		/** Inits ProfileIcons */		init: function  {			if (typeof ['fosl.wds'] != 'object') {				this.getWDS;			}			this.initScript;		},		/** Gets WDSIcons script in case it's not loaded  */		getWDS: function  {			importScriptPage('WDSIcons/code.js', 'dev');		},		/** Inits the script */		initScript: function  {			require(['fosl.wds'], function (wds) { $(".tabs li").each(function {					var _id = $(this).data('id'),						_icon;					switch (_id) {						case 'profile':							_icon = 'user';							break;						case 'talk':						case 'wall':							_icon = 'note';							break;						case 'blog':							_icon = 'quote';							break;						case 'contribs':							_icon = 'pencil';							break;						case 'following':							_icon = 'pages';							break;						case 'user-activity':							_icon = 'activity';					}					$(this).find('a').prepend(wds.icon(_icon, ['profile-icons'], 16));				}) })		}	}	ProfileIcons.init; }(jQuery, mediaWiki));