ملاحظة: بعد الحفظ، قد يلزمك إفراغ الكاش لرؤية التغييرات.

/*jshint scripturl:true*/
mw.util.addPortletLink('p-tb', 'javascript:importScript("MediaWiki:VisualFileChange.js");', 'Perform batch task', 't-AjaxQuickDeleteOnDemand');
/*jshint scripturl:false*/
/*global mw, $, importScript*/
/*jshint curly:false, scripturl:true, strict:true */
window.AjaxDeleteWatchUserTalk = true;
window.AjaxDeleteWatchFile = true;
window.aqdCORSOptOut = true;
importScript('MediaWiki:Gadget-Extra-Edittools2.js');
window.AjaxDeleteExtraButtons = [
                {
                    'label': 'DW No Source',
                    'tag': '{'+'{subst:dw-nsd}}',
                    'img_summary': 'This is a [[COM:DW|derivative work]] and no source is provided.',
                    'talk_tag': '{'+'{subst:dw image source|1=%FILE%}}',
                    'talk_summary': 'Original source is missing for %FILE%',
                }, {
                    'label': 'Tag as dupe',
                    'tag': '{'+'{duplicate|1=%PARAMETER%}}',
                    'img_summary': 'Tagging as duplicate of  [[%PARAMETER%]]',
                    'prompt_text': 'Which is file is this a duplicate of?'

                }
];
var ns = mw.config.get('wgNamespaceNumber'), //  global [[Bugzilla:33837]] <nowiki>
	ul = mw.config.get('wgUserLanguage'),
	pn = mw.config.get('wgPageName'),
	un = mw.config.get('wgUserName'),
	ac = mw.config.get('wgAction'),
	ti = mw.config.get('wgTitle'),
	cun = "", // (optional) CUSTOM username
	convertToSVGTypes = "geology, meteorology, road sign",
	GlobalReplaceDefaultReason = '',
	AjaxDeleteExtraButtons = [];

importScript('User:Menner/svg-button.js'); //[[User:Menner/svg-button.js]]
if (typeof(mw.util.getParamValue('withJS')) !== "string" || mw.util.getParamValue('withJS').indexOf(
		"MediaWiki:CommonsSvgChecker.js") === -1) {
	importScript('MediaWiki:CommonsSvgChecker.js');
}

function prefillDupe(e) { // hack for AjaxDeleteExtraButtons duplicate
	"use strict";
	if (!e) return;
	var talk_summary, talk_tag;
	if (e.target && e.target.parentNode.id) {
		talk_tag = '{{subst:Speedynote|1=%FILE%|2={{subst:int:File-exists-duplicate|}} [[:File:%PARAMETER%]].}}';
		talk_summary = 'Duplicate notification';
	}
	AjaxQuickDelete.insertTagOnPage(
		"{{duplicate|1=%PARAMETER%}}",
		"Tagging as duplicate of [[File:%PARAMETER%]]",
		talk_tag,
		talk_summary,
		"Which file is this a duplicate of?"
	);
	setTimeout(function () {  // cleanup prefix / namespace "File:"
		var $t = $('#AjaxQuestion0');
		$t.val($('#mw-imagepage-section-duplicates ul a').eq(0).attr('title')).focusout(function (e) {
			e.preventDefault();
			return $t.val($.trim($t.val()).replace(/^[Ff]ile\:/, ''));
		});
	}, 200);
}
	
