mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/RevisionSlider
synced 2024-11-15 03:33:45 +00:00
Merge "build: Update eslint to 0.4.0 and make pass"
This commit is contained in:
commit
7a705aade7
|
@ -211,11 +211,11 @@
|
|||
* @param {SliderView} sliderView
|
||||
*/
|
||||
addHandlersToCoreLinks: function ( sliderView ) {
|
||||
$( '#differences-nextlink' ).click( function() {
|
||||
$( '#differences-nextlink' ).click( function () {
|
||||
sliderView.showNextDiff();
|
||||
return false;
|
||||
} );
|
||||
$( '#differences-prevlink' ).click( function() {
|
||||
$( '#differences-prevlink' ).click( function () {
|
||||
sliderView.showPrevDiff();
|
||||
return false;
|
||||
} );
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
*
|
||||
* @return {jQuery} the help button object
|
||||
*/
|
||||
render: function() {
|
||||
render: function () {
|
||||
var helpButton, helpPopup;
|
||||
|
||||
helpButton = new OO.ui.ButtonWidget( {
|
||||
|
@ -25,13 +25,13 @@
|
|||
classes: [ 'mw-revslider-tooltip', 'mw-revslider-help-tooltip' ]
|
||||
} );
|
||||
helpButton.$element
|
||||
.click( function() {
|
||||
.click( function () {
|
||||
mw.libs.revisionSlider.HelpDialog.show();
|
||||
} )
|
||||
.mouseover( function() {
|
||||
.mouseover( function () {
|
||||
helpPopup.toggle( true );
|
||||
} )
|
||||
.mouseout( function() {
|
||||
.mouseout( function () {
|
||||
helpPopup.toggle( false );
|
||||
} );
|
||||
|
||||
|
|
|
@ -117,7 +117,7 @@
|
|||
}
|
||||
},
|
||||
|
||||
calcRelativeChangeSize: function( diffSize, maxChangeSizeLogged ) {
|
||||
calcRelativeChangeSize: function ( diffSize, maxChangeSizeLogged ) {
|
||||
if ( diffSize === 0 ) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -376,7 +376,7 @@
|
|||
/**
|
||||
* @return {jQuery}
|
||||
*/
|
||||
getElement: function() {
|
||||
getElement: function () {
|
||||
return this.$html;
|
||||
}
|
||||
} );
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
*
|
||||
* @return {OO.ui.ButtonWidget}
|
||||
*/
|
||||
renderBackwardArrow: function() {
|
||||
renderBackwardArrow: function () {
|
||||
var backwardArrowButton,
|
||||
backwardArrowPopup;
|
||||
|
||||
|
@ -62,7 +62,7 @@
|
|||
*
|
||||
* @return {OO.ui.ButtonWidget}
|
||||
*/
|
||||
renderForwardArrow: function() {
|
||||
renderForwardArrow: function () {
|
||||
var forwardArrowButton,
|
||||
forwardArrowPopup;
|
||||
|
||||
|
|
|
@ -141,7 +141,7 @@
|
|||
* @param {jQuery} $revisions
|
||||
* @return {jQuery} the revisions container
|
||||
*/
|
||||
renderRevisionsContainer: function( containerWidth, $revisions ) {
|
||||
renderRevisionsContainer: function ( containerWidth, $revisions ) {
|
||||
return $( '<div>' )
|
||||
.addClass( 'mw-revslider-revisions-container' )
|
||||
.css( {
|
||||
|
@ -156,7 +156,7 @@
|
|||
* @param {number} containerWidth
|
||||
* @return {jQuery} the pointer container
|
||||
*/
|
||||
renderPointerContainer: function( containerWidth ) {
|
||||
renderPointerContainer: function ( containerWidth ) {
|
||||
var pointerContainerSideOffset = 53,
|
||||
pointerContainerWidth = containerWidth + this.revisionWidth - 1,
|
||||
pointerContainerStyle;
|
||||
|
@ -182,13 +182,13 @@
|
|||
*
|
||||
* @param {jQuery} $revisions
|
||||
*/
|
||||
initPointers: function( $revisions ) {
|
||||
initPointers: function ( $revisions ) {
|
||||
var $pointers,
|
||||
escapePressed = false;
|
||||
|
||||
$pointers = this.$element.find( '.mw-revslider-pointer' );
|
||||
|
||||
$( 'body' ).keydown( function( e ) {
|
||||
$( 'body' ).keydown( function ( e ) {
|
||||
if ( e.which === 27 ) {
|
||||
escapePressed = true;
|
||||
$pointers.trigger( 'mouseup' );
|
||||
|
@ -206,7 +206,7 @@
|
|||
* @param {string} containmentClass
|
||||
* @return {Object}
|
||||
*/
|
||||
buildDraggableOptions: function( escapePressed, $revisions, containmentClass ) {
|
||||
buildDraggableOptions: function ( escapePressed, $revisions, containmentClass ) {
|
||||
var lastValidLeftPos,
|
||||
self = this;
|
||||
|
||||
|
@ -214,13 +214,13 @@
|
|||
axis: 'x',
|
||||
grid: [ this.revisionWidth, null ],
|
||||
containment: containmentClass,
|
||||
start: function() {
|
||||
start: function () {
|
||||
self.isDragged = true;
|
||||
self.setPointerDragCursor();
|
||||
self.fadeOutPointerLines();
|
||||
escapePressed = false;
|
||||
},
|
||||
stop: function() {
|
||||
stop: function () {
|
||||
var $p = $( this ),
|
||||
relativeIndex = self.getRelativePointerIndex( $p ),
|
||||
pointer = self.whichPointer( $p ),
|
||||
|
@ -253,7 +253,7 @@
|
|||
|
||||
self.redrawPointerLines();
|
||||
},
|
||||
drag: function( event, ui ) {
|
||||
drag: function ( event, ui ) {
|
||||
lastValidLeftPos = self.draggableDragAction(
|
||||
event,
|
||||
ui,
|
||||
|
@ -261,13 +261,13 @@
|
|||
lastValidLeftPos
|
||||
);
|
||||
},
|
||||
revert: function() {
|
||||
revert: function () {
|
||||
return escapePressed;
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
draggableDragAction: function( event, ui, pointer, lastValidLeftPos ) {
|
||||
draggableDragAction: function ( event, ui, pointer, lastValidLeftPos ) {
|
||||
var olderLeftPos, newerLeftPos,
|
||||
isNew = $( pointer ).hasClass( 'mw-revslider-pointer-newer' );
|
||||
|
||||
|
@ -293,12 +293,12 @@
|
|||
return lastValidLeftPos;
|
||||
},
|
||||
|
||||
setPointerDragCursor: function() {
|
||||
setPointerDragCursor: function () {
|
||||
$( '.mw-revslider-revision-wrapper' )
|
||||
.addClass( 'mw-revslider-pointer-cursor' );
|
||||
},
|
||||
|
||||
removePointerDragCursor: function() {
|
||||
removePointerDragCursor: function () {
|
||||
$( '.mw-revslider-revision-wrapper' )
|
||||
.removeClass( 'mw-revslider-pointer-cursor' );
|
||||
},
|
||||
|
@ -309,7 +309,7 @@
|
|||
* @param {jQuery} $pointer
|
||||
* @return {number}
|
||||
*/
|
||||
getRelativePointerIndex: function( $pointer ) {
|
||||
getRelativePointerIndex: function ( $pointer ) {
|
||||
var pos = $pointer.position().left,
|
||||
pointer = this.whichPointer( $pointer );
|
||||
|
||||
|
@ -319,7 +319,7 @@
|
|||
return Math.ceil( ( pos + this.revisionWidth / 2 ) / this.revisionWidth );
|
||||
},
|
||||
|
||||
getNewestVisibleRevisonLeftPos: function() {
|
||||
getNewestVisibleRevisonLeftPos: function () {
|
||||
return $( '.mw-revslider-revisions-container' ).width() - this.revisionWidth;
|
||||
},
|
||||
|
||||
|
@ -394,7 +394,7 @@
|
|||
this.resetAndRefreshRevisions();
|
||||
},
|
||||
|
||||
resetAndRefreshRevisions: function() {
|
||||
resetAndRefreshRevisions: function () {
|
||||
this.slide( 0 );
|
||||
this.resetPointerStylesBasedOnPosition();
|
||||
this.resetRevisionStylesBasedOnPointerPosition(
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
* @param {number} containerWidth
|
||||
* @return {jQuery} the pointer container
|
||||
*/
|
||||
renderPointerContainer: function( containerWidth ) {
|
||||
renderPointerContainer: function ( containerWidth ) {
|
||||
var pointerContainerPosition = 53,
|
||||
pointerContainerWidth = containerWidth + this.revisionWidth - 1,
|
||||
pointerContainerStyle, lastMouseMoveRevisionPos,
|
||||
|
@ -39,7 +39,7 @@
|
|||
.addClass( 'mw-revslider-pointer-container' )
|
||||
.css( pointerContainerStyle )
|
||||
.append( this.renderPointerContainers() )
|
||||
.mousemove( function( event ) {
|
||||
.mousemove( function ( event ) {
|
||||
if ( !self.isDragged ) {
|
||||
lastMouseMoveRevisionPos = self.showTooltipsOnMouseMoveHandler(
|
||||
event,
|
||||
|
@ -49,13 +49,13 @@
|
|||
} );
|
||||
},
|
||||
|
||||
renderPointerContainers: function() {
|
||||
renderPointerContainers: function () {
|
||||
var self = this;
|
||||
|
||||
return [
|
||||
$( '<div>' )
|
||||
.addClass( 'mw-revslider-pointer-container-newer' )
|
||||
.click( function( event ) {
|
||||
.click( function ( event ) {
|
||||
self.sliderLineClickHandler( event, $( this ) );
|
||||
} )
|
||||
.append(
|
||||
|
@ -64,7 +64,7 @@
|
|||
),
|
||||
$( '<div>' )
|
||||
.addClass( 'mw-revslider-pointer-container-older' )
|
||||
.click( function( event ) {
|
||||
.click( function ( event ) {
|
||||
self.sliderLineClickHandler( event, $( this ) );
|
||||
} )
|
||||
.append(
|
||||
|
@ -79,7 +79,7 @@
|
|||
*
|
||||
* @param {jQuery} $revisions
|
||||
*/
|
||||
initPointers: function( $revisions ) {
|
||||
initPointers: function ( $revisions ) {
|
||||
var $pointers,
|
||||
$pointerOlder = this.pointerOlder.getView().getElement(),
|
||||
$pointerNewer = this.pointerNewer.getView().getElement(),
|
||||
|
@ -87,7 +87,7 @@
|
|||
|
||||
$pointers = this.$element.find( '.mw-revslider-pointer' );
|
||||
|
||||
$( 'body' ).keydown( function( e ) {
|
||||
$( 'body' ).keydown( function ( e ) {
|
||||
if ( e.which === 27 ) {
|
||||
escapePressed = true;
|
||||
$pointers.trigger( 'mouseup' );
|
||||
|
@ -106,7 +106,7 @@
|
|||
SliderViewTwo.super.prototype.resetPointerStylesBasedOnPosition.call( this );
|
||||
},
|
||||
|
||||
draggableDragAction: function( event, ui, pointer, lastValidLeftPos ) {
|
||||
draggableDragAction: function ( event, ui, pointer, lastValidLeftPos ) {
|
||||
var pos, $revisions, $hoveredRevisionWrapper;
|
||||
|
||||
pos = this.getRevisionPositionFromLeftOffset(
|
||||
|
@ -124,7 +124,7 @@
|
|||
return pos;
|
||||
},
|
||||
|
||||
setPointerDragCursor: function() {
|
||||
setPointerDragCursor: function () {
|
||||
$( '.mw-revslider-pointer, ' +
|
||||
'.mw-revslider-pointer-container, ' +
|
||||
'.mw-revslider-pointer-container-newer, ' +
|
||||
|
@ -134,7 +134,7 @@
|
|||
.addClass( 'mw-revslider-pointer-grabbing' );
|
||||
},
|
||||
|
||||
removePointerDragCursor: function() {
|
||||
removePointerDragCursor: function () {
|
||||
$( '.mw-revslider-pointer, ' +
|
||||
'.mw-revslider-pointer-container, ' +
|
||||
'.mw-revslider-pointer-container-newer, ' +
|
||||
|
@ -144,7 +144,7 @@
|
|||
.removeClass( 'mw-revslider-pointer-grabbing' );
|
||||
},
|
||||
|
||||
showTooltipsOnMouseMoveHandler: function( event, lastValidPosition ) {
|
||||
showTooltipsOnMouseMoveHandler: function ( event, lastValidPosition ) {
|
||||
var pos = this.getRevisionPositionFromLeftOffset( event.pageX ),
|
||||
$hoveredRevisionWrapper;
|
||||
|
||||
|
@ -158,7 +158,7 @@
|
|||
return pos;
|
||||
},
|
||||
|
||||
sliderLineClickHandler: function( event, $line ) {
|
||||
sliderLineClickHandler: function ( event, $line ) {
|
||||
var pos = this.getRevisionPositionFromLeftOffset( event.pageX ),
|
||||
$clickedRev, pointerMoved, pointerOther, $revisions;
|
||||
|
||||
|
@ -187,7 +187,7 @@
|
|||
this.alignPointers();
|
||||
},
|
||||
|
||||
getRevisionPositionFromLeftOffset: function( leftOffset ) {
|
||||
getRevisionPositionFromLeftOffset: function ( leftOffset ) {
|
||||
var $revisions = this.getRevisionsElement(),
|
||||
revisionsX = $revisions.offset().left,
|
||||
pos = Math.ceil( Math.abs( leftOffset - revisionsX ) / this.revisionWidth );
|
||||
|
@ -204,15 +204,15 @@
|
|||
return pos;
|
||||
},
|
||||
|
||||
resetPointerStylesBasedOnPosition: function() {
|
||||
resetPointerStylesBasedOnPosition: function () {
|
||||
this.updateOlderSliderLineCSS();
|
||||
this.updateNewerSliderLineCSS();
|
||||
},
|
||||
|
||||
resetPointerColorsBasedOnValues: function() {
|
||||
resetPointerColorsBasedOnValues: function () {
|
||||
},
|
||||
|
||||
updateOlderSliderLineCSS: function() {
|
||||
updateOlderSliderLineCSS: function () {
|
||||
var widthToSet = ( this.getOlderDistanceToOldest() + this.getDistanceBetweenPointers() ) *
|
||||
this.revisionWidth,
|
||||
marginToSet = -this.revisionWidth / 2;
|
||||
|
@ -224,7 +224,7 @@
|
|||
);
|
||||
},
|
||||
|
||||
updateNewerSliderLineCSS: function() {
|
||||
updateNewerSliderLineCSS: function () {
|
||||
var widthToSet = ( this.getNewerDistanceToNewest() + this.getDistanceBetweenPointers() + 2 ) *
|
||||
this.revisionWidth,
|
||||
marginToSet = ( this.getOlderDistanceToOldest() * this.revisionWidth ) -
|
||||
|
@ -238,7 +238,7 @@
|
|||
);
|
||||
},
|
||||
|
||||
setSliderLineCSS: function( $lineContainer, widthToSet, marginToSet ) {
|
||||
setSliderLineCSS: function ( $lineContainer, widthToSet, marginToSet ) {
|
||||
if ( this.dir === 'ltr' ) {
|
||||
$lineContainer.css( {
|
||||
width: widthToSet,
|
||||
|
@ -252,23 +252,23 @@
|
|||
}
|
||||
},
|
||||
|
||||
getOlderDistanceToOldest: function() {
|
||||
getOlderDistanceToOldest: function () {
|
||||
return this.pointerOlder.getPosition() - this.slider.getOldestVisibleRevisionIndex();
|
||||
},
|
||||
|
||||
getNewerDistanceToNewest: function() {
|
||||
getNewerDistanceToNewest: function () {
|
||||
return this.slider.getNewestVisibleRevisionIndex() - this.pointerNewer.getPosition();
|
||||
},
|
||||
|
||||
getDistanceBetweenPointers: function() {
|
||||
getDistanceBetweenPointers: function () {
|
||||
return this.pointerNewer.getPosition() - this.pointerOlder.getPosition();
|
||||
},
|
||||
|
||||
getRevisionsElement: function() {
|
||||
getRevisionsElement: function () {
|
||||
return this.slider.getRevisions().getView().getElement();
|
||||
},
|
||||
|
||||
revisionWrapperClickHandler: function() {
|
||||
revisionWrapperClickHandler: function () {
|
||||
}
|
||||
} );
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
expanded = autoExpand,
|
||||
autoExpandButton,
|
||||
toggleButton = OO.ui.ButtonWidget.static.infuse( $( '.mw-revslider-toggle-button' ) ),
|
||||
initialize = function() {
|
||||
initialize = function () {
|
||||
var startTime = mw.now(),
|
||||
api = new mw.libs.revisionSlider.Api( mw.util.wikiScript( 'api' ) );
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"eslint": "3.12.2",
|
||||
"eslint-config-wikimedia": "0.3.0",
|
||||
"eslint-config-wikimedia": "0.4.0",
|
||||
"grunt": "1.0.1",
|
||||
"grunt-banana-checker": "0.5.0",
|
||||
"grunt-eslint": "19.0.0",
|
||||
|
|
Loading…
Reference in a new issue