2016-05-10 12:42:05 +00:00
|
|
|
( function ( mw, $ ) {
|
|
|
|
var RevisionList = function ( revs ) {
|
2016-05-10 16:45:11 +00:00
|
|
|
this.revisions = [];
|
2016-05-10 12:42:05 +00:00
|
|
|
this.initialize( revs );
|
|
|
|
this.view = new mw.libs.revisionSlider.RevisionListView( this );
|
|
|
|
};
|
|
|
|
|
|
|
|
$.extend( RevisionList.prototype, {
|
|
|
|
/**
|
|
|
|
* @type {Revision[]}
|
|
|
|
*/
|
|
|
|
revisions: [],
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @type {RevisionListView}
|
|
|
|
*/
|
|
|
|
view: null,
|
|
|
|
|
|
|
|
initialize: function ( revs ) {
|
2016-05-12 13:52:54 +00:00
|
|
|
var i, rev;
|
2016-05-10 12:42:05 +00:00
|
|
|
|
|
|
|
for ( i = 0; i < revs.length; i++ ) {
|
2016-05-12 13:52:54 +00:00
|
|
|
rev = new mw.libs.revisionSlider.Revision( revs[ i ] );
|
|
|
|
rev.setRelativeSize( i > 0 ? revs[ i ].size - revs[ i - 1 ].size : revs[ i ].size );
|
|
|
|
|
|
|
|
this.revisions.push( rev );
|
2016-05-10 12:42:05 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
getBiggestChangeSize: function () {
|
|
|
|
var max = 0,
|
2016-05-12 13:52:54 +00:00
|
|
|
i;
|
2016-05-10 12:42:05 +00:00
|
|
|
|
2016-05-12 13:52:54 +00:00
|
|
|
for ( i = 0; i < this.revisions.length; i++ ) {
|
|
|
|
max = Math.max( max, Math.abs( this.revisions[ i ].getRelativeSize() ) );
|
2016-05-10 12:42:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return max;
|
|
|
|
},
|
|
|
|
|
|
|
|
getRevisions: function () {
|
|
|
|
return this.revisions;
|
|
|
|
},
|
|
|
|
|
|
|
|
getLength: function () {
|
|
|
|
return this.revisions.length;
|
|
|
|
},
|
|
|
|
|
|
|
|
getView: function () {
|
|
|
|
return this.view;
|
|
|
|
}
|
|
|
|
} );
|
|
|
|
|
|
|
|
mw.libs.revisionSlider = mw.libs.revisionSlider || {};
|
|
|
|
mw.libs.revisionSlider.RevisionList = RevisionList;
|
|
|
|
}( mediaWiki, jQuery ) );
|