mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/RevisionSlider
synced 2024-11-15 11:40:43 +00:00
980f2ca917
* threw out most of the things from init.js * turned Slider + View into respective modules * pointers should remember position (except on page load) and correctly slide back to their position/to the side Some things still need testing and refactoring. Addshore: - CS fixes and comment out current failing tests Bug: T134395 Change-Id: I78a7095e1d9902314163b1443448f47ef0484d4e
52 lines
1.5 KiB
JavaScript
Executable file
52 lines
1.5 KiB
JavaScript
Executable file
( function ( mw, $ ) {
|
|
|
|
// Function called when a tick on the slider is clicked
|
|
// Params: v1 - Left revision ID; v2 - Right revision ID
|
|
// function refresh( v1, v2 ) {
|
|
// if( v1 === -1 || v2 === -1 ) return;
|
|
//
|
|
// var $url = gServer + gScript + '?title=' + gPageName + '&diff=' + v2 + '&oldid=' + v1;
|
|
// location.href = $url;
|
|
// }
|
|
|
|
// function getSectionLegend( revs ) {
|
|
// var revData = getComposedRevData( revs ),
|
|
// html = '<div class="revisions-legend">',
|
|
// sectionName;
|
|
// for ( sectionName in revData.sectionMap ) {
|
|
// html += '<span class="rvslider-legend-box" style="color:' + revData.sectionMap[ sectionName ] + ';"> ■</span>' + sectionName;
|
|
// }
|
|
// return html + '</div>';
|
|
// }
|
|
|
|
mw.loader.using( [ 'jquery.ui.draggable', 'jquery.ui.tooltip', 'jquery.tipsy' ], function () {
|
|
$( function () {
|
|
mw.libs.revisionSlider.fetchRevisions( {
|
|
pageName: mw.config.get( 'wgPageName' ),
|
|
startId: mw.config.get( 'wgCurRevisionId' ),
|
|
|
|
success: function ( data ) {
|
|
var revs = data.query.pages[ 0 ].revisions,
|
|
revisionList,
|
|
$container,
|
|
slider;
|
|
if ( !revs ) {
|
|
return;
|
|
}
|
|
revs.reverse();
|
|
|
|
revisionList = new mw.libs.revisionSlider.RevisionList( revs );
|
|
$container = $( '#revision-slider-container' );
|
|
slider = new mw.libs.revisionSlider.Slider( revisionList );
|
|
slider.getView().render( $container );
|
|
|
|
$( '#revision-slider-placeholder' ).remove();
|
|
|
|
// TODO add the legend back!
|
|
}
|
|
} );
|
|
} );
|
|
} );
|
|
|
|
}( mediaWiki, jQuery ) );
|