first commit

This commit is contained in:
2024-07-31 13:12:38 +07:00
commit b4e8cbe182
10213 changed files with 3125839 additions and 0 deletions

View File

@@ -0,0 +1,112 @@
/*
* Based on tristen hoverintent plugin - https://github.com/tristen/hoverintent
*/
(function( $ ) {
'use strict';
var hoverIntent = function( el, onOver, onOut ) {
var x, y, pX, pY,
h = {},
state = 0,
timer = 0;
var options = {
sensitivity: 7,
interval: 100,
timeout: 0
};
function delay( el, e ) {
if ( timer )
timer = clearTimeout( timer );
state = 0;
return onOut ? onOut.call( el, e ) : null;
}
function tracker( e ) {
x = e.clientX;
y = e.clientY;
}
function compare( el, e ) {
if ( timer )
timer = clearTimeout( timer );
if ( (Math.abs( pX - x ) + Math.abs( pY - y )) < options.sensitivity ) {
state = 1;
return onOver ? onOver.call( el, e ) : null;
} else {
pX = x;
pY = y;
timer = setTimeout( function() {
compare( el, e );
}, options.interval );
}
}
// Public methods
h.options = function( opt ) {
options = $.extend( {}, options, opt );
return h;
};
function dispatchOver( e ) {
if ( timer )
timer = clearTimeout( timer );
el.removeEventListener( 'mousemove', tracker );
if ( state !== 1 ) {
pX = e.clientX;
pY = e.clientY;
el.addEventListener( 'mousemove', tracker );
timer = setTimeout( function() {
compare( el, e );
}, options.interval );
}
return this;
}
function dispatchOut( e ) {
if ( timer )
timer = clearTimeout( timer );
el.removeEventListener( 'mousemove', tracker );
if ( state === 1 ) {
timer = setTimeout( function() {
delay( el, e );
}, options.timeout );
}
return this;
}
h.remove = function() {
el.removeEventListener( 'mouseover', dispatchOver );
el.removeEventListener( 'mouseleave', dispatchOut );
};
el.addEventListener( 'mouseover', dispatchOver );
el.addEventListener( 'mouseleave', dispatchOut );
return h;
};
$.fn.hoverIntent = function( over, out, options ) {
return this.each( function() {
hoverIntent( this, over, out ).options( options || {} );
} );
};
})( jQuery );

View File

@@ -0,0 +1 @@
!function(h){"use strict";var i=function(i,o,r){var u,s,v,c,t={},m=0,a=0,l={sensitivity:7,interval:100,timeout:0};function f(e){u=e.clientX,s=e.clientY}function e(e){return a&&(a=clearTimeout(a)),i.removeEventListener("mousemove",f),1!==m&&(v=e.clientX,c=e.clientY,i.addEventListener("mousemove",f),a=setTimeout(function(){!function e(t,n){if(a&&(a=clearTimeout(a)),Math.abs(v-u)+Math.abs(c-s)<l.sensitivity)return m=1,o?o.call(t,n):null;v=u,c=s,a=setTimeout(function(){e(t,n)},l.interval)}(i,e)},l.interval)),this}function n(n){return a&&(a=clearTimeout(a)),i.removeEventListener("mousemove",f),1===m&&(a=setTimeout(function(){var e,t;e=i,t=n,a&&(a=clearTimeout(a)),m=0,r&&r.call(e,t)},l.timeout)),this}return t.options=function(e){return l=h.extend({},l,e),t},t.remove=function(){i.removeEventListener("mouseover",e),i.removeEventListener("mouseleave",n)},i.addEventListener("mouseover",e),i.addEventListener("mouseleave",n),t};h.fn.hoverIntent=function(e,t,n){return this.each(function(){i(this,e,t).options(n||{})})}}(jQuery);