mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/RevisionSlider
synced 2024-11-15 03:33:45 +00:00
Merge "Update diff view on pointer move."
This commit is contained in:
commit
28407bb283
|
@ -76,6 +76,7 @@
|
|||
],
|
||||
"dependencies": [
|
||||
"ext.RevisionSlider.SectionLegend",
|
||||
"ext.RevisionSlider.DiffPage",
|
||||
"ext.RevisionSlider.Pointer"
|
||||
]
|
||||
},
|
||||
|
@ -87,6 +88,11 @@
|
|||
"ext.RevisionSlider.rainbow"
|
||||
]
|
||||
},
|
||||
"ext.RevisionSlider.DiffPage": {
|
||||
"scripts": [
|
||||
"modules/ext.RevisionSlider.DiffPage.js"
|
||||
]
|
||||
},
|
||||
"ext.RevisionSlider.RevisionList": {
|
||||
"scripts": [
|
||||
"modules/ext.RevisionSlider.RevisionList.js"
|
||||
|
|
25
modules/ext.RevisionSlider.DiffPage.js
Normal file
25
modules/ext.RevisionSlider.DiffPage.js
Normal file
|
@ -0,0 +1,25 @@
|
|||
( function ( mw, $ ) {
|
||||
var DiffPage = function () {
|
||||
};
|
||||
|
||||
$.extend( DiffPage.prototype, {
|
||||
refresh: function ( oldId, newId ) {
|
||||
$.ajax( {
|
||||
url: mw.util.wikiScript( 'index' ),
|
||||
data: {
|
||||
diff: newId,
|
||||
oldid: oldId
|
||||
},
|
||||
success: function ( data ) {
|
||||
data = $( '<div/>' ).html( data ).contents();
|
||||
$( 'body' )
|
||||
.find( 'table.diff[data-mw=\'interface\']' )
|
||||
.html( data.find( 'table.diff[data-mw=\'interface\']' ) );
|
||||
}
|
||||
} );
|
||||
}
|
||||
} );
|
||||
|
||||
mw.libs.revisionSlider = mw.libs.revisionSlider || {};
|
||||
mw.libs.revisionSlider.DiffPage = DiffPage;
|
||||
}( mediaWiki, jQuery ) );
|
|
@ -31,6 +31,7 @@
|
|||
render: function ( $container ) {
|
||||
var containerWidth = this.calculateSliderContainerWidth(),
|
||||
sectionLegend = new mw.libs.revisionSlider.SectionLegend( this.slider.getRevisions() ),
|
||||
diffPage = new mw.libs.revisionSlider.DiffPage( this.slider.getRevisions() ),
|
||||
$revisions = this.slider.getRevisions().getView().render( this.revisionWidth, sectionLegend.getSectionColorMap() ),
|
||||
$slider = $( '<div class="revision-slider"/>' ),
|
||||
self = this;
|
||||
|
@ -76,6 +77,14 @@
|
|||
pointer = self.whichPointer( $p ),
|
||||
pos = parseInt( $p.css( 'left' ), 10 );
|
||||
pointer.setPosition( self.slider.getFirstVisibleRevisionIndex() + Math.floor( pos / self.revisionWidth ) );
|
||||
diffPage.refresh(
|
||||
$revisions
|
||||
.find( 'div.revision[data-pos=\'' + self.leftPointer.getPosition() + '\']' )
|
||||
.attr( 'data-revid' ),
|
||||
$revisions
|
||||
.find( 'div.revision[data-pos=\'' + self.rightPointer.getPosition() + '\']' )
|
||||
.attr( 'data-revid' )
|
||||
);
|
||||
}
|
||||
} );
|
||||
|
||||
|
|
Loading…
Reference in a new issue