ব্যবহারকারী:Pratyya Ghosh/Renamelink.js

উইকিপিডিয়া, মুক্ত বিশ্বকোষ থেকে

লক্ষ্য করুন: প্রকাশ করার পর, পরিবর্তনগুলো দেখতে আপনাকে আপনার ব্রাউজারের ক্যাশে পরিষ্কার করার প্রয়োজন হতে পারে।

  • ফায়ারফক্স / সাফারি: পুনরায় লোড-এ ক্লিক করার সময় শিফট টিপে ধরে রাখুন, অথবা হয় Ctrl-F5 বা Ctrl-R টিপুন (ম্যাকে ⌘-R টিপুন)
  • গুগল ক্রোম: Ctrl-Shift-R (ম্যাকে ⌘-Shift-R) টিপুন
  • ইন্টারনেট এক্সপ্লোরার / এজ: Ctrl ধরে রাখা অবস্থায় Refresh-এ ক্লিক করুন, অথবা Ctrl-F5 টিপুন
  • অপেরা: Ctrl-F5 টিপুন।
// <nowiki>
/*global jQuery:false, mediaWiki:false, AjaxQuickDelete:false*/
/*jshint curly:false, laxbreak:true*/

/**************************************
   Request renaming of an image
   composed in 2012 by Rillke
   
   Thanks to all translators.

   The following code is jsHint-valid.
**************************************/

