সদস্য:Sajidmahamud835/common.js

অসমীয়া ৱিকিপিডিয়াৰ পৰা

টোকা: প্ৰকাশ কৰাৰ পাছত পৰিৱৰ্তনসমূহ চাবৰ বাবে আপোনাৰ ব্ৰাউজাৰত কেশ্ব অগ্ৰাহ্য কৰিবলগীয়া হ'ব পাৰে।

  • ফায়াৰফক্স / চাফাৰি: Shift ধৰি ৰাখি Reload ক্লিক কৰক, বা Ctrl-F5 আৰু Ctrl-R ৰ ভিতৰত যিকোনো এটা ক্লিক কৰক (মেকত ⌘-R)
  • গুগল ক্ৰ'ম: Ctrl-Shift-R টিপক (মেকত ⌘-Shift-R)
  • ইণ্টাৰনে'ট এক্সপ্ল'ৰাৰ / এড্‌জ: Ctrl ধৰি ৰাখি Refresh ক্লিক কৰক, বা Ctrl-F5 টিপক
  • অপেৰা: Ctrl-F5 টিপক।
/** <nowiki>
 * The global JS file for Hydriz
 *
 * This is the global JS file purely designed for User:Hydriz.
 *
 * When editing this page, please hardcode the URL to the script as
 * things might break when simply importing script from local page.
 *
 * After editing this page, please bypass cache by refreshing using
 * Ctrl+F5. Changes here will affect wikis throughout Wikimedia
 * Foundation and certain external wikis, please use with care.
 *
 * @author Hydriz
 */

/** Special functions **/
// Check if string is in array
function userHydrizin_array( string, array ) {
	var i = '';
		for (i in array) {
			if (array[i] == string) {
				return true;
			}
		}
	return false;
}

// Make the first letter uppercase
function userHydrizucfirst( string ) {
	return string[0].toUpperCase() + string.slice(1);
}

// Check if a string ends with a suffix
function userHydrizendsWith( string, suffix ) {
    return string.match( suffix+"$" ) == suffix;
}

/** Administration **/
// Database of wikis that have sysop or bureaucrat rights
// This is checked with mw.config.get( 'wgServer' ), so do add the leading '//'
var userHydrizrights = {
	'sysop': [
		'//incubator.wikimedia.org',
		'//simple.wiktionary.org'
	],
	'bureaucrat': [
		'//incubator.wikimedia.org'
	]
};

// Sysop tools
if ( userHydrizin_array( mw.config.get( 'wgServer' ), userHydrizrights['sysop'] ) ) {
	// Clean delete reasons
	jQuery( document ).ready( function() {
		if ( wgAction == 'delete' ) {
			var wpReason = document.getElementById( 'wpReason' );
			if ( !wpReason ) {
				return;
			}
			var regexp = /(content was|page was empty|content before blanking was)/i;
			if ( regexp.test( wpReason.value ) ) {
				wpReason.value = '';
			}
		}
	} );

	// Adds some links to Special:Block
	mw.loader.load('//meta.wikimedia.org/w/index.php?title=MediaWiki:Gadget-blockoptions.js&action=raw&ctype=text/javascript');

	// Mass deletions of pages (Implements Special:MassDelete)
	mw.loader.load('//incubator.wikimedia.org/w/index.php?title=MediaWiki:Gadget-massdelete.js&action=raw&ctype=text/javascript');

	// Add "User rights" link in the tab
	if ( userHydrizin_array( mw.config.get('wgNamespaceNumber'), [2, 3] ) ) {
		mw.util.addPortletLink( 'p-cactions', wgScript + '?title=Special:UserRights&user=' + encodeURIComponent( wgTitle.split('/')[0] ),
			'Rights', 'ca-rights', 'Change user rights' );
	}
}

/** Usability improvements and tools **/
// UTC Live clock
mw.loader.load('//www.mediawiki.org/w/index.php?title=MediaWiki:Gadget-UTCLiveClock.js&action=raw&ctype=text/javascript');

