--- web/search_mrsparkle/exposed/js/contrib/patches/intro.js.org	2017-01-27 14:21:30.000000000 -0800
+++ web/search_mrsparkle/exposed/js/contrib/intro.js	2017-01-27 14:23:30.000000000 -0800
@@ -38,6 +38,8 @@
       skipLabel: 'Skip',
       /* Done button label in tooltip box */
       doneLabel: 'Done',
+      /* If tour has another linked tour */
+      nextTourLabel: '',
       /* Hide previous button in the first step? Otherwise, it will be disabled button. */
       hidePrev: false,
       /* Hide next button in the last step? Otherwise, it will be disabled button. */
@@ -102,7 +104,7 @@
         //use querySelector function only when developer used CSS selector
         if (typeof(currentItem.element) === 'string') {
           //grab the element with given selector from the page
-          currentItem.element = document.querySelector(currentItem.element);
+          currentItem.element = $(currentItem.element)[0];
         }
 
         //intro without element
@@ -325,10 +327,14 @@
     if ((this._introItems.length) <= this._currentStep) {
       //end of the intro
       //check if any callback is defined
+      if (this._options.nextTourURL) {
+        window.location = this._options.nextTourURL;
+      }
       if (typeof (this._introCompleteCallback) === 'function') {
         this._introCompleteCallback.call(this);
       }
-      _exitIntro.call(this, this._targetElement);
+      //_exitIntro.call(this, this._targetElement);
+      --this._currentStep;
       return;
     }
 
@@ -383,7 +389,7 @@
       if (overlayLayer.parentNode) {
         overlayLayer.parentNode.removeChild(overlayLayer);
       }
-    }, 500);
+    }, 10);
 
     //remove all helper layers
     var helperLayer = targetElement.querySelector('.introjs-helperLayer');
@@ -792,6 +798,7 @@
           oldArrowLayer        = oldReferenceLayer.querySelector('.introjs-arrow'),
           oldtooltipContainer  = oldReferenceLayer.querySelector('.introjs-tooltip'),
           skipTooltipButton    = oldReferenceLayer.querySelector('.introjs-skipbutton'),
+          nextTourButton       = oldReferenceLayer.querySelector('.introjs-nexttourbutton'),
           prevTooltipButton    = oldReferenceLayer.querySelector('.introjs-prevbutton'),
           nextTooltipButton    = oldReferenceLayer.querySelector('.introjs-nextbutton');
 
@@ -860,7 +867,7 @@
           //still in the tour, focus on next
           nextTooltipButton.focus();
         }
-      }, 350);
+      }, 10);
 
     } else {
       var helperLayer       = document.createElement('div'),
@@ -870,10 +877,14 @@
           tooltipTextLayer  = document.createElement('div'),
           bulletsLayer      = document.createElement('div'),
           progressLayer     = document.createElement('div'),
-          buttonsLayer      = document.createElement('div');
+          buttonsLayer      = document.createElement('div'),
+          linksLayer        = document.createElement('div');
 
       helperLayer.className = highlightClass;
       referenceLayer.className = 'introjs-tooltipReferenceLayer';
+      referenceLayer.onmousedown = function(e) {
+        e.stopPropagation();
+      }
 
       //set new position to helper layer
       _setHelperLayerPosition.call(self, helperLayer);
@@ -900,7 +911,8 @@
         var innerLi    = document.createElement('li');
         var anchorLink = document.createElement('a');
 
-        anchorLink.onclick = function() {
+        anchorLink.onmousedown = function(e) {
+          e.stopPropagation();
           self.goToStep(this.getAttribute('data-stepnumber'));
         };
 
@@ -932,6 +944,11 @@
         buttonsLayer.style.display = 'none';
       }
 
+      linksLayer.className = 'introjs-tooltiplinks';
+      if (this._options.showButtons === false) {
+        linksLayer.style.display = 'none';
+      }
+
       tooltipLayer.className = 'introjs-tooltip';
       tooltipLayer.appendChild(tooltipTextLayer);
       tooltipLayer.appendChild(bulletsLayer);
@@ -945,16 +962,19 @@
         referenceLayer.appendChild(helperNumberLayer);
       }
 
+      tooltipLayer.onmousedown = function(e) {
+        e.stopPropagation();
+      }
+
       tooltipLayer.appendChild(arrowLayer);
       referenceLayer.appendChild(tooltipLayer);
 
       //next button
       var nextTooltipButton = document.createElement('a');
 
