MediaWiki:RotateRequest.js: Difference between revisions

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search
Content deleted Content added
m watchlist: 'nochange' && use libAPI
let's apply RTL dialog fix from common.css as other jQuery UI based tools are also affected
Tag: Manual revert
 
(23 intermediate revisions by 13 users not shown)
Line 1: Line 1:
// <nowiki>
// <nowiki>
/* global mediaWiki */
// Invoke automated jsHint-validation on save: A feature on WikimediaCommons
// Interested? See [[:commons:MediaWiki:JSValidator.js]], [[:commons:Help:JSValidator.js]].
/*global jQuery:false, $:false, mw:false */


// Disable purging of thumbnails before displaying to speed-up the process
// Disable purging of thumbnails before displaying to speed-up the process
Line 8: Line 6:
// that require fresh thumbs. Simply remove the following line.
// that require fresh thumbs. Simply remove the following line.
window.rotateDontPurge = true;
window.rotateDontPurge = true;



/**************************************
/**************************************
Request rotation of an image
Request rotation of an image
composed in 2011 by Rillke
composed in 2011 by Rillke

The following code is jsHint-valid.
**************************************/
**************************************/
/* eslint indent:["error","tab",{"outerIIFEBody":0}] */
(function($) {
( function ( $, mw ) {
'use strict';
'use strict';
if (window.rRot || mw.config.get('wgNamespaceNumber') !== 6) {
if ( window.rRot || mw.config.get( 'wgNamespaceNumber' ) !== 6 ) { return; }

return;
}
window.rRot = {
window.rRot = {
dialog: function() {
dialog: function () {
var dlgButtons = {};
var dlgButtons = {},
var _this = this;
self = this,

var fileExt = mw.config.get('wgPageName').slice(mw.config.get('wgPageName').lastIndexOf('.')+1).toLowerCase();
fileExt = mw.config.get( 'wgPageName' ).slice( mw.config.get( 'wgPageName' ).lastIndexOf( '.' ) + 1 ).toLowerCase(),
var angleBotCompat = true;
angleBotCompat = true,
var lastAngle = 0;
lastAngle = 0,
var lastOptionId = this.config.dlg.customOption;
lastOptionId = this.config.dlg.customOption,
var cookie = $.cookie( 'rRotate' );
cookie = mw.cookie.get( 'rRotate' );
this.usedBotOption = false;
this.usedBotOption = false;
this.sending = false;
this.sending = false;

cookie = cookie ? (cookie) : (this.config.dlg.customNumber);
cookie = cookie || ( this.config.dlg.customNumber );
if ('string' === typeof cookie) {
if ( typeof cookie === 'string' ) {
cookie = cookie.split('|');
cookie = cookie.split( '|' );
lastAngle = cookie[0] - 0;
lastAngle = cookie[ 0 ] - 0;
if (cookie[1] && ('B' === cookie[1])) {
if ( cookie[ 1 ] && ( cookie[ 1 ] === 'B' ) ) {
if (-1 !== $.inArray(lastAngle, this.config.botAcceptedAngels)) {
if ( $.inArray( lastAngle, this.config.botAcceptedAngles ) !== -1 ) {
this.usedBotOption = true;
this.usedBotOption = true;
lastOptionId = $.inArray(lastAngle, this.config.botAcceptedAngels);
lastOptionId = $.inArray( lastAngle, this.config.botAcceptedAngles );
}
}
} else {
} else {
Line 50: Line 44:
lastAngle = cookie - 0;
lastAngle = cookie - 0;
}
}

this.angle = 0;
this.angle = 0;
this.fileExtBotCompat = (-1 !== $.inArray(fileExt, this.config.botAcceptedFormats));
this.fileExtBotCompat = ( $.inArray( fileExt, this.config.botAcceptedFormats ) !== -1 );
var setAngle = function(newAngle) {
if (!/\d+/.test(newAngle)) {
return false;
}
newAngle = newAngle - 0;
if (newAngle < 0) {
newAngle = 360 + newAngle;
}
if (0 > newAngle || newAngle > 360) {
return false;
}
_this.angle = newAngle;
if (_this.purgeCompleted) {
$('#uniqueImg').rotate({animateTo: newAngle});
}
var oldAngleBotCompat = angleBotCompat;
angleBotCompat = (-1 !== $.inArray(newAngle, _this.config.botAcceptedAngels));
if ((oldAngleBotCompat !== angleBotCompat)) {
$(document).triggerHandler('rotaterequest', ['newAngleBotCompat', angleBotCompat]);
}
return true;
};
var botOptions = function() {
var r = '', i = 0, a = 0, l = _this.config.botAcceptedAngels.length;
for (i=0; i < l; i++) {
a = _this.config.botAcceptedAngels[i];
r += '<label for="rRot' + i + '" style="' + _this.config.dlg.labelStyle + '">' +
'<input name="angle" type="radio" id="rRot' + i + '" value="' + a + '" /> ' + a + '° </label><br/>';
}
return r;
};


var setAngle = function ( newAngle ) {
var supportsCSS = $('img:first').rotate({ getSupportCSS: true });
if ( !/\d+/.test( newAngle ) ) {
return false;
var purgeComplete = function(result) {
// Add the image to the container
var imgSrc = '';
if (result) {
try {
_this.$imgNode = $('table.filehistory', $(result)).find('img').eq(0).clone().css('overflow', 'visible').attr('id', 'uniqueImg');
} catch (e) {}
}
if (!_this.$imgNode || 0 === _this.$imgNode.length) {
_this.$imgNode = $('table.filehistory').find('img').eq(0).clone().css('overflow', 'visible').attr('id', 'uniqueImg');
}
if (0 === _this.$imgNode.length) {
_this.$imgNode = $('<img>', {
alt: 'no thumb available',
title: 'This is NOT the actual image. There is no thumb available.',
height: '120',
width: '120',
id: 'uniqueImg'
}).css('overflow', 'visible');
imgSrc = '//bits.wikimedia.org/skins-1.18/common/images/icons/fileicon.png';
} else {
imgSrc = _this.$imgNode.attr('src');
}
var w = _this.$imgNode.attr('width'),
h = _this.$imgNode.attr('height');
_this.$imgNode
.css('top', Math.max(w/2 - h/2, 0)).css('position', 'relative')
.load(function () {
$('#loadContainer').fadeOut();
$('#imgContainer').fadeIn();
$('#uniqueImg').rotate({ angle:0 });
$('#uniqueImg').rotate({animateTo: _this.angle});
}).error(function () {
$('#loadContainer').fadeOut();
$('#imgContainer').fadeIn();
$('#uniqueImg').rotate({ angle:0 });
$('#uniqueImg').rotate({animateTo: _this.angle});
_this.fail("The server was unable to create a thumbnail. You may close and re-open the dialog.");
});
if (!supportsCSS) {
_this.$imgNode.attr('src', '//upload.wikimedia.org/wikipedia/commons/9/92/Bert2_transp_5B5B5B_cont_150ms.gif');
$('#loadContainer').fadeOut();
$('#imgContainer').fadeIn();
}
if (supportsCSS && !window.rotateDontPurge) {
imgSrc = (imgSrc + '?dummy=' + Math.floor(Math.random()*10000000));
}
if (!window.rotateDontPurge) {
window.rotateDontPurge = true;
// Only added for old cached thumbs. Possible not a stable way to achieve this. Please remove it ASAP.
var imgPathParts = imgSrc.split('\/');
var imgLastPart = imgPathParts[imgPathParts.length-1].match(/(\D*|(?:\D*\d{1,3}\-)*)(\d+)(px.+)/);
if (imgLastPart) {
imgPathParts[imgPathParts.length-1] = imgLastPart[1] + (parseInt(imgLastPart[2], 10)+1) + imgLastPart[3];
imgSrc = imgPathParts.join('\/');
}
}
// ---
newAngle = newAngle - 0;
if ( newAngle < 0 ) {
}
newAngle = 360 + newAngle;
_this.$imgNode.attr('src', imgSrc);
}
_this.$dlgNode.find('#imgContainer').prepend(_this.$imgNode);
if ( newAngle < 0 || newAngle > 360 ) { return false; }

_this.purgeCompleted = true;
self.angle = newAngle;
$('#uniqueImg').rotate({animateTo: _this.angle});
if ( self.purgeCompleted ) {
};
$( '#uniqueImg' ).rotate( { animateTo: newAngle } );
}
this.$dlgNode = $('<div>', {}).html(

var oldAngleBotCompat = angleBotCompat;
angleBotCompat = ( $.inArray( newAngle, self.config.botAcceptedAngles ) !== -1 );
if ( ( oldAngleBotCompat !== angleBotCompat ) ) {
$( document ).triggerHandler( 'rotaterequest', [ 'newAngleBotCompat', angleBotCompat ] );
}
return true;
},

botOptions = function () {
var r = '', i = 0, a = 0, l = self.config.botAcceptedAngles.length;
for ( i = 0; i < l; i++ ) {
a = self.config.botAcceptedAngles[ i ];
r += '<label for="rRot' + i + '" style="' + self.config.dlg.labelStyle + '"><input name="angle" type="radio" id="rRot' + i + '" value="' + a + '" /> ' + a + '° </label><br>';
}
return r;
},

supportsCSS = $( 'img:first' ).rotate( { getSupportCSS: true } ),

purgeComplete = function ( result ) {
// Add the image to the container
var imgSrc = '';
if ( result ) {
try {
self.$imgNode = $( 'table.filehistory', $( result ) ).find( 'img' ).eq( 0 ).clone().css( 'overflow', 'visible' ).attr( 'id', 'uniqueImg' );
} catch ( e ) {}
}
if ( !self.$imgNode || !self.$imgNode.length ) {
self.$imgNode = $( 'table.filehistory' ).find( 'img' ).eq( 0 ).clone().css( 'overflow', 'visible' ).attr( 'id', 'uniqueImg' );
}
if ( !self.$imgNode.length ) {
self.$imgNode = $( '<img>', {
alt: 'no thumb available',
title: 'This is NOT the actual image. There is no thumb available.',
height: '120',
width: '120',
id: 'uniqueImg',
style: 'overflow: visible'
} );
imgSrc = '/static/current/resources/assets/file-type-icons/fileicon.png';
} else {
imgSrc = self.$imgNode.attr( 'src' );
}
var w = self.$imgNode.attr( 'width' ),
h = self.$imgNode.attr( 'height' );
self.$imgNode
.css( { top: Math.max( w / 2 - h / 2, 0 ), position: 'relative' } )
.on( 'load', function () {
$( '#loadContainer' ).fadeOut();
$( '#imgContainer' ).fadeIn();
$( '#uniqueImg' ).rotate( { angle: 0, animateTo: self.angle } );
} )
.on( 'error', function () {
$( '#loadContainer' ).fadeOut();
$( '#imgContainer' ).fadeIn();
$( '#uniqueImg' ).rotate( { angle: 0, animateTo: self.angle } );
self.fail( 'The server was unable to create a thumbnail. You may close and re-open the dialog.' );
} );

if ( !supportsCSS ) {
self.$imgNode.attr( 'src', '//upload.wikimedia.org/wikipedia/commons/9/92/Bert2_transp_5B5B5B_cont_150ms.gif' );
$( '#loadContainer' ).fadeOut();
$( '#imgContainer' ).fadeIn();
}

if ( supportsCSS && !window.rotateDontPurge ) {
imgSrc = ( imgSrc + '?dummy=' + Math.floor( Math.random() * 10000000 ) );
}
if ( !window.rotateDontPurge ) {
window.rotateDontPurge = true;
// Only added for old cached thumbs. Possible not a stable way to achieve this. Please remove it ASAP.
var imgPathParts = imgSrc.split( '/' ),
imgLastPart = imgPathParts[ imgPathParts.length - 1 ].match( /(\D*|(?:\D*\d{1,3}-)*)(\d+)(px.+)/ );
if ( imgLastPart ) {
imgPathParts[ imgPathParts.length - 1 ] = imgLastPart[ 1 ] + ( parseInt( imgLastPart[ 2 ], 10 ) + 1 ) + imgLastPart[ 3 ];
imgSrc = imgPathParts.join( '/' );
}
// ---
}
self.$imgNode.attr( 'src', imgSrc );
self.$dlgNode.find( '#imgContainer' ).prepend( self.$imgNode );

self.purgeCompleted = true;
$( '#uniqueImg' ).rotate( { animateTo: self.angle } );
};

this.$dlgNode = $( '<div>', {} ).html(
'<div id="loadContainer" style="position:absolute; right:15px; top:90px; width:128px; height:120px; overflow:visible; height:160px;' +
'<div id="loadContainer" style="position:absolute; right:15px; top:90px; width:128px; height:120px; overflow:visible; height:160px;' +
'background: url(\'//upload.wikimedia.org/wikipedia/commons/9/92/Bert2_transp_5B5B5B_cont_150ms.gif\') no-repeat scroll center;">&nbsp;</div>' +
'background: url(\'//upload.wikimedia.org/wikipedia/commons/9/92/Bert2_transp_5B5B5B_cont_150ms.gif\') no-repeat scroll center;">&nbsp;</div>' +
'<div id="imgOuterContainer" style="position:absolute; right:30px; top:90px; max-width:120px; overflow:visible; height:160px;">' +
'<div id="imgOuterContainer" style="position:absolute; right:30px; top:90px; max-width:120px; overflow:visible; height:160px;">' +
'<div id="imgContainer" style="display:none;"></div>' +
'<div id="imgContainer" style="display:none;"></div>' +
'<div id="imgCaption" style="bottom: 0pt; position: absolute; width: 250px; right: -10px; font-size: 0.8em; text-align: right;">' +
'<div id="imgCaption" style="bottom: 0pt; position: absolute; width: 250px; right: -10px; font-size: 0.8em; text-align: right;">' +
mw.html.escape(this.i18n.imgCaption) + '</div></div>' +
mw.html.escape( this.i18n.imgCaption ) + '</div></div>' +
'<div id="readyContainer" style="position:absolute; right:160px; top:70px; width:120; height:120; display:none;">' +
'<div id="readyContainer" style="position:absolute; right:160px; top:70px; width:120; height:120; display:none;">' +
'<img src="//upload.wikimedia.org/wikipedia/commons/3/32/Picframe_ok.png" height="120" width="120"/></div>' +
'<img src="//upload.wikimedia.org/wikipedia/commons/3/32/Picframe_ok.png" height="120" width="120"/></div>' +
'<div id="errorContainer" style="position:absolute; right:160px; top:70px; width:120; height:120; display:none; background:#F99 url(\'//upload.wikimedia.org/wikipedia/commons/c/ca/Crystal_error.png\') no-repeat scroll center; overflow:auto;"></div>' +
'<div id="errorContainer" style="position:absolute; right:160px; top:70px; width:120; height:120; display:none; background:#F99 url(\'//upload.wikimedia.org/wikipedia/commons/c/ca/Crystal_error.png\') no-repeat scroll center; overflow:auto;"></div>' +
'<div id="rRotOptions" style="float:left; max-width:270px;">' + '<p>' + mw.html.escape(this.i18n.intro) + '</p>' + mw.html.escape(this.i18n.clockwise) + '<br />' +
'<div id="rRotOptions" style="float:left; max-width:270px;">' +
'<p>' + mw.html.escape( this.i18n.intro ) + '</p>' + mw.html.escape( this.i18n.clockwise ) +
botOptions() +
'<br>' + botOptions() +
'<span style="' + _this.config.dlg.labelStyle + '"><div style="position:relative;">' +
'<span style="' + self.config.dlg.labelStyle + '"><div style="position:relative;">' +
'<input name="angle" type="radio" id="rRotC" value="' + lastAngle + '" />' +
'<input name="angle" type="radio" id="rRotC" value="' + lastAngle + '" />' +
'<div id="rRotCOverlay" style="position:absolute; left:0; right:0; top:0; bottom:0; z-index:1005;"></div>' +
'<div id="rRotCOverlay" style="position:absolute; left:0; right:0; top:0; bottom:0; z-index:1005;"></div>' +
' <input name="customAngle" type="text" id="rRotCtext" size="6" maxlength="3" disabled="disabled" value="' + lastAngle + '" />°' +
' <input name="customAngle" type="number" id="rRotCtext" style="width:55px" maxlength="3" disabled="disabled" value="' + lastAngle + '" />°' +
'</div></span><br style="clear:left;"/><br/>' +
'</div></span><br style="clear:left;"/><br>' +
'<div style="float:left; max-width:270px;"><b>' + mw.html.escape(this.i18n.noteheader) + '</b>' +
'<div style="float:left; max-width:270px;"><b>' + mw.html.escape( this.i18n.noteheader ) + '</b>' +
'<br/><span id="rRotNote"></span></div></div>'
'<br><span id="rRotNote"></span></div></div>'
);
);
this.$errorContainer = this.$dlgNode.find('#errorContainer');
this.$errorContainer = this.$dlgNode.find( '#errorContainer' );
this.$rotNote = this.$dlgNode.find('#rRotNote');
this.$rotNote = this.$dlgNode.find( '#rRotNote' );

// Event handlers
// Event handlers
this.$dlgNode.find('input').bind('change', function() {
this.$dlgNode.find( 'input' ).on( 'change', function () {
if ('radio' === $(this).attr('type')) {
if ( $( this ).attr( 'type' ) === 'radio' ) {
setAngle($(this).attr('value'));
setAngle( $( this ).attr( 'value' ) );
_this.usedBotOption = true;
self.usedBotOption = true;
_this.$dButtons.eq(0).button('option', 'disabled', false);
self.$dButtons.eq( 0 ).button( 'option', 'disabled', false );
} else {
} else {
setAngle($(this).val());
setAngle( $( this ).val() );
_this.usedBotOption = false;
self.usedBotOption = false;
}
}
if ('rRotCtext' === $(this).attr('id')) {
if ( $( this ).attr( 'id' ) === 'rRotCtext' ) { return true; }
var $textnode = self.$dlgNode.find( '#rRotCtext' ),
return true;
$overlayNode = self.$dlgNode.find( '#rRotCOverlay' ),
}
state = ( $( this ).attr( 'id' ) === 'rRotC' );
var $textnode = _this.$dlgNode.find('#rRotCtext');
if ( state ) {
var $overlayNode = _this.$dlgNode.find('#rRotCOverlay');
self.usedBotOption = false;
var state = ('rRotC' === $(this).attr('id'));
$textnode.prop( 'disabled', false );
if (state) {
setTimeout( function () {
_this.usedBotOption = false;
$textnode.removeAttr('disabled');
setTimeout(function () {
$overlayNode.hide();
$overlayNode.hide();
$textnode.focus();
$textnode.focus();
$textnode.select();
$textnode.select();
}, 50);
}, 50 );
} else {
} else {
_this.usedBotOption = true;
self.usedBotOption = true;
$textnode.attr('disabled', 'disabled');
$textnode.prop( 'disabled', true );
$overlayNode.show();
$overlayNode.show();
}
}
return true;
return true;
});
} );
this.$dlgNode.find('#rRotCtext').bind('input keyup', function() {
this.$dlgNode.find( '#rRotCtext' ).on( 'input keyup', function () {
$(this).val($(this).val().replace(/\D/g, ''));
$( this ).val( $( this ).val().replace( /\D/g, '' ) );
if (!setAngle($(this).val()) && $(this).val()) {
if ( !setAngle( $( this ).val() ) && $( this ).val() ) {
$(this).val($(this).val()%360);
$( this ).val( $( this ).val() % 360 );
}
}
_this.$dlgNode.find('#rRotC').attr('value', $(this).val());
self.$dlgNode.find( '#rRotC' ).attr( 'value', $( this ).val() );
_this.usedBotOption = false;
self.usedBotOption = false;
return true;
return true;
});
} );
this.$dlgNode.find('#rRotOptions').find('input').bind('keyup', function(e) {
this.$dlgNode.find( '#rRotOptions' ).find( 'input' ).on( 'keyup', function ( e ) {
if (13 === e.which) {
if ( e.which === 13 ) {
_this.sendRequest();
self.sendRequest();
}
}
return true;
return true;
});
} );
this.$dlgNode.find('#rRotCOverlay').bind('click', function(e) {
this.$dlgNode.find( '#rRotCOverlay' ).on( 'click', function ( /* e*/ ) {
_this.$dlgNode.find('#rRotC').click();
self.$dlgNode.find( '#rRotC' ).click();
_this.$dlgNode.find('#rRotC').triggerHandler('change');
self.$dlgNode.find( '#rRotC' ).triggerHandler( 'change' );
return false;
return false;
});
} );

dlgButtons[this.i18n.submitButtonLabel] = function () {
dlgButtons[ this.i18n.submitButtonLabel ] = function () {
_this.sendRequest();
self.sendRequest();
};
};
dlgButtons[this.i18n.cancelButtonLabel] = function () {
dlgButtons[ this.i18n.cancelButtonLabel ] = function () {
$(this).dialog("close");
$( this ).dialog( 'close' );
};
};
this.$dlgNode.dialog({
this.$dlgNode.dialog( {
modal: true,
modal: true,
closeOnEscape: true,
closeOnEscape: true,
Line 245: Line 235:
title: this.config.helpLink + ' ' + this.i18n.headline,
title: this.config.helpLink + ' ' + this.i18n.headline,
height: this.config.dlg.height,
height: this.config.dlg.height,
maxHeight: $(window).height(),
maxHeight: $( window ).height(),
width: Math.min($(window).width(), this.config.dlg.width),
width: Math.min( $( window ).width(), this.config.dlg.width ),
buttons: dlgButtons,
buttons: dlgButtons,
close: function () {
close: function () {
$(this).dialog("destroy");
$( this ).dialog( 'destroy' );
$(this).remove();
$( this ).remove();
_this.dlgPresent = false;
self.dlgPresent = false;
},
},
open: function () {
open: function () {
var $dlg = $(this);
var $dlg = $( this );
self.$dButtons = $dlg.parent().find( '.ui-dialog-buttonpane' ).find( 'button' );
_this.$dButtons = $dlg.parent().find('.ui-dialog-buttonpane').find('button');
self.$dButtons.eq( 0 ).specialButton( 'proceed' );
_this.$dButtons.eq(0).specialButton('proceed');
self.$dButtons.eq( 1 ).specialButton( 'cancel' );

_this.$dButtons.eq(1).specialButton('cancel');
$dlg.parents( '.ui-dialog' ).css( {
position: 'fixed',
$dlg.parents('.ui-dialog').css({
top: Math.round( ( $( window ).height() - Math.min( $( window ).height(), $( '.ui-dialog.ui-widget' ).height() ) ) / 2 ) + 'px'
position:'fixed',
} );
top:Math.round(($(window).height() - Math.min($(window).height(), $('.ui-dialog.ui-widget').height())) / 2) + 'px'
});
}
}
});
} );
if (!window.rotateDontPurge) {
if ( !window.rotateDontPurge ) {
// send a purge-request
// send a purge-request
var query = {
var query = {
title: mw.config.get('wgPageName'),
title: mw.config.get( 'wgPageName' ),
action: 'purge'
action: 'purge'
};
};
$.get(mw.config.get('wgScript'), query, function(result) {
$.get( mw.config.get( 'wgScript' ), query, function ( result ) {
purgeComplete(result);
purgeComplete( result );
});
} );
} else {
} else {
purgeComplete();
purgeComplete();
}
}
$(document).bind('rotaterequest', function(e, intE, p) {
$( document ).on( 'rotaterequest', function ( e, intE, p ) {
if (!intE || 'newAngleBotCompat' !== intE) {
if ( !intE || intE !== 'newAngleBotCompat' ) { return; }
return;
}
var newText = '';
var newText = '';
if (p && _this.fileExtBotCompat) {
if ( p && self.fileExtBotCompat ) {
newText = _this.i18n.noteBot;
newText = self.i18n.noteBot;
} else {
} else {
if (!_this.fileExtBotCompat) { newText = _this.i18n.noteMime; }
if ( !self.fileExtBotCompat ) { newText = self.i18n.noteMime; } else {
var st = self.config.botAcceptedAngles.join( ', ' );
else {
var st = _this.config.botAcceptedAngels.join(', ');
st = st.substring( 0, st.lastIndexOf( ',' ) );
newText = self.i18n.noteAngle.replace( '%1', st ).replace( '%2', self.config.botAcceptedAngles[ self.config.botAcceptedAngles.length - 1 ] );
st = st.substring(0, st.lastIndexOf(',') );
newText = _this.i18n.noteAngle.replace('%1', st).replace('%2', _this.config.botAcceptedAngels[_this.config.botAcceptedAngels.length-1]);
}
}
}
}
_this.$rotNote.html(newText);
self.$rotNote.html( newText );
});
} );
angleBotCompat = true;
angleBotCompat = true;
setAngle(lastAngle);
setAngle( lastAngle );
angleBotCompat = false;
angleBotCompat = false;
if ('none' === lastOptionId) {
if ( lastOptionId === 'none' ) {
setAngle(0);
setAngle( 0 );
_this.$dButtons.eq(0).button('option', 'disabled', true);
self.$dButtons.eq( 0 ).button( 'option', 'disabled', true );
} else {
} else {
setAngle(lastAngle);
setAngle( lastAngle );
_this.$dlgNode.find('#rRot' + lastOptionId).click();
self.$dlgNode.find( '#rRot' + lastOptionId ).click();
}
}
// Finally get some status information about the bot:
// Finally get some status information about the bot:
var gotBotStatus = function(result) {
var gotBotStatus = function ( result ) {
if (!result) {
if ( !result ) { return; }
result = $( '<div>' + result + '</div>' ).find( 'p' ).html();
return;
if ( self.i18n.noteBot === self.$rotNote.html() ) {
self.$rotNote.html( result );
}
}
self.i18n.noteBot = result;
result = $('<div>' + result + '</div>').find('p').html();
if (_this.i18n.noteBot === _this.$rotNote.html()) {
_this.$rotNote.html(result);
}
_this.i18n.noteBot = result;
};
};
if (_this.config.currentBotStatus) {
if ( self.config.currentBotStatus ) {
// create a cache-preventer (maxage is already 0) and send the XHR to obtain the current status
// create a cache-preventer (maxage is already 0) and send the XHR to obtain the current status
var currentDate = new Date(),
var currentDate = new Date(),
dummy = currentDate.getDate() + '-' + currentDate.getHours();
dummy = currentDate.getDate() + '-' + currentDate.getHours();
$.get(mw.config.get('wgScript'), { 'action': 'render', title: _this.config.currentBotStatus, uselang: mw.config.get('wgUserLanguage'), dummy: dummy }, gotBotStatus);
$.get( mw.config.get( 'wgScript' ), {
action: 'render', title: self.config.currentBotStatus, uselang: mw.config.get( 'wgUserLanguage' ), dummy: dummy
}, gotBotStatus );
// Purge the template in some intervalls (each 10s only every 5th minute); something better would be appreciated
// Purge the template in some intervalls (each 10s only every 5th minute); something better would be appreciated
if ((0 === currentDate.getSeconds()%10) && (0 === currentDate.getMinutes()%5)) {
if ( ( currentDate.getSeconds() % 10 === 0 ) && ( currentDate.getMinutes() % 5 === 0 ) ) {
$.get(mw.config.get('wgScript'), { 'action': 'purge', title: _this.config.currentBotStatus });
$.get( mw.config.get( 'wgScript' ), { action: 'purge', title: self.config.currentBotStatus } );
}
}
}
}
},
},
sendRequest: function() {
sendRequest: function () {
var _this = this;
var self = this,
var a = 0;
a = 0;

if (_this.sending || _this.$dButtons.eq(0).button('option', 'disabled')) {
if ( self.sending || self.$dButtons.eq( 0 ).button( 'option', 'disabled' ) ) { return; }

return;
self.$dlgNode.parent().find( 'input, button' ).addClass( 'disabled' ).prop( 'disabled', true );
}
self.animationID = setInterval( function () {
a += 10;
_this.$dlgNode.parent().find('input, button').addClass('disabled').attr('disabled', 'disabled');
var $img = $( '#uniqueImg' );
_this.animationID = setInterval(function(){
$img.rotate( { angle: a } );
a+=10;
var $img = $('#uniqueImg');
if ( $img.length < 1 ) {
clearInterval( self.animationID );
$img.rotate({ angle: a });
if ($img.length < 1) {
clearInterval(_this.animationID);
}
}
}, 50);
}, 50 );


var doEdit = function (text) {
var doEdit = function ( text ) {
var n_text = text.replace(_this.config.customTemplateRemoval, ''),
var nText = text.replace( self.config.customTemplateRemoval, '' ),
tl = _this.config.customTemplate.replace('%1', _this.angle);
tl = self.config.customTemplate.replace( '%1', self.angle ),
params = {
editType: 'text',
var params = {
editType: 'text',
title: mw.config.get( 'wgPageName' ),
nocreate: 1,
title: mw.config.get('wgPageName'),
nocreate: 1,
watchlist: 'nochange',
watchlist: 'nochange',
tags: 'RotateLink',
summary: '([[Help:RotateLink|Script]]) Requesting rotation of the image by ' + _this.angle + '°.'
summary: 'Requesting rotation of the image by ' + self.angle + '°.'
};
};

if (n_text === text) {
if ( nText === text ) {
params.editType = 'prependtext';
params.editType = 'prependtext';
params.text = tl;
params.text = tl;
} else {
} else {
params.text = _this.config.customTemplate.replace('%1', _this.angle) + n_text;
params.text = self.config.customTemplate.replace( '%1', self.angle ) + nText;
}
}


try { // silently fail
try { // silently fail
$.cookie( 'rRot', (_this.angle + '|' + (_this.usedBotOption ? 'B' : 'C')), {
mw.cookie.set( 'rRot', ( self.angle + '|' + ( self.usedBotOption ? 'B' : 'C' ) ), {
expires: 14, // expires in 14 days
expires: 14, // expires in 14 days
path: '/' // domain-wide, entire wiki
path: '/' // domain-wide, entire wiki
});
} );
} catch (ex) {}
} catch ( ex ) {}


$(document).triggerHandler('rotaterequest', ['sendingRequest', params]);
$( document ).triggerHandler( 'rotaterequest', [ 'sendingRequest', params ] );
_this.sending = true;
self.sending = true;


mw.loader.using('ext.gadget.libAPI', function() {
mw.loader.using( 'ext.gadget.libAPI', function () {
mw.libs.commons.api.$editPage(params).done(function() {
mw.libs.commons.api.$editPage( params ).done( function () {
_this.sending = false;
self.sending = false;
try {
try {
_this.requestCB();
self.requestCB();
} catch (e) {
} catch ( e ) {
return _this.fail(e);
return self.fail( e );
}
}
}).fail(function(errText, paramsPassedIn, result) {
} ).fail( function ( errText, paramsPassedIn, result ) {
_this.sending = false;
self.sending = false;
return _this.fail("API request failed (" +
return self.fail( 'API request failed (' +
( result && result.error && result.error.code ) + "): " + errText);
( result && result.error && result.error.code ) + '): ' + errText );
});
} );
});
} );
};
};
$.get(mw.config.get('wgScript'), { 'action': 'raw', title: mw.config.get('wgPageName'), '_': $.now() }, doEdit).fail(function() {
$.get( mw.config.get( 'wgScript' ), { action: 'raw', title: mw.config.get( 'wgPageName' ), _: $.now() }, doEdit ).fail( function () {
_this.fail("Could not obtain latest WikiText of the page. Connection lost? Adblocker?");
self.fail( 'Could not obtain latest WikiText of the page. Connection lost? Adblocker?' );
});
} );
},
},
requestCB: function() {
requestCB: function () {
var _this = this;
var self = this;
$(document).triggerHandler('rotaterequest', ['success']);
$( document ).triggerHandler( 'rotaterequest', [ 'success' ] );

clearInterval(_this.animationID);
clearInterval( self.animationID );
var doAfterAnimation = function() {
var doAfterAnimation = function () {
window.location.href = encodeURI(mw.config.get('wgServer') + mw.config.get('wgArticlePath').replace('$1', mw.config.get('wgPageName')));
window.location.href = encodeURI( mw.config.get( 'wgServer' ) + mw.config.get( 'wgArticlePath' ).replace( '$1', mw.config.get( 'wgPageName' ) ) );
};
};
_this.$dlgNode.find('#readyContainer').fadeIn();
self.$dlgNode.find( '#readyContainer' ).fadeIn();
$('#uniqueImg').rotate({animateTo: _this.angle, callback: doAfterAnimation });
$( '#uniqueImg' ).rotate( { animateTo: self.angle, callback: doAfterAnimation } );
// If the browser-tab is idle, it fails sometime to call-back
// If the browser-tab is idle, it fails sometime to call-back
doAfterAnimation();
doAfterAnimation();
},
},
fail: function(err) {
fail: function ( err ) {
if ('object' === typeof err) {
if ( typeof err === 'object' ) {
var stErr = err.message + '<br/>' + err.name;
var stErr = err.message + '<br>' + err.name;
if (err.lineNumber) {
if ( err.lineNumber ) {
stErr += ' @line' + err.lineNumber;
stErr += ' @line' + err.lineNumber;
}
}
err = stErr;
err = stErr;
}
}
this.$errorContainer.text(err);
this.$errorContainer.text( err );
this.$errorContainer.fadeIn();
this.$errorContainer.fadeIn();
$(document).triggerHandler('rotaterequest', ['failed', err]);
$( document ).triggerHandler( 'rotaterequest', [ 'failed', err ] );
},
},
init: function() {
init: function () {
var _this = this,
var self = this,
botlink = '<a href="' + mw.util.getUrl('User:Rotatebot') + '" target="_blank">Rotatebot</a>';
botlink = '<a href="' + mw.util.getUrl( 'User:Rotatebot' ) + '" target="_blank">Rotatebot</a>';
// save some code-lines by assigning similar languages
// save some code-lines by assigning similar languages
// -zh
// -zh
_this.i18n['zh-hk'] = _this.i18n['zh-mo'] = _this.i18n['zh-tw'] = _this.i18n['zh-hant']; // zh-hk, zh-mo, zh-tw get the zh-hant i18n
self.i18n[ 'zh-hk' ] = self.i18n[ 'zh-mo' ] = self.i18n[ 'zh-tw' ] = self.i18n[ 'zh-hant' ]; // zh-hk, zh-mo, zh-tw get the zh-hant i18n
// merge languages
// merge languages
$.extend(_this.i18n, _this.i18n[mw.config.get('wgUserLanguage').split('-')[0]], _this.i18n[mw.config.get('wgUserLanguage')]);
$.extend( self.i18n, self.i18n[ mw.config.get( 'wgUserLanguage' ).split( '-' )[ 0 ] ], self.i18n[ mw.config.get( 'wgUserLanguage' ) ] );

// inserting links
// inserting links
_this.i18n.headline = _this.i18n.headline.replace('%ERRLINK%',
self.i18n.headline = self.i18n.headline.replace( '%ERRLINK%',
'href="' + mw.util.getUrl('MediaWiki talk:Gadget-RotateLink.js') + '" target="_blank"');
'href="' + mw.util.getUrl( 'MediaWiki talk:Gadget-RotateLink.js' ) + '" target="_blank"' );
_this.i18n.noteMime = _this.i18n.noteMime.replace('Rotatebot', botlink);
self.i18n.noteMime = self.i18n.noteMime.replace( 'Rotatebot', botlink );
_this.i18n.noteAngle = _this.i18n.noteAngle.replace('Rotatebot', botlink);
self.i18n.noteAngle = self.i18n.noteAngle.replace( 'Rotatebot', botlink );
_this.i18n.noteBot = _this.i18n.noteBot.replace('Rotatebot', botlink);
self.i18n.noteBot = self.i18n.noteBot.replace( 'Rotatebot', botlink );
_this.i18n.noteMime = _this.i18n.noteMime.replace('%ROTATEBOTLINK%',
self.i18n.noteMime = self.i18n.noteMime.replace( '%ROTATEBOTLINK%',
'href="' + mw.util.getUrl('User:Rotatebot') + '" target="_blank"');
'href="' + mw.util.getUrl( 'User:Rotatebot' ) + '" target="_blank"' );


// Finally set up event handlers
// Finally set up event handlers
$(document).bind('rotaterequest', function(evt, a, b) {
$( document ).on( 'rotaterequest', function ( evt, a ) {
if (a && 'start' === a) {
if ( a && a === 'start' ) {
_this.dialog();
self.dialog();
}
}
});
} );
$(document).triggerHandler('scriptLoaded', ['rotaterequest', 'init']);
$( document ).triggerHandler( 'scriptLoaded', [ 'rotaterequest', 'init' ] );
},
},
// Translation
// Translation
i18n: {
i18n: {
'ca': {
ca: {
'submitButtonLabel': 'confirma la soŀlicitud de rotació',
submitButtonLabel: 'confirma la soŀlicitud de rotació',
'cancelButtonLabel': 'canceŀla',
cancelButtonLabel: 'canceŀla',
'headline': 'Quants graus s’hauria de girar la imatge? ' +
headline: 'Quants graus s’hauria de girar la imatge? Podeu <a %ERRLINK%>informar</a> d’errades o suggeriments.',
intro: 'Podeu utilitzar aquesta funció per corregir imatges que es mostren en una orientació incorrecta (com passa sovint amb fotos digitals en vertical).',
'Podeu <a %ERRLINK%>informar</a> d’errades o suggeriments.',
clockwise: 'En sentit horari:',
'intro': 'Podeu utilitzar aquesta funció per corregir imatges que es mostren en una orientació incorrecta (com passa sovint amb fotos digitals en vertical).',
'clockwise': 'En sentit horari:',
noteheader: 'Nota: ',
noteAngle: 'Rotatebot pot girar %1° o %2° fent-ho en unes poques hores. Per a altres valors pot trigar més en ser atès.',
'noteheader': 'Nota: ',
'noteAngle': 'Rotatebot pot girar %1° o %2° fent-ho en unes poques hores. Per a altres valors pot trigar més en ser atès.',
noteMime: 'Rotatebot no pot tractar aquest format de fitxer. Aquesta soŀlicitud pot trigar més en ser atesa.',
'noteMime': 'Rotatebot no pot tractar aquest format de fitxer. Aquesta soŀlicitud pot trigar més en ser atesa.',
noteBot: 'Rotatebot pot executar aquesta soŀlicitud en unes poques hores.',
imgCaption: 'Corregiu l’orientació d’aquesta mostra seleccionant un angle.'
'noteBot': 'Rotatebot pot executar aquesta soŀlicitud en unes poques hores.',
'imgCaption': 'Corregiu l’orientació d’aquesta mostra seleccionant un angle.'
},
},
'cs': {
cs: {
'submitButtonLabel': 'Potvrdit požadavek na otočení',
submitButtonLabel: 'Potvrdit požadavek na otočení',
'cancelButtonLabel': 'Storno',
cancelButtonLabel: 'Storno',
'headline': 'O kolik stupňů se má tento obrázek otočit? ' +
headline: 'O kolik stupňů se má tento obrázek otočit? <a %ERRLINK%>Chyby a vylepšení</a>.',
intro: 'Touto funkcí můžete opravit obrázky, které se zobrazují špatně otočené (což se často stává u digitálních fotografií na výšku).',
'<a %ERRLINK%>Chyby a vylepšení</a>.',
clockwise: 'Ve směru hodinových ručiček',
'intro': 'Touto funkcí můžete opravit obrázky, které se zobrazují špatně otočené (což se často stává u digitálních fotografií na výšku).',
noteheader: 'Poznámka: ',
'clockwise': 'Ve směru hodinových ručiček',
noteAngle: 'Otočení o %1 nebo %2° bude Rotatebot schopen vyřídit během pár hodin.',
'noteheader': 'Poznámka: ',
noteMime: 'Rotatebot neumí zpracovávat soubory tohoto typu nebo formátu. Na otočení si budete muset pravděpodobně počkat delší dobu.',
'noteAngle': 'Otočení o %1 nebo %2° bude Rotatebot schopen vyřídit během pár hodin.',
noteBot: 'Rotatebot by tento požadavek měl zvládnout během několika hodin.',
'noteMime': 'Rotatebot neumí zpracovávat soubory tohoto typu nebo formátu. Na otočení si budete muset pravděpodobně počkat delší dobu.',
imgCaption: 'Opravte natočení tohoto náhledu volbou úhlu.'
'noteBot': 'Rotatebot by tento požadavek měl zvládnout během několika hodin.',
'imgCaption': 'Opravte natočení tohoto náhledu volbou úhlu.'
},
},
'da': {
da: {
'submitButtonLabel': 'Bekræft anmodning om rotation',
submitButtonLabel: 'Bekræft anmodning om rotation',
'cancelButtonLabel': 'Afbryd',
cancelButtonLabel: 'Afbryd',
'headline': 'Hvor mange grader bør dette billede roteres? ' +
headline: 'Hvor mange grader bør dette billede roteres? <a %ERRLINK%>Rapporter</a> fejl og idéer.',
clockwise: 'Mod uret',
'<a %ERRLINK%>Rapporter</a> fejl og idéer.',
'clockwise': 'Mod uret',
noteheader: 'Note: ',
noteAngle: 'Hvis du anmoder om en rotation på %1 eller %2° så vil Rotatebot gøre dette i løbet af få timer.',
'noteheader': 'Note: ',
noteMime: 'Rotatebot kan ikke behandle medier af denne filtype. Det vil sandsynligvis tage en del tid før det bliver muligt.',
'noteAngle': 'Hvis du anmoder om en rotation på %1 eller %2° så vil Rotatebot gøre dette i løbet af få timer.',
'noteMime': 'Rotatebot kan ikke behandle medier af denne filtype. Det vil sandsynligvis tage en del tid før det bliver muligt.',
noteBot: 'Rotatebot kan udføre denne anmodning i løbet af timer.'
'noteBot': 'Rotatebot kan udføre denne anmodning i løbet af få timer.'
},
},
'de': {
de: {
'submitButtonLabel': 'Drehung beauftragen',
submitButtonLabel: 'Drehen!',
'cancelButtonLabel': 'Abbrechen',
cancelButtonLabel: 'Abbrechen',
'headline': 'Um wieviel Grad soll das Bild gedreht werden? ' +
headline: 'Um wieviel Grad soll das Bild gedreht werden? <a %ERRLINK%>Fehler und Ideen</a>.',
intro: 'Du kannst diese Funktion verwenden, um Bilder zu korrigieren, die in falscher Orientierung angezeigt werden (wie es oft bei hochkant fotografierten digitalen Fotos passiert).',
'Fehler im Script bitte <a %ERRLINK%>melden</a>.',
clockwise: 'Im Uhrzeigersinn:',
'intro': 'Mit dieser Funktion können falsch gedrehte Bilder (wie es häufig bei Digitalfotos im Hochformat vorkommt) korrigiert werden.',
'clockwise': 'Im Uhrzeigersinn',
noteheader: 'Beachte: ',
noteAngle: 'Wenn Du eine Drehung um %1 oder %2° erbittest, wird Rotatebot das in ein paar Stunden tun. Voraussichtlich wird es so viel mehr Zeit erfordern.',
'noteheader': 'Hinweis: ',
noteMime: 'Dieses Dateiformat kann nicht <a %ROTATEBOTLINK%>automatisch gedreht werden</a>; das Drehen muss von Hand erledigt werden, was einige Zeit dauert.',
'noteAngle': 'Wenn eine Drehung um %1 oder %2° gefordert wird, wird der Rotatebot das in wenigen Stunden erledigen. Ansonsten kann es länger dauern.',
'noteMime': 'Der Rotatebot kann Medien dieses Dateiformats nicht automatisch drehen. Die Drehung muss von Hand vorgenommen werden.',
noteBot: 'Rotatebot kann diese Anfrage in ein paar Stunden erledigen.',
imgCaption: 'Korrigiere die Orientierung des Vorschaubildes indem Du einen Winkel auswählst.'
'noteBot': 'Der Rotatebot wird das Bild in wenigen Stunden drehen.',
'imgCaption': 'Drehe dieses Vorschaubild in die richtige Ausrichtung, indem Du eine Option auswählst.'
},
},
'el': {
el: {
'submitButtonLabel': 'Επιβεβαιώστε το αίτημα περιστροφής',
submitButtonLabel: 'Επιβεβαιώστε το αίτημα περιστροφής',
'cancelButtonLabel': 'Άκυρο',
cancelButtonLabel: 'Άκυρο',
'headline': 'Περίπου πόσες μοίρες πρέπει να περιστραφεί η εικόνα; ' +
headline: 'Περίπου πόσες μοίρες πρέπει να περιστραφεί η εικόνα; <a %ERRLINK%>Αναφέρετε</a> σφάλματα και ιδέες.',
intro: 'Με αυτή τη λειτουργία μπορείτε να διορθώσετε εικόνες που προβάλλονται με λάθος προσανατολισμό (όπως συμβαίνει μερικές φορές με τις "όρθιες" ψηφιακές φωτογραφίες).',
'<a %ERRLINK%>Αναφέρετε</a> σφάλματα και ιδέες.',
clockwise: 'Προς τα δεξιά:',
'intro': 'Με αυτή τη λειτουργία μπορείτε να διορθώσετε εικόνες που προβάλλονται με λάθος προσανατολισμό (όπως συμβαίνει μερικές φορές με τις "όρθιες" ψηφιακές φωτογραφίες).',
noteheader: 'Σημείωση: ',
'clockwise': 'Προς τα δεξιά:',
noteAngle: 'Αν ζητήσετε περιστροφή κατά %1 ή %2° το Rotatebot θα εκτελέσει το αίτημα μέσα σε μερικές ώρες. Αν ζητήσετε άλλο αριθμό μοιρών, το αίτημα θα πρέπει να γίνει χειροκίνητα από κάποιον εθελοντή, και πιθανότατα θα πάρει περισσότερο χρόνο.',
'noteheader': 'Σημείωση: ',
'noteAngle': 'Αν ζητήσετε περιστροφή κατά %1 ή %2° το Rotatebot θα εκτελέσει το αίτημα μέσα σε μερικές ώρες. Αν ζητήσετε άλλο αριθμό μοιρών, το αίτημα θα πρέπει να γίνει χειροκίνητα από κάποιον εθελοντή, και πιθανότατα θα πάρει περισσότερο χρόνο.',
noteMime: 'Αυτός ο τύπος αρχείου δεν μπορεί να <a %ROTATEBOTLINK%>περιστραφεί αυτόματα</a>. Η περιστροφή θα πρέπει να γίνει χειροκίνητα, κάτι που θα πάρει χρόνο.',
noteBot: 'Το Rotatebot μπορεί να εκτελέσει αυτό το αίτημα μέσα σε λίγες ώρες.',
'noteMime': 'Αυτός ο τύπος αρχείου δεν μπορεί να <a %ROTATEBOTLINK%>περιστραφεί αυτόματα</a>. Η περιστροφή θα πρέπει να γίνει χειροκίνητα, κάτι που θα πάρει χρόνο.',
imgCaption: 'Διορθώστε τον προσανατολισμό αυτής της μικρογραφίας επιλέγοντας γωνία περιστροφής.'
'noteBot': 'Το Rotatebot μπορεί να εκτελέσει αυτό το αίτημα μέσα σε λίγες ώρες.',
'imgCaption': 'Διορθώστε τον προσανατολισμό αυτής της μικρογραφίας επιλέγοντας γωνία περιστροφής.'
},
},
'es': {
es: {
'submitButtonLabel': 'Confirmar la solicitud de rotación',
submitButtonLabel: 'Confirmar la solicitud de rotación',
'cancelButtonLabel': 'Cancelar',
cancelButtonLabel: 'Cancelar',
'headline': '¿Cuántos grados debería girarse esta imagen? ' +
headline: '¿Cuántos grados debería girarse esta imagen? <a %ERRLINK%>Notificar fallos o ideas</a>.',
intro: 'Puedes usar esta funcionalidad para corregir imágenes que no muestran una orientación correcta (algo que ocurre con frecuencia en fotos digitales tomadas en vertical).',
'<a %ERRLINK%>Notificar fallos o ideas</a>.',
clockwise: 'En el sentido de las agujas del reloj:',
'intro': 'Puedes usar esta funcionalidad para corregir imágenes que no muestran una orientación correcta (algo que ocurre con frecuencia en fotos digitales tomadas en vertical).',
noteheader: 'Nota: ',
'clockwise': 'En el sentido de las agujas del reloj:',
noteAngle: 'Si solicitas una rotación de %1º o %2°, Rotatebot lo hará en unas horas. Para los otros valores tardará más tiempo en completar la tarea.',
'noteheader': 'Nota: ',
noteMime: 'Este tipo de archivos no se puede <a %ROTATEBOTLINK%>rotar automáticamente</a>; la rotación tendrá que hacerse manualmente, algo que puede llevar más tiempo.',
'noteAngle': 'Si solicitas una rotación de %1º o %2°, Rotatebot lo hará en unas horas. Para los otros valores tardará más tiempo en completar la tarea.',
noteBot: 'Rotatebot puede realizar esta solicitud en unas horas.',
'noteMime': 'Este tipo de archivos no se puede <a %ROTATEBOTLINK%>rotar automáticamente</a>; la rotación tendrá que hacerse manualmente, algo que puede llevar más tiempo.',
'noteBot': 'Rotatebot puede realizar esta solicitud en unas horas.',
imgCaption: 'Corrige la orientación de esta miniatura seleccionando un ángulo.'
'imgCaption': 'Corrige la orientación de esta miniatura seleccionando un ángulo.'
},
},
'fa': {
fa: {
'submitButtonLabel': 'تأیید درخواست چرخش',
submitButtonLabel: 'تأیید درخواست چرخش',
'cancelButtonLabel': 'لغو',
cancelButtonLabel: 'لغو',
'headline': 'این تصویر حدوداً چند درجه باید چرخانده شود؟ ' +
headline: 'این تصویر حدوداً چند درجه باید چرخانده شود؟ اشکالات و نظراتتان را <a %ERRLINK%>گزارش دهید</a>.',
intro: 'شما می\u200cتوانید از این ابزار برای تصحیح تصاویری که جهت\u200cگیری نادرستی دارند، استفاده کنید (مشابه این وضعیت مکرراً در تصاویر دیجیتالی ایستاده دیده می\u200cشود).',
'اشکالات و نظراتتان را <a %ERRLINK%>گزارش دهید</a>.',
clockwise: 'ساعت\u200cگرد:',
'intro': 'شما می\u200cتوانید از این ابزار برای تصحیح تصاویری که جهت\u200cگیری نادرستی دارند، استفاده کنید (مشابه این وضعیت مکرراً در تصاویر دیجیتالی ایستاده دیده می\u200cشود).',
'clockwise': 'ساعت\u200cگرد:',
noteheader: 'توجه: ',
noteAngle: 'اگر درخواست چرخش %1 یا %2° است، ربات این عمل را ظرف چند ساعت انجام خواهد داد. در غیر این\u200cصورت، احتمالاً زمان بیشتری طول خواهد کشید تا درخواست شما انجام داده شود.',
'noteheader': 'توجه: ',
noteMime: 'این نوع پرونده را نمی\u200cتوان به طور خودکار <a %ROTATEBOTLINK%>چرخاند</a>؛ چرخاندن پرونده باید به صورت دستی انجام گیرد که ممکن است مدتی طول بکشد.',
'noteAngle': 'اگر درخواست چرخش %1 یا %2° است، ربات این عمل را ظرف چند ساعت انجام خواهد داد. در غیر این\u200cصورت، احتمالاً زمان بیشتری طول خواهد کشید تا درخواست شما انجام داده شود.',
noteBot: 'ربات نمی\u200cتواند ظرف چند ساعت آینده درخواست چرخش را انجام دهد.',
'noteMime': 'این نوع پرونده را نمی\u200cتوان به طور خودکار <a %ROTATEBOTLINK%>چرخاند</a>؛ چرخاندن پرونده باید به صورت دستی انجام گیرد که ممکن است مدتی طول بکشد.',
imgCaption: 'جهت\u200cگیری تصویر بندانگشتی را با انتخاب زاویهٔ مناسب تصحیح نمایید.'
'noteBot': 'ربات نمی\u200cتواند ظرف چند ساعت آینده درخواست چرخش را انجام دهد.',
'imgCaption': 'جهت\u200cگیری تصویر بندانگشتی را با انتخاب زاویهٔ مناسب تصحیح نمایید.'
},
},
'fr': {
fi: {
'submitButtonLabel': 'Confirmer la demande de rotation',
submitButtonLabel: 'vahvista kiertopyyntö',
'cancelButtonLabel': 'Annuler',
cancelButtonLabel: 'peruuta',
'headline': "De combien de degrés l’image doit-elle être tournée ? " +
headline: 'Kuinka montaa astetta tätä kuvaa pitäisi suurin piirtein kiertää? ' +
'<a %ERRLINK%>Rapporter les bogues et les suggestions</a> s.v.p.',
'<a %ERRLINK%>Kerro</a> bugeista ja ideoista.',
intro: 'Voit käyttää tätä ominaisuutta korjataksesi kuvia, jotka näkyvät vääräsuuntaisesti (kuten yleisesti käy pystysuuntaisten digitaalisten valokuvien kanssa).',
'clockwise': "dans le sens des aiguilles d’une montre",
'noteheader': 'Note : ',
clockwise: 'Myötäpäivään:',
noteheader: 'Huomautus: ',
'noteAngle': 'Si vous soumettez une rotation de %1° ou %2° Rotatebot le fera dans quelques heures.',
// Hint for translation:
'noteMime': 'Rotatebot ne prend pas en charge ce format de fichier. Il y a de grande chances pour que cela prenne plus de temps.',
// The following message is displayed e.g. if you request a rotation of e.g. 3° because Rotatebot can't rotate by this angle.
'noteBot': "Rotatebot peut s’occuper de cette requête dans quelques heures.",
// A volunteer has to do this.
'intro': 'Vous pouvez utiliser cet outil pour corriger les images ayant une mauvaise orientation (comme cela arrive fréquemment avec les photos numériques verticales).',
noteAngle: 'Jos pyydät a kiertoa astemäärällä %1 tai %2°, Rotatebot tulee tekemään tämän parin tunnin sisällä. Tämän tekeminen tulee todennäköisesti kestämään kauemmin, jos Rotatebot ei voi suorittaa pyyntöä.',
'imgCaption': "Corrigez l’orientation de cette miniature en sélectionnant un angle."
// Hint for translation:
// The following message is displayed e.g. on djvu or pdf-files because Rotatebot can't rotate them.
// A volunteer has to do this.
noteMime: 'Tämäntyyppistä tiedostoa ei voida <a %ROTATEBOTLINK%>kiertää automaattisesti</a>; kiertäminen on tehtävä manuaalisesti, joka voi kestää jonkin aikaa.',
noteBot: 'Rotatebot voi suorittaa tämän pyynnön parin tunnin sisällä.',
imgCaption: 'Korjaa tämän pienoiskuvan suunta valitsemalla kulma.'
},
},
'gl': {
fr: {
'submitButtonLabel': 'confirmar a solicitude de rotación',
submitButtonLabel: 'confirmer la demande de rotation',
'cancelButtonLabel': 'cancelar',
cancelButtonLabel: 'annuler',
headline: 'De combien de degrés (environ) devrait-on faire pivoter cette image? <a %ERRLINK%>Signalez</a> des bugs ou des idées.',
'headline': 'Cantos graos cómpre rotar esta imaxe? ' +
intro: 'Vous pouvez utiliser cette fonction pour corriger des images qui ne s’affichent pas avec une orientation correcte (comme cela peut arriver fréquemment avec des photos numériques).',
'<a %ERRLINK%>Achéguenos</a> erros e ideas.',
clockwise: 'Dans le sens horaire :',
'intro': 'Pode facer uso desta función para corrixir as imaxes que teñan unha orientación incorrecta (cousa que ocorre frecuentemente coas fotos dixitais tomadas en vertical).',
noteheader: 'Note : ',
'clockwise': 'No sentido das agullas do reloxo:',
noteAngle: 'Si vous demandez une rotation de %1 ou %2°, Rotatebot ne pourra pas le faire avant au moins quelques heures. Cela devrait sans doute prendre beaucoup plus de temps, voire ne pas pouvoir être fait.',
'noteheader': 'Nota: ',
noteMime: 'Ce type de fichier ne peut pas subir une <a %ROTATEBOTLINK%>rotation via un robot</a> ; la rotation devra être réalisée manuellement, ce qui peut prendre un peu de temps.',
'noteAngle': 'Rotatebot pode realizar unha rotación en %1º ou %2° nunhas poucas horas. Para outros valores pode tardar máis tempo ou mesmo non completar a tarefa.',
noteBot: 'Rotatebot peut traiter cette demande d’ici quelques heures.',
'noteMime': 'Este tipo de ficheiro non se pode <a %ROTATEBOTLINK%>rotar automaticamente</a>; cómpre facer a rotación de xeito manual, algo que pode levar algún tempo.',
imgCaption: 'Corrigez l’orientation de cette miniature en choisissant un angle.'
'noteBot': 'Rotatebot pode levar a cabo esta solicitude nunhas horas.',
'imgCaption': 'Corrixa a orientación desta miniatura seleccionando un ángulo.'
},
},
'it': {
gl: {
'submitButtonLabel': 'conferma rotazione richiesta',
submitButtonLabel: 'confirmar a solicitude de rotación',
'cancelButtonLabel': 'annulla',
cancelButtonLabel: 'cancelar',
headline: 'Cantos graos cómpre rotar esta imaxe? <a %ERRLINK%>Achéguenos</a> erros e ideas.',
'headline': 'Di quanti gradi dovrebbe essere ruotata l\'immagine? ' +
intro: 'Pode facer uso desta función para corrixir as imaxes que teñan unha orientación incorrecta (cousa que ocorre frecuentemente coas fotos dixitais tomadas en vertical).',
'<a %ERRLINK%>Segnala bug o suggerimenti</a>.',
clockwise: 'No sentido das agullas do reloxo:',
'intro': 'Puoi usare questo strumento per correggere immagini orientate in modo errato (come capita spesso con immagini digitali scattate in verticale).',
'clockwise': 'Senso orario:',
noteheader: 'Nota: ',
noteAngle: 'Rotatebot pode realizar unha rotación en %1º ou %2° nunhas poucas horas. Para outros valores pode tardar máis tempo ou mesmo non completar a tarefa.',
'noteheader': 'Nota: ',
noteMime: 'Este tipo de ficheiro non se pode <a %ROTATEBOTLINK%>rotar automaticamente</a>; cómpre facer a rotación de xeito manual, algo que pode levar algún tempo.',
'noteAngle': 'Se richiedi una rotazione di %1 o %2°, Rotatebot impiegherà qualche ora.',
noteBot: 'Rotatebot pode levar a cabo esta solicitude nunhas horas.',
'noteMime': 'Rotatebot non è in grado di <a %ROTATEBOTLINK%>elaborare automaticamente</a> questo tipo di file. È necessario farlo manualmente, il che probabilmente richiederà più tempo.',
imgCaption: 'Corrixa a orientación desta miniatura seleccionando un ángulo.'
'noteBot': 'Rotatebot può soddisfare questa richiesta in poche ore.',
'imgCaption': 'Correggi l\'orientamento di questa miniatura selezionando un\'opzione.'
},
},
'ja': {
hr: {
'submitButtonLabel': '依頼を確認',
submitButtonLabel: 'potvrdi zahtjev za okretanjem',
'cancelButtonLabel': 'キャンセル',
cancelButtonLabel: 'odustani',
headline: 'Za koliko stupnjeva bi slika trebala biti okrenuta? <a %ERRLINK%>Napišite</a> probleme i prijedloge.',
'headline': 'この画像を何度回転させますか? ' +
intro: 'Rabite ovu mogućnost za slike krive orijentacije.',
'バグや提案は<a %ERRLINK%>こちら</a>',
clockwise: 'U smjeru kazaljke na satu:',
'intro': 'この機能では(主に縦長のデジタル画像でみられるような)正しくない向きに回転してしまった画像を正しい向きに直すことができます。',
'clockwise': '時計回りで',
noteheader: 'Napomena: ',
noteAngle: 'Ako zatražite okretanje za %1 ili %2° Rotatebot će to učiniti za nekoliko sati, a inače će trebati nešto više vremena.',
'noteheader': 'お知らせ ',
noteMime: 'Ova slika ne može biti <a %ROTATEBOTLINK%>automatski okrenuta</a>. Okretanje treba napraviti ručno, za što će trebati neko vrijeme.',
'noteAngle': '%1, %2°に回転させる場合は、Rotatebotによって数時間で回転されます。他の角度に回転させる場合は、それ以上の時間がかかります。',
noteBot: 'Rotatebot će riješiti zahtjev za nekoliko sati.',
'noteMime': 'この形式のファイルは、<a %ROTATEBOTLINK%>Rotatebot</a>で回転させることができません。回転は人の手によっておこなわれるため、時間がかかります。',
imgCaption: 'Ispravite orijentaciju ove sličice označavanjem kuta.'
'noteBot': 'Rotatebotは数時間でこの画像を回転します。',
'imgCaption': 'このサムネイルで正しい方向になるように角度を選択して下さい。'
},
},
'mk': {
it: {
'submitButtonLabel': 'Потврди',
submitButtonLabel: 'conferma rotazione richiesta',
'cancelButtonLabel': 'Откажи',
cancelButtonLabel: 'annulla',
headline: 'Di quanti gradi dovrebbe essere ruotata l\'immagine? <a %ERRLINK%>Segnala bug o suggerimenti</a>.',
'headline': 'За околу колку степени треба да се сврти сликата? ' +
intro: 'Puoi usare questo strumento per correggere immagini orientate in modo errato (come capita spesso con immagini digitali scattate in verticale).',
'<a %ERRLINK%>Пријавувајте грешки и нови идеи</a>.',
clockwise: 'Senso orario:',
'intro': 'Со оваа функција можете да ги исправате погрешно свртените слики (како што често се случува кај дигиталните фотографии).',
'clockwise': 'Надесно',
noteheader: 'Nota: ',
noteAngle: 'Se richiedi una rotazione di %1 o %2°, Rotatebot impiegherà qualche ora.',
'noteheader': 'Напомена: ',
noteMime: 'Rotatebot non è in grado di <a %ROTATEBOTLINK%>elaborare automaticamente</a> questo tipo di file. È necessario farlo manualmente, il che probabilmente richiederà più tempo.',
'noteAngle': 'Ако побарате свртување за %1 или %2° Rotatebot ќе го изврши вртењето за неколку часа.',
noteBot: 'Rotatebot può soddisfare questa richiesta in poche ore.',
'noteMime': 'Rotatebot не може да работи со ваква слика или формат. Веројатно ова би потрајало подолго.',
imgCaption: 'Correggi l\'orientamento di questa miniatura selezionando un\'opzione.'
'noteBot': 'Rotatebot може да го изврши бараното за неколку часа.',
'imgCaption': 'Поправете ја насоченоста на минијатурава - одберете агол.'
},
},
'ml': {
ja: {
'submitButtonLabel': 'തിരിക്കൽ നിർദ്ദേശം സ്ഥിരീകരിക്കുക',
submitButtonLabel: '依頼を確認',
'cancelButtonLabel': 'റദ്ദാക്കുക',
cancelButtonLabel: 'キャンセル',
headline: 'この画像を何度回転させますか? バグや提案は<a %ERRLINK%>こちら</a>',
'headline': 'ഏകദേശം എത്ര ഡിഗ്രിയാണ് ഈ ചിത്രം തിരിക്കേണ്ടത്? ' + 'പ്രശ്നങ്ങളും ആശയങ്ങളും <a %ERRLINK%>അറിയിക്കുക</a>.',
intro: 'この機能では(主に縦長のデジタル画像でみられるような)正しくない向きに回転してしまった画像を正しい向きに直すことができます。',
'intro': 'തെറ്റായ ദിശയിൽ ചേർത്തിരിക്കുന്ന ചിത്രങ്ങൾ ശരിയാക്കാൻ ഈ സൗകര്യം ഉപയോഗിക്കാവുന്നതാണ് (ഉദാഹരണത്തിന് തലകീഴായി പോയ ഡിജിറ്റൽ ഫോട്ടോകൾ).',
'clockwise': 'പ്രദക്ഷിണദിശ:',
clockwise: '時計回りで',
'noteheader': 'കുറിപ്പ്: ',
noteheader: 'お知らせ ',
noteAngle: '%1, %2°に回転させる場合は、Rotatebotによって数時間で回転されます。他の角度に回転させる場合は、それ以上の時間がかかります。',
'noteAngle': 'താങ്കൾ %1 അല്ലെങ്കിൽ %2° തിരിക്കാനാണ് ആവശ്യപ്പെടുന്നതെങ്കിൽ റൊട്ടേറ്റ്ബോട്ട് ഏതാനം മണിക്കൂറുകൾക്കുള്ളിൽ അത് ചെയ്യുന്നതായിരിക്കും. അതിനു സാധാരണയിലും കൂടുതൽ സമയമെടുത്തേക്കും.',
noteMime: 'この形式のファイルは、<a %ROTATEBOTLINK%>Rotatebot</a>で回転させることができません。回転は人の手によっておこなわれるため、時間がかかります。',
'noteMime': 'ഈ പ്രമാണം <a %ROTATEBOTLINK%>മനുഷ്യസഹായമില്ലാതെ തിരിക്കാൻ</a> കഴിയില്ല; മനുഷ്യസഹായം ലഭിക്കാൻ സമയമെടുത്തേക്കാം.',
noteBot: 'Rotatebotは数時間でこの画像を回転します。',
'noteBot': 'റൊട്ടേറ്റ്ബോട്ട് ഈ നിർദ്ദേശം ഏതാനം മണിക്കൂറുകൾക്കുള്ളിൽ നടപ്പിലാക്കും.',
imgCaption: 'このサムネイルで正しい方向になるように角度を選択して下さい。'
'imgCaption': 'കോൺ തിരഞ്ഞെടുത്ത് ഈ ലഘുചിത്രത്തിന്റെ ദിശ ശരിയാക്കുക.'
},
},
'nl': {
mk: {
'submitButtonLabel': 'Rotatieverzoek bevestigen',
submitButtonLabel: 'Потврди',
'cancelButtonLabel': 'Annuleren',
cancelButtonLabel: 'Откажи',
headline: 'За околу колку степени треба да се сврти сликата? <a %ERRLINK%>Пријавувајте грешки и нови идеи</a>.',
'headline': 'Hoeveel graden moet de afbeelding worden geroteerd? ' +
intro: 'Со оваа функција можете да ги исправате погрешно свртените слики (како што често се случува кај дигиталните фотографии).',
'<a %ERRLINK%>Rapporteer</a> bugs en ideeën.',
clockwise: 'Надесно',
'intro': 'U kunt deze functie gebruiken om afbeeldingen te corrigeren die worden weergegeven met een verkeerde oriëntatie (zoals dit vaak voorkomt met rechtopstaande digitale foto\'s).',
noteheader: 'Напомена: ',
'clockwise': 'Met de klok mee:',
noteAngle: 'Ако побарате свртување за %1 или %2° Rotatebot ќе го изврши вртењето за неколку часа.',
'noteheader': 'Noot: ',
noteMime: 'Rotatebot не може да работи со ваква слика или формат. Веројатно ова би потрајало подолго.',
'noteAngle': 'Indien u een rotatie verzoekt van %1 of %2° voert Rotatebot dit binnen enkele uren uit. Andere rotaties nemen waarschijnlijk meer tijd in beslag.',
noteBot: 'Rotatebot може да го изврши бараното за неколку часа.',
'noteMime': 'Dit type bestand kan niet <a %ROTATEBOTLINK%>automatisch geroteerd</a> worden; de rotatie moet handmatig moeten uitgevoerd worden. Dit kan enige tijd kan duren.',
imgCaption: 'Поправете ја насоченоста на минијатурава - одберете агол.'
'noteBot': 'Rotatebot kan dit verzoek binnen enkele uren uitvoeren.',
'imgCaption': 'Corrigeer de oriëntatie van deze miniatuur door een rotatiehoek te selecteren.'
},
},
'pl': {
ml: {
'submitButtonLabel': 'Potwierdź wniosek',
submitButtonLabel: 'തിരിക്കൽ നിർദ്ദേശം സ്ഥിരീകരിക്കുക',
'cancelButtonLabel': 'Anuluj',
cancelButtonLabel: 'റദ്ദാക്കുക',
headline: 'ഏകദേശം എത്ര ഡിഗ്രിയാണ് ഈ ചിത്രം തിരിക്കേണ്ടത്? പ്രശ്നങ്ങളും ആശയങ്ങളും <a %ERRLINK%>അറിയിക്കുക</a>.',
'headline': 'O ile stopni powinna być obrócona ta grafika? ' +
intro: 'തെറ്റായ ദിശയിൽ ചേർത്തിരിക്കുന്ന ചിത്രങ്ങൾ ശരിയാക്കാൻ ഈ സൗകര്യം ഉപയോഗിക്കാവുന്നതാണ് (ഉദാഹരണത്തിന് തലകീഴായി പോയ ഡിജിറ്റൽ ഫോട്ടോകൾ).',
'<a %ERRLINK%>Prosimy o zgłaszanie błędów lub nowych pomysłów</a>.',
clockwise: 'പ്രദക്ഷിണദിശ:',
'intro': 'Możesz używać tej funkcji do poprawiania grafik o złej orientacji (np. w przypadku pionowych fotografii cyfrowych).',
noteheader: 'കുറിപ്പ്: ',
'clockwise': 'Zgodnie z ruchem wskazówek zegara',
noteAngle: 'താങ്കൾ %1 അല്ലെങ്കിൽ %2° തിരിക്കാനാണ് ആവശ്യപ്പെടുന്നതെങ്കിൽ റൊട്ടേറ്റ്ബോട്ട് ഏതാനം മണിക്കൂറുകൾക്കുള്ളിൽ അത് ചെയ്യുന്നതായിരിക്കും. അതിനു സാധിച്ചില്ലെങ്കിൽ, കൂടുതൽ സമയം എടുക്കാനിടയുണ്ട്.',
'noteheader': 'Uwaga: ',
noteMime: 'ഈ പ്രമാണം <a %ROTATEBOTLINK%>മനുഷ്യസഹായമില്ലാതെ തിരിക്കാൻ</a> കഴിയില്ല; മനുഷ്യസഹായം ലഭിക്കാൻ സമയമെടുത്തേക്കാം.',
'noteAngle': 'Jeśli poprosisz o obrócenie grafiki o %1 lub %2°, Rotatebot zrobi to w ciągu kilku godzin.',
noteBot: 'റൊട്ടേറ്റ്ബോട്ട് ഈ നിർദ്ദേശം ഏതാനം മണിക്കൂറുകൾക്കുള്ളിൽ നടപ്പിലാക്കും.',
'noteMime': 'Rotatebot nie jest w stanie obsłużyć pliku w tym formacie, w związku z czym wykonanie Twojego wniosku może potrwać nieco dłużej.',
imgCaption: 'കോൺ തിരഞ്ഞെടുത്ത് ഈ ലഘുചിത്രത്തിന്റെ ദിശ ശരിയാക്കുക.'
'noteBot': 'Rotatebot może wykonać ten wniosek w ciągu kilku godzin.'
},
},
nl: {
'pt': { // also correct for pt-br
'submitButtonLabel': 'confirmar pedido de rotação',
submitButtonLabel: 'Rotatieverzoek bevestigen',
'cancelButtonLabel': 'cancelar',
cancelButtonLabel: 'Annuleren',
headline: 'Hoeveel graden moet de afbeelding worden geroteerd? <a %ERRLINK%>Rapporteer</a> bugs en ideeën.',
'intro': 'Podes usar esta função para corrigir imagens que estão a ser exibidas na orientação errada (como é comum acontecer com imagens digitais fotografadas na vertical).',
intro: 'U kunt deze functie gebruiken om afbeeldingen te corrigeren die worden weergegeven met een verkeerde oriëntatie (zoals dit vaak voorkomt met rechtopstaande digitale foto\'s).',
'headline': 'Em quantos graus esta imagem deve ser rotacionada? ' +
clockwise: 'Met de klok mee:',
'<a %ERRLINK%>Reporte bugs e ideias</a>.',
'clockwise': 'sentido horário',
noteheader: 'Noot: ',
noteAngle: 'Indien u een rotatie verzoekt van %1 of %2° voert Rotatebot dit binnen enkele uren uit. Andere rotaties nemen waarschijnlijk meer tijd in beslag.',
'noteheader': 'Nota: ',
noteMime: 'Dit type bestand kan niet <a %ROTATEBOTLINK%>automatisch geroteerd</a> worden; de rotatie moet handmatig moeten uitgevoerd worden. Dit kan enige tijd kan duren.',
'noteAngle': 'Se solicitar uma rotação de %1 ou %2° Rotatebot atenderá o pedido em algumas horas.',
noteBot: 'Rotatebot kan dit verzoek binnen enkele uren uitvoeren.',
'noteMime': 'Rotatebot não consegue lidar com mídia neste formato de arquivo. Seu pedido poderá demorar mais para ser atendido.',
imgCaption: 'Corrigeer de oriëntatie van deze miniatuur door een rotatiehoek te selecteren.'
'noteBot': 'Rotatebot pode executar este pedido em algumas horas.'
},
},
'ro': {
pl: {
'submitButtonLabel': 'confirmă cererea de rotire',
submitButtonLabel: 'Potwierdź wniosek',
'cancelButtonLabel': 'anulează',
cancelButtonLabel: 'Anuluj',
headline: 'O ile stopni powinna być obrócona ta grafika? <a %ERRLINK%>Prosimy o zgłaszanie błędów lub nowych pomysłów</a>.',
'headline': 'Cu câte grade trebuie rotită imaginea? ' +
intro: 'Możesz używać tej funkcji do poprawiania grafik o złej orientacji (np. w przypadku pionowych fotografii cyfrowych).',
'<a %ERRLINK%>Raportaţi</a> buguri şi idei de feature-uri.',
clockwise: 'Zgodnie z ruchem wskazówek zegara',
'intro': 'Puteţi utiliza această funcţie pentru a corecta imaginile afişate cu o orientare greşită (aşa cum se întâmplă adesea în cazul unor fotografii făcute „în picioare”.',
'clockwise': 'Sens orar:',
noteheader: 'Uwaga: ',
noteAngle: 'Jeśli poprosisz o obrócenie grafiki o %1 lub %2°, Rotatebot zrobi to w ciągu kilku godzin.',
'noteheader': 'Notă: ',
noteMime: 'Rotatebot nie jest w stanie obsłużyć pliku w tym formacie, w związku z czym wykonanie Twojego wniosku może potrwać nieco dłużej.',
'noteAngle': 'Dacă cereţi o rotaţie cu %1 sau %2° Rotatebot va face aceasta în câteva ore. Aceasta, însă, probabil va dura mult şi nu e sigur dacă se va face.',
noteBot: 'Rotatebot może wykonać ten wniosek w ciągu kilku godzin.'
'noteMime': 'Rotatebot nu poate roti fişiere media în acest format. Probabil va dura ceva vreme până să se efectueze rotaţia.',
'noteBot': 'Rotatebot poate executa această cerere în câteva ore.',
'imgCaption': 'Corectaţi orientarea acestui thumbnail alegând un unghi.'
},
},
pt: { // also correct for pt-br
'ru': {
'submitButtonLabel': 'Подтвердить запрос',
submitButtonLabel: 'confirmar pedido de rotação',
'cancelButtonLabel': 'Отменить',
cancelButtonLabel: 'cancelar',
intro: 'Podes usar esta função para corrigir imagens que estão a ser exibidas na orientação errada (como é comum acontecer com imagens digitais fotografadas na vertical).',
'headline': 'На сколько градусов нужно повернуть изображение? ' +
headline: 'Em quantos graus esta imagem deve ser rotacionada? <a %ERRLINK%>Reporte bugs e ideias</a>.',
'<a %ERRLINK%>Написать</a> об ошибках и идеях.',
clockwise: 'sentido horário',
'intro': 'Вы можете воспользоваться этим инструментом для исправления изображений с неправильной ориентацией (зачастую это цифровые фото с вертикальной ориентацией).',
noteheader: 'Nota: ',
'clockwise': 'По часовой стрелке:',
noteAngle: 'Se solicitar uma rotação de %1 ou %2° Rotatebot atenderá o pedido em algumas horas.',
'noteheader': 'Примечание: ',
noteMime: 'Rotatebot não consegue lidar com mídia neste formato de arquivo. Seu pedido poderá demorar mais para ser atendido.',
'noteAngle': 'Если вы запрашиваете вращение на %1 или %2°, Rotatebot выполнит его в течение нескольких часов. Если на другой угол, то это может занять больше времени.',
noteBot: 'Rotatebot pode executar este pedido em algumas horas.'
'noteMime': 'Этот тип файла не может быть <a %ROTATEBOTLINK%>повёрнут автоматически</a>; вращение должно быть произведено вручную, что может потребовать некоторого времени.',
'noteBot': 'Rotatebot может выполнить этот запрос в течение нескольких часов.',
'imgCaption': 'Исправьте ориентацию этой миниатюры, выбрав угол.'
},
},
'sl': {
ro: {
'submitButtonLabel': 'potrdi zahtevo za zasuk',
submitButtonLabel: 'confirmă cererea de rotire',
'cancelButtonLabel': 'prekliči',
cancelButtonLabel: 'anulează',
headline: 'Cu câte grade trebuie rotită imaginea? <a %ERRLINK%>Raportaţi</a> buguri şi idei de feature-uri.',
'headline': 'Za koliko stopinj je treba zavrteti sliko? ' +
intro: 'Puteţi utiliza această funcţie pentru a corecta imaginile afişate cu o orientare greşită (aşa cum se întâmplă adesea în cazul unor fotografii făcute „în picioare”.',
'<a %ERRLINK%>Sporočite</a> hrošče in predloge.',
clockwise: 'Sens orar:',
'intro': 'To funkcijo lahko uporabite za popravo slik, ki so prikazane napačno usmerjene (pogosto pri pokončnih digitalnih fotografijah).',
noteheader: 'Notă: ',
'clockwise': 'V smeri urnega kazalca:',
noteAngle: 'Dacă cereţi o rotaţie cu %1 sau %2° Rotatebot va face aceasta în câteva ore. Aceasta, însă, probabil va dura mult şi nu e sigur dacă se va face.',
'noteheader': 'Opomba: ',
noteMime: 'Rotatebot nu poate roti fişiere media în acest format. Probabil va dura ceva vreme până să se efectueze rotaţia.',
'noteAngle': 'Če boste zahtevali zasuk za %1 ali %2°, ga bo v nekaj urah opravil Rotatebot. Sicer bo to najverjetneje vzelo več časa.',
noteBot: 'Rotatebot poate executa această cerere în câteva ore.',
'noteMime': 'Te vrste datoteke ni mogoče <a %ROTATEBOTLINK%>zasukati samodejno</a>; zasuk je treba opraviti ročno, kar lahko vzame nekaj časa.',
imgCaption: 'Corectaţi orientarea acestui thumbnail alegând un unghi.'
'noteBot': 'To zahtevo lahko Rotatebot izvrši v nekaj urah.',
'imgCaption': 'Z izbiro kota popravite usmerjenost predogledne sličice.'
},
},
'sr': {
ru: {
'submitButtonLabel': 'Потврди захтев за ротирање',
submitButtonLabel: 'Подтвердить запрос',
'cancelButtonLabel': 'Откажи',
cancelButtonLabel: 'Отменить',
headline: 'На сколько градусов нужно повернуть изображение? <a %ERRLINK%>Написать</a> об ошибках и идеях.',
'headline': 'За колико степени би требало ротирати слику? ' +
intro: 'Вы можете воспользоваться этим инструментом для исправления изображений с неправильной ориентацией (зачастую это цифровые фото с вертикальной ориентацией).',
'<a %ERRLINK%>Пријави</a> грешке и идеје.',
clockwise: 'По часовой стрелке:',
'intro': 'Овим алатом можете да поправите слике које су погрешно ротиране (као што се често дешава када се фото-апарт постави вертикално).',
noteheader: 'Примечание: ',
'clockwise': 'У смеру казаљке на сату:',
noteAngle: 'Если вы запрашиваете вращение на %1 или %2°, Rotatebot выполнит его в течение нескольких часов. Если на другой угол, то это может занять больше времени.',
'noteheader': 'Напомена: ',
noteMime: 'Этот тип файла не может быть <a %ROTATEBOTLINK%>повёрнут автоматически</a>; вращение должно быть произведено вручную, что может потребовать некоторого времени.',
'noteAngle': 'Ако тражите ротацију од %1 или %2° Rotatebot ће то урадити за неколико сати. Ако не, значи да му вероватно треба више времена да то изврши.',
noteBot: 'Rotatebot может выполнить этот запрос в течение нескольких часов.',
'noteMime': 'Овај тип фајла се не може <a %ROTATEBOTLINK%>аутоматски ротирати</a>; то ће морати да се обави ручно, што може да потраје неко време.',
imgCaption: 'Исправьте ориентацию этой миниатюры, выбрав угол.'
'noteBot': 'Rotatebot може да изврши овај захтев за неколико сати.',
'imgCaption': 'Поправите оријентацију ове сличице избором одговарајућег угла.'
},
},
'sv': {
sl: {
'submitButtonLabel': 'bekräfta roteringsbegäran',
submitButtonLabel: 'potrdi zahtevo za zasuk',
'cancelButtonLabel': 'avbryt',
cancelButtonLabel: 'prekliči',
'headline': 'Hur många grader ska denna bild roteras? ' +
headline: 'Za koliko stopinj je treba zavrteti sliko? <a %ERRLINK%>Sporočite</a> hrošče in predloge.',
intro: 'To funkcijo lahko uporabite za popravo slik, ki so prikazane napačno usmerjene (pogosto pri pokončnih digitalnih fotografijah).',
'<a %ERRLINK%>Rapportera</a> buggar och idéer.',
clockwise: 'V smeri urnega kazalca:',
'intro': 'Du kan använda denna funktion för att korrigera bilder som visas i fel vinkel (vilket förekommer ofta med digitala bilder som är upprättstående).',
'clockwise': 'Medurs:',
noteheader: 'Opomba: ',
noteAngle: 'Če boste zahtevali zasuk za %1 ali %2°, ga bo v nekaj urah opravil Rotatebot. Sicer bo to najverjetneje vzelo več časa.',
'noteheader': 'OBS: ',
noteMime: 'Te vrste datoteke ni mogoče <a %ROTATEBOTLINK%>zasukati samodejno</a>; zasuk je treba opraviti ročno, kar lahko vzame nekaj časa.',
'noteAngle': 'Om du begär en rotering med %1 eller %2° kommer Rotatebot göra detta inom några timmar. Troligt att det kommer att ta längre tid att utföras.',
noteBot: 'To zahtevo lahko Rotatebot izvrši v nekaj urah.',
'noteMime': 'Denna filtyp kan inte <a %ROTATEBOTLINK%>roteras automatiskt</a>; roteringen kommer att utföras manuellt, som kan ta lite tid.',
imgCaption: 'Z izbiro kota popravite usmerjenost predogledne sličice.'
'noteBot': 'Rotatebot kan utföra denna begäran inom några timmar.',
'imgCaption': 'Korrigera orienteringen för denna miniatyr genom att välja en vinkel.'
},
},
sr: {
'zh': { // also correct for zh-hans, zh-cn, zh-my, zh-sg
'submitButtonLabel': '确认旋转请求',
submitButtonLabel: 'Потврди захтев за ротирање',
'cancelButtonLabel': '取消',
cancelButtonLabel: 'Откажи',
headline: 'За колико степени би требало ротирати слику? <a %ERRLINK%>Пријави</a> грешке и идеје.',
'headline': '这个图像应该被旋转多少度?' +
intro: 'Овим алатом можете да поправите слике које су погрешно ротиране (као што се често дешава када се фото-апарт постави вертикално).',
'<a %ERRLINK%>报告</a>错误和想法。',
clockwise: 'У смеру казаљке на сату:',
'intro': '您可以使用这个功能来修正显示方向错误的图像(例如常见的纵向数码照片)。',
'clockwise': '顺时针',
noteheader: 'Напомена: ',
noteAngle: 'Ако тражите ротацију од %1 или %2° Rotatebot ће то урадити за неколико сати. Ако не, значи да му вероватно треба више времена да то изврши.',
'noteheader': '注:',
noteMime: 'Овај тип фајла се не може <a %ROTATEBOTLINK%>аутоматски ротирати</a>; то ће морати да се обави ручно, што може да потраје неко време.',
'noteAngle': '如果您请求旋转%1或%2°,Rotatebot会在几个小时内完成旋转。',
noteBot: 'Rotatebot може да изврши овај захтев за неколико сати.',
'noteMime': '此类型的文件不能被<a %ROTATEBOTLINK%>自动旋转</a>;旋转将人工完成,这可能需要更多的时间。',
imgCaption: 'Поправите оријентацију ове сличице избором одговарајућег угла.'
'noteBot': 'Rotatebot可以在几个小时内执行这个请求。',
'imgCaption': '选择一个角度使此缩略图显示为正确的方向。'
},
},
sv: {
'zh-hant': { // also correct for zh-hk, zh-mo, zh-tw (enabled VIA HACK directly above "// merge languages" )
'submitButtonLabel': '確認旋轉請求',
submitButtonLabel: 'bekräfta roteringsbegäran',
'cancelButtonLabel': '取消',
cancelButtonLabel: 'avbryt',
headline: 'Hur många grader ska denna bild roteras? <a %ERRLINK%>Rapportera</a> buggar och idéer.',
'headline': '這個圖像應該被旋轉多少度?' +
intro: 'Du kan använda denna funktion för att korrigera bilder som visas i fel vinkel (vilket förekommer ofta med digitala bilder som är upprättstående).',
'<a %ERRLINK%>報告</a>錯誤和想法。',
clockwise: 'Medurs:',
'intro': '您可以使用這個功能來修正顯示方向錯誤的圖像(例如常見的縱向數位照片)。',
'clockwise': '順時針',
noteheader: 'OBS: ',
noteAngle: 'Om du begär en rotering med %1 eller %2° kommer Rotatebot göra detta inom några timmar. Troligt att det kommer att ta längre tid att utföras.',
'noteheader': '注:',
noteMime: 'Denna filtyp kan inte <a %ROTATEBOTLINK%>roteras automatiskt</a>; roteringen kommer att utföras manuellt, som kan ta lite tid.',
'noteAngle': '如果您請求旋轉%1或%2°,Rotatebot會在幾個小時內完成旋轉。',
noteBot: 'Rotatebot kan utföra denna begäran inom några timmar.',
'noteMime': '此類型的檔案不能被<a %ROTATEBOTLINK%>自動旋轉</a>;旋轉將人工完成,這可能需要更多的時間。',
imgCaption: 'Korrigera orienteringen för denna miniatyr genom att välja en vinkel.'
'noteBot': 'Rotatebot可以在幾個小時內執行這個請求。',
'imgCaption': '選擇一個角度使此縮圖顯示爲正確的方向。'
},
},
uk: {
'submitButtonLabel': 'confirm rotate request',
submitButtonLabel: 'підтвердити запит на обертання',
'cancelButtonLabel': 'cancel',
cancelButtonLabel: 'скасувати',
'headline': 'How many degrees this image should be rotated? ' +
headline: 'На скільки градусів слід обернути це зображення? <a %ERRLINK%>Повідомте</a> про баги та ідеї.',
'<a %ERRLINK%>Report</a> bugs and ideas.',
intro: 'Можете скористатись цією функцією для виправлення зображень, що мають хибну орієнтацію (як це часто буває з вертикальними цифровими фото).',
'intro': 'You can use this function to correct images which display in the wrong orientation (as frequently occurs with vertical orientation digital photos).',
'clockwise': 'Clockwise:',
clockwise: 'За годинниковою стрілкою:',
'noteheader': 'Note: ',
noteheader: 'Примітка: ',
noteAngle: 'Якщо Ви подаєте запит на обертання на %1 або %2°, Rotatebot виконає його за кілька годин. Якщо ж ні, то найімовірніше, таке обертання потребує більше часу.',
'noteAngle': 'If you request a rotation by %1 or %2° Rotatebot will do this in a few hours. If you request a rotation by any other angle it will probably take longer.',
'noteMime': 'This type of file cannot be <a %ROTATEBOTLINK%>rotated automatically</a>; rotation will have to be done manually, which may take some time.',
noteMime: 'Цей тип файлу не можна <a %ROTATEBOTLINK%>обернути автоматично</a>; обертання треба буде зробити вручну, що може зайняти трохи часу.',
'noteBot': 'Rotatebot can execute this request in a few hours.',
noteBot: 'Rotatebot зможе виконати цей запит за кілька годин.',
imgCaption: 'Виправте орієнтацію цієї мініатюри, вибравши відповідний кут.'
'imgCaption': 'Correct the orientation of this thumbnail by selecting an angle.'
},
zh: { // also correct for zh-hans, zh-cn, zh-my, zh-sg
submitButtonLabel: '确认旋转请求',
cancelButtonLabel: '取消',
headline: '这个图像应该被旋转多少度?<a %ERRLINK%>报告</a>错误和想法。',
intro: '您可以使用这个功能来修正显示方向错误的图像(例如常见的纵向数码照片)。',
clockwise: '顺时针',
noteheader: '注:',
noteAngle: '如果您请求旋转%1或%2°,Rotatebot会在几个小时内完成旋转。',
noteMime: '此类型的文件不能被<a %ROTATEBOTLINK%>自动旋转</a>;旋转将人工完成,这可能需要更多的时间。',
noteBot: 'Rotatebot可以在几个小时内执行这个请求。',
imgCaption: '选择一个角度使此缩略图显示为正确的方向。'
},
'zh-hant': { // also correct for zh-hk, zh-mo, zh-tw (enabled VIA HACK directly above "// merge languages" )
submitButtonLabel: '確認旋轉請求',
cancelButtonLabel: '取消',
headline: '這個圖像應該被旋轉多少度?<a %ERRLINK%>報告</a>錯誤和想法。',
intro: '您可以使用這個功能來修正顯示方向錯誤的圖像(例如常見的縱向數位照片)。',
clockwise: '順時針',
noteheader: '注:',
noteAngle: '如果您請求旋轉%1或%2°,Rotatebot會在幾個小時內完成旋轉。',
noteMime: '此類型的檔案不能被<a %ROTATEBOTLINK%>自動旋轉</a>;旋轉將人工完成,這可能需要更多的時間。',
noteBot: 'Rotatebot可以在幾個小時內執行這個請求。',
imgCaption: '選擇一個角度使此縮圖顯示爲正確的方向。'
},
submitButtonLabel: 'confirm rotate request',
cancelButtonLabel: 'cancel',
headline: 'How many degrees this image should be rotated? <a %ERRLINK%>Report</a> bugs and ideas.',
intro: 'You can use this function to correct images which display in the wrong orientation (as frequently occurs with vertical orientation digital photos).',
clockwise: 'Clockwise:',
noteheader: 'Note: ',
noteAngle: 'If you request a rotation by %1 or %2° Rotatebot will do this in a few hours. If you request a rotation by any other angle it will probably take longer.',
noteMime: 'This type of file cannot be <a %ROTATEBOTLINK%>rotated automatically</a>; rotation will have to be done manually, which may take some time.',
noteBot: 'Rotatebot can execute this request in a few hours.',
imgCaption: 'Correct the orientation of this thumbnail by selecting an angle.'
},
},
// Configuration
// Configuration
Line 759: Line 763:
labelStyle: 'width: 140px; display: inline-block; height:1.6em;',
labelStyle: 'width: 140px; display: inline-block; height:1.6em;',
customNumber: '123', // like the Cookie: '<number>|B' OR just '123'
customNumber: '123', // like the Cookie: '<number>|B' OR just '123'
customOption: 'none' // 'C' (custom) OR 'none' OR 0 to botAcceptedAngels.length-1
customOption: 'none' // 'C' (custom) OR 'none' OR 0 to botAcceptedAngles.length-1
},
},
customTemplate: '{{rotate|%1}}\n',
customTemplate: '{{rotate|%1}}\n',
customTemplateRemoval: /\{\{rotate\|.+?\}\}\n?/ig,
customTemplateRemoval: /\{\{rotate\|.+?\}\}\n?/ig,
botAcceptedFormats: ['png', 'jpg', 'jpeg', 'gif'],
botAcceptedFormats: [ 'png', 'jpg', 'jpeg', 'gif', 'tif', 'tiff' ],
botAcceptedAngels: [90, 180, 270], // must be numbers only
botAcceptedAngles: [ 90, 180, 270 ], // must be numbers only
helpLink: '<a href="' + mw.util.getUrl('Help:RotateLink') + '" target="_blank"><img src="//upload.wikimedia.org/wikipedia/commons/4/45/GeoGebra_icon_help.png" alt="?"/></a>',
helpLink: '<a href="' + mw.util.getUrl( 'Help:RotateLink' ) + '" target="_blank"><img src="//upload.wikimedia.org/wikipedia/commons/4/45/GeoGebra_icon_help.png" alt="?"/></a>',
currentBotStatus: 'User:Rotatebot/approx max wait time rotatelink'
currentBotStatus: 'User:Rotatebot/approx max wait time rotatelink'
}
}
};
};

if (!window.rRotSettings) {
if ( !window.rRotSettings ) {
window.rRotSettings = {};
window.rRotSettings = {};
}
}
$.extend(window.rRot.config, window.rRotSettings);
$.extend( window.rRot.config, window.rRotSettings );

mw.loader.using(['jquery.cookie', 'jquery.ui.dialog', 'mediawiki.user', 'mediawiki.util', 'ext.gadget.libJQuery', 'ext.gadget.jquery.rotate'], function(){
mw.loader.using( [ 'mediawiki.cookie', 'jquery.ui', 'mediawiki.user', 'mediawiki.util', 'ext.gadget.libJQuery', 'ext.gadget.jquery.rotate' ], function () {
window.rRot.init();
window.rRot.init();
});
} );
})(jQuery);
}( jQuery, mediaWiki ) );
// Just for debugging
// Just for debugging
// $(document).unbind('rotaterequest');
// $( document ).off( 'rotaterequest' );
// $(document).triggerHandler('rotaterequest', ['start']);
// $( document ).triggerHandler( 'rotaterequest', [ 'start' ] );
// </nowiki>
// </nowiki>

