User:Speravir/common.js

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search
Note: After saving, you have to bypass your browser's cache to see the changes. Internet Explorer: press Ctrl-F5, Mozilla: hold down Shift while clicking Reload (or press Ctrl-Shift-R), Opera/Konqueror: press F5, Safari: hold down Shift + Alt while clicking Reload, Chrome: hold down Shift while clicking Reload.
// <nowiki>
var isActive = true;

if (isActive) {
var conf = {
	action: mw.config.get('wgAction'),
	ns: mw.config.get('wgNamespaceNumber'), // cf. [[Help:Namespaces]]
	title: mw.config.get('wgTitle'),
	catALotDisabled: []
};

// Cat-a-lot
conf.catALotDisabled = [// full page title in quotes
	"Hauptseite", // main page for German speaking users
	"Main Page" // English main page
];
// Cat-a-Lot Configuration (automatic entry)

//catALot///////////////////////////////////////
////////// Cat-A-Lot user preferences //////////
window.catALotPrefs = { "watchlist":"nochange", "minor":true, "editpages":true, "docleanup":true, "subcatcount":100, "redir_category":"Category redirects" };
////////////////////////////////////catALotEnd//

$.when(mw.loader.using(['mediawiki.util']), $.ready).done(function () {

/**
 * Cat-a-lot - changes category of multiple files
 * [[Help:Gadget-Cat-a-lot]] - [[MediaWiki:Gadget-Cat-a-lot.js]]
**/
//if( $.inArray(conf.title, conf.catALotDisabled) === -1 ) { //JQuery version
if( conf.catALotDisabled.indexOf(conf.title) === -1 ) {
	// https://commons.mediawiki.org/wiki/MediaWiki:Gadget-Cat-a-lot.js
	mw.loader.load("https://commons.wikimedia.org/w/index.php?title=MediaWiki:Gadget-Cat-a-lot.js&action=raw&ctype=text/javascript");
	// https://commons.mediawiki.org/wiki/MediaWiki:Gadget-Cat-a-lot.css
	mw.loader.load("https://commons.wikimedia.org/w/index.php?title=MediaWiki:Gadget-Cat-a-lot.css&action=raw&ctype=text/css", "text/css");
}

if (conf.ns === 6) { // 6 = File
// [[User talk:Rillke/bigChunkedUpload.js]]
	mw.loader.load( "https://commons.wikimedia.org/w/index.php?title=User:Rillke/bigChunkedUpload.js&action=raw&ctype=text/javascript" );

// [[User talk:Rillke/SVGedit.js]]
	mw.loader.load( "https://commons.wikimedia.org/w/index.php?title=User:Rillke/SVGedit.js&action=raw&ctype=text/javascript" );

/* Perhelion - [[User talk:Perhelion]] */
// [[User:Perhelion/justReplace.js]]
	window.GlobalReplaceDefaultReason = "better image version, using Commons script";
	mw.loader.load( "https://commons.wikimedia.org/w/index.php?title=User:Perhelion/justReplace.js&action=raw&ctype=text/javascript" );
} //if conf.ns 6

if (conf.ns === 14 && conf.action === "view") { // 14 = Category
// [[User:Perhelion/massrename.js]]
	mw.loader.load( "https://commons.wikimedia.org/w/index.php?title=User:Perhelion/massrename.js&action=raw&ctype=text/javascript" );
}

if (conf.action === "history") {
// [[m:User:Hoo man]], [[m:User:Hoo man/Scripts/Smart rollback]]
	if (typeof(smartRollbackConfig) === 'undefined') smartRollbackConfig = {};
	smartRollbackConfig.lang = 'de';
	smartRollbackConfig.toolLinkMethod = 'p-cactions';
	mw.loader.load( "https://meta.wikimedia.org/w/index.php?title=User:Hoo_man/smart_rollback.js&action=raw&ctype=text/javascript" );
}

if (conf.action === "edit" || "submit") {
/* TemplateScript by Pathoschild */
// [[:meta:TemplateScript]] / [[:meta:User talk:Pathoschild]]
/* @update-token [[File:Pathoschild/templatescript.js]] */
$.ajax("https://tools-static.wmflabs.org/meta/scripts/pathoschild.templatescript.js", { dataType:'script', cache:true }).then(function() {
	pathoschild.TemplateScript.add([
		{ category:'Licence Review',
		name: 'Pixabay',
		tooltip: 'For positive Pixabay reviews',
		forNamespaces: 'file',
		script: function(editor) {
			editor
				.replace(/\{\{\s*[Pp]ixabay\s*\|(\s*(1\s*=\s*)?\d+(\s*\|\s*(2\s*=\s*)?[Vv][Ii][Dd])?)(\s*\|[^\}]*)?\}\}/g, '{{subst:pblr|$1}}')
				.appendEditSummary('licence review')
				.clickPreview();
		}},
		{ category: 'Speedy delete',
		name: 'Filename errors',
		tooltip: 'For files with error in name',
		forNamespaces: 'file',
		script: function(editor) {
			editor
				.prepend("{{SD|1=[[Commons:CSD#G1{{!}}G1]]: error in filename, recently uploaded}}\n")
				.appendEditSummary('speedy deletion request')
				.clickPreview();
		}},
		{ category: 'Discussions',
		 name: 'DNAU',
		tooltip: 'Do not archive until …',
		template: '{{subst:DNAU|0}}\n',
		position: 'cursor',
		editSummary: '[[Template:DNAU|DNAU]]',
		editSummaryPosition: 'after',
		isMinorEdit: true,
		forNamespaces: [1, 3, 4, 5, 7, 9, 11, 13, 15, 101, 103, 105, 107, 461, 487, 491, 829, 1199]
		},
		{ category: 'Discussions',
		 name:'Section resolved',
		tooltip: 'Appends the according template.',
		template: '{{section resolved|1=--~~~~}}\n',
		position: 'after',
		editSummary: 'mark section as resolved',
		editSummaryPosition: 'after',
		isMinorEdit: true,
		forNamespaces: [1, 3, 4, 5, 7, 9, 11, 13, 15, 101, 103, 105, 107, 461, 487, 491, 829, 1199]
		}
	]);
});
/* End of TemplateScript */
} // if conf.action "edit"
}); // End of loading function for
   // mw.loader.using( 'mediawiki.util' )