-      nextTooltipButton.onclick = function() {
-        if (self._introItems.length - 1 != self._currentStep) {
-          _nextStep.call(self);
-        }
+      nextTooltipButton.onmousedown = function(e) {
+        e.stopPropagation();
+        _nextStep.call(self);
       };
 
       _setAnchorAsButton(nextTooltipButton);
@@ -963,7 +983,8 @@
       //previous button
       var prevTooltipButton = document.createElement('a');
 
-      prevTooltipButton.onclick = function() {
+      prevTooltipButton.onmousedown = function(e) {
+        e.stopPropagation();
         if (self._currentStep != 0) {
           _previousStep.call(self);
         }
@@ -978,7 +999,8 @@
       _setAnchorAsButton(skipTooltipButton);
       skipTooltipButton.innerHTML = this._options.skipLabel;
 
-      skipTooltipButton.onclick = function() {
+      skipTooltipButton.onmousedown = function(e) {
+        e.stopPropagation();
         if (self._introItems.length - 1 == self._currentStep && typeof (self._introCompleteCallback) === 'function') {
           self._introCompleteCallback.call(self);
         }
@@ -990,7 +1012,24 @@
         _exitIntro.call(self, self._targetElement);
       };
 
-      buttonsLayer.appendChild(skipTooltipButton);
+      linksLayer.appendChild(skipTooltipButton);
+
+      // Next Tour link
+      var nextTourButton = document.createElement('a');
+      nextTourButton.className = 'introjs-button introjs-nexttourbutton';
+      nextTourButton.href = 'javascript:void(0);';
+      nextTourButton.innerHTML = '';
+
+      nextTourButton.onmousedown = function(e) {
+        e.stopPropagation();
+        if (this._options.nextTourURL) {
+          window.location = this._options.nextTourURL;
+        }
+
+        _exitIntro.call(self, self._targetElement);
+      }.bind(this);
+
+      linksLayer.appendChild(nextTourButton);
 
       //in order to prevent displaying next/previous button always
       if (this._introItems.length > 1) {
@@ -998,6 +1037,7 @@
         buttonsLayer.appendChild(nextTooltipButton);
       }
 
+      buttonsLayer.appendChild(linksLayer);
       tooltipLayer.appendChild(buttonsLayer);
 
       //set proper position
@@ -1011,6 +1051,7 @@
 
     prevTooltipButton.removeAttribute('tabIndex');
     nextTooltipButton.removeAttribute('tabIndex');
+    skipTooltipButton.classList.remove('done');
 
     if (this._currentStep == 0 && this._introItems.length > 1) {
       nextTooltipButton.className = 'introjs-button introjs-nextbutton';
@@ -1024,8 +1065,8 @@
 
       prevTooltipButton.tabIndex = '-1';
       skipTooltipButton.innerHTML = this._options.skipLabel;
+      nextTourButton.innerHTML = '';
     } else if (this._introItems.length - 1 == this._currentStep || this._introItems.length == 1) {
-      skipTooltipButton.innerHTML = this._options.doneLabel;
       prevTooltipButton.className = 'introjs-button introjs-prevbutton';
 
       if (this._options.hideNext == true) {
@@ -1036,10 +1077,18 @@
       }
 
       nextTooltipButton.tabIndex = '-1';
+      if (this._options.nextTourLabel) {
+        //nextTourButton.innerHTML = 'Continue to ' + this._options.nextTourLabel;
+        nextTooltipButton.classList.remove('introjs-disabled');
+      } else {
+        skipTooltipButton.classList.add('done');
+        skipTooltipButton.innerHTML = this._options.doneLabel;
+      }
     } else {
       prevTooltipButton.className = 'introjs-button introjs-prevbutton';
       nextTooltipButton.className = 'introjs-button introjs-nextbutton';
       skipTooltipButton.innerHTML = this._options.skipLabel;
+      nextTourButton.innerHTML = '';
     }
 
     //Set focus on "next" button, so that hitting Enter always moves you onto the next step
@@ -1207,7 +1256,8 @@
 
     targetElm.appendChild(overlayLayer);
 
-    overlayLayer.onclick = function() {
+    overlayLayer.onmousedown = function(e) {
+      e.stopPropagation();
       if (self._options.exitOnOverlayClick == true) {
 
         //check if any callback is defined