(function($, mw) {
	'use strict';
	if (window.rRename || mw.config.get('wgNamespaceNumber') !== 6) {
		return;
	}

	var _this = window.rRename = {
		rDialog: function() {
			this.showProgress();

			var dlgButtons = {},
				$submitButton;

			var $txtNewNameL = $('<label>', {
				'for': 'txtNewName',
				text: this.rI18n.lNewName
			});
			this.$txtNewName = $('<input>').attr({
				id: 'txtNewName',
				type: 'text',
				style: 'width: 99%',
				placeholder: this.rI18n.pNewName,
				value: mw.config.get('wgPageName')
			}).change(function() {
				var val = _this.cleanFileName(this.value).replace(/\%/g, ' ');
				if (val !== this.value) this.value = _this.cleanFileName(this.value).replace(/\%/g, ' ');
			}).keyup().tipsy({
				'gravity': 's',
				'fallback': this.rI18n.tNewName,
				'trigger': 'focus'
			}).keyup(function(e) {
				$submitButton.submitOnEnter(e);
			});

			var $selRationaleL = $('<label>', {
				'for': 'txtReason',
				text: this.rI18n.lRationale
			});
			this.$selRationale = $('<select>').attr({
				id: 'selRationale',
				style: 'width: 99%',
				size: 1
			}).tipsy({
				'gravity': 's',
				'fallback': this.rI18n.tRationale,
				'trigger': 'focus'
			}).append($('<option>', {
				value: 0
			}).text(this.rI18n.pRationale)).val(0).change(function() {
				var val = $(this).val() - 0;
				$('table.hovertable tr.ui-state-focus').removeClass('ui-state-focus');
				if (0 === val) return;
				$('table.hovertable').find('tr').eq(val).addClass('ui-state-focus');
			}).keyup(function(e) {
				$submitButton.submitOnEnter(e);
			});

			var $txtReasonL = $('<label>', {
				'for': 'txtReason',
				text: this.rI18n.lReason
			});
			this.$txtReason = $('<input>').attr({
				id: 'txtReason',
				type: 'text',
				style: 'width: 99%',
				placeholder: this.rI18n.pReason
			}).tipsy({
				'gravity': 's',
				'fallback': this.rI18n.tReason,
				'trigger': 'focus'
			}).keyup(function(e) {
				$submitButton.submitOnEnter(e);
			});

			var $chAcceptL = $('<label>', {
				'for': 'chAccept',
				text: this.rI18n.lAccept
			});
			this.$chAccept = $('<input>').attr({
				id: 'chAccept',
				type: 'checkbox'
			}).change(function() {
				if (this.checked) {
					$submitButton.button('option', 'disabled', false);
				} else {
					$submitButton.button('option', 'disabled', true);
				}
			});

			mw.util.addCSS('table.hovertable tr:hover { background-color: white !important; border: 1px solid #A7D7F9 !important; outline: 1px solid #A7D7F9; }\n' + 'table.hovertable tr:hover > td { background-color: white !important; border: 1px solid #A7D7F9 !important; }\n' + 'table.hovertable tr:active > td { background: orange !important; }\n' + 'table.hovertable tr:focus > td { background: orange !important; }\n' + 'table.hovertable tr.ui-state-focus { outline: 1px solid #7E7 !important; }\n' + 'table.hovertable { cursor:pointer; }\n');
			this.rPolicy.find('table').addClass('hovertable');
			var selectionHandler = function() {
					var $this = $(this);
					if ($this.find('td').length) {
						$('table.hovertable tr.ui-state-focus').removeClass('ui-state-focus');
						$this.addClass('ui-state-focus');
						_this.$selRationale.val($this.data('v'));
					}
				};
			this.rPolicy.find('tr').each(function(i, el) {
				if (i === 0) return;
				var $el = $(el),
					$tds = $el.find('td'),
					tdVerbose = $tds.eq(1).text();
				_this.$selRationale.append($('<option>', {
					value: i
				}).text($tds.eq(0).text() + tdVerbose.substr(0, 80) + (tdVerbose.length > 70 ? '…' : '')));
				$el.data('v', i);
				$(this).click(selectionHandler);
			});

			this.$dlgNode = $('<div>', {
				style: 'border: 1px solid #fff'
			}).append(
			this.rPolicy, $txtNewNameL, '<br/>', this.$txtNewName, '<br/><br/>', $selRationaleL, '<br/>', this.$selRationale, '<br/><br/>', $txtReasonL, '<br/>', this.$txtReason, '<br/><br/>', this.$chAccept, $chAcceptL);

			dlgButtons[this.rI18n.submitButtonLabel] = function() {
				_this.tasks = [];
				_this.$dButtons.button('option', 'disabled', true);
				_this.addTask('rCheckInputs');
				_this.addTask('doesFileExist');
				_this.fileNameExistsCB = 'rFileExists';
				_this.addTask('rIsOnBlackList');
				_this.addTask('rSendRequest');
				_this.addTask('rReady');
				_this.nextTask();
			};
			dlgButtons[this.rI18n.cancelButtonLabel] = function() {
				$(this).dialog("close");
			};

			this.$dlgNode.dialog({
				modal: true,
				closeOnEscape: true,
				position: 'center',
				title: this.rConfig.helpLink + this.rI18n.headline,
				height: this.rConfig.dlg.height,
				width: Math.min($(window).width(), this.rConfig.dlg.width),
				buttons: dlgButtons,
				close: function() {
					$(this).dialog("destroy");
					$(this).remove();
					$('.tipsy').remove();
					_this.dlgPresent = false;
				},
				open: function() {
					var $dlg = $(this);

					$dlg.parents('.ui-dialog').css({
						position: 'fixed',
						top: Math.round(($(window).height() - Math.min($(window).height(), $('.ui-dialog.ui-widget').height())) / 2) + 'px'
					});

					_this.$dButtons = $dlg.parent().find('.ui-dialog-buttonpane').find('button');
					$submitButton = _this.$dButtons.eq(0);
					$submitButton.specialButton('proceed').button({
						disabled: true
					});
					_this.$dButtons.eq(1).specialButton('cancel');
					$submitButton.submitOnEnter = function(e) {
						if (13 === e.which && !this.button('option', 'disabled')) this.click();
					};
				}
			});

			setTimeout(function() {
				_this.$dlgNode.dialog('option', 'position', 'center');
			}, 1);

			this.dlgPresent = true;
		},
		rGetPolicy: function() {
			if (this.rPolicy) return this.nextTask();
			$.ajax({
				url: mw.config.get('wgScript'),
				dataType: 'html',
				data: {
					'action': 'render',
					'title': _this.rConfig.reasonPage,
					'uselang': mw.config.get('wgUserLanguage')
				},
				cache: true,
				success: function(result) {
					_this.rPolicy = $(result).find('#onlyinclude');
					_this.nextTask();
				},
				error: function(x, status, error) {
					_this.fail('RenameLink: Error getting policy. Server status: ' + x.status + ' - Error:' + error);
				}
			});
		},
		rAbort: function($el, text) {
			this.tasks = [];
			setTimeout(function() {
				_this.$txtReason.removeAttr('title');
				_this.$selRationale.removeAttr('title');
				_this.$txtNewName.removeAttr('title');
				_this.$dButtons.button('option', 'disabled', false);
				$el.removeClass('ui-state-error');
			}, 4000);
			this.showProgress();
			$el.attr('title', text).focus();
			$el.addClass('ui-state-error');
		},
		rCheckInputs: function() {
			AjaxQuickDelete.showProgress(this.rI18n.progress.input);
			this.destination = this.rNewName = this.cleanFileName(this.$txtNewName.val()).replace(/^File:/, '');
			if (0 === this.$selRationale.val() - 0) {
				return this.rAbort(this.$selRationale, this.rI18n.invalidRationale);
			}
			if (this.rNewName < 5) {
				return this.rAbort(this.$txtNewName, this.rI18n.nameToShort);
			}
			if (this.rNewName === this.cleanFileName(mw.config.get('wgPageName')).replace(/^File:/, '')) {
				return this.rAbort(this.$txtNewName, this.rI18n.newName);
			}

			// Test whether user selected first reason
			if (1 === this.$selRationale.val() - 0) {
				var query = {
					'action': 'query',
					'prop': 'imageinfo',
					'iiprop': 'user',
					'iilimit': 100,
					'titles': mw.config.get('wgPageName').replace(/_/g, ' ')
				};
				return this.queryAPI(query, 'rCheckInputsCB');
			}
			this.nextTask();
		},
		rCheckInputsCB: function(result) {
			if (!result || !result.query || !result.query.pages) return this.nextTask();
			var hasRevisions, isByUser;
			$.each(result.query.pages, function(id, pg) {
				if (pg.imageinfo) {
					hasRevisions = true;
					$.each(pg.imageinfo, function(i, ii) {
						if (ii.user === mw.config.get('wgUserName')) {
							isByUser = true;
							return false;
						}
					});
				}
			});
			if (hasRevisions && !isByUser) {
				return this.rAbort(this.$selRationale, this.rI18n.notTheUploader);
			} else {
				return this.nextTask();
			}
		},
		rFileExists: function(result) {
			return this.rAbort(this.$txtNewName, this.rI18n.nameExists);
		},
		rIsOnBlackList: function() {
			var query = {
				'action': 'titleblacklist',
				'tbtitle': 'File:' + this.rNewName,
				'tbaction': 'create'
			};
			this.showProgress(this.rI18n.progress.blacklisted);
			this.queryAPI(query, 'rIsBlacklistedCB');
		},
		rIsBlacklistedCB: function(result) {
			if (!result || !result.titleblacklist || !result.titleblacklist.result) throw new Error('RenameLink: result.titleblacklist is undefined.');
			if ('blacklisted' === result.titleblacklist.result) {
				return this.rAbort(this.$txtNewName, this.rI18n.blacklisted);
			}
			return this.nextTask();
		},
		rSendRequest: function() {
			this.edittoken = this.edittoken || mw.user.tokens.get('editToken');
			var doEdit = function(result) {
					var newText, editType;
					if (!result) {
						newText = _this.rConfig.addTemplate.replace('%NEWFILE%', _this.rNewName).replace('%REASON%', _this.$txtReason.val()).replace('%NUMBER%', _this.$selRationale.val());
						editType = 'prependtext';
					} else {
						newText = result.replace(_this.rConfig.removeTemplate, '');
						newText = _this.rConfig.addTemplate.replace('%NEWFILE%', _this.rNewName).replace('%REASON%', _this.$txtReason.val()).replace('%NUMBER%', _this.$selRationale.val()) + newText;
						editType = 'text';
					}

					var page = {
						title: mw.config.get('wgPageName').replace(/_/g, ' '),
						text: newText,
						editType: editType
					};
					_this.showProgress(_this.rI18n.progress.edit);
					_this.savePage(page, _this.rConfig.summary.replace('%NEWFILE%', _this.rNewName).replace('%REASON%', _this.$txtReason.val()).replace('%NUMBER%', _this.$selRationale.val()), 'nextTask');
				};
			var $xhr = $.get(mw.config.get('wgScript'), {
				'action': 'raw',
				title: mw.config.get('wgPageName'),
				maxage: 0,
				smaxage: 0,
				dummy: Math.round(Math.random() * 1073741824)
			}, doEdit);
			$xhr.error(function(jqXHR, textStatus, errorThrown) {
				if (404 === jqXHR.status) return doEdit('');
				_this.fail('Error retrieving wikitext. Server status ' + jqXHR.status + '<br/>\nERR: ' + textStatus + '.');
			});
			this.showProgress(this.rI18n.progress.load);
		},
		rReady: function(result) {
			this.showProgress();
			document.location.href = document.location.href;
		},
		rInit: function() {
			// save some code-lines by assigning similar languages

			// merge languages
			$.extend(true, _this.rI18n, _this.rI18n[mw.config.get('wgUserLanguage').split('-')[0]], _this.rI18n[mw.config.get('wgUserLanguage')]);

			// Finally set up event handlers
			$(document).bind('renamerequest', function(evt, a, b) {
				if (a && 'start' === a) {
					_this.showProgress(_this.rI18n.progress.policy);
					_this.tasks = [];
					_this.addTask('rGetPolicy');
					_this.addTask('rDialog');
					_this.nextTask();
				}
			});
			$(document).triggerHandler('scriptLoaded', ['renamerequest', 'init']);
		},
		// Translation
		// This should be changed when gadgets 2.0 are available
		rI18n: {
			'bn': {
				submitButtonLabel: "পুনঃনামকরণের অনুরোধ",
				proceedButtonLabel: "প্রক্রিয়াকরণ হচ্ছে",
				cancelButtonLabel: "বাতিল",
				headline: "একটি ফাইল পুনঃনামকরণ",
				lNewName: "নতুন নাম লিখুন",
				tNewName: "পছন্দসই ফাইলের নাম লিখুন",
				pNewName: "নতুন নাম",
				lRationale: "নীতি অনুযায়ী যুক্তিসহ ব্যাখ্যা",
				tRationale: "একটি বৈধ কারণ উল্লেখ করুন বা টেবিল থেকে একটি বেছে নিন",
				pRationale: "একটি কারণ বেছে নিন",
				lReason: "অতিরিক্ত ব্যাখ্যা / কারণ / যুক্তি",
				tReason: "ঐচ্ছিক: বিস্তারিত প্রদান করুন",
				pReason: "অতিরিক্ত কারণ বা যুক্তি",
				lAccept: "আমি স্বীকার করি যে, পুনরাবৃত্তিমূলক অ-সমর্থনযোগ্য পুনঃনামকরণ অনুরোধের ক্ষেত্রে আমার জন্য এই বৈশিষ্ট্য অবরুদ্ধ হবে।",
				invalidRationale: "একটি বৈধ যুক্তিসহ ব্যাখ্যা নির্বাচন করুন",
				nameToShort: "নাম খুব ছোট",
				newName: "দয়া করে একটি *নতুন* নাম নির্দিষ্ট করুন",
				notTheUploader: "সৎ ভাবে: আপনি আপলোডকারী নয়",
				nameExists: "উল্লিখিত ফাইলটির নামে একটি ফাইল ইতিমধ্যেই আছে - দয়া করে অন্য নাম বেছে নিন",
				blacklisted: "এই নামটি কালোতালিকাভুক্ত - দয়া করে অন্য নাম বেছে নিন",
				progress: {
					policy: "নীতি লোড হচ্ছে",
					input: "ইনপুট পরীক্ষা হচ্ছে",
					blacklisted: "নতুন ফাইলের নাম কালোতালিকাভুক্ত কিনা তা পরীক্ষা করা হচ্ছে",
					load: "উইকিটেক্সট লোড হচ্ছে",
					edit: "এই ফাইল স্থানান্তর করতে একজন ফাইল মুভারকে অনুরোধ করা হচ্ছে"
				}
			},
			'de': {
				submitButtonLabel: "Umbenennung beauftragen",
				proceedButtonLabel: "Weiter",
				cancelButtonLabel: "Abbrechen",
				headline: "Umbenennung einer Datei",
				lNewName: "Neuer Dateiname",
				tNewName: "Gib den gewünschten Dateinamen ein",
				pNewName: "neuer Name",
				lRationale: "Kriterium gemäß der Richtlinie",
				tRationale: "Eine Begründung auswählen",
				pRationale: "Begründung wählen",
				lReason: "Weitere Gründe",
				tReason: "Optional: Weitere Erklärung",
				pReason: "zusätzliche Erklärung des Wunsches",
				lAccept: "Ich nehme zur Kenntnis, dass wiederholte ungerechtfertigte Umbenennungsaufträge zur Sperrung der Funktion führen können.",
				invalidRationale: "Ein gültiges Kriterium auswählen",
				nameToShort: "Name ist zu kurz",
				newName: "Bitte gib einen *neuen* Namen ein",
				notTheUploader: "Sei ehrlich: Du hast diese Datei nicht hochgeladen",
				nameExists: "Es gibt bereits eine Datei diesen Namens. Wähle einen anderen Namen",
				blacklisted: "Dieser Name steht auf der schwarzen Liste. Wähle einen anderen Namen",
				progress: {
					policy: "Richtlinie laden",
					input: "Eingabe überprüfen",
					blacklisted: "Schwarze Liste prüfen",
					load: "Wikitext laden",
					edit: "Einen Dateiverschieber beauftragen"
				}
			},
			'es': {
				submitButtonLabel: "Solicitar el cambio de nombre",
				proceedButtonLabel: "Proceder",
				cancelButtonLabel: "Cancelar",
				headline: "Renombrando un archivo",
				lNewName: "Introduce el nuevo nombre",
				tNewName: "Introduce el nombre deseado para el archivo",
				pNewName: "nuevo nombre",
				lRationale: "Razón lógica de acuerdo a la política",
				tRationale: "Proporciona una razón válida o selecciona una de la tabla",
				pRationale: "Selecciona una razón",
				lReason: "Explicación / razón / justificación adicional",
				tReason: "Opcional: Proporciona detalles",
				pReason: "razón o justificación adicional",
				lAccept: "Reconozco que las peticiones reiteradas de cambios de nombre no justificados me bloquearán esta función.",
				invalidRationale: "Selecciona una justificación válida",
				nameToShort: "El nombre es demasiado corto",
				newName: "Por favor especifica un *nuevo* nombre",
				notTheUploader: "Sé honesto/a: No eres el subidor/a",
				nameExists: "Ya existe un archivo con el nombre del archivo especificado. Por favor, elige otro nombre",
				blacklisted: "Este nombre está en la lista negra. Por favor, elige otro nombre",
				progress: {
					policy: "Cargando la política",
					input: "Comprobando la entrada",
					blacklisted: "Comprobando si el nuevo nombre del archivo está en la lista negra",
					load: "Cargando wikitext",
					edit: "Solicitando a un renombrador de archivos que mueva este archivo"
				}
			},
			'fa': {
				submitButtonLabel: "درخواست تغییر نام",
				proceedButtonLabel: "اقدام",
				cancelButtonLabel: "لغو",
				headline: "تغییر نام پرونده",
				lNewName: "نام جدید را بنویسید",
				tNewName: "نام مورد نظرتان را بنویسید",
				pNewName: "نام جدید",
				lRationale: "دلیل بر پایه سیاست\u200cها",
				tRationale: "دلیلتان را بیان کنید یا از جدول زیر انتخاب کنید",
				pRationale: "انتخاب دلیل",
				lReason: "توضیحات بیشتر / دلیل / توجیه",
				tReason: "اختیاری: بیان جزئیات",
				pReason: "دلیل یا توجیه بیشتر",
				lAccept: "مطلع هستم که عدم بیان دلیل باعث می\u200cشود که رسیدگی به این درخواست متوقف گردد.",
				invalidRationale: "یک معیار مجاز انتخاب کنید",
				nameToShort: "نام بسیار کوتاه",
				newName: "لطفا یک نام *جدید* مشخص کنید",
				notTheUploader: "صادقانه: شما بارگذار نیستید",
				nameExists: ".پرونده\u200cای با این نام موجود است، لطفاً یک نام دیگر انتخاب کنید",
				blacklisted: "این نام در فهرست سیاه قرار دارد لطفاً یک نام دیگر انتخاب کنید.",
				progress: {
					policy: "بارگیری سیاست\u200cها",
					input: "چک کردن ورودی",
					blacklisted: "چک کردن اینکه آیا نام در فهرست سیاه است یا نه",
					load: "بارگیری ویکی\u200cمتن",
					edit: "در حال درخواست انتقال\u200cدهندهٔ پرونده برای انتقال این پرونده"
				}
			},
			'fr': {
				submitButtonLabel: "Confirmer la demande de renommage",
				proceedButtonLabel: "Confirmer",
				cancelButtonLabel: "Annuler",
				headline: "Renommer un fichier",
				lNewName: "Entrez le nouveau nom",
				tNewName: "Entrez le nom de fichier souhaité",
				pNewName: "nouveau nom",
				lRationale: "Motif, conformément aux règles",
				tRationale: "Veuillez indiquer un motif valide ou le sélectionner dans la table ci-dessus",
				pRationale: "Sélectionnez un motif",
				lReason: "Explications complémentaires",
				tReason: "Facultatif: Donnez des détails",
				pReason: "Motif complémentaire",
				lAccept: "Je comprends que des requêtes non justifiées répétées me priveront l’accès à cet outil.",
				invalidRationale: "Veuillez sélectionner un motif valide",
				nameToShort: "Le nom est trop court",
				newName: "Veuillez indiquer un *nouveau* nom",
				notTheUploader: "Sauf erreur, ce n’est pas vous qui avez téléversé ce fichier",
				nameExists: "Il existe déjà un autre fichier avec ce nom, veuillez en choisir un autre",
				blacklisted: "Ce nom est blacklist, veuillez en choisir un auter",
				progress: {
					policy: "Chargement des règles",
					input: "Vérfication des entrées",
					blacklisted: "Vérification du nouveau nom dans la liste noire",
					load: "Chargement du wikitexte",
					edit: "Demander à un renommeur de fichiers de renommer ce fichier"
				}
			},
			'gl': {
				submitButtonLabel: "Solicitar o cambio de nome",
				proceedButtonLabel: "Continuar",
				cancelButtonLabel: "Cancelar",
				headline: "Cambiar o nome dun ficheiro",
				lNewName: "Escribe o novo nome",
				tNewName: "Escribe o nome desexado para o ficheiro",
				pNewName: "novo nome",
				lRationale: "Motivo de acordo coa política",
				tRationale: "Dá un motivo válido ou selecciona un da táboa",
				pRationale: "Selecciona un motivo",
				lReason: "Explicación/motivo/xustificación adicional",
				tReason: "Opcional: Dá máis detalles",
				pReason: "motivo ou xustificación adicional",
				lAccept: "Acepto que as solicitudes reiteradas de cambio de nome non xustificadas hanme bloquear esta función.",
				invalidRationale: "Selecciona un motivo válido",
				nameToShort: "O nome é demasiado curto",
				newName: "Especifica un *novo* nome",
				notTheUploader: "Sé honesto: Non es a persoa que subiu o ficheiro",
				nameExists: "Xa existe un ficheiro co nome especificado. Escolle outro nome",
				blacklisted: "Este nome está na lista negra. Escolle outro nome",
				progress: {
					policy: "Cargando a política",
					input: "Comprobando a entrada",
					blacklisted: "Comprobando se o novo nome está na lista negra",
					load: "Cargando o texto wiki",
					edit: "Solicitando a un renomeador de ficheiros que traslade o ficheiro"
				}
			},
			'ja': {
				submitButtonLabel: "改名を依頼",
				proceedButtonLabel: "進む",
				cancelButtonLabel: "取り消す",
				headline: "ファイルの改名",
				lNewName: "新しい名前をお入れください'",
				tNewName: "望ましいファイル名をここにお入れください",
				pNewName: "新しい名前",
				lRationale: "方針を踏まえた改名理由をお入れください",
				tRationale: "適切な理由をご記入、または下記の表からお選びください",
				pRationale: "理由をお選びください",
				lReason: "補足説明、理由、根拠",
				tReason: "詳細に説明してください(省略可能です)",
				pReason: "補足的な理由または根拠",
				lAccept: "根拠のない改名依頼を繰り返した場合、この機能の使用の禁止処分を受けることを了承します",
				invalidRationale: "適切な理由をお選びください",
				nameToShort: "名前が短すぎます",
				newName: "「新しい」名前を指定してください",
				notTheUploader: "嘘はやめましょう:あなたはアップロード者ではありません",
				nameExists: "指定された名前のファイルがすでにあります。別の名前をお選びください",
				blacklisted: "この名前は禁止されています。別の名前をお選びください",
				progress: {
					policy: "方針を読み込んでいます",
					input: "入力をチェックしています",
					blacklisted: "新しいファイル名が禁止されていないかチェックしています",
					load: "ウィキ文を読み込んでいます",
					edit: "ファイル移動者 (Filemover) に移動を依頼しています"
				}
			},
			'ko': {
				submitButtonLabel: "파일 이름 변경 요청",
				proceedButtonLabel: "확인",
				cancelButtonLabel: "취소",
				headline: "파일 이름 바꾸기",
				lNewName: "새로운 이름을 입력하세요",
				tNewName: "원하는 새 이름을 입력하세요",
				pNewName: "새 이름",
				lRationale: "정책에 따른 조건 번호",
				tRationale: "정당한 이유를 제시하거나 표에서 고르세요.",
				pRationale: "이유 선택",
				lReason: "추가 설명 / 이유 / 타당한 이유",
				tReason: "선택 사항: 자세한 설명",
				pReason: "추가적인 설명 혹은 타당한 이유",
				lAccept: "나는 정당하지 않은 파일 이름 변경 요청을 계속하면 이 기능을 쓸 수 없게 됨에 동의합니다.",
				invalidRationale: "유효한 이유를 선택하세요",
				nameToShort: "이름이 너무 짧습니다",
				newName: "*새*이름을 명시해 주세요",
				notTheUploader: "정직하십시오: 당신은 사진을 올리지 않았습니다.",
				nameExists: "이미 해당 파일 이름이 존재합니다 - 다른 이름을 선택해 주세요",
				blacklisted: "해당 파일 이름은 블랙리스트에 포함되어 있습니다 - 다른 이름을 선택해 주세요",
				progress: {
				        policy: "정책 로딩 중",
				        input: "입력 확인 중",
				        blacklisted: "새 파일 이름이 블랙리스트에 포함되었나 확인 중",
				        load: "위키텍스트 로딩 중",
				        edit: "파일 이동자에게 파일을 이동할 것을 요청하는 중"
				}
			},
			'ml': {
				submitButtonLabel: "പേര് മാറ്റാൻ നിർദ്ദേശിക്കുക",
				proceedButtonLabel: "തുടങ്ങുക",
				cancelButtonLabel: "വേണ്ടെന്ന് വയ്ക്കുക",
				headline: "പ്രമാണത്തിന്റെ പേര് മാറ്റുക",
				lNewName: "പുതിയ നാമം നൽകുക",
				tNewName: "പുതിയ നാമം",
				pNewName: "പുതിയ നാമം",
				lRationale: "പേര് മാറ്റാനുള്ള കാരണം",
				tRationale: "താഴെയുള്ള പട്ടികയിൽ നിന്ന് ഒരു കാരണം തിരഞ്ഞെടുക്കുക, അല്ലെങ്കിൽ മറ്റൊന്ന് നൽകുക.",
				pRationale: "ഒരു കാരണം നൽകുക",
				lReason: "കൂടുതൽ കാരണങ്ങൾ / ന്യായങ്ങൾ",
				tReason: "ഐച്ചികം: കൂടുതൽ വിവരങ്ങൾ നൽകുക",
				pReason: "മറ്റ് കാരണങ്ങളും ന്യായങ്ങളും",
				lAccept: "അനാവശ്യമായി പേരു മാറ്റം നിർദ്ദേശിക്കുന്നത് ഈ ഉപകരണം ഉപയോഗിക്കുന്നതിന്റെ നിന്ന് എന്നെ തടഞ്ഞേക്കുമെന്ന് ഞാൻ മനസ്സിലാക്കന്നു.",
				invalidRationale: "ശരിയായ ഒരു കാരണം തിരഞ്ഞെടുക്കുക.",
				nameToShort: "പേരിനു നീളം കുറവാണ്",
				newName: "*പുതിയ* ഒരു പേര് നൽകുക",
				notTheUploader: "സമ്മതിക്കുക: താങ്കളല്ല ഈ പ്രമാണം അപ്ലോഡ് ചെയ്തിരിക്കുന്നത്",
				nameExists: "ഈ പേരിൽ മറ്റൊരു പ്രമാണം നിലവിലുണ്ട് - മറ്റേതെങ്കിലും നാമം നിർദ്ദേശിക്കുക.",
				blacklisted: "ഈ നാമം നൽകാൻ സാധ്യമല്ല - മറ്റേതെങ്കിലും നാമം നിർദ്ദേശിക്കുക.",
				progress: {
					policy: "നയങ്ങൾ തിരഞ്ഞെടുക്കുന്നു.",
					input: "പൂരിപ്പിച്ച വിവരങ്ങൾ പരിശോധിക്കുന്നു.",
					blacklisted: "തടയപ്പെട്ട നാമം ആണോ നൽകിയിരിക്കുന്നതെന്ന് പരിശോധിക്കുന്നു.",
					load: "വിക്കിടെക്സ്റ്റ് ശരിയാക്കുന്നു.",
					edit: "പ്രമാണത്തിന്റെ നാമം മാറ്റാനുള്ള നിർദ്ദേശം താളിൽ ചേർക്കുന്നു."
				}
			},
			'nl': {
				submitButtonLabel: "Vraag hernoeming aan",
				proceedButtonLabel: "Gaan",
				cancelButtonLabel: "Annuleren",
				headline: "Bestand hernoemen",
				lNewName: "Vul de nieuwe naam in",
				tNewName: "Vul de gewenste naam in",
				pNewName: "nieuwe naam",
				lRationale: "Motivering volgens het beleid",
				tRationale: "Kies een geldige reden of selecteer een uit de tabel",
				pRationale: "Selecteer een reden",
				lReason: "Aanvullende uitleg / reden / motivering",
				tReason: "Optioneel: verstrek details",
				pReason: "aanvullende reden of rechtvaardiging",
				lAccept: "Ik erken dat herhaalde niet-gerechtvaardige aanvragen voor hernoeming  kunnen leiden tot blokkade van deze functie.",
				invalidRationale: "Selecteer een geldige motivering",
				nameToShort: "Naam is te kort",
				newName: "Kies een *nieuwe* naam",
				notTheUploader: "Wees eerlijk: Je bent niet de uploader",
				nameExists: "Er bestaat al een bestand met de gekozen naam - kies een andere naam",
				blacklisted: "Deze naam is niet toegestaan - kies een andere naam",
				progress: {
					policy: "Beleid laden",
					input: "Invoer controleren",
					blacklisted: "Controleren of de nieuwe naam is toegestaan",
					load: "Wikitekst laden",
					edit: "Een bestandshernoemer vragen dit bestand te hernoemen"
				}
			},
			'pl': {
				submitButtonLabel: "Zmień nazwę",
				proceedButtonLabel: "Kontynuuj",
				cancelButtonLabel: "Anuluj",
				headline: "Zmiana nazwy pliku",
				lNewName: "Wpisz nową nazwę",
				tNewName: "Wpisz żądaną nazwę pliku",
				pNewName: "nowa nazwa",
				lRationale: "Uzasadnienie zgodnie z warunkami",
				tRationale: "Podaj ważny powód lub wybierz jeden z listy",
				pRationale: "Wskaż powód",
				lReason: "Dodatkowe wyjaśnienie / przyczyna / uzasadnienie",
				tReason: "Opcjonalnie: Podaj szczegóły",
				pReason: "dodatkowa przyczyna lub uzasadnienie",
				lAccept: "Rozumiem, że powtarzające się nieuzasadnione żądania zmiany nazwy spowodują zablokowanie tej funkcji dla mnie.",
				invalidRationale: "Wybierz poprawne uzasadnienie",
				nameToShort: "Nazwa jest za krótka",
				newName: "Proszę wpisać *nową* nazwę",
				notTheUploader: "Mówiąc szczerze: Nie jesteś uploaderem",
				nameExists: "Istnieje już plik o takiej nazwie - Proszę wybrać inną nazwę",
				blacklisted: "Ta nazwa jest na czarnej liście - Proszę wybrać inną nazwę",
				progress: {
					policy: "Ładowanie warunków",
					input: "Sprawdzanie formularza",
					blacklisted: "Sprawdzanie, czy nowa nazwa pliku nie jest na czarnej liście",
					load: "Ładowanie Wikitekstu",
					edit: "Powiadamianie filemovera o przeniesieniu tego pliku"
				}
			}, 
			'pt': {
				submitButtonLabel: "Solicitar renomeação",
				proceedButtonLabel: "Continuar",
				cancelButtonLabel: "Cancelar",
				headline: "Renomeando um arquivo",
				lNewName: "Digite o novo nome",
				tNewName: "Digite o nome do arquivo desejado",
				pNewName: "novo nome",
				lRationale: "Razão de acordo com a política",
				tRationale: "Forneça uma razão válida ou selecione uma da tabela",
				pRationale: "Selecione uma razão",
				lReason: "Explicação / razão / justificativa adicional",
				tReason: "Opcional: Forneça detalhes",
				pReason: "razão ou justificativa adicional",
				lAccept: "Eu reconheço que solicitações repetidas de renomeação não-justificadas farão com que essa ferramenta seja bloqueada para mim.",
				invalidRationale: "Selecione uma razão válida",
				nameToShort: "O nome é muito curto",
				newName: "Por favor, especifique um *novo* nome de arquivo",
				notTheUploader: "Seja honesto: você não é o carregador",
				nameExists: "Já existe um arquivo com o nome do arquivo especificado - Por favor, escolha um outro nome",
				blacklisted: "Este nome está na lista negra - Por favor, escolha um outro nome",
				progress: {
						policy: "Carregando política",
						input: "Verificando a entrada",
						blacklisted: "Verificando se o novo nome do arquivo está na lista negra",
						load: "Carregando Wikitexto",
						edit: "Solicitando a um renomeador de arquivos que mova este arquivo"
				}
			},
			'ro': {
				submitButtonLabel: "Cerere de redenumire",
				proceedButtonLabel: "Continuați",
				cancelButtonLabel: "Revocare",
				headline: "Redenumirea unui fișier",
				lNewName: "Introduceți noul nume",
				tNewName: "Introduceți numele dorit pentru fișier",
				pNewName: "nume nou",
				lRationale: "Motiv în conformitate cu politica",
				tRationale: "Alegeți introduceți un motiv valid sau alegeți unul din tabel",
				pRationale: "Alegeți un motiv",
				lReason: "Explicație / motiv / justificare adițională",
				tReason: "Opțional: Introduceți detalii",
				pReason: "motiv sau justificare adițională",
				lAccept: "Sunt de acord că cererile repetate nejustificate de redenumire vor duce la blocarea acestei funcții pentru mine.",
				invalidRationale: "Alegeți un motiv valid",
				nameToShort: "Numele este prea scurt",
				newName: "Introduceți un nume *nou*",
				notTheUploader: "Fiți sincer: Nu sunteți persoana care l-a încărcat",
				nameExists: "Există deja un fișier cu numele specificat - Alegeți altul",
				blacklisted: "Acest nume este pe lista neagră - Alegeți alt nume",
				progress: {
					policy: "Se încarcă politica",
					input: "Se verifică datele introduse",
					blacklisted: "Se verifică dacă numele nou este pe lista neagră",
					load: "Se încarcă Wikitextul",
					edit: "Se introduce cererea de redenumire a fișierului"
				}
			},
			'ru': {
				submitButtonLabel: "Запрос на переименование",
				proceedButtonLabel: "Продолжить",
				cancelButtonLabel: "Отмена",
				headline: "Переименование файла",
				lNewName: "Введите новое название",
				tNewName: "Введите желаемое название файла",
				pNewName: "новое название",
				lRationale: "Обоснование в соответствии с правилом",
				tRationale: "Укажите подходящую причину или выберите её из таблицы",
				pRationale: "Выбор причины",
				lReason: "Дополнительные пояснения / причины / обоснования",
				tReason: "Опционально: опишите подробнее",
				pReason: "дополнительная причина или обоснование",
				lAccept: "Я понимаю, что при систематическом размещении неоправданных запросов на переименование, эта возможность будет для меня заблокирована.",
				invalidRationale: "Выбор подходящего обоснования",
				nameToShort: "Название слишком короткое",
				newName: "Пожалуйста, укажите *новое* название",
				notTheUploader: "Будьте честны: не вы загрузили этот файл",
				nameExists: "Файл с указанным названием уже существует. Пожалуйста, выберите другое название",
				blacklisted: "Это название находится в чёрном списке. Пожалуйста, выберите другое название",
				progress: {
					policy: "Загрузка правила",
					input: "Проверка ввода",
					blacklisted: "Проверка, не входит ли новое название файла в чёрный список",
					load: "Загрузка викитекста",
					edit: "Запрос к переименовывающим файлы на переименование этого файла"
				}
			},
			'sv': {
				submitButtonLabel: "Begär omdöpning",
				proceedButtonLabel: "Fortsätt",
				cancelButtonLabel: "Avbryt",
				headline: "Omdöpning av fil",
				lNewName: "Ange det nya namnet",
				tNewName: "Ange det önskade filnamnet",
				pNewName: "nytt namn",
				lRationale: "Kriterium enligt riktlinjerna",
				tRationale: "Ange en giltig anledning eller välj en från tabellen",
				pRationale: "Välj en anledning",
				lReason: "Ytterligare förklaring / anledning / motivation",
				tReason: "Valfri: Ytterligare detaljer",
				pReason: "ytterligare anledning eller motivation",
				lAccept: "Jag är införstådd med att upprepade icke-motiverade begäran om omdöpning kommer att leda till att detta verktyg blockeras för mig.",
				invalidRationale: "Välj en giltig anledning",
				nameToShort: "Namnet är för kort",
				newName: "Vänligen välj ett *nytt* namn",
				notTheUploader: "Var ärlig: Du är inte uppladdaren",
				nameExists: "Det finns redan en fil med det angivna namnet. Välj ett annat namn.",
				blacklisted: "Detta namn är svartlistat. Välj ett annat namn.",
				progress: {
					policy: "Laddar riktlinjer",
					input: "Kontrollerar indata",
					blacklisted: "Kollar om det nya filnamnet är svartlistat",
					load: "Laddar wikitext",
					edit: "Begär att en filflyttare flyttar denna fil"
				}
			},
			'tr': {
				submitButtonLabel: "Yeniden adlandırma isteği gönder",
				proceedButtonLabel: "İlerle",
				cancelButtonLabel: "İptal",
				headline: "Dosyaların yeniden adlandırılması",
				lNewName: "Yeni adı girin",
				tNewName: "İstediğiniz dosya adını girin",
				pNewName: "yeni adı",
				lRationale: "Politikaya göre yeniden adlandırma gerekçesi",
				tRationale: "Geçerli bir neden verin ya da tablodan birini seçin",
				pRationale: "Bir neden seçin",
				lReason: "Ek açıklama/neden/gerekçe",
				tReason: "Ayrıntı girin (isteğe bağlı)",
				pReason: "ek bir neden ya da gerekçe",
				lAccept: "Değerlendirilmemiş isim değişikliği taleplerini tekrarlamamın, engellenmemle sonuçlanacağını kabul ediyorum.",
				invalidRationale: "Geçerli bir gerekçe seçin",
				nameToShort: "Adı çok kısa",
				newName: "Lütfen \"yeni\" ad girin",
				notTheUploader: "Dürüst olunuz: Dosyayı yükleyen siz değilsiniz",
				nameExists: "Belirtilen dosya adıyla bir dosya zaten mevcut. Lütfen başka bir ad seçin.",
				blacklisted: "Bu ad kara listededir. Lütfen başka bir ad seçin.",
				progress: {
					policy: "Politika yükleniyor",
					input: "Girdi denetleniyor",
					blacklisted: "Yeni dosya adının kara listede olup olmadığı denetleniyor",
					load: "Vikimetin yükleniyor",
					edit: "Bu dosyayı taşımak için bir dosya taşıyıcı (filemover) isteniyor."
				}
			},
			submitButtonLabel: "Request renaming",
			proceedButtonLabel: "Proceed",
			cancelButtonLabel: "Cancel",
			headline: "Renaming a file",
			lNewName: "Enter the new name",
			tNewName: "Enter the desired file name",
			pNewName: "new name",
			lRationale: "Rationale according to the policy",
			tRationale: "Provide a valid reason or select one from the table",
			pRationale: "Select a reason",
			lReason: "Additional explanation / reason / justification",
			tReason: "Optional: Provide details",
			pReason: "additional reason or justification",
			lAccept: "I acknowledge that repeated non-justified rename requests will block this feature for me.",
			invalidRationale: "Select a valid rationale",
			nameToShort: "Name is too short",
			newName: "Please specify a *new* name",
			notTheUploader: "Be honest: You are not the uploader",
			nameExists: "There is already a file with the specified file name - Please choose another name",
			blacklisted: "This name is blacklisted - Please choose another name",
			progress: {
				policy: "Loading policy",
				input: "Checking input",
				blacklisted: "Checking whether the new file name is blacklisted",
				load: "Loading Wikitext",
				edit: "Requesting a filemover to move this file"
			}
		},
		// Configuration
		rConfig: {
			reasonPage: 'Template:File renaming reasons/render',
			removeTemplate: /\{\{\s*(?:[Rr]ename|[Bb]ad name)[^\{\}]*\}\}(?:\s*)?/,
			addTemplate: '{{rename|1=%NEWFILE%|2=%NUMBER%|3=%REASON%|user=' + mw.config.get('wgUserName') + '}}\n',
			summary: "([[Help:RenameLink|Script]]): Requesting renaming this file to [[File:%NEWFILE%]]; Reason: %REASON%; Criterion %NUMBER%",
			dlg: {
				width: 850,
				height: ($(window).height() > 770 ? 'auto' : $(window).height())
			},
			helpLink: '<a href="' + mw.util.getUrl('Help:RenameLink') + '" target="_blank"><img src="//upload.wikimedia.org/wikipedia/commons/4/45/GeoGebra_icon_help.png" alt="?"/></a>'
		}
	};

	mw.loader.using(['ext.gadget.AjaxQuickDelete', 'ext.gadget.libJQuery', 'jquery.tipsy'], function() {
		$.extend(true, window.AjaxQuickDelete, window.rRename);
		_this = window.AjaxQuickDelete;
		window.AjaxQuickDelete.rInit();
	});
})(jQuery, mediaWiki);
// Just for debugging
// $(document).unbind('renamerequest');
// $(document).triggerHandler('renamerequest', ['start']);
// </nowiki>