// Adds a link to Special:PrefixIndex and Special:Log
mw.loader.using(['mediawiki.util', 'mediawiki.user'], function () {
	$(document).ready(function () {
		// Clone .mw-contributions-footer to the top as well
		if (mw.config.get('wgCanonicalSpecialPageName') === 'Contributions' && $('.mw-contributions-footer').length) {
			$('#contentSub').after($('.mw-contributions-footer').prop('outerHTML'));
		}

		// Extra links in personal topbar
		mw.util.addPortletLink('p-tb', mw.util.getUrl('Special:Prefixindex/' + mw.config.get('wgPageName')), 'Subpages', 'tb-prefixindex');
		mw.util.addPortletLink('p-personal', mw.util.getUrl( 'Special:Log/' + mw.user.getName() ), 'Logs', 'pt-mylogs', null, null, '#pt-logout');
	});
});

// A tool for editing TemplateData information
mw.loader.load('//fr.wikipedia.org/w/index.php?title=Utilisateur:Ltrlg/scripts/TemplateDataEditor.js&action=raw&ctype=text/javascript');

// HotCat: A tool for easier editing of categories
mw.loader.load('//commons.wikimedia.org/w/index.php?title=MediaWiki:Gadget-HotCat.js&action=raw&ctype=text/javascript');

// PurgeTab: Add links to purge, hard purge and perform a null edit on pages
mw.loader.load('//en.wikisource.org/w/index.php?title=MediaWiki:Gadget-PurgeTab.js&action=raw&ctype=text/javascript');

/** Shortcuts **/
/**
 * Redirect User:Name/skin.js and skin.css to the current skin's pages
 * (unless the 'skin' page really exists)
 * @source mediawiki.org/wiki/Snippets/Redirect_skin.js
 * @rev 3
 */
mw.loader.using( 'mediawiki.util', function () {
	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[0] + '/' + mw.config.get( 'skin' );
			if ( titleParts[1] === 'skin.js' ) {
				window.location.href = mw.util.getUrl( userSkinPage + '.js' );
			} else if ( titleParts[1] === 'skin.css' ) {
				window.location.href = mw.util.getUrl( userSkinPage + '.css' );
			}
		}
	}
});

// Real Time Recent Changes
mw.loader.load('//meta.wikimedia.org/w/index.php?title=User:Krinkle/RTRC.js&action=raw&ctype=text/javascript');

/**
 * Wiki-specific tools
 * This section allows scripts to be loaded on specific wikis instead
 * of having to modify the local Special:MyPage/skin.js page.
 * Please note that importing scripts here still requires the use of
 * mw.loader.load and not importScript.
 */
if ( mw.config.get( 'wgServer' ) == '//commons.wikimedia.org' ) {
	// Easy reviewing of Flickr images transferred to Commons
	mw.loader.load('//commons.wikimedia.org/w/index.php?title=User:Patstuart/Flickrreview.js&action=raw&ctype=text/javascript');
	// Enable Twinkle on Commons
	mw.loader.load('//commons.wikimedia.org/w/index.php?title=User:Kanonkas/twinkle.js&action=raw&ctype=text/javascript');
} else if ( ( mw.config.get( 'wgServer' ) == '//en.wikipedia.org' ) || ( mw.config.get( 'wgServer' ) == '//en.wikipedia.beta.wmflabs.org' ) ) {
	// AfC Redirect Helper script
	mw.loader.load('//en.wikipedia.org/w/index.php?title=User:The_Earwig/afc-helper.js&action=raw&ctype=text/javascript');
	// Easy tagging of stubs
	mw.loader.load('//en.wikipedia.org/w/index.php?title=User:Ais523/stubtagtab2.js&action=raw&ctype=text/javascript');
	// View the PersonData of an article (if there is one)
	mw.loader.load('//en.wikipedia.org/w/index.php?title=User:Dr pda/persondata.js&action=raw&ctype=text/javascript');
	// Easy fixing of dashes
	mw.loader.load('//en.wikipedia.org/w/index.php?title=User:GregU/dashes.js&action=raw&ctype=text/javascript');
} else if ( mw.config.get( 'wgServer' ) == '//simple.wikipedia.org' ) {
	var enwplink = '//en.wikipedia.org/wiki/Special:Search/' + mw.config.get( 'wgPageName' );
	mw.util.addPortletLink( 'p-tb', enwplink, 'English', 't-enwp', 'English Wikipedia page', 't', '#t-print' );
} else if ( mw.config.get( 'wgServer' ) == '//simple.wiktionary.org' ) {
	// Local fix of the creation script
	mw.loader.load('//simple.wiktionary.org/w/index.php?title=User:Hydriz/creation.js&action=raw&ctype=text/javascript');
	var sewplink = '//simple.wikipedia.org/wiki/Special:Search/' + userHydrizucfirst( mw.config.get( 'wgPageName' ) );
	var enwtlink = '//en.wiktionary.org/wiki/Special:Search/' + mw.config.get( 'wgPageName' );
	mw.util.addPortletLink( 'p-tb', sewplink, 'Wikipedia', 't-sewp', 'Find Wikipedia article', 'w', '#t-print' );
	mw.util.addPortletLink( 'p-tb', enwtlink, 'Wiktionary', 't-enwt', 'English Wiktionary entry', 't', '#t-print' );
} else if ( ( mw.config.get( 'wgServer' ) == '//en.wikisource.org' ) || ( mw.config.get( 'wgServer' ) == '//en.wikisource.beta.wmflabs.org' ) ) {
	// Allows for quick creation of pages without text
	mw.loader.load('//en.wikisource.org/w/index.php?title=MediaWiki:Gadget-Without text.js&action=raw&ctype=text/javascript');
	// Checks if the brackets matches
	mw.loader.load('//en.wikipedia.org/w/index.php?title=User:Ais523/bracketmatch.js&action=raw&ctype=text/javascript');
} else if ( mw.config.get( "wgPageContentLanguage" ) == 'zh' ) {
	// Make the font size bigger
	document.querySelector("#bodyContent").style.fontSize = "110%";
}

