For faster navigation, this Iframe is preloading the Wikiwand page for User:NguoiDungKhongDinhDanh/ContribsTabVector.js.

User:NguoiDungKhongDinhDanh/ContribsTabVector.js

/* This script adds Contributions and Statistics tabs to User and User talk pages. For Vector skin.

This script was originally written by [[User:Equazcion]] and rewritten mostly from scratch by [[User:HueSatLum]].

To use this script, place the following line in your vector.js page:

	importScript('User:Equazcion/ContribsTabVector.js'); // Backlink: [[User:Equazcion/ContribsTabVector.js]]

CentralAuth added by NguoiDungKhongDinhDanh.

Add any or all of these lines after the importScript line above to set various options (the default values are shown):

	var contribsTab = true;                    // Turns the Contributions tab on or off (set to false; for off)
	var contribsTabStats = true;               // Turns the Statistics tab on or off (set to false; for off)
	var CATab = true;                          // Turns the CentralAuth tab on or off (set to false; for off)
	var contribsTabNumber = 50;                // Number of contributions to display in the Contributions tab. Can be 1 to 5000.
	var contribsTabName = "Contributions";     // Custom name for Contributions tab. Replace quoted text with your desired name.
	var contribsTabStatsName = "Statistics";   // Custom name for Statistics tab. Replace quoted text with your desired name.
	var CATabName = "CentralAuth";             // Custom name for CentralAuth tab. Replace quoted text with your desired name.
-- End of documentation -- */

mw.loader.using( ['mediawiki.util', 'mediawiki.Uri'], function () {
	"use strict";
	var username, firstTab, contribsTabUrl, contribsTabStatsUrl, CATabUrl;

	// Set default options for any that haven't been set
	function setDefault( option, val ) {
		if ( window[option] === undefined ) {
			window[option] = val;
		}
	}
	setDefault( 'contribsTabName', 'Ctrbs' );
	setDefault( 'contribsTabNumber', 50 );
	setDefault( 'contribsTabStats', true );
	setDefault( 'contribsTab', true );
	setDefault( 'contribsTabStatsName', 'Stats' );
	setDefault( 'CATabName', 'CA' );
	setDefault( 'CATab', true );	

	username = mw.config.get( 'wgRelevantUserName' );
	if ( !username ) {
		return; // Don't do anything if we're not on a page with a relevant username (i.e. User or User talk)
	}

	firstTab = $( '#p-views ul li' ).eq( 0 ); // Tab to put the new tabs before (usually "Read")

	if ( window.contribsTab ) { // Construct the contribs tab, if it's not turned off
		// Construct contribs URL
		contribsTabUrl = mw.util.getUrl( 'Special:Contributions', {
			target: username,
			limit: window.contribsTabNumber
		} );

		mw.util.addPortletLink(
			'p-views',
			contribsTabUrl,
			window.contribsTabName,
			'ca-contributions',
			'Show this user\'s contributions',
			null,
			firstTab
		);
	}

    if ( window.CATab ) { // Construct the CA tab, if it's not turned off
		// Construct CA URL
		contribsTabUrl = mw.util.getUrl( 'Special:CentralAuth', {
			target: username,
		} );

		mw.util.addPortletLink(
			'p-views',
			contribsTabUrl,
			window.CATabName,
			'ca-CA',
			'Show this user\'s CentralAuth',
			null,
			firstTab
		);
	}
	
	if ( window.contribsTabStats ) { // Construct the stats tab, if it's not turned off
		// Construct stats URL
		contribsTabStatsUrl = new mw.Uri( '//tools.wmflabs.org/xtools-ec/' )
			.extend( {
				user: username,
				project: mw.config.get( 'wgDBname' )
			} )
			.toString();

		mw.util.addPortletLink(
			'p-views',
			contribsTabStatsUrl,
			window.contribsTabStatsName,
			'ca-statistics',
			'Show this user\'s editing statistics',
			null,
			firstTab
		);
	}
} );
{{bottomLinkPreText}} {{bottomLinkText}}
User:NguoiDungKhongDinhDanh/ContribsTabVector.js
Listen to this article

This browser is not supported by Wikiwand :(
Wikiwand requires a browser with modern capabilities in order to provide you with the best reading experience.
Please download and use one of the following browsers:

This article was just edited, click to reload
This article has been deleted on Wikipedia (Why?)

Back to homepage

Please click Add in the dialog above
Please click Allow in the top-left corner,
then click Install Now in the dialog
Please click Open in the download dialog,
then click Install
Please click the "Downloads" icon in the Safari toolbar, open the first download in the list,
then click Install
{{::$root.activation.text}}

Install Wikiwand

Install on Chrome Install on Firefox
Don't forget to rate us

Tell your friends about Wikiwand!

Gmail Facebook Twitter Link

Enjoying Wikiwand?

Tell your friends and spread the love:
Share on Gmail Share on Facebook Share on Twitter Share on Buffer

Our magic isn't perfect

You can help our automatic cover photo selection by reporting an unsuitable photo.

This photo is visually disturbing This photo is not a good choice

Thank you for helping!


Your input will affect cover photo selection, along with input from other users.

X

Get ready for Wikiwand 2.0 ๐ŸŽ‰! the new version arrives on September 1st! Don't want to wait?