Last active
January 1, 2016 02:18
-
-
Save ika18/8077967 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var showTimeId; | |
var moveTimeId; | |
var slideLeaveTimeId; | |
me.$element.on('mouseenter', '[data-action="note"], [data-action="email"], [data-action="target"], [data-action="shortlist"], [data-action="task"], [data-action="floating"]', function ($e) { | |
var $target = $($e.target); | |
var mouseenter = function (e) { | |
clearTimeout(moveTimeId); | |
$(this).off(e); | |
}; | |
var mouseleave = function (e) { | |
slideLeaveTimeId = setTimeout(function () { | |
me.publish('slide-helper/note/close'); | |
$(this).off(e); | |
}, 600); | |
}; | |
$('.slide-helper').off('mouseenter.helper', mouseenter).off('mouseleave.helper', mouseleave); | |
if ($target.closest('ul.dropdown-menu').length) { | |
return; | |
} | |
if (me._json.islimited || me._isAdmin || $target.text() === '0' || $target.find('[class*="count"]').text() === '0') { | |
return; | |
} | |
clearTimeout(showTimeId); | |
clearTimeout(moveTimeId); | |
clearTimeout(slideLeaveTimeId); | |
showTimeId = setTimeout(function () { | |
$target.off('mouseleave'); | |
var action = $target.data('action'); | |
switch (action) { | |
case 'note': | |
me.publish('slide-helper/note/reload', me._json, 'candidate'); | |
break; | |
case 'shortlist': | |
me.publish('slide-helper/shortlist/reload', me._json.id, 'candidate'); | |
break; | |
default: | |
me.publish('slide-helper/' + action + '/reload', me._json.id); | |
break; | |
} | |
$target.on('mouseleave', function (e) { | |
moveTimeId = setTimeout(function () { | |
me.publish('slide-helper/note/close'); | |
$('.slide-helper').off('mouseenter.helper', mouseenter).off('mouseleave.helper', mouseleave); | |
}, 600); | |
$('.slide-helper').on('mouseenter.helper', mouseenter).on('mouseleave.helper', mouseleave); | |
$target.off('mouseleave'); | |
}); | |
}, 500); | |
$target.on('mouseleave', function (e) { | |
clearTimeout(showTimeId); | |
clearTimeout(moveTimeId); | |
$target.off('mouseleave'); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment