1(function ($) { 2 'use strict'; 3 4 var timer; 5 6 function trackLeave(ev) { 7 if (ev.clientY > 0) { 8 return; 9 } 10 11 if (timer) { 12 clearTimeout(timer); 13 } 14 15 if ($.exitIntent.settings.sensitivity <= 0) { 16 $.event.trigger('exitintent'); 17 return; 18 } 19 20 timer = setTimeout( 21 function() { 22 timer = null; 23 $.event.trigger('exitintent'); 24 }, $.exitIntent.settings.sensitivity); 25 } 26 27 function trackEnter() { 28 if (timer) { 29 clearTimeout(timer); 30 timer = null; 31 } 32 } 33 34 $.exitIntent = function(enable, options) { 35 $.exitIntent.settings = $.extend($.exitIntent.settings, options); 36 37 if (enable == 'enable') { 38 $(window).mouseleave(trackLeave); 39 $(window).mouseenter(trackEnter); 40 } else if (enable == 'disable') { 41 trackEnter(); // Turn off any outstanding timer 42 $(window).unbind('mouseleave', trackLeave); 43 $(window).unbind('mouseenter', trackEnter); 44 } else { 45 throw "Invalid parameter to jQuery.exitIntent -- should be 'enable'/'disable'"; 46 } 47 } 48 49 $.exitIntent.settings = { 50 'sensitivity': 300 51 }; 52 53})(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.