From 1c80902b7f1f71be9e47b28fb09a69ab7923110f Mon Sep 17 00:00:00 2001
From: Peter Rotich <peter@osticket.com>
Date: Mon, 19 May 2014 15:42:50 +0000
Subject: [PATCH] Remove tool tips on pjax click

---
 scp/js/scp.js | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/scp/js/scp.js b/scp/js/scp.js
index 9c223cf67..d77060212 100644
--- a/scp/js/scp.js
+++ b/scp/js/scp.js
@@ -639,12 +639,20 @@ $(document).on('pjax:click', function(options) {
         $.autoLock.releaseLock();
     // Stop all animations
     $(document).stop(false, true);
+
+    // Remove tips and clear any pending timer
+    $('.tip, .help-tips, .userPreview, .ticketPreview, .previewfaq').each(function() {
+        if ($(this).data('timer'))
+            clearTimeout($(this).data('timer'));
+    });
+    $('.tip_box').remove();
 });
 
 $(document).on('pjax:start', function() {
     // Cancel save-changes warning banner
     $(document).unbind('pjax:beforeSend.changed');
     $(window).unbind('beforeunload');
+    $('.tip_box').remove();
 });
 
 $(document).on('pjax:send', function(event) {
@@ -666,13 +674,16 @@ $(document).on('pjax:complete', function() {
     $("#loadingbar").width("101%").delay(200).fadeOut(400, function() {
         $(this).remove();
     });
+
+    $('.tip_box').remove();
+    $('.dialog .body').empty().parent().hide();
     $('#overlay').stop(false, true).hide().removeAttr('style');
 });
 
 $(document).on('pjax:end', function() {
     // Close popups
     // Close tooltips
-    $('.tip_box').empty().hide();
+    $('.tip_box').remove();
     $('.dialog .body').empty().parent().hide();
     $('#overlay').hide();
 });
-- 
GitLab