Ticket #24425: 24425.draft.33.diff
File 24425.draft.33.diff, 3.0 KB (added by , 12 years ago) |
---|
-
wp-admin/js/revisions.js
394 394 template: wp.template( 'revisions-tooltip' ), 395 395 396 396 initialize: function() { 397 this.listenTo( this.model, 'change:s liderHovering', this.sliderHoveringChanged );397 this.listenTo( this.model, 'change:showTooltip', this.sliderHoveringChanged ); 398 398 this.listenTo( this.model, 'change:tooltipPosition', this.tooltipPositionChanged ); 399 399 }, 400 400 401 401 ready: function() { 402 402 }, 403 403 404 // Show or hide tooltip based on s liderHoveringis true404 // Show or hide tooltip based on showTooltip is true 405 405 sliderHoveringChanged: function() { 406 if ( this.model.get( 's liderHovering' ) ) {406 if ( this.model.get( 'showTooltip' ) ) { 407 407 this.$el.show(); 408 408 } else { 409 409 this.$el.hide(); … … 521 521 // Find the initially selected revision 522 522 var initiallySelectedRevisionIndex = 523 523 this.model.revisions.indexOf( 524 this.model.revisions.findWhere( 524 this.model.revisions.findWhere( { id: Number( revisions.settings.selectedRevision ) } ) ); 525 525 526 526 this.settings = new revisions.model.Slider({ 527 527 max: latestRevisionIndex, … … 533 533 }, 534 534 535 535 ready: function() { 536 // Refresh the currently selected revision position in case router has set it. 537 this.settings.attributes.value = this.model.revisions.indexOf( 538 this.model.revisions.findWhere( { id: Number( revisions.settings.selectedRevision ) } ) ); 539 this.slide( '', this.settings.attributes ); 540 536 541 this.$el.slider( this.settings.toJSON() ); 537 542 538 543 // Listen for changes in Compare Two Mode setting 539 544 this.listenTo( this.model, 'change:compareTwoMode', this.updateSliderSettings ); 540 545 541 this.settings.on( 'change', function( model, options) {546 this.settings.on( 'change', function() { 542 547 this.updateSliderSettings(); 543 548 }, this ); 544 549 545 550 // Listen for changes in the diffId 546 551 this.listenTo( this.model, 'change:diffId', this.diffIdChanged ); 547 552 548 // Reset to the initially selected revision549 this.slide( '', this.settings.attributes );550 551 553 }, 552 554 553 555 mousemove: function( e ) { … … 574 576 }, 575 577 576 578 mouseenter: function( e ) { 577 this.model.set( 's liderHovering', true );579 this.model.set( 'showTooltip', true ); 578 580 }, 579 581 580 582 mouseleave: function( e ) { 581 this.model.set( 's liderHovering', false );583 this.model.set( 'showTooltip', false ); 582 584 }, 583 585 584 586 updateSliderSettings: function() { … … 740 742 }, 250 ), 741 743 742 744 gotoRevisionId: function( from, to, handles ) { 743 if ( '2' === handles ) { 744 this.model.set( { compareTwoMode: true } ); 745 } else { 746 this.model.set( { compareTwoMode: false } ); 747 } 745 this.model.set( { compareTwoMode: '2' === handles } ); 748 746 749 747 if ( 'undefined' !== typeof this.model ) { 750 748 var selectedToRevision = … … 756 754 to: selectedToRevision, 757 755 from: selectedFromRevision } ); 758 756 } 757 revisions.settings.selectedRevision = to; 759 758 } 760 759 }); 761 760