<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[24603] trunk/wp-admin/js/revisions.js: Revisions: A healthy dose of pinking shears.</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://core.trac.wordpress.org/changeset/24603">24603</a></dd>
<dt>Author</dt> <dd>koopersmith</dd>
<dt>Date</dt> <dd>2013-07-09 07:33:15 +0000 (Tue, 09 Jul 2013)</dd>
</dl>

<h3>Log Message</h3>
<pre>Revisions: A healthy dose of pinking shears. See <a href="http://core.trac.wordpress.org/ticket/24425">#24425</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminjsrevisionsjs">trunk/wp-admin/js/revisions.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminjsrevisionsjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/js/revisions.js (24602 => 24603)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/js/revisions.js   2013-07-09 07:14:23 UTC (rev 24602)
+++ trunk/wp-admin/js/revisions.js      2013-07-09 07:33:15 UTC (rev 24603)
</span><span class="lines">@@ -47,7 +47,7 @@
</span><span class="cx">  });
</span><span class="cx"> 
</span><span class="cx">  revisions.model.Diff = Backbone.Model.extend({
</span><del>-               initialize: function(attributes, options) {
</del><ins>+                initialize: function( attributes, options ) {
</ins><span class="cx">                   var fields = this.get('fields');
</span><span class="cx">                  this.unset('fields');
</span><span class="cx"> 
</span><span class="lines">@@ -56,7 +56,7 @@
</span><span class="cx">  });
</span><span class="cx"> 
</span><span class="cx">  revisions.model.Diffs = Backbone.Collection.extend({
</span><del>-               initialize: function(models, options) {
</del><ins>+                initialize: function( models, options ) {
</ins><span class="cx">                   this.revisions = options.revisions;
</span><span class="cx">                  this.requests  = {};
</span><span class="cx">          },
</span><span class="lines">@@ -130,7 +130,7 @@
</span><span class="cx"> 
</span><span class="cx">          getProximalDiffIds: function() {
</span><span class="cx">                  var previous = 0, ids = [];
</span><del>-                       this.revisions.each( _.bind( function(revision) {
</del><ins>+                        this.revisions.each( _.bind( function( revision ) {
</ins><span class="cx">                           ids.push( previous + ':' + revision.id );
</span><span class="cx">                          previous = revision.id;
</span><span class="cx">                  }, this ) );
</span><span class="lines">@@ -160,9 +160,9 @@
</span><span class="cx"> 
</span><span class="cx">          sync: function( method, model, options ) {
</span><span class="cx">                  if ( 'read' === method ) {
</span><del>-                               options         = options || {};
</del><ins>+                                options = options || {};
</ins><span class="cx">                           options.context = this;
</span><del>-                               options.data    = _.extend( options.data || {}, {
</del><ins>+                                options.data = _.extend( options.data || {}, {
</ins><span class="cx">                                   action: 'get-revision-diffs',
</span><span class="cx">                                  post_id: revisions.settings.postId
</span><span class="cx">                          });
</span><span class="lines">@@ -232,7 +232,6 @@
</span><span class="cx">                  });
</span><span class="cx"> 
</span><span class="cx">                  this.listenTo( this.model, 'change:diffId', this.updateDiff );
</span><del>-
</del><span class="cx">                   this.listenTo( this.model, 'change:compareTwoMode', this.updateCompareTwoMode );
</span><span class="cx"> 
</span><span class="cx">                  this.views.set( '.revisions-control-frame', new revisions.view.Controls({
</span><span class="lines">@@ -269,10 +268,12 @@
</span><span class="cx">                  this.model.diffs.ensure( this.model.get('diffId'), this ).done( function( diff ) {
</span><span class="cx">                          if ( this.model.get('diffId') !== diff.id )
</span><span class="cx">                                  return;
</span><ins>+
</ins><span class="cx">                           this.views.set( '.revisions-diff-frame', new revisions.view.Diff({
</span><span class="cx">                                  model: diff
</span><del>-                               }));
-                               this.model.trigger( 'renderDiff' );
</del><ins>+                                }) );
+
+                               this.model.trigger('renderDiff');
</ins><span class="cx">                   });
</span><span class="cx">          },
</span><span class="cx"> 
</span><span class="lines">@@ -290,12 +291,12 @@
</span><span class="cx">                  // Add the button view
</span><span class="cx">                  this.views.add( new revisions.view.Buttons({
</span><span class="cx">                          model: this.model
</span><del>-                       }));
</del><ins>+                        }) );
</ins><span class="cx"> 
</span><span class="cx">                  // Add the checkbox view
</span><span class="cx">                  this.views.add( new revisions.view.Checkbox({
</span><span class="cx">                          model: this.model
</span><del>-                       }));
</del><ins>+                        }) );
</ins><span class="cx"> 
</span><span class="cx">                  // Add the tooltip view
</span><span class="cx">                  var tooltip = new revisions.view.Tooltip({
</span><span class="lines">@@ -306,7 +307,7 @@
</span><span class="cx">                  // Add the Tickmarks view
</span><span class="cx">                  this.views.add( new revisions.view.Tickmarks({
</span><span class="cx">                          model: this.model
</span><del>-                       }));
</del><ins>+                        }) );
</ins><span class="cx"> 
</span><span class="cx">                  // Add the Slider view with a reference to the tooltip view
</span><span class="cx">                  this.views.add( new revisions.view.Slider({
</span><span class="lines">@@ -330,16 +331,16 @@
</span><span class="cx"> 
</span><span class="cx">          numberOfTickmarksSet: function() {
</span><span class="cx">                  var tickCount = this.model.revisions.length - 1, // One tickmark per model
</span><del>-                               sliderWidth = $( '.wp-slider' ).parent().width() * 0.7, // Width of slider is 70% of container (reset on resize)
</del><ins>+                                sliderWidth = $('.wp-slider').parent().width() * 0.7, // Width of slider is 70% of container (reset on resize)
</ins><span class="cx">                           tickWidth = Math.floor( sliderWidth / tickCount ), // Divide width by # of tickmarks, round down
</span><span class="cx">                          newSiderWidth = ( ( tickWidth + 1 ) * tickCount ) + 1, // Calculate the actual width
</span><span class="cx">                          tickNumber;
</span><span class="cx"> 
</span><del>-                       $( '.wp-slider' ).css( 'width', newSiderWidth ); // Reset the slider width to match the calculated tick size
</del><ins>+                        $('.wp-slider').css( 'width', newSiderWidth ); // Reset the slider width to match the calculated tick size
</ins><span class="cx">                   this.$el.css( 'width', newSiderWidth ); // Match the tickmark div width
</span><span class="cx"> 
</span><span class="cx">                  for ( tickNumber = 0; tickNumber <= tickCount; tickNumber++ ){
</span><del>-                               this.$el.append( '<div style="left:' + ( tickWidth * tickNumber ) + 'px;"></div>' );
</del><ins>+                                this.$el.append('<div style="left:' + ( tickWidth * tickNumber ) + 'px;"></div>');
</ins><span class="cx">                   }
</span><span class="cx">          },
</span><span class="cx"> 
</span><span class="lines">@@ -347,9 +348,9 @@
</span><span class="cx">                  var self = this;
</span><span class="cx">                  self.numberOfTickmarksSet();
</span><span class="cx">                  $( window ).on( 'resize', _.debounce( function() {
</span><del>-                               self.$el.html( '' );
</del><ins>+                                self.$el.html('');
</ins><span class="cx">                           self.numberOfTickmarksSet();
</span><del>-                               }, 50 ) );
</del><ins>+                        }, 50 ) );
</ins><span class="cx">           }
</span><span class="cx">  });
</span><span class="cx"> 
</span><span class="lines">@@ -375,7 +376,7 @@
</span><span class="cx">          updateMeta: function() {
</span><span class="cx">                  this.$el.html( this.template( this.model.toJSON() ) );
</span><span class="cx"> 
</span><del>-                       $( '#restore-revision' ).prop( 'disabled', this.model.get( 'to' ).attributes.current );
</del><ins>+                        $('#restore-revision').prop( 'disabled', this.model.get('to').attributes.current );
</ins><span class="cx">           }
</span><span class="cx">  });
</span><span class="cx"> 
</span><span class="lines">@@ -383,7 +384,7 @@
</span><span class="cx">  // Encapsulates all of the configuration for the compare checkbox.
</span><span class="cx">  revisions.view.Checkbox = wp.Backbone.View.extend({
</span><span class="cx">          className: 'revisions-checkbox',
</span><del>-               template: wp.template( 'revisions-checkbox' ),
</del><ins>+                template: wp.template('revisions-checkbox'),
</ins><span class="cx"> 
</span><span class="cx">          events: {
</span><span class="cx">                  'click .compare-two-revisions': 'compareTwoToggle'
</span><span class="lines">@@ -394,14 +395,14 @@
</span><span class="cx">          },
</span><span class="cx"> 
</span><span class="cx">          updateCompareTwoMode: function() {
</span><del>-                       if ( this.model.get( 'compareTwoMode' ) ) {
-                               $( '.compare-two-revisions' ).prop( 'checked', true );
</del><ins>+                        if ( this.model.get('compareTwoMode') ) {
+                               $('.compare-two-revisions').prop( 'checked', true );
</ins><span class="cx">                           // in RTL mode the 'left handle' is the second in the slider, 'right' is first
</span><del>-                               $( '.wp-slider a.ui-slider-handle' ).first().addClass( isRtl ? 'right-handle' : 'left-handle' );
-                               $( '.wp-slider a.ui-slider-handle' ).last().addClass( isRtl ? 'left-handle' : 'right-handle' );
</del><ins>+                                $('.wp-slider a.ui-slider-handle').first().addClass( isRtl ? 'right-handle' : 'left-handle' );
+                               $('.wp-slider a.ui-slider-handle').last().addClass( isRtl ? 'left-handle' : 'right-handle' );
</ins><span class="cx">                   } else {
</span><del>-                               $( '.compare-two-revisions' ).prop( 'checked', false );
-                               $( '.wp-slider a.ui-slider-handle' ).removeClass( 'left-handle' ).removeClass( 'right-handle' );
</del><ins>+                                $('.compare-two-revisions').prop( 'checked', false );
+                               $('.wp-slider a.ui-slider-handle').removeClass('left-handle').removeClass('right-handle');
</ins><span class="cx">                   }
</span><span class="cx"> 
</span><span class="cx">          },
</span><span class="lines">@@ -409,16 +410,16 @@
</span><span class="cx">          // Toggle the compare two mode feature when the compare two checkbox is checked.
</span><span class="cx">          compareTwoToggle: function( event ) {
</span><span class="cx">                  // Activate compare two mode?
</span><del>-                       this.model.set( { compareTwoMode: $( '.compare-two-revisions' ).prop( 'checked' ) } );
</del><ins>+                        this.model.set({ compareTwoMode: $('.compare-two-revisions').prop('checked') });
</ins><span class="cx"> 
</span><span class="cx">                  // Update route
</span><del>-                       this.model.revisionsRouter.navigateRoute( this.model.get( 'to').id, this.model.get( 'from' ).id );
</del><ins>+                        this.model.revisionsRouter.navigateRoute( this.model.get('to').id, this.model.get('from').id );
</ins><span class="cx">           },
</span><span class="cx"> 
</span><span class="cx">          ready: function() {
</span><span class="cx">                  // Hide compare two mode toggle when fewer than three revisions.
</span><span class="cx">                  if ( this.model.revisions.length < 3 )
</span><del>-                               $( '.revision-toggle-compare-mode' ).hide();
</del><ins>+                                $('.revision-toggle-compare-mode').hide();
</ins><span class="cx"> 
</span><span class="cx">                  this.listenTo( this.model, 'change:compareTwoMode', this.updateCompareTwoMode );
</span><span class="cx"> 
</span><span class="lines">@@ -432,7 +433,7 @@
</span><span class="cx">  // Encapsulates the tooltip.
</span><span class="cx">  revisions.view.Tooltip = wp.Backbone.View.extend({
</span><span class="cx">          className: 'revisions-tooltip',
</span><del>-               template: wp.template( 'revisions-tooltip' ),
</del><ins>+                template: wp.template('revisions-tooltip'),
</ins><span class="cx"> 
</span><span class="cx">          initialize: function() {
</span><span class="cx">                  this.listenTo( this.model, 'change', this.render );
</span><span class="lines">@@ -440,28 +441,28 @@
</span><span class="cx"> 
</span><span class="cx">          ready: function() {
</span><span class="cx">                  // Hide tooltip on start.
</span><del>-                       this.$el.addClass( 'hidden' );
</del><ins>+                        this.$el.addClass('hidden');
</ins><span class="cx">           },
</span><span class="cx"> 
</span><span class="cx">          show: function() {
</span><del>-                       this.$el.removeClass( 'hidden' );
</del><ins>+                        this.$el.removeClass('hidden');
</ins><span class="cx">           },
</span><span class="cx"> 
</span><span class="cx">          hide: function() {
</span><del>-                       this.$el.addClass( 'hidden' );
</del><ins>+                        this.$el.addClass('hidden');
</ins><span class="cx">           },
</span><span class="cx"> 
</span><span class="cx">          render: function() {
</span><span class="cx">                  // Check if a revision exists.
</span><del>-                       if ( null === this.model.get( 'revision' ) )
</del><ins>+                        if ( null === this.model.get('revision') )
</ins><span class="cx">                           return;
</span><span class="cx"> 
</span><span class="cx">                  // Insert revision data.
</span><del>-                       this.$el.html( this.template( this.model.get( 'revision' ).toJSON() ) );
</del><ins>+                        this.$el.html( this.template( this.model.get('revision').toJSON() ) );
</ins><span class="cx"> 
</span><span class="cx">                  // Set the position.
</span><del>-                       var offset = $( '.revisions-buttons' ).offset().left;
-                       this.$el.css( 'left', this.model.get( 'position' ) - offset );
</del><ins>+                        var offset = $('.revisions-buttons').offset().left;
+                       this.$el.css( 'left', this.model.get('position') - offset );
</ins><span class="cx">           }
</span><span class="cx">  });
</span><span class="cx"> 
</span><span class="lines">@@ -469,7 +470,7 @@
</span><span class="cx">  // Encapsulates all of the configuration for the previous/next buttons.
</span><span class="cx">  revisions.view.Buttons = wp.Backbone.View.extend({
</span><span class="cx">          className: 'revisions-buttons',
</span><del>-               template: wp.template( 'revisions-buttons' ),
</del><ins>+                template: wp.template('revisions-buttons'),
</ins><span class="cx"> 
</span><span class="cx">          events: {
</span><span class="cx">                  'click #next': 'nextRevision',
</span><span class="lines">@@ -503,14 +504,14 @@
</span><span class="cx"> 
</span><span class="cx">          // Go to the 'next' revision, direction takes into account RTL mode.
</span><span class="cx">          nextRevision: function() {
</span><del>-                       var toIndex = isRtl ? this.model.revisions.length - this.model.revisions.indexOf( this.model.get( 'to' ) ) - 1 : this.model.revisions.indexOf( this.model.get( 'to' ) );
</del><ins>+                        var toIndex = isRtl ? this.model.revisions.length - this.model.revisions.indexOf( this.model.get('to') ) - 1 : this.model.revisions.indexOf( this.model.get('to') );
</ins><span class="cx">                   toIndex     = isRtl ? toIndex - 1 : toIndex + 1;
</span><span class="cx">                  this.gotoModel( toIndex );
</span><span class="cx">          },
</span><span class="cx"> 
</span><span class="cx">          // Go to the 'previous' revision, direction takes into account RTL mode.
</span><span class="cx">          previousRevision: function() {
</span><del>-                       var toIndex = isRtl ? this.model.revisions.length - this.model.revisions.indexOf( this.model.get( 'to' ) ) - 1 : this.model.revisions.indexOf( this.model.get( 'to' ) );
</del><ins>+                        var toIndex = isRtl ? this.model.revisions.length - this.model.revisions.indexOf( this.model.get('to') ) - 1 : this.model.revisions.indexOf( this.model.get('to') );
</ins><span class="cx">                   toIndex     = isRtl ? toIndex + 1 : toIndex - 1;
</span><span class="cx">                  this.gotoModel( toIndex );
</span><span class="cx">          },
</span><span class="lines">@@ -519,9 +520,9 @@
</span><span class="cx">          disabledButtonCheck: function() {
</span><span class="cx">                  var maxVal = this.model.revisions.length - 1,
</span><span class="cx">                          minVal = 0,
</span><del>-                               next = $( '.revisions-next .button' ),
-                               previous = $( '.revisions-previous .button' ),
-                               val = this.model.revisions.indexOf( this.model.get( 'to' ) );
</del><ins>+                                next = $('.revisions-next .button'),
+                               previous = $('.revisions-previous .button'),
+                               val = this.model.revisions.indexOf( this.model.get('to') );
</ins><span class="cx"> 
</span><span class="cx">                  // Disable "Next" button if you're on the last node.
</span><span class="cx">                  next.prop( 'disabled', ( maxVal === val ) );
</span><span class="lines">@@ -554,7 +555,7 @@
</span><span class="cx">                  // Find the initially selected revision
</span><span class="cx">                  var initiallySelectedRevisionIndex =
</span><span class="cx">                          this.model.revisions.indexOf(
</span><del>-                                       this.model.revisions.findWhere( { id: Number( revisions.settings.selectedRevision ) } ) );
</del><ins>+                                        this.model.revisions.findWhere({ id: Number( revisions.settings.selectedRevision ) }) );
</ins><span class="cx"> 
</span><span class="cx">                  this.settings = new revisions.model.Slider({
</span><span class="cx">                          max:   latestRevisionIndex,
</span><span class="lines">@@ -568,7 +569,7 @@
</span><span class="cx">          ready: function() {
</span><span class="cx">                  // Refresh the currently selected revision position in case router has set it.
</span><span class="cx">                  this.settings.attributes.value = this.model.revisions.indexOf(
</span><del>-                               this.model.revisions.findWhere( { id: Number( revisions.settings.selectedRevision ) } ) );
</del><ins>+                                this.model.revisions.findWhere({ id: Number( revisions.settings.selectedRevision ) }) );
</ins><span class="cx"> 
</span><span class="cx">                  // And update the slider in case the route has set it.
</span><span class="cx">                  this.updateSliderSettings();
</span><span class="lines">@@ -619,24 +620,24 @@
</span><span class="cx">          },
</span><span class="cx"> 
</span><span class="cx">          updateSliderSettings: function() {
</span><del>-                       if ( this.model.get( 'compareTwoMode' ) ) {
</del><ins>+                        if ( this.model.get('compareTwoMode') ) {
</ins><span class="cx">                           var leftValue, rightValue;
</span><span class="cx"> 
</span><span class="cx">                          // In single handle mode, the 1st stored revision is 'blank' and the 'from' model is not set
</span><span class="cx">                          // In this case we move the to index over one
</span><del>-                               if ( 'undefined' == typeof this.model.get( 'from' ) ) {
</del><ins>+                                if ( 'undefined' == typeof this.model.get('from') ) {
</ins><span class="cx">                                   if ( isRtl ) {
</span><del>-                                               leftValue  = this.model.revisions.length -  this.model.revisions.indexOf( this.model.get( 'to' ) ) - 2;
</del><ins>+                                                leftValue  = this.model.revisions.length -  this.model.revisions.indexOf( this.model.get('to') ) - 2;
</ins><span class="cx">                                           rightValue = leftValue + 1;
</span><span class="cx">                                  } else {
</span><del>-                                               leftValue  = this.model.revisions.indexOf( this.model.get( 'to' ) );
</del><ins>+                                                leftValue  = this.model.revisions.indexOf( this.model.get('to') );
</ins><span class="cx">                                           rightValue = leftValue + 1;
</span><span class="cx">                                  }
</span><span class="cx">                          } else {
</span><del>-                                       leftValue = isRtl ?     this.model.revisions.length - this.model.revisions.indexOf( this.model.get( 'to' ) ) - 1 :
-                                                                                       this.model.revisions.indexOf( this.model.get( 'from' ) ),
-                                       rightValue = isRtl ?    this.model.revisions.length - this.model.revisions.indexOf( this.model.get( 'from' ) ) - 1 :
-                                                                                       this.model.revisions.indexOf( this.model.get( 'to' ) );
</del><ins>+                                        leftValue = isRtl ?     this.model.revisions.length - this.model.revisions.indexOf( this.model.get('to') ) - 1 :
+                                                                                       this.model.revisions.indexOf( this.model.get('from') ),
+                                       rightValue = isRtl ?    this.model.revisions.length - this.model.revisions.indexOf( this.model.get('from') ) - 1 :
+                                                                                       this.model.revisions.indexOf( this.model.get('to') );
</ins><span class="cx">                           }
</span><span class="cx"> 
</span><span class="cx">                          // Set handles to current from / to models.
</span><span class="lines">@@ -652,14 +653,14 @@
</span><span class="cx">                  } else {
</span><span class="cx">                          this.$el.slider( { // Set handle to current to model
</span><span class="cx">                                  // Reverse order for RTL.
</span><del>-                                       value: isRtl ?  this.model.revisions.length - this.model.revisions.indexOf( this.model.get( 'to' ) ) - 1 :
-                                                                       this.model.revisions.indexOf( this.model.get( 'to' ) ),
</del><ins>+                                        value: isRtl ?  this.model.revisions.length - this.model.revisions.indexOf( this.model.get('to') ) - 1 :
+                                                                       this.model.revisions.indexOf( this.model.get('to') ),
</ins><span class="cx">                                   values: null, // Clear existing two handled values
</span><span class="cx">                                  range: false
</span><span class="cx">                          } );
</span><span class="cx">                  }
</span><span class="cx"> 
</span><del>-                       if ( this.model.get( 'compareTwoMode' ) ){
</del><ins>+                        if ( this.model.get('compareTwoMode') ){
</ins><span class="cx">                           // in RTL mode the 'left handle' is the second in the slider, 'right' is first
</span><span class="cx">                          $( 'a.ui-slider-handle', this.$el )
</span><span class="cx">                                  .first()
</span><span class="lines">@@ -674,13 +675,13 @@
</span><span class="cx"> 
</span><span class="cx">          diffIdChanged: function() {
</span><span class="cx">                  // Reset the view settings when diffId is changed
</span><del>-                       if ( this.model.get( 'compareTwoMode' ) ) {
-                               this.settings.set( { 'values': [
-                                               this.model.revisions.indexOf( this.model.get( 'from' ) ),
-                                               this.model.revisions.indexOf( this.model.get( 'to' ) )
-                                       ] } );
</del><ins>+                        if ( this.model.get('compareTwoMode') ) {
+                               this.settings.set({ 'values': [
+                                       this.model.revisions.indexOf( this.model.get('from') ),
+                                       this.model.revisions.indexOf( this.model.get('to') )
+                               ] });
</ins><span class="cx">                   } else {
</span><del>-                               this.settings.set( { 'value': this.model.revisions.indexOf( this.model.get( 'to' ) ) } );
</del><ins>+                                this.settings.set({ 'value': this.model.revisions.indexOf( this.model.get('to') ) });
</ins><span class="cx">                   }
</span><span class="cx">          },
</span><span class="cx"> 
</span><span class="lines">@@ -702,11 +703,11 @@
</span><span class="cx"> 
</span><span class="cx">                          // In two handle mode, ensure handles can't be dragged past each other.
</span><span class="cx">                          // Adjust left/right boundaries and reset points.
</span><del>-                               if ( view.model.get( 'compareTwoMode' ) ) {
-                                       var rightHandle = $( ui.handle ).parent().find( '.right-handle' ),
-                                               leftHandle  = $( ui.handle ).parent().find( '.left-handle' );
</del><ins>+                                if ( view.model.get('compareTwoMode') ) {
+                                       var rightHandle = $( ui.handle ).parent().find('.right-handle'),
+                                               leftHandle  = $( ui.handle ).parent().find('.left-handle');
</ins><span class="cx"> 
</span><del>-                                       if ( $( ui.handle ).hasClass( 'left-handle' ) ) {
</del><ins>+                                        if ( $( ui.handle ).hasClass('left-handle') ) {
</ins><span class="cx">                                           // Dragging the left handle, boundary is right handle.
</span><span class="cx">                                          // RTL mode calculations reverse directions.
</span><span class="cx">                                          if ( isRtl ) {
</span><span class="lines">@@ -743,7 +744,7 @@
</span><span class="cx">          slide: function( event, ui ) {
</span><span class="cx">                  var attributes;
</span><span class="cx">                  // Compare two revisions mode
</span><del>-                       if ( 'undefined' !== typeof ui.values && this.model.get( 'compareTwoMode' ) ) {
</del><ins>+                        if ( 'undefined' !== typeof ui.values && this.model.get('compareTwoMode') ) {
</ins><span class="cx">                           // Prevent sliders from occupying same spot
</span><span class="cx">                          if ( ui.values[1] === ui.values[0] )
</span><span class="cx">                                  return false;
</span><span class="lines">@@ -764,16 +765,16 @@
</span><span class="cx">                          if ( sliderPosition ) // Reverse directions for RTL.
</span><span class="cx">                                  attributes.from = this.model.revisions.at( sliderPosition - 1  );
</span><span class="cx">                          else
</span><del>-                                       this.model.unset('from', { silent: true });
</del><ins>+                                        this.model.unset( 'from', { silent: true });
</ins><span class="cx">                   }
</span><span class="cx">                  this.model.set( attributes );
</span><span class="cx">          },
</span><span class="cx"> 
</span><span class="cx">          stop: function( event, ui ) {
</span><del>-                       $( window ).off( 'mousemove' );
</del><ins>+                        $( window ).off('mousemove');
</ins><span class="cx"> 
</span><span class="cx">                  // Reset settings props handle back to the step position.
</span><del>-                       this.settings.trigger( 'change' );
</del><ins>+                        this.settings.trigger('change');
</ins><span class="cx">           }
</span><span class="cx">  });
</span><span class="cx"> 
</span><span class="lines">@@ -805,7 +806,7 @@
</span><span class="cx"> 
</span><span class="cx">          navigateRoute: function( to, from ) {
</span><span class="cx">                  var navigateTo = '/revision/from/' + from + '/to/' + to + '/handles/';
</span><del>-                       if ( this.model.get( 'compareTwoMode' ) ) {
</del><ins>+                        if ( this.model.get('compareTwoMode') ) {
</ins><span class="cx">                           navigateTo += '2';
</span><span class="cx">                  } else {
</span><span class="cx">                          navigateTo += '1';
</span><span class="lines">@@ -822,14 +823,13 @@
</span><span class="cx">                  this.model.set( { compareTwoMode: ( '2' === handles ) } );
</span><span class="cx"> 
</span><span class="cx">                  if ( 'undefined' !== typeof this.model ) {
</span><del>-                               var selectedToRevision =
-                                       this.model.revisions.findWhere( { 'id': Number( to ) } ),
-                                       selectedFromRevision =
-                                       this.model.revisions.findWhere( { 'id': Number( from ) } );
</del><ins>+                                var selectedToRevision = this.model.revisions.findWhere({ 'id': Number( to ) }),
+                                       selectedFromRevision = this.model.revisions.findWhere({ 'id': Number( from ) });
</ins><span class="cx"> 
</span><del>-                               this.model.set( {
-                                       to:   selectedToRevision,
-                                       from: selectedFromRevision } );
</del><ins>+                                this.model.set({
+                                       to: selectedToRevision,
+                                       from: selectedFromRevision
+                               });
</ins><span class="cx">                   }
</span><span class="cx">                  revisions.settings.selectedRevision = to;
</span><span class="cx">          }
</span></span></pre>
</div>
</div>

</body>
</html>