// [[MediaWiki:Gadget-LargerGallery.js]] / [[MediaWiki talk:Gadget-LargerGallery.js]]
var lGRE = /([Mm]edia renaming requests)|([Mm]edia requiring renaming)|((Files|[Ii]mages|Screenshots).*with bad(\sfile)? names)/;
if (conf.ns === 14 && (conf.title.match(lGRE) !== null) ) {
// [[:Category:Media requiring renaming]] and subcategories
	window.largerGallery = 1;
	window.largerGalleryZoom = 1;
} else 
	window.largerGallery = 1.25; 

// [[MediaWiki:Gadget-markAdmins.js]] / [[MediaWiki talk:Gadget-markAdmins.js]]
window.markAdminCfg = { groups: {
	'image-reviewer':  {enabled: true},
	'interface-admin': {enabled: true, label: 'I'},
	'templateeditor':  {enabled: true, label: 'T'},
	'vrt-permissions': {enabled: true}
} };
window.dontmarkmyself = true;

}// if (isActive)

// only with classic edit view or "wikieditor.js": [[:de:Benutzer:Schnark/js/wikieditor]]
// variable from global.js is now used

// [[Help:VisualFileChange.js]] - [[MediaWiki:VisualFileChange.js]]
window.vFC_PortletText = 'Visual File Change';
// Configuration for VisualFileChange (automatic entry)

//vFCvFCCfg/////////////////////////////////////
/////// VISUAL FILE CHANGE CONFIGURATION ///////
///// DO NOT MODIFY BY HAND - FINGERS AWAY! ////
////////////////////////////////////////////////
window.vFCSettings = {"userNote":"Yours sincerely,","firstTest":0,"testEdits":0,"defaultAction":"c_replace","watchlistUserTalk":"nochange","watchlistFiles":"nochange","watchlistReplace":"nochange","watchlistOTRS":"nochange","loadBatchSize":100,"maxSimultaneousReq":5,"summaryChacheLen":5,"loadThumbs":true,"loadWikitext":true};
//////////////////////////////////vFCvFCCfgEnd//
//</nowiki>