if ( userHydrizendsWith( mw.config.get( 'wgServer' ), 'wikipedia.org' ) ) {
	// Script for viewing information from Wikidata underneath the page title
	mw.loader.load("//www.wikidata.org/w/index.php?title=User:Yair rand/WikidataInfo.js&action=raw&ctype=text/javascript");
} else if ( userHydrizendsWith( mw.config.get( 'wgServer' ), 'beta.wmflabs.org' ) ) {
	// Add some steward tools
	mw.loader.load('//tools-static.wmflabs.org/meta/scripts/pathoschild.stewardscript.js');
}

/** Anti-vandalism tools **/
// Gives some useful links on user, user talk and user contribution pages
mw.loader.load('//meta.wikimedia.org/w/index.php?title=User:Hoo_man/useful_links.js&action=raw&ctype=text/javascript');

// Smart rollback
mw.loader.load('//meta.wikimedia.org/w/index.php?title=User:Hoo_man/smart_rollback.js&action=raw&ctype=text/javascript');

// Tag pages fast.
// IMPORTANT: This script must be placed at the end of this file!
// Adding support for some special wikis that do not use the standard deletion template
var speedyTemplates = {
	'//commons.wikimedia.org': 'speedydelete',
	'//en.wikisource.org': 'sdelete',
	'//www.mediawiki.org': 'speedy',
	'//ml.wikipedia.org': 'SD'
};
// Globally recognized template
var speedyTemplate = "delete";
if ( mw.config.get( 'wgServer' ) in speedyTemplates ) {
	speedyTemplate = speedyTemplates[ mw.config.get( 'wgServer' ) ];
}
mw.loader.load('//meta.wikimedia.org/w/index.php?title=User:Hoo_man/tagger.js&action=raw&ctype=text/javascript');
if(typeof(taggerConfig) == 'undefined') taggerConfig = {};
taggerConfig.tags = [];
taggerConfig.editSummary = [];
taggerConfig.tags[1] = '{{' + speedyTemplate +  '|Little or no meaning}}';
taggerConfig.editSummary[taggerConfig.tags[1]] = 'Nominating page for deletion';
taggerConfig.tags[2] = '{{' + speedyTemplate + '|Spam}}';
taggerConfig.editSummary[taggerConfig.tags[2]] = 'Nominating page for deletion';
// Special tags for the Simple English wikis
if ( mw.config.get( 'wgServer' ) == '//simple.wiktionary.org' ) {
	taggerConfig.tags[3] = '{{wikipedia}}';
	taggerConfig.editSummary[taggerConfig.tags[3]] = 'Adding link to Wikipedia';
} else if ( mw.config.get( 'wgServer' ) == '//simple.wikipedia.org' ) {
	taggerConfig.tags[3] = '{{wiktionary}}';
	taggerConfig.editSummary[taggerConfig.tags[3]] = 'Adding link to Wiktionary';
}
// All others (custom tagging)
taggerConfig.tags['other'] = 'Other -> (Please give an edit summary as well)';