<!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>[25995] trunk/src/wp-content/themes/twentyfourteen/js: Twenty Fourteen: JavaScript fixes after running jshint, see r25960:</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/25995">25995</a></dd>
<dt>Author</dt> <dd>lancewillett</dd>
<dt>Date</dt> <dd>2013-10-30 18:52:54 +0000 (Wed, 30 Oct 2013)</dd>
</dl>

<h3>Log Message</h3>
<pre>Twenty Fourteen: JavaScript fixes after running jshint, see <a href="http://core.trac.wordpress.org/changeset/25960">r25960</a>:

 * Enforce `===` instead of `==`
 * Fix confusing use of `!`
 * Remove unused variables like `calcNext`, defined but never used
 * Proper use of braces
 * Move functions out of if/else statements
 * Document unknown functions as Microsoft-specific</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpcontentthemestwentyfourteenjsfunctionsjs">trunk/src/wp-content/themes/twentyfourteen/js/functions.js</a></li>
<li><a href="#trunksrcwpcontentthemestwentyfourteenjskeyboardimagenavigationjs">trunk/src/wp-content/themes/twentyfourteen/js/keyboard-image-navigation.js</a></li>
<li><a href="#trunksrcwpcontentthemestwentyfourteenjssliderjs">trunk/src/wp-content/themes/twentyfourteen/js/slider.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpcontentthemestwentyfourteenjsfunctionsjs"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-content/themes/twentyfourteen/js/functions.js (25994 => 25995)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-content/themes/twentyfourteen/js/functions.js       2013-10-30 16:03:14 UTC (rev 25994)
+++ trunk/src/wp-content/themes/twentyfourteen/js/functions.js  2013-10-30 18:52:54 UTC (rev 25995)
</span><span class="lines">@@ -5,12 +5,14 @@
</span><span class="cx">  // Enable menu toggle for small screens.
</span><span class="cx">  ( function() {
</span><span class="cx">          var nav = $( '#primary-navigation' ), button, menu;
</span><del>-               if ( ! nav )
</del><ins>+                if ( ! nav ) {
</ins><span class="cx">                   return;
</span><ins>+               }
</ins><span class="cx"> 
</span><span class="cx">          button = nav.find( '.menu-toggle' );
</span><del>-               if ( ! button )
</del><ins>+                if ( ! button ) {
</ins><span class="cx">                   return;
</span><ins>+               }
</ins><span class="cx"> 
</span><span class="cx">          // Hide button if menu is missing or empty.
</span><span class="cx">          menu = nav.find( '.nav-menu' );
</span><span class="lines">@@ -34,11 +36,12 @@
</span><span class="cx">          var element = document.getElementById( location.hash.substring( 1 ) );
</span><span class="cx"> 
</span><span class="cx">          if ( element ) {
</span><del>-                       if ( ! /^(?:a|select|input|button|textarea)$/i.test( element.tagName ) )
</del><ins>+                        if ( ! /^(?:a|select|input|button|textarea)$/i.test( element.tagName ) ) {
</ins><span class="cx">                           element.tabIndex = -1;
</span><ins>+                       }
</ins><span class="cx"> 
</span><span class="cx">                  element.focus();
</span><del>-               };
</del><ins>+                }
</ins><span class="cx">   } );
</span><span class="cx"> 
</span><span class="cx">  $( function() {
</span><span class="lines">@@ -50,8 +53,9 @@
</span><span class="cx">                  that.toggleClass( 'active' );
</span><span class="cx">                  wrapper.toggleClass( 'hide' );
</span><span class="cx"> 
</span><del>-                       if ( that.is( '.active' ) )
</del><ins>+                        if ( that.is( '.active' ) ) {
</ins><span class="cx">                           wrapper.find( '.search-field' ).focus();
</span><ins>+                       }
</ins><span class="cx">           } );
</span><span class="cx"> 
</span><span class="cx">          /*
</span><span class="lines">@@ -65,10 +69,11 @@
</span><span class="cx">                      mastheadOffset = $( '#masthead' ).offset().top - toolbarOffset;
</span><span class="cx"> 
</span><span class="cx">                  _window.on( 'scroll.twentyfourteen', function() {
</span><del>-                               if ( window.scrollY > mastheadOffset )
</del><ins>+                                if ( window.scrollY > mastheadOffset ) {
</ins><span class="cx">                                   body.addClass( 'masthead-fixed' );
</span><del>-                               else
</del><ins>+                                } else {
</ins><span class="cx">                                   body.removeClass( 'masthead-fixed' );
</span><ins>+                               }
</ins><span class="cx">                   } );
</span><span class="cx">          }
</span><span class="cx"> 
</span><span class="lines">@@ -89,7 +94,7 @@
</span><span class="cx">                  isResizable: true,
</span><span class="cx">                  isRTL: $( 'body' ).is( '.rtl' )
</span><span class="cx">          } );
</span><del>-       };
</del><ins>+        }
</ins><span class="cx"> 
</span><span class="cx">  // Initialize Featured Content slider.
</span><span class="cx">  _window.load( function() {
</span></span></pre></div>
<a id="trunksrcwpcontentthemestwentyfourteenjskeyboardimagenavigationjs"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-content/themes/twentyfourteen/js/keyboard-image-navigation.js (25994 => 25995)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-content/themes/twentyfourteen/js/keyboard-image-navigation.js       2013-10-30 16:03:14 UTC (rev 25994)
+++ trunk/src/wp-content/themes/twentyfourteen/js/keyboard-image-navigation.js  2013-10-30 18:52:54 UTC (rev 25995)
</span><span class="lines">@@ -1,10 +1,10 @@
</span><span class="cx"> jQuery( document ).ready( function( $ ) {
</span><span class="cx">  $( document ).keydown( function( e ) {
</span><span class="cx">          var url = false;
</span><del>-               if ( e.which == 37 ) {  // Left arrow key code
</del><ins>+                if ( e.which === 37 ) {  // Left arrow key code
</ins><span class="cx">                   url = $( '.previous-image a' ).attr( 'href' );
</span><span class="cx">          }
</span><del>-               else if ( e.which == 39 ) {  // Right arrow key code
</del><ins>+                else if ( e.which === 39 ) {  // Right arrow key code
</ins><span class="cx">                   url = $( '.entry-attachment a' ).attr( 'href' );
</span><span class="cx">          }
</span><span class="cx">          if ( url && ( !$( 'textarea, input' ).is( ':focus' ) ) ) {
</span></span></pre></div>
<a id="trunksrcwpcontentthemestwentyfourteenjssliderjs"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-content/themes/twentyfourteen/js/slider.js (25994 => 25995)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-content/themes/twentyfourteen/js/slider.js  2013-10-30 16:03:14 UTC (rev 25994)
+++ trunk/src/wp-content/themes/twentyfourteen/js/slider.js     2013-10-30 18:52:54 UTC (rev 25995)
</span><span class="lines">@@ -15,12 +15,11 @@
</span><span class="cx"> 
</span><span class="cx">          var namespace = slider.vars.namespace,
</span><span class="cx">                  msGesture = window.navigator && window.navigator.msPointerEnabled && window.MSGesture,
</span><del>-                       touch = ( ( 'ontouchstart' in window ) || msGesture || window.DocumentTouch && document instanceof DocumentTouch ),
</del><ins>+                        touch = ( ( 'ontouchstart' in window ) || msGesture || window.DocumentTouch && document instanceof DocumentTouch ), // MSFT specific.
</ins><span class="cx">                   eventType = 'click touchend MSPointerUp',
</span><span class="cx">                  watchedEvent = '',
</span><span class="cx">                  watchedEventClearTimer,
</span><del>-                       methods = {},
-                       focused = true;
</del><ins>+                        methods = {};
</ins><span class="cx"> 
</span><span class="cx">          // Store a reference to the slider object.
</span><span class="cx">          $.data( el, 'featuredslider', slider );
</span><span class="lines">@@ -52,8 +51,9 @@
</span><span class="cx">                                  return false;
</span><span class="cx">                          }() );
</span><span class="cx">                          // CONTROLSCONTAINER
</span><del>-                               if ( slider.vars.controlsContainer !== '' )
</del><ins>+                                if ( slider.vars.controlsContainer !== '' ) {
</ins><span class="cx">                                   slider.controlsContainer = $( slider.vars.controlsContainer ).length > 0 && $( slider.vars.controlsContainer );
</span><ins>+                               }
</ins><span class="cx"> 
</span><span class="cx">                          slider.doMath();
</span><span class="cx"> 
</span><span class="lines">@@ -78,8 +78,9 @@
</span><span class="cx">                          }
</span><span class="cx"> 
</span><span class="cx">                          // TOUCH
</span><del>-                               if ( touch )
</del><ins>+                                if ( touch ) {
</ins><span class="cx">                                   methods.touch();
</span><ins>+                               }
</ins><span class="cx"> 
</span><span class="cx">                          $( window ).bind( 'resize orientationchange focus', methods.resize );
</span><span class="cx"> 
</span><span class="lines">@@ -127,8 +128,9 @@
</span><span class="cx">                                          }
</span><span class="cx"> 
</span><span class="cx">                                          // Set up flags to prevent event duplication.
</span><del>-                                               if ( watchedEvent === '' )
</del><ins>+                                                if ( watchedEvent === '' ) {
</ins><span class="cx">                                                   watchedEvent = event.type;
</span><ins>+                                               }
</ins><span class="cx"> 
</span><span class="cx">                                          methods.setToClearWatchedEvent();
</span><span class="cx">                                  } );
</span><span class="lines">@@ -178,8 +180,9 @@
</span><span class="cx">                                          }
</span><span class="cx"> 
</span><span class="cx">                                          // Set up flags to prevent event duplication.
</span><del>-                                               if ( watchedEvent === '' )
</del><ins>+                                                if ( watchedEvent === '' ) {
</ins><span class="cx">                                                   watchedEvent = event.type;
</span><ins>+                                               }
</ins><span class="cx"> 
</span><span class="cx">                                          methods.setToClearWatchedEvent();
</span><span class="cx">                                  } );
</span><span class="lines">@@ -208,134 +211,136 @@
</span><span class="cx"> 
</span><span class="cx">                          if ( ! msGesture ) {
</span><span class="cx">                                  el.addEventListener( 'touchstart', onTouchStart, false );
</span><ins>+                               } else {
+                                       el.style.msTouchAction = 'none';
+                                       el._gesture = new MSGesture(); // MSFT specific.
+                                       el._gesture.target = el;
+                                       el.addEventListener( 'MSPointerDown', onMSPointerDown, false );
+                                       el._slider = slider;
+                                       el.addEventListener( 'MSGestureChange', onMSGestureChange, false );
+                                       el.addEventListener( 'MSGestureEnd', onMSGestureEnd, false );
+                               }
</ins><span class="cx"> 
</span><del>-                                       function onTouchStart( e ) {
-                                               if ( slider.animating ) {
-                                                       e.preventDefault();
-                                               } else if ( ( window.navigator.msPointerEnabled ) || e.touches.length === 1 ) {
-                                                       cwidth = slider.w;
-                                                       startT = Number( new Date() );
</del><ins>+                                function onTouchStart( e ) {
+                                       if ( slider.animating ) {
+                                               e.preventDefault();
+                                       } else if ( ( window.navigator.msPointerEnabled ) || e.touches.length === 1 ) {
+                                               cwidth = slider.w;
+                                               startT = Number( new Date() );
</ins><span class="cx"> 
</span><del>-                                                       // Local vars for X and Y points.
-                                                       localX = e.touches[0].pageX;
-                                                       localY = e.touches[0].pageY;
</del><ins>+                                                // Local vars for X and Y points.
+                                               localX = e.touches[0].pageX;
+                                               localY = e.touches[0].pageY;
</ins><span class="cx"> 
</span><del>-                                                       offset = ( slider.animatingTo === slider.last ) ? 0 :
-                                                                        ( slider.currentSlide === slider.last ) ? slider.limit : ( slider.currentSlide + slider.cloneOffset ) * cwidth;
-                                                       startX = localX;
-                                                       startY = localY;
</del><ins>+                                                offset = ( slider.animatingTo === slider.last ) ? 0 :
+                                                                ( slider.currentSlide === slider.last ) ? slider.limit : ( slider.currentSlide + slider.cloneOffset ) * cwidth;
+                                               startX = localX;
+                                               startY = localY;
</ins><span class="cx"> 
</span><del>-                                                       el.addEventListener( 'touchmove', onTouchMove, false );
-                                                       el.addEventListener( 'touchend', onTouchEnd, false );
-                                               }
</del><ins>+                                                el.addEventListener( 'touchmove', onTouchMove, false );
+                                               el.addEventListener( 'touchend', onTouchEnd, false );
</ins><span class="cx">                                   }
</span><ins>+                               }
</ins><span class="cx"> 
</span><del>-                                       function onTouchMove( e ) {
-                                               // Local vars for X and Y points.
-                                               localX = e.touches[0].pageX;
-                                               localY = e.touches[0].pageY;
</del><ins>+                                function onTouchMove( e ) {
+                                       // Local vars for X and Y points.
+                                       localX = e.touches[0].pageX;
+                                       localY = e.touches[0].pageY;
</ins><span class="cx"> 
</span><del>-                                               dx = startX - localX;
-                                               scrolling = Math.abs( dx ) < Math.abs( localY - startY );
</del><ins>+                                        dx = startX - localX;
+                                       scrolling = Math.abs( dx ) < Math.abs( localY - startY );
</ins><span class="cx"> 
</span><del>-                                               var fxms = 500;
</del><ins>+                                        var fxms = 500;
</ins><span class="cx"> 
</span><del>-                                               if ( ! scrolling || Number( new Date() ) - startT > fxms ) {
-                                                       e.preventDefault();
-                                                       if ( slider.transitions ) {
-                                                               slider.setProps( offset + dx, 'setTouch' );
-                                                       }
</del><ins>+                                        if ( ! scrolling || Number( new Date() ) - startT > fxms ) {
+                                               e.preventDefault();
+                                               if ( slider.transitions ) {
+                                                       slider.setProps( offset + dx, 'setTouch' );
</ins><span class="cx">                                           }
</span><span class="cx">                                  }
</span><ins>+                               }
</ins><span class="cx"> 
</span><del>-                                       function onTouchEnd( e ) {
-                                               // Finish the touch by undoing the touch session.
-                                               el.removeEventListener( 'touchmove', onTouchMove, false );
</del><ins>+                                function onTouchEnd() {
+                                       // Finish the touch by undoing the touch session.
+                                       el.removeEventListener( 'touchmove', onTouchMove, false );
</ins><span class="cx"> 
</span><del>-                                               if ( slider.animatingTo === slider.currentSlide && ! scrolling && ! ( dx === null ) ) {
-                                                       var updateDx = dx,
-                                                               target = ( updateDx > 0 ) ? slider.getTarget( 'next' ) : slider.getTarget( 'prev' );
</del><ins>+                                        if ( slider.animatingTo === slider.currentSlide && ! scrolling && dx !== null ) {
+                                               var updateDx = dx,
+                                                       target = ( updateDx > 0 ) ? slider.getTarget( 'next' ) : slider.getTarget( 'prev' );
</ins><span class="cx"> 
</span><del>-                                                       slider.featureAnimate( target );
-                                               }
-                                               el.removeEventListener( 'touchend', onTouchEnd, false );
</del><ins>+                                                slider.featureAnimate( target );
+                                       }
+                                       el.removeEventListener( 'touchend', onTouchEnd, false );
</ins><span class="cx"> 
</span><del>-                                               startX = null;
-                                               startY = null;
-                                               dx = null;
-                                               offset = null;
</del><ins>+                                        startX = null;
+                                       startY = null;
+                                       dx = null;
+                                       offset = null;
+                               }
+
+                               function onMSPointerDown( e ) {
+                                       e.stopPropagation();
+                                       if ( slider.animating ) {
+                                               e.preventDefault();
+                                       } else {
+                                               el._gesture.addPointer( e.pointerId );
+                                               accDx = 0;
+                                               cwidth = slider.w;
+                                               startT = Number( new Date() );
+                                               offset = ( slider.animatingTo === slider.last ) ? 0 : ( slider.currentSlide === slider.last ) ? slider.limit : ( slider.currentSlide + slider.cloneOffset ) * cwidth;
</ins><span class="cx">                                   }
</span><del>-                               } else {
-                                       el.style.msTouchAction = 'none';
-                                       el._gesture = new MSGesture();
-                                       el._gesture.target = el;
-                                       el.addEventListener( 'MSPointerDown', onMSPointerDown, false );
-                                       el._slider = slider;
-                                       el.addEventListener( 'MSGestureChange', onMSGestureChange, false );
-                                       el.addEventListener( 'MSGestureEnd', onMSGestureEnd, false );
</del><ins>+                                }
</ins><span class="cx"> 
</span><del>-                                       function onMSPointerDown( e ) {
-                                               e.stopPropagation();
-                                               if ( slider.animating ) {
-                                                       e.preventDefault();
-                                               } else {
-                                                       el._gesture.addPointer( e.pointerId );
-                                                       accDx = 0;
-                                                       cwidth = slider.w;
-                                                       startT = Number( new Date() );
-                                                       offset = ( slider.animatingTo === slider.last ) ? 0 : ( slider.currentSlide === slider.last ) ? slider.limit : ( slider.currentSlide + slider.cloneOffset ) * cwidth;
-                                               }
</del><ins>+                                function onMSGestureChange( e ) {
+                                       e.stopPropagation();
+                                       var slider = e.target._slider;
+                                       if ( ! slider ) {
+                                               return;
</ins><span class="cx">                                   }
</span><span class="cx"> 
</span><del>-                                       function onMSGestureChange( e ) {
-                                               e.stopPropagation();
-                                               var slider = e.target._slider;
-                                               if ( ! slider )
-                                                       return;
</del><ins>+                                        var transX = -e.translationX,
+                                               transY = -e.translationY;
</ins><span class="cx"> 
</span><del>-                                               var transX = -e.translationX,
-                                                       transY = -e.translationY;
</del><ins>+                                        // Accumulate translations.
+                                       accDx = accDx + transX;
+                                       dx = accDx;
+                                       scrolling = Math.abs( accDx ) < Math.abs( -transY );
</ins><span class="cx"> 
</span><del>-                                               // Accumulate translations.
-                                               accDx = accDx + transX;
-                                               dx = accDx;
-                                               scrolling = Math.abs( accDx ) < Math.abs( -transY );
</del><ins>+                                        if ( e.detail === e.MSGESTURE_FLAG_INERTIA ) {
+                                               setImmediate( function () {  // MSFT specific.
+                                                       el._gesture.stop();
+                                               } );
</ins><span class="cx"> 
</span><del>-                                               if ( e.detail === e.MSGESTURE_FLAG_INERTIA ) {
-                                                       setImmediate( function () {
-                                                               el._gesture.stop();
-                                                       } );
</del><ins>+                                                return;
+                                       }
</ins><span class="cx"> 
</span><del>-                                                       return;
</del><ins>+                                        if ( ! scrolling || Number( new Date() ) - startT > 500 ) {
+                                               e.preventDefault();
+                                               if ( slider.transitions ) {
+                                                       slider.setProps( offset + dx, 'setTouch' );
</ins><span class="cx">                                           }
</span><ins>+                                       }
+                               }
</ins><span class="cx"> 
</span><del>-                                               if ( ! scrolling || Number( new Date() ) - startT > 500 ) {
-                                                       e.preventDefault();
-                                                       if ( slider.transitions ) {
-                                                               slider.setProps( offset + dx, 'setTouch' );
-                                                       }
-                                               }
</del><ins>+                                function onMSGestureEnd( e ) {
+                                       e.stopPropagation();
+                                       var slider = e.target._slider;
+                                       if ( ! slider ) {
+                                               return;
</ins><span class="cx">                                   }
</span><span class="cx"> 
</span><del>-                                       function onMSGestureEnd( e ) {
-                                               e.stopPropagation();
-                                               var slider = e.target._slider;
-                                               if ( ! slider )
-                                                       return;
</del><ins>+                                        if ( slider.animatingTo === slider.currentSlide && ! scrolling && dx !== null ) {
+                                               var updateDx = dx,
+                                                   target = ( updateDx > 0 ) ? slider.getTarget( 'next' ) : slider.getTarget( 'prev' );
</ins><span class="cx"> 
</span><del>-                                               if ( slider.animatingTo === slider.currentSlide && ! scrolling && ! ( dx === null ) ) {
-                                                       var updateDx = dx,
-                                                           target = ( updateDx > 0 ) ? slider.getTarget( 'next' ) : slider.getTarget( 'prev' );
</del><ins>+                                                slider.featureAnimate( target );
+                                       }
</ins><span class="cx"> 
</span><del>-                                                       slider.featureAnimate( target );
-                                               }
-
-                                               startX = null;
-                                               startY = null;
-                                               dx = null;
-                                               offset = null;
-                                               accDx = 0;
-                                       }
</del><ins>+                                        startX = null;
+                                       startY = null;
+                                       dx = null;
+                                       offset = null;
+                                       accDx = 0;
</ins><span class="cx">                           }
</span><span class="cx">                  },
</span><span class="cx"> 
</span><span class="lines">@@ -365,8 +370,9 @@
</span><span class="cx"> 
</span><span class="cx">          // Public methods.
</span><span class="cx">          slider.featureAnimate = function( target ) {
</span><del>-                       if ( target !== slider.currentSlide )
</del><ins>+                        if ( target !== slider.currentSlide ) {
</ins><span class="cx">                           slider.direction = ( target > slider.currentSlide ) ? 'next' : 'prev';
</span><ins>+                       }
</ins><span class="cx"> 
</span><span class="cx">                  if ( ! slider.animating && slider.is( ':visible' ) ) {
</span><span class="cx">                          slider.animating = true;
</span><span class="lines">@@ -383,7 +389,7 @@
</span><span class="cx">                          methods.directionNav.update();
</span><span class="cx"> 
</span><span class="cx">                          var dimension = slider.computedW,
</span><del>-                                       margin, slideString, calcNext;
</del><ins>+                                        slideString;
</ins><span class="cx"> 
</span><span class="cx">                          if ( slider.currentSlide === 0 && target === slider.count - 1 && slider.direction !== 'next' ) {
</span><span class="cx">                                  slideString = 0;
</span><span class="lines">@@ -455,12 +461,13 @@
</span><span class="cx">                  }
</span><span class="cx"> 
</span><span class="cx">                  slider.args[slider.prop] = target;
</span><del>-                       if ( slider.transitions || dur === undefined )
</del><ins>+                        if ( slider.transitions || dur === undefined ) {
</ins><span class="cx">                           slider.container.css( slider.args );
</span><ins>+                       }
</ins><span class="cx">           };
</span><span class="cx"> 
</span><span class="cx">          slider.setup = function( type ) {
</span><del>-                       var sliderOffset, arr;
</del><ins>+                        var sliderOffset;
</ins><span class="cx"> 
</span><span class="cx">                  if ( type === 'init' ) {
</span><span class="cx">                          slider.viewport = $( '<div class="' + namespace + 'viewport"></div>' ).css( { 'overflow': 'hidden', 'position': 'relative' } ).appendTo( slider ).append( slider.container );
</span><span class="lines">@@ -470,8 +477,9 @@
</span><span class="cx">                  slider.cloneCount = 2;
</span><span class="cx">                  slider.cloneOffset = 1;
</span><span class="cx">                  // Clear out old clones.
</span><del>-                       if ( type !== 'init' )
</del><ins>+                        if ( type !== 'init' ) {
</ins><span class="cx">                           slider.container.find( '.clone' ).remove();
</span><ins>+                       }
</ins><span class="cx"> 
</span><span class="cx">                  slider.container.append( slider.slides.first().clone().addClass( 'clone' ).attr( 'aria-hidden', 'true' ) ).prepend( slider.slides.last().clone().addClass( 'clone' ).attr( 'aria-hidden', 'true' ) );
</span><span class="cx">                  slider.newSlides = $( slider.vars.selector, slider );
</span><span class="lines">@@ -531,13 +539,6 @@
</span><span class="cx">          methods.init();
</span><span class="cx">  };
</span><span class="cx"> 
</span><del>-       // Ensure the slider isn't focused if the window loses focus.
-       $( window ).blur( function ( e ) {
-               focused = false;
-       } ).focus( function ( e ) {
-               focused = true;
-       } );
-
</del><span class="cx">   // Default settings.
</span><span class="cx">  $.featuredslider.defaults = {
</span><span class="cx">          namespace: 'slider-',     // String: prefix string attached to the class of every element generated by the plugin.
</span><span class="lines">@@ -552,8 +553,9 @@
</span><span class="cx"> 
</span><span class="cx">  // FeaturedSlider: plugin function.
</span><span class="cx">  $.fn.featuredslider = function( options ) {
</span><del>-               if ( options === undefined )
</del><ins>+                if ( options === undefined ) {
</ins><span class="cx">                   options = {};
</span><ins>+               }
</ins><span class="cx"> 
</span><span class="cx">          if ( typeof options === 'object' ) {
</span><span class="cx">                  return this.each( function() {
</span></span></pre>
</div>
</div>

</body>
</html>