( function ( mw, $ ) { var RevisionListView = function ( revisionList ) { this.revisionList = revisionList; }; $.extend( RevisionListView.prototype, { /** * @type {RevisionList} */ revisionList: null, render: function ( revisionTickWidth ) { var $html = $( '
' ), revs = this.revisionList.getRevisions(), maxChangeSizeLogged = Math.log( this.revisionList.getBiggestChangeSize() ), i, diffSize, $tooltip, relativeChangeSize; for ( i = 0; i < revs.length; i++ ) { diffSize = revs[ i ].getRelativeSize(); relativeChangeSize = diffSize !== 0 ? Math.ceil( 65.0 * Math.log( Math.abs( diffSize ) ) / maxChangeSizeLogged ) + 5 : 0; $tooltip = this.makeTooltip( revs[ i ] ); $html .append( $( '' ) .css( { left: revisionTickWidth * i + 'px', height: relativeChangeSize + 'px', width: revisionTickWidth + 'px', top: diffSize > 0 ? '-' + relativeChangeSize + 'px' : 0, background: 'black' } ) .tipsy( { gravity: 's', html: true, fade: true } ) ) .append( $( '' ) .css( { left: revisionTickWidth * i + 'px', width: revisionTickWidth + 'px' } ) ); } return $html; }, makeTooltip: function ( rev ) { var $tooltip = $( '' + rev.getFormattedDate() + '
' ) .append( $( '' ).text( mw.html.escape( rev.getUser() ) ) ) .append( rev.getComment() ? $( '' ).append( '' ).text( mw.html.escape( rev.getComment() ) ) : '' ) .append( $( '' ).html( rev.getSize() + ' bytes' ) ) .append( rev.isMinor() ? $( '' ).html( mw.message( 'minoredit' ).text() ) : '' ); return $( '' ).append( $tooltip ).html(); } } ); mw.libs.revisionSlider = mw.libs.revisionSlider || {}; mw.libs.revisionSlider.RevisionListView = RevisionListView; }( mediaWiki, jQuery ) );