Latest revision as of 20:53, 6 June 2024

// <nowiki>
/* global mediaWiki */

// Disable purging of thumbnails before displaying to speed-up the process
// Please re-enable in case of modifications to the MW-thumbnail engine
// that require fresh thumbs. Simply remove the following line.
window.rotateDontPurge = true;

/**************************************
Request rotation of an image
composed in 2011 by Rillke
**************************************/
/* eslint indent:["error","tab",{"outerIIFEBody":0}] */
( function ( $, mw ) {
'use strict';
if ( window.rRot || mw.config.get( 'wgNamespaceNumber' ) !== 6 ) { return; }

window.rRot = {
	dialog: function () {
		var dlgButtons = {},
			self = this,

			fileExt = mw.config.get( 'wgPageName' ).slice( mw.config.get( 'wgPageName' ).lastIndexOf( '.' ) + 1 ).toLowerCase(),
			angleBotCompat = true,
			lastAngle = 0,
			lastOptionId = this.config.dlg.customOption,
			cookie = mw.cookie.get( 'rRotate' );
		this.usedBotOption = false;
		this.sending = false;

		cookie = cookie || ( this.config.dlg.customNumber );
		if ( typeof cookie === 'string' ) {
			cookie = cookie.split( '|' );
			lastAngle = cookie[ 0 ] - 0;
			if ( cookie[ 1 ] && ( cookie[ 1 ] === 'B' ) ) {
				if ( $.inArray( lastAngle, this.config.botAcceptedAngles ) !== -1 ) {
					this.usedBotOption = true;
					lastOptionId = $.inArray( lastAngle, this.config.botAcceptedAngles );
				}
			} else {
				lastOptionId = this.config.dlg.customOption;
			}
		} else {
			lastAngle = cookie - 0;
		}

		this.angle = 0;
		this.fileExtBotCompat = ( $.inArray( fileExt, this.config.botAcceptedFormats ) !== -1 );

		var setAngle = function ( newAngle ) {
				if ( !/\d+/.test( newAngle ) ) {
					return false;
				}
				newAngle = newAngle - 0;
				if ( newAngle < 0 ) {
					newAngle = 360 + newAngle;
				}
				if ( newAngle < 0 || newAngle > 360 ) { return false; }

				self.angle = newAngle;
				if ( self.purgeCompleted ) {
					$( '#uniqueImg' ).rotate( { animateTo: newAngle } );
				}

				var oldAngleBotCompat = angleBotCompat;
				angleBotCompat = ( $.inArray( newAngle, self.config.botAcceptedAngles ) !== -1 );
				if ( ( oldAngleBotCompat !== angleBotCompat ) ) {
					$( document ).triggerHandler( 'rotaterequest', [ 'newAngleBotCompat', angleBotCompat ] );
				}
				return true;
			},

			botOptions = function () {
				var r = '', i = 0, a = 0, l = self.config.botAcceptedAngles.length;
				for ( i = 0; i < l; i++ ) {
					a = self.config.botAcceptedAngles[ i ];
					r += '<label for="rRot' + i + '" style="' + self.config.dlg.labelStyle + '"><input name="angle" type="radio" id="rRot' + i + '" value="' + a + '" /> ' + a + '° </label><br>';
				}
				return r;
			},

			supportsCSS = $( 'img:first' ).rotate( { getSupportCSS: true } ),

			purgeComplete = function ( result ) {
				// Add the image to the container
				var imgSrc = '';
				if ( result ) {
					try {
						self.$imgNode = $( 'table.filehistory', $( result ) ).find( 'img' ).eq( 0 ).clone().css( 'overflow', 'visible' ).attr( 'id', 'uniqueImg' );
					} catch ( e ) {}
				}
				if ( !self.$imgNode || !self.$imgNode.length ) {
					self.$imgNode = $( 'table.filehistory' ).find( 'img' ).eq( 0 ).clone().css( 'overflow', 'visible' ).attr( 'id', 'uniqueImg' );
				}
				if ( !self.$imgNode.length ) {
					self.$imgNode = $( '<img>', {
						alt: 'no thumb available',
						title: 'This is NOT the actual image. There is no thumb available.',
						height: '120',
						width: '120',
						id: 'uniqueImg',
						style: 'overflow: visible'
					} );
					imgSrc = '/static/current/resources/assets/file-type-icons/fileicon.png';
				} else {
					imgSrc = self.$imgNode.attr( 'src' );
				}
				var w = self.$imgNode.attr( 'width' ),
					h = self.$imgNode.attr( 'height' );
				self.$imgNode
					.css( { top: Math.max( w / 2 - h / 2, 0 ), position: 'relative' } )
					.on( 'load', function () {
						$( '#loadContainer' ).fadeOut();
						$( '#imgContainer' ).fadeIn();
						$( '#uniqueImg' ).rotate( { angle: 0, animateTo: self.angle } );
					} )
					.on( 'error', function () {
						$( '#loadContainer' ).fadeOut();
						$( '#imgContainer' ).fadeIn();
						$( '#uniqueImg' ).rotate( { angle: 0, animateTo: self.angle } );
						self.fail( 'The server was unable to create a thumbnail. You may close and re-open the dialog.' );
					} );

				if ( !supportsCSS ) {
					self.$imgNode.attr( 'src', '//upload.wikimedia.org/wikipedia/commons/9/92/Bert2_transp_5B5B5B_cont_150ms.gif' );
					$( '#loadContainer' ).fadeOut();
					$( '#imgContainer' ).fadeIn();
				}

				if ( supportsCSS && !window.rotateDontPurge ) {
					imgSrc = ( imgSrc + '?dummy=' + Math.floor( Math.random() * 10000000 ) );
				}
				if ( !window.rotateDontPurge ) {
					window.rotateDontPurge = true;
					// Only added for old cached thumbs. Possible not a stable way to achieve this. Please remove it ASAP.
					var imgPathParts = imgSrc.split( '/' ),
				 imgLastPart = imgPathParts[ imgPathParts.length - 1 ].match( /(\D*|(?:\D*\d{1,3}-)*)(\d+)(px.+)/ );
					if ( imgLastPart ) {
						imgPathParts[ imgPathParts.length - 1 ] = imgLastPart[ 1 ] + ( parseInt( imgLastPart[ 2 ], 10 ) + 1 ) + imgLastPart[ 3 ];
						imgSrc = imgPathParts.join( '/' );
					}
					// ---
				}
				self.$imgNode.attr( 'src', imgSrc );
				self.$dlgNode.find( '#imgContainer' ).prepend( self.$imgNode );

				self.purgeCompleted = true;
				$( '#uniqueImg' ).rotate( { animateTo: self.angle } );
			};

		this.$dlgNode = $( '<div>', {} ).html(
			'<div id="loadContainer" style="position:absolute; right:15px; top:90px; width:128px; height:120px; overflow:visible; height:160px;' +
			'background: url(\'//upload.wikimedia.org/wikipedia/commons/9/92/Bert2_transp_5B5B5B_cont_150ms.gif\') no-repeat scroll center;">&nbsp;</div>' +
			'<div id="imgOuterContainer" style="position:absolute; right:30px; top:90px; max-width:120px; overflow:visible; height:160px;">' +
			'<div id="imgContainer" style="display:none;"></div>' +
			'<div id="imgCaption" style="bottom: 0pt; position: absolute; width: 250px; right: -10px; font-size: 0.8em; text-align: right;">' +
			mw.html.escape( this.i18n.imgCaption ) + '</div></div>' +
			'<div id="readyContainer" style="position:absolute; right:160px; top:70px; width:120; height:120; display:none;">' +
			'<img src="//upload.wikimedia.org/wikipedia/commons/3/32/Picframe_ok.png" height="120" width="120"/></div>' +
			'<div id="errorContainer" style="position:absolute; right:160px; top:70px; width:120; height:120; display:none; background:#F99 url(\'//upload.wikimedia.org/wikipedia/commons/c/ca/Crystal_error.png\') no-repeat scroll center; overflow:auto;"></div>' +
			'<div id="rRotOptions" style="float:left; max-width:270px;">' +
			'<p>' + mw.html.escape( this.i18n.intro ) + '</p>' + mw.html.escape( this.i18n.clockwise ) +
			'<br>' + botOptions() +
			'<span style="' + self.config.dlg.labelStyle + '"><div style="position:relative;">' +
			'<input name="angle" type="radio" id="rRotC" value="' + lastAngle + '" />' +
			'<div id="rRotCOverlay" style="position:absolute; left:0; right:0; top:0; bottom:0; z-index:1005;"></div>' +
			' <input name="customAngle" type="number" id="rRotCtext" style="width:55px" maxlength="3" disabled="disabled" value="' + lastAngle + '" />°' +
			'</div></span><br style="clear:left;"/><br>' +
			'<div style="float:left; max-width:270px;"><b>' + mw.html.escape( this.i18n.noteheader ) + '</b>' +
			'<br><span id="rRotNote"></span></div></div>'
		);
		this.$errorContainer = this.$dlgNode.find( '#errorContainer' );
		this.$rotNote = this.$dlgNode.find( '#rRotNote' );

		// Event handlers
		this.$dlgNode.find( 'input' ).on( 'change', function () {
			if ( $( this ).attr( 'type' ) === 'radio' ) {
				setAngle( $( this ).attr( 'value' ) );
				self.usedBotOption = true;
				self.$dButtons.eq( 0 ).button( 'option', 'disabled', false );
			} else {
				setAngle( $( this ).val() );
				self.usedBotOption = false;
			}
			if ( $( this ).attr( 'id' ) === 'rRotCtext' ) { return true; }
			var $textnode = self.$dlgNode.find( '#rRotCtext' ),
				$overlayNode = self.$dlgNode.find( '#rRotCOverlay' ),
				state = ( $( this ).attr( 'id' ) === 'rRotC' );
			if ( state ) {
				self.usedBotOption = false;
				$textnode.prop( 'disabled', false );
				setTimeout( function () {
					$overlayNode.hide();
					$textnode.focus();
					$textnode.select();
				}, 50 );
			} else {
				self.usedBotOption = true;
				$textnode.prop( 'disabled', true );
				$overlayNode.show();
			}
			return true;
		} );
		this.$dlgNode.find( '#rRotCtext' ).on( 'input keyup', function () {
			$( this ).val( $( this ).val().replace( /\D/g, '' ) );
			if ( !setAngle( $( this ).val() ) && $( this ).val() ) {
				$( this ).val( $( this ).val() % 360 );
			}
			self.$dlgNode.find( '#rRotC' ).attr( 'value', $( this ).val() );
			self.usedBotOption = false;
			return true;
		} );
		this.$dlgNode.find( '#rRotOptions' ).find( 'input' ).on( 'keyup', function ( e ) {
			if ( e.which === 13 ) {
				self.sendRequest();
			}
			return true;
		} );
		this.$dlgNode.find( '#rRotCOverlay' ).on( 'click', function ( /* e*/ ) {
			self.$dlgNode.find( '#rRotC' ).click();
			self.$dlgNode.find( '#rRotC' ).triggerHandler( 'change' );
			return false;
		} );

		dlgButtons[ this.i18n.submitButtonLabel ] = function () {
			self.sendRequest();
		};
		dlgButtons[ this.i18n.cancelButtonLabel ] = function () {
			$( this ).dialog( 'close' );
		};
		this.$dlgNode.dialog( {
			modal: true,
			closeOnEscape: true,
			position: 'center',
			title: this.config.helpLink + ' ' + this.i18n.headline,
			height: this.config.dlg.height,
			maxHeight: $( window ).height(),
			width: Math.min( $( window ).width(), this.config.dlg.width ),
			buttons: dlgButtons,
			close: function () {
				$( this ).dialog( 'destroy' );
				$( this ).remove();
				self.dlgPresent = false;
			},
			open: function () {
				var $dlg = $( this );
				self.$dButtons = $dlg.parent().find( '.ui-dialog-buttonpane' ).find( 'button' );
				self.$dButtons.eq( 0 ).specialButton( 'proceed' );
				self.$dButtons.eq( 1 ).specialButton( 'cancel' );

				$dlg.parents( '.ui-dialog' ).css( {
					position: 'fixed',
					top: Math.round( ( $( window ).height() - Math.min( $( window ).height(), $( '.ui-dialog.ui-widget' ).height() ) ) / 2 ) + 'px'
				} );
			}
		} );
		if ( !window.rotateDontPurge ) {
		// send a purge-request
			var query = {
				title: mw.config.get( 'wgPageName' ),
				action: 'purge'
			};
			$.get( mw.config.get( 'wgScript' ), query, function ( result ) {
				purgeComplete( result );
			} );
		} else {
			purgeComplete();
		}
		$( document ).on( 'rotaterequest', function ( e, intE, p ) {
			if ( !intE || intE !== 'newAngleBotCompat' ) { return; }
			var newText = '';
			if ( p && self.fileExtBotCompat ) {
				newText = self.i18n.noteBot;
			} else {
				if ( !self.fileExtBotCompat ) { newText = self.i18n.noteMime; } else {
					var st = self.config.botAcceptedAngles.join( ', ' );
					st = st.substring( 0, st.lastIndexOf( ',' ) );
					newText = self.i18n.noteAngle.replace( '%1', st ).replace( '%2', self.config.botAcceptedAngles[ self.config.botAcceptedAngles.length - 1 ] );
				}
			}
			self.$rotNote.html( newText );
		} );
		angleBotCompat = true;
		setAngle( lastAngle );
		angleBotCompat = false;
		if ( lastOptionId === 'none' ) {
			setAngle( 0 );
			self.$dButtons.eq( 0 ).button( 'option', 'disabled', true );
		} else {
			setAngle( lastAngle );
			self.$dlgNode.find( '#rRot' + lastOptionId ).click();
		}
		// Finally get some status information about the bot:
		var gotBotStatus = function ( result ) {
			if ( !result ) { return; }
			result = $( '<div>' + result + '</div>' ).find( 'p' ).html();
			if ( self.i18n.noteBot === self.$rotNote.html() ) {
				self.$rotNote.html( result );
			}
			self.i18n.noteBot = result;
		};
		if ( self.config.currentBotStatus ) {
		// create a cache-preventer (maxage is already 0) and send the XHR to obtain the current status
			var currentDate = new Date(),
				dummy = currentDate.getDate() + '-' + currentDate.getHours();
			$.get( mw.config.get( 'wgScript' ), {
				action: 'render', title: self.config.currentBotStatus, uselang: mw.config.get( 'wgUserLanguage' ), dummy: dummy
			}, gotBotStatus );
			// Purge the template in some intervalls (each 10s only every 5th minute); something better would be appreciated
			if ( ( currentDate.getSeconds() % 10 === 0 ) && ( currentDate.getMinutes() % 5 === 0 ) ) {
				$.get( mw.config.get( 'wgScript' ), { action: 'purge', title: self.config.currentBotStatus } );
			}
		}
	},
	sendRequest: function () {
		var self = this,
			a = 0;

		if ( self.sending || self.$dButtons.eq( 0 ).button( 'option', 'disabled' ) ) { return; }

		self.$dlgNode.parent().find( 'input, button' ).addClass( 'disabled' ).prop( 'disabled', true );
		self.animationID = setInterval( function () {
			a += 10;
			var $img = $( '#uniqueImg' );
			$img.rotate( { angle: a } );
			if ( $img.length < 1 ) {
				clearInterval( self.animationID );
			}
		}, 50 );

		var doEdit = function ( text ) {
			var nText = text.replace( self.config.customTemplateRemoval, '' ),
				tl = self.config.customTemplate.replace( '%1', self.angle ),
				params = {
					editType: 'text',
					title: mw.config.get( 'wgPageName' ),
					nocreate: 1,
					watchlist: 'nochange',
					tags: 'RotateLink',
					summary: 'Requesting rotation of the image by ' + self.angle + '°.'
				};

			if ( nText === text ) {
				params.editType = 'prependtext';
				params.text = tl;
			} else {
				params.text = self.config.customTemplate.replace( '%1', self.angle ) + nText;
			}

			try { // silently fail
				mw.cookie.set( 'rRot', ( self.angle + '|' + ( self.usedBotOption ? 'B' : 'C' ) ), {
					expires: 14, // expires in 14 days
					path: '/' // domain-wide, entire wiki
				} );
			} catch ( ex ) {}

			$( document ).triggerHandler( 'rotaterequest', [ 'sendingRequest', params ] );
			self.sending = true;

			mw.loader.using( 'ext.gadget.libAPI', function () {
				mw.libs.commons.api.$editPage( params ).done( function () {
					self.sending = false;
					try {
						self.requestCB();
					} catch ( e ) {
						return self.fail( e );
					}
				} ).fail( function ( errText, paramsPassedIn, result ) {
					self.sending = false;
					return self.fail( 'API request failed (' +
					( result && result.error && result.error.code ) + '): ' + errText );
				} );
			} );
		};
		$.get( mw.config.get( 'wgScript' ), { action: 'raw', title: mw.config.get( 'wgPageName' ), _: $.now() }, doEdit ).fail( function () {
			self.fail( 'Could not obtain latest WikiText of the page. Connection lost? Adblocker?' );
		} );
	},
	requestCB: function () {
		var self = this;
		$( document ).triggerHandler( 'rotaterequest', [ 'success' ] );

		clearInterval( self.animationID );
		var doAfterAnimation = function () {
			window.location.href = encodeURI( mw.config.get( 'wgServer' ) + mw.config.get( 'wgArticlePath' ).replace( '$1', mw.config.get( 'wgPageName' ) ) );
		};
		self.$dlgNode.find( '#readyContainer' ).fadeIn();
		$( '#uniqueImg' ).rotate( { animateTo: self.angle, callback: doAfterAnimation } );
		// If the browser-tab is idle, it fails sometime to call-back
		doAfterAnimation();
	},
	fail: function ( err ) {
		if ( typeof err === 'object' ) {
			var stErr = err.message + '<br>' + err.name;
			if ( err.lineNumber ) {
				stErr += ' @line' + err.lineNumber;
			}
			err = stErr;
		}
		this.$errorContainer.text( err );
		this.$errorContainer.fadeIn();
		$( document ).triggerHandler( 'rotaterequest', [ 'failed', err ] );
	},
	init: function () {
		var self = this,
			botlink = '<a href="' + mw.util.getUrl( 'User:Rotatebot' ) + '" target="_blank">Rotatebot</a>';
		// save some code-lines by assigning similar languages
		// -zh
		self.i18n[ 'zh-hk' ] = self.i18n[ 'zh-mo' ] = self.i18n[ 'zh-tw' ] = self.i18n[ 'zh-hant' ]; // zh-hk, zh-mo, zh-tw get the zh-hant i18n
		// merge languages
		$.extend( self.i18n, self.i18n[ mw.config.get( 'wgUserLanguage' ).split( '-' )[ 0 ] ], self.i18n[ mw.config.get( 'wgUserLanguage' ) ] );

		// inserting links
		self.i18n.headline = self.i18n.headline.replace( '%ERRLINK%',
			'href="' + mw.util.getUrl( 'MediaWiki talk:Gadget-RotateLink.js' ) + '" target="_blank"' );
		self.i18n.noteMime = self.i18n.noteMime.replace( 'Rotatebot', botlink );
		self.i18n.noteAngle = self.i18n.noteAngle.replace( 'Rotatebot', botlink );
		self.i18n.noteBot = self.i18n.noteBot.replace( 'Rotatebot', botlink );
		self.i18n.noteMime = self.i18n.noteMime.replace( '%ROTATEBOTLINK%',
			'href="' + mw.util.getUrl( 'User:Rotatebot' ) + '" target="_blank"' );

		// Finally set up event handlers
		$( document ).on( 'rotaterequest', function ( evt, a ) {
			if ( a && a === 'start' ) {
				self.dialog();
			}
		} );
		$( document ).triggerHandler( 'scriptLoaded', [ 'rotaterequest', 'init' ] );
	},
	// Translation
	i18n: {
		ca: {
			submitButtonLabel: 'confirma la soŀlicitud de rotació',
			cancelButtonLabel: 'canceŀla',
			headline: 'Quants graus s’hauria de girar la imatge? Podeu <a %ERRLINK%>informar</a> d’errades o suggeriments.',
			intro: 'Podeu utilitzar aquesta funció per corregir imatges que es mostren en una orientació incorrecta (com passa sovint amb fotos digitals en vertical).',
			clockwise: 'En sentit horari:',
			noteheader: 'Nota: ',
			noteAngle: 'Rotatebot pot girar %1° o %2° fent-ho en unes poques hores. Per a altres valors pot trigar més en ser atès.',
			noteMime: 'Rotatebot no pot tractar aquest format de fitxer. Aquesta soŀlicitud pot trigar més en ser atesa.',
			noteBot: 'Rotatebot pot executar aquesta soŀlicitud en unes poques hores.',
			imgCaption: 'Corregiu l’orientació d’aquesta mostra seleccionant un angle.'
		},
		cs: {
			submitButtonLabel: 'Potvrdit požadavek na otočení',
			cancelButtonLabel: 'Storno',
			headline: 'O kolik stupňů se má tento obrázek otočit? <a %ERRLINK%>Chyby a vylepšení</a>.',
			intro: 'Touto funkcí můžete opravit obrázky, které se zobrazují špatně otočené (což se často stává u digitálních fotografií na výšku).',
			clockwise: 'Ve směru hodinových ručiček',
			noteheader: 'Poznámka: ',
			noteAngle: 'Otočení o %1 nebo %2° bude Rotatebot schopen vyřídit během pár hodin.',
			noteMime: 'Rotatebot neumí zpracovávat soubory tohoto typu nebo formátu. Na otočení si budete muset pravděpodobně počkat delší dobu.',
			noteBot: 'Rotatebot by tento požadavek měl zvládnout během několika hodin.',
			imgCaption: 'Opravte natočení tohoto náhledu volbou úhlu.'
		},
		da: {
			submitButtonLabel: 'Bekræft anmodning om rotation',
			cancelButtonLabel: 'Afbryd',
			headline: 'Hvor mange grader bør dette billede roteres? <a %ERRLINK%>Rapporter</a> fejl og idéer.',
			clockwise: 'Mod uret',
			noteheader: 'Note: ',
			noteAngle: 'Hvis du anmoder om en rotation på %1 eller %2° så vil Rotatebot gøre dette i løbet af få timer.',
			noteMime: 'Rotatebot kan ikke behandle medier af denne filtype. Det vil sandsynligvis tage en del tid før det bliver muligt.',
			noteBot: 'Rotatebot kan udføre denne anmodning i løbet af få timer.'
		},
		de: {
			submitButtonLabel: 'Drehen!',
			cancelButtonLabel: 'Abbrechen',
			headline: 'Um wieviel Grad soll das Bild gedreht werden? <a %ERRLINK%>Fehler und Ideen</a>.',
			intro: 'Du kannst diese Funktion verwenden, um Bilder zu korrigieren, die in falscher Orientierung angezeigt werden (wie es oft bei hochkant fotografierten digitalen Fotos passiert).',
			clockwise: 'Im Uhrzeigersinn:',
			noteheader: 'Beachte: ',
			noteAngle: 'Wenn Du eine Drehung um %1 oder %2° erbittest, wird Rotatebot das in ein paar Stunden tun. Voraussichtlich wird es so viel mehr Zeit erfordern.',
			noteMime: 'Dieses Dateiformat kann nicht <a %ROTATEBOTLINK%>automatisch gedreht werden</a>; das Drehen muss von Hand erledigt werden, was einige Zeit dauert.',
			noteBot: 'Rotatebot kann diese Anfrage in ein paar Stunden erledigen.',
			imgCaption: 'Korrigiere die Orientierung des Vorschaubildes indem Du einen Winkel auswählst.'
		},
		el: {
			submitButtonLabel: 'Επιβεβαιώστε το αίτημα περιστροφής',
			cancelButtonLabel: 'Άκυρο',
			headline: 'Περίπου πόσες μοίρες πρέπει να περιστραφεί η εικόνα; <a %ERRLINK%>Αναφέρετε</a> σφάλματα και ιδέες.',
			intro: 'Με αυτή τη λειτουργία μπορείτε να διορθώσετε εικόνες που προβάλλονται με λάθος προσανατολισμό (όπως συμβαίνει μερικές φορές με τις "όρθιες" ψηφιακές φωτογραφίες).',
			clockwise: 'Προς τα δεξιά:',
			noteheader: 'Σημείωση: ',
			noteAngle: 'Αν ζητήσετε περιστροφή κατά %1 ή %2° το Rotatebot θα εκτελέσει το αίτημα μέσα σε μερικές ώρες. Αν ζητήσετε άλλο αριθμό μοιρών, το αίτημα θα πρέπει να γίνει χειροκίνητα από κάποιον εθελοντή, και πιθανότατα θα πάρει περισσότερο χρόνο.',
			noteMime: 'Αυτός ο τύπος αρχείου δεν μπορεί να <a %ROTATEBOTLINK%>περιστραφεί αυτόματα</a>. Η περιστροφή θα πρέπει να γίνει χειροκίνητα, κάτι που θα πάρει χρόνο.',
			noteBot: 'Το Rotatebot μπορεί να εκτελέσει αυτό το αίτημα μέσα σε λίγες ώρες.',
			imgCaption: 'Διορθώστε τον προσανατολισμό αυτής της μικρογραφίας επιλέγοντας γωνία περιστροφής.'
		},
		es: {
			submitButtonLabel: 'Confirmar la solicitud de rotación',
			cancelButtonLabel: 'Cancelar',
			headline: '¿Cuántos grados debería girarse esta imagen? <a %ERRLINK%>Notificar fallos o ideas</a>.',
			intro: 'Puedes usar esta funcionalidad para corregir imágenes que no muestran una orientación correcta (algo que ocurre con frecuencia en fotos digitales tomadas en vertical).',
			clockwise: 'En el sentido de las agujas del reloj:',
			noteheader: 'Nota: ',
			noteAngle: 'Si solicitas una rotación de %1º o %2°, Rotatebot lo hará en unas horas. Para los otros valores tardará más tiempo en completar la tarea.',
			noteMime: 'Este tipo de archivos no se puede <a %ROTATEBOTLINK%>rotar automáticamente</a>; la rotación tendrá que hacerse manualmente, algo que puede llevar más tiempo.',
			noteBot: 'Rotatebot puede realizar esta solicitud en unas horas.',
			imgCaption: 'Corrige la orientación de esta miniatura seleccionando un ángulo.'
		},
		fa: {
			submitButtonLabel: 'تأیید درخواست چرخش',
			cancelButtonLabel: 'لغو',
			headline: 'این تصویر حدوداً چند درجه باید چرخانده شود؟ اشکالات و نظراتتان را <a %ERRLINK%>گزارش دهید</a>.',
			intro: 'شما می\u200cتوانید از این ابزار برای تصحیح تصاویری که جهت\u200cگیری نادرستی دارند، استفاده کنید (مشابه این وضعیت مکرراً در تصاویر دیجیتالی ایستاده دیده می\u200cشود).',
			clockwise: 'ساعت\u200cگرد:',
			noteheader: 'توجه: ',
			noteAngle: 'اگر درخواست چرخش %1 یا %2° است، ربات این عمل را ظرف چند ساعت انجام خواهد داد. در غیر این\u200cصورت، احتمالاً زمان بیشتری طول خواهد کشید تا درخواست شما انجام داده شود.',
			noteMime: 'این نوع پرونده را نمی\u200cتوان به طور خودکار <a %ROTATEBOTLINK%>چرخاند</a>؛ چرخاندن پرونده باید به صورت دستی انجام گیرد که ممکن است مدتی طول بکشد.',
			noteBot: 'ربات نمی\u200cتواند ظرف چند ساعت آینده درخواست چرخش را انجام دهد.',
			imgCaption: 'جهت\u200cگیری تصویر بندانگشتی را با انتخاب زاویهٔ مناسب تصحیح نمایید.'
		},
		fi: {
			submitButtonLabel: 'vahvista kiertopyyntö',
			cancelButtonLabel: 'peruuta',
			headline: 'Kuinka montaa astetta tätä kuvaa pitäisi suurin piirtein kiertää? ' + 
				'<a %ERRLINK%>Kerro</a> bugeista ja ideoista.',
			intro: 'Voit käyttää tätä ominaisuutta korjataksesi kuvia, jotka näkyvät vääräsuuntaisesti (kuten yleisesti käy pystysuuntaisten digitaalisten valokuvien kanssa).',
			clockwise: 'Myötäpäivään:',
			noteheader: 'Huomautus: ',
				// Hint for translation:
				// The following message is displayed e.g. if you request a rotation of e.g. 3° because Rotatebot can't rotate by this angle. 
				// A volunteer has to do this.
			noteAngle: 'Jos pyydät a kiertoa astemäärällä %1 tai %2°, Rotatebot tulee tekemään tämän parin tunnin sisällä. Tämän tekeminen tulee todennäköisesti kestämään kauemmin, jos Rotatebot ei voi suorittaa pyyntöä.',
				// Hint for translation:
				// The following message is displayed e.g. on djvu or pdf-files because Rotatebot can't rotate them. 
				// A volunteer has to do this.
			noteMime: 'Tämäntyyppistä tiedostoa ei voida <a %ROTATEBOTLINK%>kiertää automaattisesti</a>; kiertäminen on tehtävä manuaalisesti, joka voi kestää jonkin aikaa.',
			noteBot: 'Rotatebot voi suorittaa tämän pyynnön parin tunnin sisällä.',
			imgCaption: 'Korjaa tämän pienoiskuvan suunta valitsemalla kulma.'			
		},
		fr: {
			submitButtonLabel: 'confirmer la demande de rotation',
			cancelButtonLabel: 'annuler',
			headline: 'De combien de degrés (environ) devrait-on faire pivoter cette image? <a %ERRLINK%>Signalez</a> des bugs ou des idées.',
			intro: 'Vous pouvez utiliser cette fonction pour corriger des images qui ne s’affichent pas avec une orientation correcte (comme cela peut arriver fréquemment avec des photos numériques).',
			clockwise: 'Dans le sens horaire :',
			noteheader: 'Note : ',
			noteAngle: 'Si vous demandez une rotation de %1 ou %2°, Rotatebot ne pourra pas le faire avant au moins quelques heures. Cela devrait sans doute prendre beaucoup plus de temps, voire ne pas pouvoir être fait.',
			noteMime: 'Ce type de fichier ne peut pas subir une <a %ROTATEBOTLINK%>rotation via un robot</a> ; la rotation devra être réalisée manuellement, ce qui peut prendre un peu de temps.',
			noteBot: 'Rotatebot peut traiter cette demande d’ici quelques heures.',
			imgCaption: 'Corrigez l’orientation de cette miniature en choisissant un angle.'
		},
		gl: {
			submitButtonLabel: 'confirmar a solicitude de rotación',
			cancelButtonLabel: 'cancelar',
			headline: 'Cantos graos cómpre rotar esta imaxe? <a %ERRLINK%>Achéguenos</a> erros e ideas.',
			intro: 'Pode facer uso desta función para corrixir as imaxes que teñan unha orientación incorrecta (cousa que ocorre frecuentemente coas fotos dixitais tomadas en vertical).',
			clockwise: 'No sentido das agullas do reloxo:',
			noteheader: 'Nota: ',
			noteAngle: 'Rotatebot pode realizar unha rotación en %1º ou %2° nunhas poucas horas. Para outros valores pode tardar máis tempo ou mesmo non completar a tarefa.',
			noteMime: 'Este tipo de ficheiro non se pode <a %ROTATEBOTLINK%>rotar automaticamente</a>; cómpre facer a rotación de xeito manual, algo que pode levar algún tempo.',
			noteBot: 'Rotatebot pode levar a cabo esta solicitude nunhas horas.',
			imgCaption: 'Corrixa a orientación desta miniatura seleccionando un ángulo.'
		},
		hr: {
			submitButtonLabel: 'potvrdi zahtjev za okretanjem',
			cancelButtonLabel: 'odustani',
			headline: 'Za koliko stupnjeva bi slika trebala biti okrenuta? <a %ERRLINK%>Napišite</a> probleme i prijedloge.',
			intro: 'Rabite ovu mogućnost za slike krive orijentacije.',
			clockwise: 'U smjeru kazaljke na satu:',
			noteheader: 'Napomena: ',
			noteAngle: 'Ako zatražite okretanje za %1 ili %2° Rotatebot će to učiniti za nekoliko sati, a inače će trebati nešto više vremena.',
			noteMime: 'Ova slika ne može biti <a %ROTATEBOTLINK%>automatski okrenuta</a>. Okretanje treba napraviti ručno, za što će trebati neko vrijeme.',
			noteBot: 'Rotatebot će riješiti zahtjev za nekoliko sati.',
			imgCaption: 'Ispravite orijentaciju ove sličice označavanjem kuta.'
		},
		it: {
			submitButtonLabel: 'conferma rotazione richiesta',
			cancelButtonLabel: 'annulla',
			headline: 'Di quanti gradi dovrebbe essere ruotata l\'immagine? <a %ERRLINK%>Segnala bug o suggerimenti</a>.',
			intro: 'Puoi usare questo strumento per correggere immagini orientate in modo errato (come capita spesso con immagini digitali scattate in verticale).',
			clockwise: 'Senso orario:',
			noteheader: 'Nota: ',
			noteAngle: 'Se richiedi una rotazione di %1 o %2°, Rotatebot impiegherà qualche ora.',
			noteMime: 'Rotatebot non è in grado di <a %ROTATEBOTLINK%>elaborare automaticamente</a> questo tipo di file. È necessario farlo manualmente, il che probabilmente richiederà più tempo.',
			noteBot: 'Rotatebot può soddisfare questa richiesta in poche ore.',
			imgCaption: 'Correggi l\'orientamento di questa miniatura selezionando un\'opzione.'
		},
		ja: {
			submitButtonLabel: '依頼を確認',
			cancelButtonLabel: 'キャンセル',
			headline: 'この画像を何度回転させますか? バグや提案は<a %ERRLINK%>こちら</a>',
			intro: 'この機能では(主に縦長のデジタル画像でみられるような)正しくない向きに回転してしまった画像を正しい向きに直すことができます。',
			clockwise: '時計回りで',
			noteheader: 'お知らせ ',
			noteAngle: '%1, %2°に回転させる場合は、Rotatebotによって数時間で回転されます。他の角度に回転させる場合は、それ以上の時間がかかります。',
			noteMime: 'この形式のファイルは、<a %ROTATEBOTLINK%>Rotatebot</a>で回転させることができません。回転は人の手によっておこなわれるため、時間がかかります。',
			noteBot: 'Rotatebotは数時間でこの画像を回転します。',
			imgCaption: 'このサムネイルで正しい方向になるように角度を選択して下さい。'
		},
		mk: {
			submitButtonLabel: 'Потврди',
			cancelButtonLabel: 'Откажи',
			headline: 'За околу колку степени треба да се сврти сликата? <a %ERRLINK%>Пријавувајте грешки и нови идеи</a>.',
			intro: 'Со оваа функција можете да ги исправате погрешно свртените слики (како што често се случува кај дигиталните фотографии).',
			clockwise: 'Надесно',
			noteheader: 'Напомена: ',
			noteAngle: 'Ако побарате свртување за %1 или %2° Rotatebot ќе го изврши вртењето за неколку часа.',
			noteMime: 'Rotatebot не може да работи со ваква слика или формат. Веројатно ова би потрајало подолго.',
			noteBot: 'Rotatebot може да го изврши бараното за неколку часа.',
			imgCaption: 'Поправете ја насоченоста на минијатурава - одберете агол.'
		},
		ml: {
			submitButtonLabel: 'തിരിക്കൽ നിർദ്ദേശം സ്ഥിരീകരിക്കുക',
			cancelButtonLabel: 'റദ്ദാക്കുക',
			headline: 'ഏകദേശം എത്ര ഡിഗ്രിയാണ് ഈ ചിത്രം തിരിക്കേണ്ടത്? പ്രശ്നങ്ങളും ആശയങ്ങളും <a %ERRLINK%>അറിയിക്കുക</a>.',
			intro: 'തെറ്റായ ദിശയിൽ ചേർത്തിരിക്കുന്ന ചിത്രങ്ങൾ ശരിയാക്കാൻ ഈ സൗകര്യം ഉപയോഗിക്കാവുന്നതാണ് (ഉദാഹരണത്തിന് തലകീഴായി പോയ ഡിജിറ്റൽ ഫോട്ടോകൾ).',
			clockwise: 'പ്രദക്ഷിണദിശ:',
			noteheader: 'കുറിപ്പ്: ',
			noteAngle: 'താങ്കൾ %1 അല്ലെങ്കിൽ %2° തിരിക്കാനാണ് ആവശ്യപ്പെടുന്നതെങ്കിൽ റൊട്ടേറ്റ്ബോട്ട് ഏതാനം മണിക്കൂറുകൾക്കുള്ളിൽ അത് ചെയ്യുന്നതായിരിക്കും. അതിനു സാധിച്ചില്ലെങ്കിൽ, കൂടുതൽ സമയം എടുക്കാനിടയുണ്ട്.',
			noteMime: 'ഈ പ്രമാണം <a %ROTATEBOTLINK%>മനുഷ്യസഹായമില്ലാതെ തിരിക്കാൻ</a> കഴിയില്ല; മനുഷ്യസഹായം ലഭിക്കാൻ സമയമെടുത്തേക്കാം.',
			noteBot: 'റൊട്ടേറ്റ്ബോട്ട് ഈ നിർദ്ദേശം ഏതാനം മണിക്കൂറുകൾക്കുള്ളിൽ നടപ്പിലാക്കും.',
			imgCaption: 'കോൺ തിരഞ്ഞെടുത്ത് ഈ ലഘുചിത്രത്തിന്റെ ദിശ ശരിയാക്കുക.'
		},
		nl: {
			submitButtonLabel: 'Rotatieverzoek bevestigen',
			cancelButtonLabel: 'Annuleren',
			headline: 'Hoeveel graden moet de afbeelding worden geroteerd? <a %ERRLINK%>Rapporteer</a> bugs en ideeën.',
			intro: 'U kunt deze functie gebruiken om afbeeldingen te corrigeren die worden weergegeven met een verkeerde oriëntatie (zoals dit vaak voorkomt met rechtopstaande digitale foto\'s).',
			clockwise: 'Met de klok mee:',
			noteheader: 'Noot: ',
			noteAngle: 'Indien u een rotatie verzoekt van %1 of %2° voert Rotatebot dit binnen enkele uren uit. Andere rotaties nemen waarschijnlijk meer tijd in beslag.',
			noteMime: 'Dit type bestand kan niet <a %ROTATEBOTLINK%>automatisch geroteerd</a> worden; de rotatie moet handmatig moeten uitgevoerd worden. Dit kan enige tijd kan duren.',
			noteBot: 'Rotatebot kan dit verzoek binnen enkele uren uitvoeren.',
			imgCaption: 'Corrigeer de oriëntatie van deze miniatuur door een rotatiehoek te selecteren.'
		},
		pl: {
			submitButtonLabel: 'Potwierdź wniosek',
			cancelButtonLabel: 'Anuluj',
			headline: 'O ile stopni powinna być obrócona ta grafika? <a %ERRLINK%>Prosimy o zgłaszanie błędów lub nowych pomysłów</a>.',
			intro: 'Możesz używać tej funkcji do poprawiania grafik o złej orientacji (np. w przypadku pionowych fotografii cyfrowych).',
			clockwise: 'Zgodnie z ruchem wskazówek zegara',
			noteheader: 'Uwaga: ',
			noteAngle: 'Jeśli poprosisz o obrócenie grafiki o %1 lub %2°, Rotatebot zrobi to w ciągu kilku godzin.',
			noteMime: 'Rotatebot nie jest w stanie obsłużyć pliku w tym formacie, w związku z czym wykonanie Twojego wniosku może potrwać nieco dłużej.',
			noteBot: 'Rotatebot może wykonać ten wniosek w ciągu kilku godzin.'
		},
		pt: { // also correct for pt-br
			submitButtonLabel: 'confirmar pedido de rotação',
			cancelButtonLabel: 'cancelar',
			intro: 'Podes usar esta função para corrigir imagens que estão a ser exibidas na orientação errada (como é comum acontecer com imagens digitais fotografadas na vertical).',
			headline: 'Em quantos graus esta imagem deve ser rotacionada? <a %ERRLINK%>Reporte bugs e ideias</a>.',
			clockwise: 'sentido horário',
			noteheader: 'Nota: ',
			noteAngle: 'Se solicitar uma rotação de %1 ou %2° Rotatebot atenderá o pedido em algumas horas.',
			noteMime: 'Rotatebot não consegue lidar com mídia neste formato de arquivo. Seu pedido poderá demorar mais para ser atendido.',
			noteBot: 'Rotatebot pode executar este pedido em algumas horas.'
		},
		ro: {
			submitButtonLabel: 'confirmă cererea de rotire',
			cancelButtonLabel: 'anulează',
			headline: 'Cu câte grade trebuie rotită imaginea? <a %ERRLINK%>Raportaţi</a> buguri şi idei de feature-uri.',
			intro: 'Puteţi utiliza această funcţie pentru a corecta imaginile afişate cu o orientare greşită (aşa cum se întâmplă adesea în cazul unor fotografii făcute „în picioare”.',
			clockwise: 'Sens orar:',
			noteheader: 'Notă: ',
			noteAngle: 'Dacă cereţi o rotaţie cu %1 sau %2° Rotatebot va face aceasta în câteva ore. Aceasta, însă, probabil va dura mult şi nu e sigur dacă se va face.',
			noteMime: 'Rotatebot nu poate roti fişiere media în acest format. Probabil va dura ceva vreme până să se efectueze rotaţia.',
			noteBot: 'Rotatebot poate executa această cerere în câteva ore.',
			imgCaption: 'Corectaţi orientarea acestui thumbnail alegând un unghi.'
		},
		ru: {
			submitButtonLabel: 'Подтвердить запрос',
			cancelButtonLabel: 'Отменить',
			headline: 'На сколько градусов нужно повернуть изображение? <a %ERRLINK%>Написать</a> об ошибках и идеях.',
			intro: 'Вы можете воспользоваться этим инструментом для исправления изображений с неправильной ориентацией (зачастую это цифровые фото с вертикальной ориентацией).',
			clockwise: 'По часовой стрелке:',
			noteheader: 'Примечание: ',
			noteAngle: 'Если вы запрашиваете вращение на %1 или %2°, Rotatebot выполнит его в течение нескольких часов. Если на другой угол, то это может занять больше времени.',
			noteMime: 'Этот тип файла не может быть <a %ROTATEBOTLINK%>повёрнут автоматически</a>; вращение должно быть произведено вручную, что может потребовать некоторого времени.',
			noteBot: 'Rotatebot может выполнить этот запрос в течение нескольких часов.',
			imgCaption: 'Исправьте ориентацию этой миниатюры, выбрав угол.'
		},
		sl: {
			submitButtonLabel: 'potrdi zahtevo za zasuk',
			cancelButtonLabel: 'prekliči',
			headline: 'Za koliko stopinj je treba zavrteti sliko? <a %ERRLINK%>Sporočite</a> hrošče in predloge.',
			intro: 'To funkcijo lahko uporabite za popravo slik, ki so prikazane napačno usmerjene (pogosto pri pokončnih digitalnih fotografijah).',
			clockwise: 'V smeri urnega kazalca:',
			noteheader: 'Opomba: ',
			noteAngle: 'Če boste zahtevali zasuk za %1 ali %2°, ga bo v nekaj urah opravil Rotatebot. Sicer bo to najverjetneje vzelo več časa.',
			noteMime: 'Te vrste datoteke ni mogoče <a %ROTATEBOTLINK%>zasukati samodejno</a>; zasuk je treba opraviti ročno, kar lahko vzame nekaj časa.',
			noteBot: 'To zahtevo lahko Rotatebot izvrši v nekaj urah.',
			imgCaption: 'Z izbiro kota popravite usmerjenost predogledne sličice.'
		},
		sr: {
			submitButtonLabel: 'Потврди захтев за ротирање',
			cancelButtonLabel: 'Откажи',
			headline: 'За колико степени би требало ротирати слику? <a %ERRLINK%>Пријави</a> грешке и идеје.',
			intro: 'Овим алатом можете да поправите слике које су погрешно ротиране (као што се често дешава када се фото-апарт постави вертикално).',
			clockwise: 'У смеру казаљке на сату:',
			noteheader: 'Напомена: ',
			noteAngle: 'Ако тражите ротацију од  %1 или %2° Rotatebot ће то урадити за неколико сати. Ако не, значи да му вероватно треба више времена да то изврши.',
			noteMime: 'Овај тип фајла се не може <a %ROTATEBOTLINK%>аутоматски ротирати</a>; то ће морати да се обави ручно, што може да потраје неко време.',
			noteBot: 'Rotatebot може да изврши овај захтев за неколико сати.',
			imgCaption: 'Поправите оријентацију ове сличице избором одговарајућег угла.'
		},
		sv: {
			submitButtonLabel: 'bekräfta roteringsbegäran',
			cancelButtonLabel: 'avbryt',
			headline: 'Hur många grader ska denna bild roteras? <a %ERRLINK%>Rapportera</a> buggar och idéer.',
			intro: 'Du kan använda denna funktion för att korrigera bilder som visas i fel vinkel (vilket förekommer ofta med digitala bilder som är upprättstående).',
			clockwise: 'Medurs:',
			noteheader: 'OBS: ',
			noteAngle: 'Om du begär en rotering med %1 eller %2° kommer Rotatebot göra detta inom några timmar. Troligt att det kommer att ta längre tid att utföras.',
			noteMime: 'Denna filtyp kan inte <a %ROTATEBOTLINK%>roteras automatiskt</a>; roteringen kommer att utföras manuellt, som kan ta lite tid.',
			noteBot: 'Rotatebot kan utföra denna begäran inom några timmar.',
			imgCaption: 'Korrigera orienteringen för denna miniatyr genom att välja en vinkel.'
		},
		uk: {
			submitButtonLabel: 'підтвердити запит на обертання',
			cancelButtonLabel: 'скасувати',
			headline: 'На скільки градусів слід обернути це зображення? <a %ERRLINK%>Повідомте</a> про баги та ідеї.',
			intro: 'Можете скористатись цією функцією для виправлення зображень, що мають хибну орієнтацію (як це часто буває з вертикальними цифровими фото).',
			clockwise: 'За годинниковою стрілкою:',
			noteheader: 'Примітка: ',
			noteAngle: 'Якщо Ви подаєте запит на обертання на %1 або %2°, Rotatebot виконає його за кілька годин. Якщо ж ні, то найімовірніше, таке обертання потребує більше часу.',
			noteMime: 'Цей тип файлу не можна <a %ROTATEBOTLINK%>обернути автоматично</a>; обертання треба буде зробити вручну, що може зайняти трохи часу.',
			noteBot: 'Rotatebot зможе виконати цей запит за кілька годин.',
			imgCaption: 'Виправте орієнтацію цієї мініатюри, вибравши відповідний кут.'
		},
		zh: { // also correct for zh-hans, zh-cn, zh-my, zh-sg
			submitButtonLabel: '确认旋转请求',
			cancelButtonLabel: '取消',
			headline: '这个图像应该被旋转多少度?<a %ERRLINK%>报告</a>错误和想法。',
			intro: '您可以使用这个功能来修正显示方向错误的图像(例如常见的纵向数码照片)。',
			clockwise: '顺时针',
			noteheader: '注:',
			noteAngle: '如果您请求旋转%1或%2°,Rotatebot会在几个小时内完成旋转。',
			noteMime: '此类型的文件不能被<a %ROTATEBOTLINK%>自动旋转</a>;旋转将人工完成,这可能需要更多的时间。',
			noteBot: 'Rotatebot可以在几个小时内执行这个请求。',
			imgCaption: '选择一个角度使此缩略图显示为正确的方向。'
		},
		'zh-hant': { // also correct for zh-hk, zh-mo, zh-tw (enabled VIA HACK directly above "// merge languages" )
			submitButtonLabel: '確認旋轉請求',
			cancelButtonLabel: '取消',
			headline: '這個圖像應該被旋轉多少度?<a %ERRLINK%>報告</a>錯誤和想法。',
			intro: '您可以使用這個功能來修正顯示方向錯誤的圖像(例如常見的縱向數位照片)。',
			clockwise: '順時針',
			noteheader: '注:',
			noteAngle: '如果您請求旋轉%1或%2°,Rotatebot會在幾個小時內完成旋轉。',
			noteMime: '此類型的檔案不能被<a %ROTATEBOTLINK%>自動旋轉</a>;旋轉將人工完成,這可能需要更多的時間。',
			noteBot: 'Rotatebot可以在幾個小時內執行這個請求。',
			imgCaption: '選擇一個角度使此縮圖顯示爲正確的方向。'
		},
		submitButtonLabel: 'confirm rotate request',
		cancelButtonLabel: 'cancel',
		headline: 'How many degrees this image should be rotated? <a %ERRLINK%>Report</a> bugs and ideas.',
		intro: 'You can use this function to correct images which display in the wrong orientation (as frequently occurs with vertical orientation digital photos).',
		clockwise: 'Clockwise:',
		noteheader: 'Note: ',
		noteAngle: 'If you request a rotation by %1 or %2° Rotatebot will do this in a few hours. If you request a rotation by any other angle it will probably take longer.',
		noteMime: 'This type of file cannot be <a %ROTATEBOTLINK%>rotated automatically</a>; rotation will have to be done manually, which may take some time.',
		noteBot: 'Rotatebot can execute this request in a few hours.',
		imgCaption: 'Correct the orientation of this thumbnail by selecting an angle.'
	},
	// Configuration
	config: {
		dlg: {
			width: 560,
			height: 'auto',
			labelStyle: 'width: 140px; display: inline-block; height:1.6em;',
			customNumber: '123', // like the Cookie: '<number>|B' OR just '123'
			customOption: 'none' // 'C' (custom) OR 'none' OR 0 to botAcceptedAngles.length-1
		},
		customTemplate: '{{rotate|%1}}\n',
		customTemplateRemoval: /\{\{rotate\|.+?\}\}\n?/ig,
		botAcceptedFormats: [ 'png', 'jpg', 'jpeg', 'gif', 'tif', 'tiff' ],
		botAcceptedAngles: [ 90, 180, 270 ], // must be numbers only
		helpLink: '<a href="' + mw.util.getUrl( 'Help:RotateLink' ) + '" target="_blank"><img src="//upload.wikimedia.org/wikipedia/commons/4/45/GeoGebra_icon_help.png" alt="?"/></a>',
		currentBotStatus: 'User:Rotatebot/approx max wait time rotatelink'
	}
};

if ( !window.rRotSettings ) {
	window.rRotSettings = {};
}
$.extend( window.rRot.config, window.rRotSettings );

mw.loader.using( [ 'mediawiki.cookie', 'jquery.ui', 'mediawiki.user', 'mediawiki.util', 'ext.gadget.libJQuery', 'ext.gadget.jquery.rotate' ], function () {
	window.rRot.init();
} );
}( jQuery, mediaWiki ) );
// Just for debugging
// $( document ).off( 'rotaterequest' );
// $( document ).triggerHandler( 'rotaterequest', [ 'start' ] );
// </nowiki>