From 9694d47bcfa2352fedd6d526cb7fda0c16094853 Mon Sep 17 00:00:00 2001 From: Mark Jaquith Date: Fri, 12 Jul 2013 17:25:27 +0000 Subject: [PATCH] Revisions: Have the tooltip follow the "from" scrubber handle when that is the one being moved, in compare-two mode. See #24425. git-svn-id: http://core.svn.wordpress.org/trunk@24678 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/js/revisions.js | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/wp-admin/js/revisions.js b/wp-admin/js/revisions.js index 951a86a87b..371d0158eb 100644 --- a/wp-admin/js/revisions.js +++ b/wp-admin/js/revisions.js @@ -827,7 +827,7 @@ window.wp = window.wp || {}; // Responds to slide events slide: function( event, ui ) { - var attributes; + var attributes, movedRevision; // Compare two revisions mode if ( ! _.isUndefined( ui.values ) && this.model.get('compareTwoMode') ) { // Prevent sliders from occupying same spot @@ -838,28 +838,26 @@ window.wp = window.wp || {}; to: this.model.revisions.at( isRtl ? this.model.revisions.length - ui.values[0] - 1 : ui.values[1] ), // Reverse directions for RTL. from: this.model.revisions.at( isRtl ? this.model.revisions.length - ui.values[1] - 1 : ui.values[0] ) // Reverse directions for RTL. }; - + movedRevision = ! isRtl && ui.value === ui.values[0] ? attributes.from : attributes.to; } else { // Compare single revision mode var sliderPosition = this.getSliderPosition( ui ); attributes = { to: this.model.revisions.at( sliderPosition ) }; - + movedRevision = attributes.to; // If we're at the first revision, unset 'from'. if ( sliderPosition ) // Reverse directions for RTL. attributes.from = this.model.revisions.at( sliderPosition - 1 ); else attributes.from = undefined; } - this.model.set( attributes ); // If we are scrubbing, a scrub to a revision is considered a hover - if ( this.model.get( 'scrubbing' ) ) { - this.model.set({ - 'hoveredRevision': attributes.to - }); - } + if ( this.model.get('scrubbing') ) + attributes.hoveredRevision = movedRevision; + + this.model.set( attributes ); }, stop: function( event, ui ) {