Ticket #23899: 23899.diff
File 23899.diff, 2.5 KB (added by , 12 years ago) |
---|
-
wp-admin/js/revisions.js
583 583 var addHtml = this.template; 584 584 this.$el.html( addHtml ); 585 585 586 var modelcount = REVAPP._revisions.length; 586 var modelcount = REVAPP._revisions.length, 587 maxVal = modelcount - 1; 587 588 588 589 slider = $( "#slider" ); 589 590 if ( 1 === REVAPP._compareOneOrTwo ) { … … 591 592 slider.slider({ 592 593 value: REVAPP._rightDiff - 1, 593 594 min: 0, 594 max: m odelcount - 1,595 max: maxVal, 595 596 step: 1, 596 597 598 create: function( event, ui ) { 599 var startVal = $(this).slider('value'); 597 600 601 if ( 0 === startVal ) 602 $('#previous').prop('disabled', true); 603 604 if ( maxVal === startVal ) 605 $('#next').prop('disabled', true); 606 }, 607 598 608 // slide interactions for one handles slider 599 609 slide: function( event, ui ) { 600 610 601 611 REVAPP._rightDiff = ( ui.value + 1 ); 602 612 REVAPP._revisionView.render(); 613 614 self.disabledButtonCheck(ui.value); 615 603 616 /* 604 617 $( 'a.ui-slider-handle' ).tooltip( { 605 618 content: REVAPP._revisions.at( ui.value ).get( 'revision_date_author_short' ), … … 735 748 return this; 736 749 }, 737 750 751 disabledButtonCheck: function(val) { 752 753 var maxVal = this.model.length - 1, 754 next = $('#next'), 755 prev = $('#previous'); 756 757 // Disable "Next" button if you're on the last node 758 if ( maxVal === val ) 759 next.prop('disabled', true); 760 else 761 next.prop('disabled', false); 762 763 // Disable "Previous" button if you're on the 0 node 764 if ( 0 === val ) 765 prev.prop('disabled', true); 766 else 767 prev.prop('disabled', false); 768 }, 769 738 770 // next and previous buttons, only available in compare one mode 739 771 events: { 740 772 'click #next': 'nextRevision', … … 746 778 if ( REVAPP._rightDiff < this.model.length ) // unless at right boundry 747 779 REVAPP._rightDiff = REVAPP._rightDiff + 1 ; 748 780 781 this.disabledButtonCheck(REVAPP._rightDiff - 1); 782 749 783 REVAPP._revisionView.render(); 750 784 751 785 $( '#slider' ).slider( 'value', REVAPP._rightDiff - 1 ).trigger( 'slide' ); … … 756 790 if ( REVAPP._rightDiff > 1 ) // unless at left boundry 757 791 REVAPP._rightDiff = REVAPP._rightDiff - 1 ; 758 792 793 this.disabledButtonCheck(REVAPP._rightDiff - 1); 794 759 795 REVAPP._revisionView.render(); 760 796 761 797 $( '#slider' ).slider( 'value', REVAPP._rightDiff - 1 ).trigger( 'slide' );