Update Koneko integration
This commit is contained in:
19
resources/public/vendor/afterresize/README.md
vendored
Normal file
19
resources/public/vendor/afterresize/README.md
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
# afterResize.js
|
||||
|
||||
If you have ever used jQuery's .resize() method to detect a window resize you may be aware that most browsers don't wait for the resize event to finish before it triggers a callback. Instead the event and it's callback is fired rapidly until the resize is complete.
|
||||
|
||||
This very simple jQuery plugin is designed to emulate an 'after resize' event. It works by adding the callback to a queue to be executed after a duration. If the event is triggered again before the end of this duration, it is restarted and the callback will not execute until the duration can finish.
|
||||
|
||||
## Example
|
||||
|
||||
```javascript
|
||||
$(document).ready( function() {
|
||||
$(window).afterResize( function() {
|
||||
alert('Resize event has finished');
|
||||
}, true, 100 );
|
||||
});
|
||||
```
|
||||
|
||||
## Licence
|
||||
|
||||
Do with it what you wish.
|
99
resources/public/vendor/afterresize/afterresize.js
vendored
Normal file
99
resources/public/vendor/afterresize/afterresize.js
vendored
Normal file
@ -0,0 +1,99 @@
|
||||
( function( $ ) {
|
||||
"use strict";
|
||||
|
||||
// Define default settings
|
||||
var defaults = {
|
||||
action: function() {},
|
||||
runOnLoad: false,
|
||||
duration: 500
|
||||
};
|
||||
|
||||
// Define global variables
|
||||
var settings = defaults,
|
||||
running = false,
|
||||
start;
|
||||
|
||||
var methods = {};
|
||||
|
||||
// Initial plugin configuration
|
||||
methods.init = function() {
|
||||
|
||||
// Allocate passed arguments to settings based on type
|
||||
for( var i = 0; i <= arguments.length; i++ ) {
|
||||
var arg = arguments[i];
|
||||
switch ( typeof arg ) {
|
||||
case "function":
|
||||
settings.action = arg;
|
||||
break;
|
||||
case "boolean":
|
||||
settings.runOnLoad = arg;
|
||||
break;
|
||||
case "number":
|
||||
settings.duration = arg;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Process each matching jQuery object
|
||||
return this.each(function() {
|
||||
|
||||
if( settings.runOnLoad ) { settings.action(); }
|
||||
|
||||
$(this).resize( function() {
|
||||
|
||||
methods.timedAction.call( this );
|
||||
|
||||
} );
|
||||
|
||||
} );
|
||||
};
|
||||
|
||||
methods.timedAction = function( code, millisec ) {
|
||||
|
||||
var doAction = function() {
|
||||
var remaining = settings.duration;
|
||||
|
||||
if( running ) {
|
||||
var elapse = new Date() - start;
|
||||
remaining = settings.duration - elapse;
|
||||
if( remaining <= 0 ) {
|
||||
// Clear timeout and reset running variable
|
||||
clearTimeout(running);
|
||||
running = false;
|
||||
// Perform user defined function
|
||||
settings.action();
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
wait( remaining );
|
||||
};
|
||||
|
||||
var wait = function( time ) {
|
||||
running = setTimeout( doAction, time );
|
||||
};
|
||||
|
||||
// Define new action starting time
|
||||
start = new Date();
|
||||
|
||||
// Define runtime settings if function is run directly
|
||||
if( typeof millisec === 'number' ) { settings.duration = millisec; }
|
||||
if( typeof code === 'function' ) { settings.action = code; }
|
||||
|
||||
// Only run timed loop if not already running
|
||||
if( !running ) { doAction(); }
|
||||
|
||||
};
|
||||
|
||||
|
||||
$.fn.afterResize = function( method ) {
|
||||
|
||||
if( methods[method] ) {
|
||||
return methods[method].apply( this, Array.prototype.slice.call( arguments, 1 ) );
|
||||
} else {
|
||||
return methods.init.apply( this, arguments );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
})(jQuery);
|
1
resources/public/vendor/afterresize/afterresize.min.js
vendored
Normal file
1
resources/public/vendor/afterresize/afterresize.min.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
(function(f){"use strict";var k={action:function(){},runOnLoad:false,duration:500};var b=k,e=false,g;var c={};c.init=function(){for(var a=0;a<=arguments.length;a++){var d=arguments[a];switch(typeof d){case"function":b.action=d;break;case"boolean":b.runOnLoad=d;break;case"number":b.duration=d;break}}return this.each(function(){if(b.runOnLoad){b.action()}f(this).resize(function(){c.timedAction.call(this)})})};c.timedAction=function(h,i){var j=function(){var a=b.duration;if(e){var d=new Date()-g;a=b.duration-d;if(a<=0){clearTimeout(e);e=false;b.action();return}}l(a)};var l=function(a){e=setTimeout(j,a)};g=new Date();if(typeof i==='number'){b.duration=i}if(typeof h==='function'){b.action=h}if(!e){j()}};f.fn.afterResize=function(a){if(c[a]){return c[a].apply(this,Array.prototype.slice.call(arguments,1))}else{return c.init.apply(this,arguments)}}})(jQuery);
|
5
resources/public/vendor/afterresize/demo.js
vendored
Normal file
5
resources/public/vendor/afterresize/demo.js
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
$(document).ready( function() {
|
||||
$(window).afterResize( function() {
|
||||
alert('Resize event has finished');
|
||||
}, true, 100 );
|
||||
});
|
13
resources/public/vendor/afterresize/index.html
vendored
Normal file
13
resources/public/vendor/afterresize/index.html
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset=utf-8 />
|
||||
<title>afterResize.js demo</title>
|
||||
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>afterResize.js</h1>
|
||||
<script src="./afterresize.js"></script>
|
||||
<script src="./demo.js"></script>
|
||||
</body>
|
||||
</html>
|
Reference in New Issue
Block a user