Minecraft Wiki

READ MORE

Minecraft Wiki
Advertisement

Megjegyzés: mentés után frissítened kell a böngésződ gyorsítótárát, hogy lásd a változásokat.

  • Firefox / Safari: tartsd lenyomva a Shift gombot és kattints a Frissítés gombra a címsorban, vagy használd a Ctrl–F5 vagy Ctrl–R billentyűkombinációt (Mac-en Command–R);
  • Google Chrome: használd a Ctrl–Shift–R billentyűkombinációt (Mac-en Command–Shift–R);
  • Internet Explorer: tartsd nyomva a Ctrl-t, és kattints a Frissítés gombra, vagy nyomj Ctrl–F5-öt;
  • Opera: ürítsd ki a gyorsítótárat a Beállítások / Haladó / Előzmények→Törlés most gombbal, majd frissítsd az oldalt.
$( function() {
'use strict';


$( '.mw-rollback-link' ).find( 'a' ).after( '<span class="edit-rollback" title="Edit rollback summary"/>' )

// Style all the things in one go
mw.util.addCSS( [
	'.edit-rollback {',
		'display: inline-block;',
		'width: 10px;',
		'height: 10px;',
		'margin-left: 2px;',
		'background: url(http://media-mcw.cursecdn.com/6/6c/Edit_pencil.png) no-repeat;',
		'cursor: pointer;',
	'}',
	'#rollback-summary {',
		'display: flex;',
		'align-items: center;',
		'position: absolute;',
		'left: 1em;',
		'right: 1em;',
		'padding: 0.8em;',
		'border: 1px solid #CCC;',
		'background-color: #F9F9F9;',
		'z-index: 99;',
		'box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.2);',
	'}',
	'#rollback-summary > *:first-child {',
		'flex: auto;',
		'margin-right: 1em;',
	'}'
	'#rollback-summary > .rollback-submit-button {',
		'flex: none;',
	'}',
].join( '\n' ) );

$( '#mw-content-text' ).on( 'click', '.edit-rollback', function() {
	var $rollback = $( '#rollback-summary' );
	
	if ( $( this ).parent().is( $rollback.parent() ) ) {
		$rollback.toggle();
	} else {
		$rollback.remove();
		
		var name = decodeURIComponent( $( this ).prev().prop( 'href' ).match( /&from=(.+)&token/ )[1].replace( /\+/g, ' ' ) );
		$rollback = $( '<div id="rollback-summary">' ).append(
			$( '<input type="text">' ).addClass( 'rollback-text' ).prop( { maxlength: 250, spellcheck: true } ).val(
				'Revert consecutive edits by [[Special:Contribs/' + name + '|' + name + ']] ([[User talk:' + name + '|talk]])'
			),
			$( '<input type="button">' ).addClass( 'mw-ui-button mw-ui-constructive rollback-submit-button' ).val( 'Rollback' )
		).insertAfter( this );
	}
	
	// This puts the cursor at the end of the text
	var $text = $rollback.find( '.rollback-text' );
	var summary = $text.val();
	$text.focus().val( '' ).val( summary );
} );

$( '#mw-content-text' ).on( 'click', '.rollback-submit-button', function() {
	var $link = $( this ).closest( '.mw-rollback-link' );
	window.location = $link.find( 'a' ).prop( 'href' ) + '&summary=' + encodeURIComponent( $link.find( '.rollback-text' ).val() );
} );

// Allow rollback to be submitted by pressing enter while focused on the input field
$( '#mw-content-text' ).on( 'keypress', '.rollback-text', function( e ) {
	if ( e.which !== 13 ) {
		return;
	}
	e.preventDefault();
	$( '.rollback-submit-button' ).click();
} );

// Close rollback if clicked anywhere else
$( window ).click( function( e ) {
	if ( !$( e.target ).is( '#rollback-summary, .edit-rollback' ) && !$( '#rollback-summary' ).has( e.target ).length ) {
		$( '#rollback-summary' ).hide();
	}
} );


} );
Advertisement