if (ns === 6) { /** Files only **/
	var ext = ti.slice(-3).toUpperCase();
	var bSVG = ( ext.indexOf("SVG") === 0 );

	// importScript('MediaWiki:ExCommons.js');  // - copy files to individual Wikis before deleting them on Commons
	
	importScript('User:Sreejithk2000/JustReplace.js');
	importScript('User:Perhelion/JustReplace+.js');
	importScript('User:Perhelion/cleanup.js'); // File desc. cleanup
	//importScript('User:Magog the Ogre/cleanup.js'); // File desc. cleanup
	//importScript('User:Rillke/bigChunkedUpload.js'); // [[Help:Chunked upload]]
	
	importScript('User:Rillke/LicenseReview.js');
	
	if ( bSVG ) { /** SVG only **/
		
		// simple SVG edit (beta)
		importScript('User:Rillke/SVGedit.js');
		
		// W3C-Validator check-link for every SVG (by [[User: Perhelion]] fixed also now for admins); + detailed byte-size
		importScript('User:Perhelion/simpleSVGcheck.js');
		
		AjaxDeleteExtraButtons.push({
			'label' : 'PoorSVG', // TracedSVG
			'tag' : '{{PoorSVG|1=%PARAMETER%}}', // Raster file
			'img_summary' : 'This SVG contains poor traced elements, please revectorize',
			'talk_tag' : '{{subst:TracedSVG/notify|1=%FILE%|2=%PARAMETER%}}',
			'talk_summary' : 'Poor SVG note',
			'prompt_text' : 'Which file is the original of?'
		}, {
			'label' : 'PoorSVG tag only', // TracedSVG
			'tag' : '{{PoorSVG|1=%PARAMETER%}}', // Raster file
			'img_summary' : 'This SVG contains poor traced elements, please revectorize',
			'prompt_text' : 'Which file is the original of?'
		}, {
			'label' : 'BadSVG',
			'tag' : '{{BadSVG}}',
			'img_summary' : 'This file contains raster graphics that should be removed',
			'talk_tag' : '{{subst:BadSVG/notification|1=%FILE%}}',
			'talk_summary' : 'Bad SVG note',
			'prompt_text' : 'Please remove embedded raster graphics?'
		}, {
			'label' : 'BadSVG tag only',
			'tag' : '{{BadSVG}}',
			'img_summary' : 'This file contains raster graphics that should be removed',
			'prompt_text' : 'Please remove embedded raster graphics?'
		}, {
			'label' : 'SVGbug', // SVGbug
			'tag' : '{{SVGbug|1=%PARAMETER%}}', // Raster file
			'img_summary' : 'This SVG contains one or more libRSVG bugs',
			'prompt_text' : 'Description of the bug or a link?'
		});
	} else {
		AjaxDeleteExtraButtons.push({
			'label' : 'ToSVG',
			'tag' : '{{Convert to SVG|1=%PARAMETER%}}',
			'img_summary' : 'This file should be better a SVG',
			'talk_tag' : '{{subst:Please use SVG|1=%FILE%}}',
			'talk_summary' : 'Use SVG note',
			'prompt_text' : 'Please use SVG insteed of raster graphics. Which type?'
		}, {
			'label' : 'ToSVG tag only ',
			'tag' : '{{Convert to SVG|1=%PARAMETER%}}',
			'img_summary' : 'This file should be better a SVG',
			'prompt_text' : 'Please use SVG insteed of raster graphics. Which type?'
		});
		GlobalReplaceDefaultReason = ext + ' → SVG';
	}
	
	// [[Help:QuickDelete]]
	//To watch user talk pages, to which you add tags
	var AjaxDeleteWatchUserTalk = true;
	//To watch file pages, to which you add tags
	var AjaxDeleteWatchFile = true;
	// adding more buttons :
	AjaxDeleteExtraButtons.push({
		'label' : 'DW No Source',
		'tag' : '{{subst:dw-nsd}}',
		'img_summary' : 'This is a [[COM:DW|derivative work]] and no source is provided',
		'talk_tag' : '{{subst:dw image source|1=%FILE%}}',
		'talk_summary' : 'Original source is missing for %FILE%'
	}, /*{ //notice talk_tag and talk_summary must be '' (void string) if uploader must not be notified
		'label' : 'Duplicate',
		'tag' : '{{duplicate|1=%PARAMETER%}}',
		'img_summary' : 'Tagging as duplicate of [[File:%PARAMETER%]]', // FIXME!?: $.trim(%PARAMETER%).replace(/^(?:File|Image)\:/, '')
		'talk_tag' : '{{subst:Speedynote|1=%FILE%|2={{subst:int:File-exists-duplicate|}} [[:File:%PARAMETER%]].}}',
		'talk_summary' : 'Duplicate notification',
		'prompt_text' : 'Which file is this a duplicate of?'
		},  {
		'label' : 'Dupe tag only ',
		'tag' : '{{duplicate|1=%PARAMETER%}}',
		'img_summary' : 'Tagging as duplicate of [[File:%PARAMETER%]]', // FIXME!?: $.trim(%PARAMETER%).replace(/^(?:File|Image)\:/, '')
		'prompt_text' : 'Which file is this a duplicate of?'
		}, */
	{ //notice talk_tag and talk_summary must be '' (void string) if uploader must not be notified
		'label' : 'Speedy',
		'tag' : '{{Speedydelete|1=%PARAMETER%}}',
		'img_summary' : 'Tagging as speedy delete because: %PARAMETER%',
		'talk_tag' : '{{subst:Speedynote|1=%FILE%|2=%PARAMETER%}}',
		'talk_summary' : 'Speedy notification',
		'prompt_text' : 'Speedy: why ? MUST PREVENT UPLOADER'
	}, {
		'label' : 'Wrong License',
		'tag' : '{{wl|1=%PARAMETER%}}',
		'img_summary' : 'Tagging as wrongly licensed because: %PARAMETER%',
		'talk_tag' : '{{subst:Wrong license note|2=%PARAMETER%|1=%FILE%}}',
		'talk_summary' : 'Notification of possible wrong license',
		'prompt_text' : 'Incorrect license: reason?'
	}, {
		'label' : 'Thumbnail',
		'tag' : '{{Thumbnail}}',
		'img_summary' : 'Tagging as thumbnail',
		'talk_tag' : '{{subst:Do not upload thumbnails|1=%FILE%}}',
		'talk_summary' : 'Thumb note',
		'prompt_text' : 'Please re-upload the full resolution version?'
	}, {
		'label' : 'Watermark',
		'tag' : '{{Watermark|1=}}',
		'img_summary' : 'This file contains a watermark that should be removed',
		'talk_tag' : '{{subst:No watermarks|1=:%FILE%}}',
		'talk_summary' : 'Watermarks note',
		'prompt_text' : 'Please remove Watermarks?'
	});
	// [[MediaWiki:Gadget-AjaxQuickDelete.js]]

	$(mw.util.addPortletLink('p-tb', null, "Duplicate", 't-dupe', null)).click(prefillDupe);
	$(mw.util.addPortletLink('p-tb', null, "Dupe tag only", null, null,'#t-dupe')).click(prefillDupe);
	
	// make editing and adding descriptions easier
	importScript('User:MarkTraceur/editDescriptions.js');
} /** Files only end **/

