added session 75 and changed about

This commit is contained in:
Kiritan Flux 2018-09-11 12:59:44 +02:00
parent 67d2a1ed53
commit 44d1d89fa5
184 changed files with 57277 additions and 51455 deletions

View file

@ -6,7 +6,7 @@
"description": "UI utilities",
"main": "utils.js",
"dependencies": {
"desandro-matches-selector": "~2.0.0"
"desandro-matches-selector": "^2.0.0"
},
"moduleType": [
"amd",

View file

@ -1,5 +1,5 @@
/**
* Fizzy UI utils v2.0.3
* Fizzy UI utils v2.0.7
* MIT license
*/
@ -54,22 +54,27 @@ utils.modulo = function( num, div ) {
// ----- makeArray ----- //
var arraySlice = Array.prototype.slice;
// turn element or nodeList into an array
utils.makeArray = function( obj ) {
var ary = [];
if ( Array.isArray( obj ) ) {
// use object if already an array
ary = obj;
} else if ( obj && typeof obj.length == 'number' ) {
// convert nodeList to array
for ( var i=0; i < obj.length; i++ ) {
ary.push( obj[i] );
}
} else {
// array of single index
ary.push( obj );
return obj;
}
return ary;
// return empty array if undefined or null. #6
if ( obj === null || obj === undefined ) {
return [];
}
var isArrayLike = typeof obj == 'object' && typeof obj.length == 'number';
if ( isArrayLike ) {
// convert nodeList to array
return arraySlice.call( obj );
}
// array of single index
return [ obj ];
};
// ----- removeFrom ----- //
@ -84,7 +89,7 @@ utils.removeFrom = function( ary, obj ) {
// ----- getParent ----- //
utils.getParent = function( elem, selector ) {
while ( elem != document.body ) {
while ( elem.parentNode && elem != document.body ) {
elem = elem.parentNode;
if ( matchesSelector( elem, selector ) ) {
return elem;
@ -148,22 +153,21 @@ utils.filterFindElements = function( elems, selector ) {
// ----- debounceMethod ----- //
utils.debounceMethod = function( _class, methodName, threshold ) {
threshold = threshold || 100;
// original method
var method = _class.prototype[ methodName ];
var timeoutName = methodName + 'Timeout';
_class.prototype[ methodName ] = function() {
var timeout = this[ timeoutName ];
if ( timeout ) {
clearTimeout( timeout );
}
var args = arguments;
clearTimeout( timeout );
var args = arguments;
var _this = this;
this[ timeoutName ] = setTimeout( function() {
method.apply( _this, args );
delete _this[ timeoutName ];
}, threshold || 100 );
}, threshold );
};
};