// SORT CONVERT-TO-SVG TAGS:
if (ns === 14 || (ns === 6 && ["edit", "submit"].indexOf(ac) !== -1 && !/SVG/i.test(ti.slice(-3))))
	importScript('User:Perhelion/fixconverttosvg.js');
if (ns === 14 && ac === "view")
	importScript('User:TheDJ/wdcat.js');

// Insert a personalized Texttemplate into the Special:Upload edit box.
//  I upload mostly my own work; preload input form; adapted from [[User: Dschwen]]
$(function () {
	"use strict";
	if (pn === 'Special:Upload' && /&uselang=([^&]*)ownwork/.test(location.search)) {
		var re = RegExp.$1;
		//mw.loader.using('moment',function(){
		setTimeout(function () {
			$('#wpUploadDescription').val(
				'=={{int:filedesc}}==\n' +
				'{{Information\n' +
				'|description=\n{{en|1=}}\n' +
				((re) ? '{{' + re + '|1=}}\n' : '') +
				'|source={{own based}} [[:File: …]]\n' +
				'|date=' + '{{Originaluploaddate|}} {{vectorization}} {{Uploaddate|{{subst:CURRENTYEAR}}-{{subst:CURRENTMONTH}}-{{subst:CURRENTDAY2}}}}\n' + 
				//+ moment().format('YYYY-MM-DD') + '}}\n' +
				'|author={{Author|original|{{unknown}}}}; {{Author|vectorization|[[User: ' + un + ']]}}\n' +
				'|permission=\n' +
				'|other_versions=\n' +
				'<gallery widths="100" heights="100" showfilename>\n\n</gallery>\n' +
				'|other_fields={{Igen|h|+}}\n' +
				'}}\n\n' +
				'=={{int:license-header}}==\n' +
				'{{self|GFDL|cc-by-sa-3.0|author=I, [[User:' + un + '|' + cun + ']]}}');
		}, 100);
		//});
	} else
		$('#n-uploadbtn').children('a').attr('href', '//commons.wikimedia.org/w/index.php?title=Special:Upload&uselang=' +
			((ul === 'en') ? '' : ul) + 'ownwork');
	// [[Mediawiki:Edittools]] 	smaller (HACK)
	if (mw.toolbar)
		$.when(mw.loader.using('ext.wikiEditor'), $.ready).then(mw.util.addCSS(".page-Edittools1.page-characters {font-size:11px}"));
});

// [[Help:VisualFileChange.js]]
mw.util.addPortletLink('p-tb', 'javascript:{importScript("MediaWiki:VisualFileChange.js"); void(0);}', "Perform batch task", 't-AjaxQuickDeleteOnDemand', null);

////////// Cat-A-Lot user preferences //////////
window.catALotPrefs = {
	"watchlist" : "watch",
	"minor" : true,
	"editpages" : true,
	"docleanup" : true,
	"subcatcount" : 50
};

//vFCProfil/////////////////////////////////////
/////// VISUAL FILE CHANGE CONFIGURATION ///////
///// DO NOT MODIFY BY HAND - FINGERS AWAY! ////
////////////////////////////////////////////////
window.vFC_Profiles = {"SVG":{"editInputs":{"mdDeleteReason":"","mdEditSummary":"→SVG","mdReplacePermission":false,"mdDeleteHeading":"Files in [[:Category:Diagrams in German]] ","mdTalkNote":"Yours sincerely,","mdRRegEx1":true,"mdRVar1":true,"mdMatchText1":"/Category:Charts in English/g","mdReplaceText1":"Category:SVG charts in English","mdRRegEx2":false,"mdRVar2":true,"mdMatchText2":"","mdReplaceText2":"","selPreserve":"secure","alsoPreserve":""},"action":"c_replace","objectMembers":{"queryParams":{"target":"Category:Charts in English","cmdir":"asc","cmsort":"sortkey","cmstartsortkey":"","cmcontinue":"file|57494b49534f555243452028454e2920464952535420313030302056414c49444154494f4e532e504e47|25826615"},"startInput":{"mode":"Category","modeCat":true,"modeUser":false,"modePage":false,"target":"Category:Charts in English","loadThumbs":true,"loadWikitext":true,"startDate":"","startFile":""}},"proceedAt":{"vals":["file|454c454354524f4e4943204348454154494e4720504152454e54532050455243455054494f4e532e504e47|17574410","file|57494b49534f555243452028454e2920464952535420313030302056414c49444154494f4e532e504e47|25826615"],"setVals":["cmcontinue"]},"time":"2015-07-21T16:50:16.750Z"}};
//////////////////////////////////vFCProfilEnd//
//</nowiki>