Comparing version 3.4.0 to 3.4.1
{ | ||
"version": "3.4.0", | ||
"version": "3.4.1", | ||
"name": "bellajs", | ||
@@ -4,0 +4,0 @@ "description": "A set of helpful and usual functions for browser and node.", |
/** | ||
* BellaJS v3.3.2.2 | ||
* BellaJS v3.4.1 | ||
* Author by @ndaidong | ||
@@ -293,2 +293,7 @@ * GitHub : https://github.com/techpush/bella.js.git | ||
/** https://github.com/jbt/js-crypto */ | ||
Bella.md5 = function(){for(var m=[],l=0;64>l;)m[l]=0|4294967296*Math.abs(Math.sin(++l));return function(c){var e,g,f,a,h=[];c=unescape(encodeURI(c));for(var b=c.length,k=[e=1732584193,g=-271733879,~e,~g],d=0;d<=b;)h[d>>2]|=(c.charCodeAt(d)||128)<<8*(d++%4);h[c=16*(b+8>>6)+14]=8*b;for(d=0;d<c;d+=16){b=k;for(a=0;64>a;)b=[f=b[3],(e=b[1]|0)+((f=b[0]+[e&(g=b[2])|~e&f,f&e|~f&g,e^g^f,g^(e|~f)][b=a>>4]+(m[a]+(h[[a,5*a+1,3*a+5,7*a][b]%16+d]|0)))<<(b=[7,12,17,22,5,9,14,20,4,11,16,23,6,10,15,21][4*b+a++%4])|f>>>32-b),e,g];for(a=4;a;)k[--a]=k[a]+b[a]}for(c="";32>a;)c+=(k[a>>3]>>4*(1^a++&7)&15).toString(16);return c}}(); | ||
Bella.sha1 = function(d){var l=0,a=0,f=[],b,c,g,h,p,e,m=[b=1732584193,c=4023233417,~b,~c,3285377520],n=[],k=unescape(encodeURI(d));for(b=k.length;a<=b;)n[a>>2]|=(k.charCodeAt(a)||128)<<8*(3-a++%4);for(n[d=(b+8>>6<<4)+15]=b<<3;l<=d;l+=16){b=m;for(a=0;80>a;b=[[(e=((k=b[0])<<5|k>>>27)+b[4]+(f[a]=16>a?~~n[l+a]:e<<1|e>>>31)+1518500249)+((c=b[1])&(g=b[2])|~c&(h=b[3])),p=e+(c^g^h)+341275144,e+(c&g|c&h|g&h)+882459459,p+1535694389][0|a++/20]|0,k,c<<30|c>>>2,g,h])e=f[a-3]^f[a-8]^f[a-14]^f[a-16];for(a=5;a;)m[--a]=m[a]+b[a]|0}for(d="";40>a;)d+=(m[a>>3]>>4*(7-a++%8)&15).toString(16);return d}; | ||
Bella.sha256 = function(){function e(a,b){return a>>>b|a<<32-b}for(var b=1,a,n=[],m=[];18>++b;)for(a=b*b;312>a;a+=b)m[a]=1;b=1;for(a=0;313>b;)m[++b]||(m[a]=Math.pow(b,0.5)%1*4294967296|0,n[a++]=Math.pow(b,1/3)%1*4294967296|0);return function(g){for(var l=m.slice(b=0),c=unescape(encodeURI(g)),h=[],d=c.length,k=[],f,p;b<d;)k[b>>2]|=(c.charCodeAt(b)&255)<<8*(3-b++%4);d*=8;k[d>>5]|=128<<24-d%32;k[p=(d+64>>9<<4)+15]=d;for(b=0;b<p;b+=16){for(c=l.slice(a=0,8);64>a;c[4]+=f)h[a]=16>a?k[a+b]:(e(f=h[a-2],17)^e(f,19)^f>>>10)+(h[a-7]|0)+(e(f=h[a-15],7)^e(f,18)^f>>>3)+(h[a-16]|0),c.unshift((f=(c.pop()+(e(g=c[4],6)^e(g,11)^e(g,25))+((g&c[5]^~g&c[6])+n[a])|0)+(h[a++]|0))+(e(d=c[0],2)^e(d,13)^e(d,22))+(d&c[1]^c[1]&c[2]^c[2]&d));for(a=8;a--;)l[a]=c[a]+l[a]}for(c="";63>a;)c+=(l[++a>>3]>>4*(7-a%8)&15).toString(16);return c}}(); | ||
// collection | ||
@@ -324,25 +329,33 @@ Bella.unique = function(a){ | ||
} | ||
Bella.msort = function(a, p, d){ | ||
if(isArray(a)){ | ||
var dn = (!d||d==='asc')?1:-1; | ||
a.sort(function(m, n){ | ||
return (m[p]>n[p])?dn:(m[p]<n[p]?(-1*dn):0); | ||
}); | ||
Bella.msort = function(a, opts){ | ||
var o = opts || {}; | ||
if(opts===-1 || opts===1 || opts==='asc' || opts==='desc'){ | ||
o = {order: opts} | ||
} | ||
return a; | ||
} | ||
Bella.empty = function (a){ | ||
if(isArray(a)){ | ||
for(var i=a.length-1; i>=0; i--){ | ||
a[i] = null; | ||
delete a[i]; | ||
if(isArray(a) && a.length>0 && isObject(o)){ | ||
var sortBy = o.sortBy || null; | ||
var order = o.order || 'asc'; | ||
var dn = (order==='asc' || order===1)?1:-1; | ||
var p = false; | ||
if(sortBy){ | ||
var a1 = a.filter(function(item){ | ||
return item.hasOwnProperty(sortBy); | ||
}); | ||
if(a1.length===a.length){ | ||
p = sortBy; | ||
} | ||
} | ||
a.length=0; | ||
} | ||
else if(isObject(a)){ | ||
for(var k in a){ | ||
a[k] = null; | ||
delete a[k]; | ||
if(p){ | ||
a.sort(function(m, n){ | ||
return (m[p]>n[p])?dn:(m[p]<n[p]?(-1*dn):0); | ||
}); | ||
} | ||
else{ | ||
a.sort(function(m, n){ | ||
return (m>n)?dn:(m<n?(-1*dn):0); | ||
}); | ||
} | ||
} | ||
return a; | ||
} | ||
@@ -349,0 +362,0 @@ |
/** | ||
* BellaJS v3.3.2.2 - min | ||
* BellaJS v3.4.1 - min | ||
* Author by @ndaidong | ||
@@ -8,25 +8,29 @@ * GitHub : https://github.com/techpush/bella.js.git | ||
/*eslint-disable*/ | ||
;(function(u){function y(a,b){for(var c="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",c=c+c.toLowerCase(),d=c.length,e=b||"",g=Math.max(a||32,e.length);e.length<g;)var q=Math.floor(Math.random()*d),e=e+(c.charAt(q)||"");return e}var d={ENV:"browser"};"undefined"!=typeof module&&module.exports&&(d.ENV="node");var x=function(a){var b=Object.prototype.toString,c=typeof a;if("object"==c){if(a){if(-1!==b.call(a).indexOf("HTML")&&-1!=b.call(a).indexOf("Element"))return"element";if(a instanceof Array||!(a instanceof | ||
;(function(v){function z(a,b){for(var c="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",c=c+c.toLowerCase(),d=c.length,e=b||"",f=Math.max(a||32,e.length);e.length<f;)var k=Math.floor(Math.random()*d),e=e+(c.charAt(k)||"");return e}var d={ENV:"browser"};"undefined"!=typeof module&&module.exports&&(d.ENV="node");var y=function(a){var b=Object.prototype.toString,c=typeof a;if("object"==c){if(a){if(-1!==b.call(a).indexOf("HTML")&&-1!=b.call(a).indexOf("Element"))return"element";if(a instanceof Array||!(a instanceof | ||
Object)&&"[object Array]"==b.call(a)||"number"==typeof a.length&&"undefined"!=typeof a.splice&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("splice"))return"array";if(!(a instanceof Object||"[object Function]"!=b.call(a)&&("undefined"==typeof a.call||"undefined"==typeof a.propertyIsEnumerable||a.propertyIsEnumerable("call"))))return"function"}return"null"}return"function"==c&&"undefined"==typeof a.call?"object":c};Object.keys||(Object.keys=function(){var a=Object.prototype.hasOwnProperty, | ||
b=!{toString:null}.propertyIsEnumerable("toString"),c="toString toLocaleString valueOf hasOwnProperty isPrototypeOf propertyIsEnumerable constructor".split(" "),d=c.length;return function(e){if("object"!==typeof e&&("function"!==typeof e||null===e))throw new TypeError("Object.keys called on non-object");var g=[],q;for(q in e)a.call(e,q)&&g.push(q);if(b)for(q=0;q<d;q++)a.call(e,c[q])&&g.push(c[q]);return g}}());var z=function(a){return"undefined"!==a},A=function(a){return!a||null===a||p(a)&&0===a.length|| | ||
v(a)&&0===Object.keys(a).length},p=function(a){return null!==a&&"array"==x(a)},h=function(a){return null!==a&&"string"==typeof a},w=function(a){return!isNaN(a)&&"number"==typeof Number(a)},B=function(a){return null!==a&&"function"==x(a)},C=function(a){return null!==a&&"element"==x(a)},v=function(a){return null!==a&&"object"==typeof a};d.isDef=z;d.isNull=function(a){return null===a};d.isEmpty=A;d.isEND=function(a){return A(a)||!z(a)};d.isBoolean=function(a){return!0===a||!1===a};d.isArray=p;d.isString= | ||
h;d.isNumber=w;d.isFunction=B;d.isElement=C;d.isObject=v;d.id=y(32);d.createId=y;d.encode=function(a){return h(a)?encodeURIComponent(a):""};d.decode=function(a){return h(a)?decodeURIComponent(a.replace(/\+/g," ")):""};d.trim=function(a){return(a&&h(a)?a.replace(/^[\s\xa0]+|[\s\xa0]+$/g,""):a)||""};d.truncate=function(a,b){if(!a||!h(a))return"...";a=d.trim(a);if(""==a)return a;var c=b||140;if(a.length<=c)return a;var n=a.substring(0,c),e=n.split(" "),g="";1<e.length?(e.pop(),g+=e.join(" "),g.length< | ||
a.length&&(g+="...")):(n.substring(0,c-3),g+="...");return g};d.stripTags=function(a){return h(a)?a.replace(/<\w+(\s+("[^"]*"|'[^']*'|[^>])+)?>|<\/\w+>/gi,""):""};d.escapeHTML=function(a){return h(a)?a.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,"""):""};d.unescapeHTML=function(a){return h(a)?a.replace(/"/g,'"').replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&"):""};d.strtolower=function(a){return h(a)?a.toLowerCase():""};d.strtoupper=function(a){return h(a)? | ||
a.toUpperCase():""};d.ucfirst=function(a){return h(a)?a.charAt(0).toUpperCase()+a.slice(1):""};d.ucwords=function(a){if(h(a)){var b=[];a.split(" ").forEach(function(a){b.push(d.ucfirst(a))});return b.join(" ")}return""};d.leftPad=function(a,b,c){w(a)&&(a+="");return h(a)?(a+="",b=b||2,a.length>=b?a:Array(b-a.length+1).join(c||"0")+a):""};d.rightPad=function(a,b,c){w(a)&&(a+="");return h(a)?(a+="",b=b||2,a.length>=b?a:a+Array(b-a.length+1).join(c||"0")):""};d.replaceAll=function(a,b,c){if(!h(a))return""; | ||
w(b)&&(b+="");w(c)&&(c+="");if(h(b)&&h(c))a=a.split(b).join(c);else if(p(b)&&h(c))b.forEach(function(b){a=d.replaceAll(a,b,c)});else if(p(b)&&p(c)&&b.length===c.length){var n=b.length;if(0<n)for(var e=0;e<n;e++)a=d.replaceAll(a,b[e],c[e])}return a};d.unique=function(a){if(p(a)){for(var b=[],c=0;c<a.length;c++)-1===b.indexOf(a[c])&&b.push(a[c]);return b}return a};d.max=function(a){return p(a)?Math.max.apply({},a):a};d.min=function(a){return p(a)?Math.min.apply({},a):a};d.contains=function(a,b,c){if(p(a))for(var d= | ||
0;d<a.length;d++){var e=a[d];if(c&&e[c]===b[c]||e===b)return!0}return!1};d.msort=function(a,b,c){if(p(a)){var d=c&&"asc"!==c?-1:1;a.sort(function(a,c){return a[b]>c[b]?d:a[b]<c[b]?-1*d:0})}return a};d.empty=function(a){if(p(a)){for(var b=a.length-1;0<=b;b--)a[b]=null,delete a[b];a.length=0}else if(v(a))for(b in a)a[b]=null,delete a[b]};d.round=function(a,b){return Math.round(a*Math.pow(10,b))/Math.pow(10,b)};d.inherits=Object.create;d.copies=function(a,b,c,n){c=c||!1;n=n||[];for(var e in a)if(!(0< | ||
n.length&&d.contains(n,e))&&(!c||c&&b.hasOwnProperty(e))){var g=a[e],q=b[e];v(q)&&v(g)||p(q)&&p(g)?b[e]=d.copies(g,b[e],c,n):b[e]=g}return b};d.clone=function(a){if(null==a||"object"!=typeof a)return a;if(a instanceof Date){var b=new Date;b.setTime(a.getTime());return b}if(a instanceof Array){b=[];a=a.slice(0);for(var c=0,n=a.length;c<n;++c)b[c]=d.clone(a[c]);return b}if(a instanceof Object){b={};for(c in a)"clone"!=c&&a.hasOwnProperty(c)&&(b[c]=d.clone(a[c]));return b}return!1};d.bind=function(a, | ||
b){return function(){return b.apply(a,arguments)}};if("browser"==d.ENV){d.device=function(){function a(a){return a.test(b)}var b=navigator.userAgent.toLowerCase();return{isStandard:window.localStorage,isWebkit:-1<b.indexOf("applewebkit"),isGecko:-1<b.indexOf("gecko")&&-1==b.indexOf("khtml"),isChrome:-1<b.indexOf("applewebkit")&&-1<b.indexOf("chrome")&&-1===b.indexOf("midori"),isSafari:-1<b.indexOf("applewebkit")&&-1==b.indexOf("chrome")&&-1===b.indexOf("midori"),isFirefox:-1<b.indexOf("gecko")&&0< | ||
b.indexOf("firefox"),isMidori:-1<b.indexOf("midori"),isIE:window.attachEvent&&!window.opera,isOpera:window.opera,isLinux:-1!=b.indexOf("linux"),isWin:-1!=b.indexOf("win"),isMac:-1!=b.indexOf("mac"),isUnix:-1!=b.indexOf("x11"),isAndroid:a(/android/i),isIOS:a(/(ipad|iphone|ipod)/i),isKindle:a(/\W(kindle|silk)\W/i),isMobile:a(/(iphone|ipod|((?:android)?.*?mobile)|blackberry|nokia)/i),isTablet:a(/(ipad|android(?!.*mobile))/i),isTV:a(/googletv|sonydtv/i),isIPad:a(/ipad/i),isIPhone:a(/iphone/i),isIPod:a(/ipod/i), | ||
isWPhone:a(/iemobile/i)}}();var m=function(a){var b=(h(a)?document.getElementById(a):a)||null;b&&C(b)&&(b.hasClass=function(a){var b=!0,d=this.className.split(" ");a=a.split(" ");for(var g=0;g<a.length;g++)if(-1===d.indexOf(a[g])){b=!1;break}return b},b.addClass=function(a){a=a.split(" ");var b=this.className.split(" ");a=a.concat(b);this.className=d.unique(a).join(" ");return this},b.removeClass=function(a){var b=this.className.split(" ");a=a.split(" ");for(var d=0;d<a.length;d++)this.hasClass(a[d])&& | ||
b.splice(b.indexOf(a[d]),1);this.className=b.join(" ");return this},b.toggleClass=function(a){b.hasClass(a)?b.removeClass(a):b.addClass(a);return this},b.empty=function(){for(;b.firstChild;)b.removeChild(b.firstChild);return b},b.html=function(a){if(!a)return b.innerHTML;b.innerHTML=a;return b},b.text=function(a){if(!a)return b.innerText||b.textContent;b.innerText?b.innerText=a:b.textContent&&(b.textContent=a);return b},b.destroy=function(){this.parentNode&&this.parentNode.removeChild(this)});return b}; | ||
d.dom={one:function(a){var b=null;(a=document.querySelector(a))&&(b=m(a));return b},all:function(a){var b=[];if(a=document.querySelectorAll(a))for(var c=0;c<a.length;c++)b.push(m(a[c]));return b},get:m,add:function(a,b){var c=b?d.element(b):document.body,n=document.createElement(a);c.appendChild(n);return m(n)},create:function(a){return m(document.createElement(a))}};d.event=function(){return{listen:function(a,b,c){"wheel"==b&&(b=d.device.isFirefox?"DOMMouseScroll":"mousewheel");a=h(a)?m(a):a;c=c|| | ||
function(){};a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent&&a.attachEvent("on"+b,c)},ignore:function(a,b,c){a=h(a)?m(a):a;a.removeEventListener?a.removeEventListener(b,c,!1):a.detachEvent&&a.detachEvent("on"+b,c)},simulate:function(a,b){var c,d=h(a)?m(a):a;document.createEventObject?(c=document.createEventObject(),d.fireEvent("on"+b,c)):(c=document.createEvent("HTMLEvents"),c.initEvent(b,!0,!0),d.dispatchEvent(c))},exit:function(a){a.cancelBubble=!0;a.stopPropagation&&a.stopPropagation(); | ||
a.preventDefault&&a.preventDefault();return!1},locate:function(a){a=a||window.event;(a=a.target||a.srcElement)&&3==a.nodeType&&(a=a.parentNode);return m(a)}}}()}d.now=function(){return new Date};d.time=function(){return(new Date).getTime()};d.date=function(){var a="D, M d, Y H:i:s A",b="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),c="January February March April May June July August September October November December".split(" "),n=function(){var a=(new Date).getTimezoneOffset(), | ||
b=Math.abs(a/60);return["GMT",0>a?"+":"-",d.leftPad(b,2)].join("")}(),e=function(g,e){var h=!1,r,f;e=e?(new Date(e)).getTime():d.time();g||(g=a);var k=function(a){return""+(10>a?"0"+a:a)};r=e instanceof Date?e:new Date(e);if(isNaN(r.getTime()))if(/^(\d+-\d+-\d+)\s(\d+:\d+:\d+)$/i.test(e))r=new Date(e.replace(" ","T"));else return e+" !";if(0<g.indexOf("a")||0<g.indexOf("A"))h=!0;f={Y:function(){return r.getFullYear()},y:function(){return(f.Y()+"").slice(-2)},F:function(){return c[f.n()-1]},M:function(){return(f.F()+ | ||
"").slice(0,3)},m:function(){return k(f.n())},n:function(){return r.getMonth()+1},S:function(){var a=f.j()+" ",b=a.charAt(a.length-2);return"1"===b?a+"st":"2"===b?a+"nd":"3"===b?a+"rd":a+"th"},j:function(){return r.getDate()},d:function(){return k(f.j())},t:function(){return(new Date(f.Y(),f.n(),0)).getDate()},w:function(){return r.getDay()},l:function(){return b[f.w()]},D:function(){return(f.l()+"").slice(0,3)},G:function(){return r.getHours()},g:function(){return f.G()%12||12},h:function(){return k(f.g())}, | ||
H:function(){return h?f.h():k(f.G())},i:function(){return k(r.getMinutes())},s:function(){return k(r.getSeconds())},a:function(){return 11<f.G()?"pm":"am"},A:function(){return f.a().toUpperCase()},O:function(){return n}};return g.replace(/\.*\\?([a-z])/gi,function(a,b){return f[a]?f[a]():b})};return{pattern:function(b){return b?a=b:a},utc:function(a){return(new Date(a||d.now())).toUTCString()},local:function(a){return e("D, j M Y H:i:s O",a)},strtotime:function(a){return(new Date(a)).getTime()},format:e, | ||
relativize:function(a){var b=a instanceof Date?a:new Date(a);a=new Date-b;b=parseInt(b,10);isNaN(b)&&(b=0);if(a<=b)return"Just now";var b=null,d={millisecond:1,second:1E3,minute:60,hour:60,day:24,month:30,year:12},c;for(c in d)if(a<d[c])break;else b=c,a/=d[c];a=Math.floor(a);1!==a&&(b+="s");return[a,b].join(" ")+" ago"}}}();d.scheduler=function(){function a(){var a=d.time(),b=Math.round(a/1E3),q=d.date.format("Y m d H i s",a),a=d.date.format("l",a);if(0<c.length)for(var p=c.length-1;0<=p;p--){var r= | ||
c[p],f;f=q;var k=a,m=b,l=r.time,t=Math.round(r.at/1E3);if(l.match(/^(sun|mon|tue|wed|thu|fri|sat)+(\w+)?(\s+)+(\d+(:\d)?)+$/gi)){l=l.split(" ");m=!1;if(1<l.length&&(t=d.trim(l[0]),l=d.trim(l[1]),k.match(new RegExp(t,"gi"))))for(k=l.split(":"),1===k.length&&(k=k.concat(["00","00"])),2===k.length&&(k=k.concat(["00"])),f=f.split(" ").slice(3,6),m=!0,t=0;t<f.length;t++)if(parseInt(f[t],10)!==parseInt(k[t],10)){m=!1;break}f=m}else if(l.match(/(d|h|m|s)/gi))f=parseInt(l,10),l=l.replace(f,""),k=0,"s"=== | ||
l?k=1:"m"===l?k=60:"h"===l?k=3600:"d"===l&&(k=86400),k*=f,f=m-t,f=0<k&&0===f%k;else{k=l.split(" ");f=f.split(" ");t=m="";for(l=0;l<k.length;l++)"*"===k[l]&&(f[l]="*"),m+=k[l],t+=f[l];f=m===t}f&&(r.fn(),r.repeat||c.splice(p,1))}else clearInterval(h),h=null}function b(b,g,m){m=m||!1;c.push({fn:g,time:b,at:d.time(),repeat:!m});h||(h=setInterval(a,1E3))}var c=[],h;return{yearly:function(a,c){b("* "+a,c)},monthly:function(a,c){b("* * "+a,c)},daily:function(a,c){b("* * * "+a,c)},hourly:function(a,c){b("* * * * "+ | ||
a,c)},every:function(a,c){b(a,c)},once:function(a,c){b(a,c,!0)}}}();"node"===d.ENV?module.exports=d:(u=u||window,B(u.define)&&u.define.amd&&u.define(function(){return d}),u.Bella=d)})(); | ||
b=!{toString:null}.propertyIsEnumerable("toString"),c="toString toLocaleString valueOf hasOwnProperty isPrototypeOf propertyIsEnumerable constructor".split(" "),d=c.length;return function(e){if("object"!==typeof e&&("function"!==typeof e||null===e))throw new TypeError("Object.keys called on non-object");var f=[],k;for(k in e)a.call(e,k)&&f.push(k);if(b)for(k=0;k<d;k++)a.call(e,c[k])&&f.push(c[k]);return f}}());var A=function(a){return"undefined"!==a},B=function(a){return!a||null===a||t(a)&&0===a.length|| | ||
w(a)&&0===Object.keys(a).length},t=function(a){return null!==a&&"array"==y(a)},m=function(a){return null!==a&&"string"==typeof a},x=function(a){return!isNaN(a)&&"number"==typeof Number(a)},C=function(a){return null!==a&&"function"==y(a)},D=function(a){return null!==a&&"element"==y(a)},w=function(a){return null!==a&&"object"==typeof a};d.isDef=A;d.isNull=function(a){return null===a};d.isEmpty=B;d.isEND=function(a){return B(a)||!A(a)};d.isBoolean=function(a){return!0===a||!1===a};d.isArray=t;d.isString= | ||
m;d.isNumber=x;d.isFunction=C;d.isElement=D;d.isObject=w;d.id=z(32);d.createId=z;d.encode=function(a){return m(a)?encodeURIComponent(a):""};d.decode=function(a){return m(a)?decodeURIComponent(a.replace(/\+/g," ")):""};d.trim=function(a){return(a&&m(a)?a.replace(/^[\s\xa0]+|[\s\xa0]+$/g,""):a)||""};d.truncate=function(a,b){if(!a||!m(a))return"...";a=d.trim(a);if(""==a)return a;var c=b||140;if(a.length<=c)return a;var q=a.substring(0,c),e=q.split(" "),f="";1<e.length?(e.pop(),f+=e.join(" "),f.length< | ||
a.length&&(f+="...")):(q.substring(0,c-3),f+="...");return f};d.stripTags=function(a){return m(a)?a.replace(/<\w+(\s+("[^"]*"|'[^']*'|[^>])+)?>|<\/\w+>/gi,""):""};d.escapeHTML=function(a){return m(a)?a.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,"""):""};d.unescapeHTML=function(a){return m(a)?a.replace(/"/g,'"').replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&"):""};d.strtolower=function(a){return m(a)?a.toLowerCase():""};d.strtoupper=function(a){return m(a)? | ||
a.toUpperCase():""};d.ucfirst=function(a){return m(a)?a.charAt(0).toUpperCase()+a.slice(1):""};d.ucwords=function(a){if(m(a)){var b=[];a.split(" ").forEach(function(a){b.push(d.ucfirst(a))});return b.join(" ")}return""};d.leftPad=function(a,b,c){x(a)&&(a+="");return m(a)?(a+="",b=b||2,a.length>=b?a:Array(b-a.length+1).join(c||"0")+a):""};d.rightPad=function(a,b,c){x(a)&&(a+="");return m(a)?(a+="",b=b||2,a.length>=b?a:a+Array(b-a.length+1).join(c||"0")):""};d.replaceAll=function(a,b,c){if(!m(a))return""; | ||
x(b)&&(b+="");x(c)&&(c+="");if(m(b)&&m(c))a=a.split(b).join(c);else if(t(b)&&m(c))b.forEach(function(b){a=d.replaceAll(a,b,c)});else if(t(b)&&t(c)&&b.length===c.length){var q=b.length;if(0<q)for(var e=0;e<q;e++)a=d.replaceAll(a,b[e],c[e])}return a};d.md5=function(){for(var a=[],b=0;64>b;)a[b]=0|4294967296*Math.abs(Math.sin(++b));return function(c){var b,e,f,k,d=[];c=unescape(encodeURI(c));for(var l=c.length,g=[b=1732584193,e=-271733879,~b,~e],h=0;h<=l;)d[h>>2]|=(c.charCodeAt(h)||128)<<8*(h++%4);d[c= | ||
16*(l+8>>6)+14]=8*l;for(h=0;h<c;h+=16){l=g;for(k=0;64>k;)l=[f=l[3],(b=l[1]|0)+((f=l[0]+[b&(e=l[2])|~b&f,f&b|~f&e,b^e^f,e^(b|~f)][l=k>>4]+(a[k]+(d[[k,5*k+1,3*k+5,7*k][l]%16+h]|0)))<<(l=[7,12,17,22,5,9,14,20,4,11,16,23,6,10,15,21][4*l+k++%4])|f>>>32-l),b,e];for(k=4;k;)g[--k]=g[k]+l[k]}for(c="";32>k;)c+=(g[k>>3]>>4*(1^k++&7)&15).toString(16);return c}}();d.sha1=function(a){var b=0,c=0,d=[],e,f,k,n,l,g,h=[e=1732584193,f=4023233417,~e,~f,3285377520],r=[],p=unescape(encodeURI(a));for(e=p.length;c<=e;)r[c>> | ||
2]|=(p.charCodeAt(c)||128)<<8*(3-c++%4);for(r[a=(e+8>>6<<4)+15]=e<<3;b<=a;b+=16){e=h;for(c=0;80>c;e=[[(g=((p=e[0])<<5|p>>>27)+e[4]+(d[c]=16>c?~~r[b+c]:g<<1|g>>>31)+1518500249)+((f=e[1])&(k=e[2])|~f&(n=e[3])),l=g+(f^k^n)+341275144,g+(f&k|f&n|k&n)+882459459,l+1535694389][0|c++/20]|0,p,f<<30|f>>>2,k,n])g=d[c-3]^d[c-8]^d[c-14]^d[c-16];for(c=5;c;)h[--c]=h[c]+e[c]|0}for(a="";40>c;)a+=(h[c>>3]>>4*(7-c++%8)&15).toString(16);return a};d.sha256=function(){function a(a,b){return a>>>b|a<<32-b}for(var b=1,c, | ||
d=[],e=[];18>++b;)for(c=b*b;312>c;c+=b)e[c]=1;b=1;for(c=0;313>b;)e[++b]||(e[c]=Math.pow(b,.5)%1*4294967296|0,d[c++]=Math.pow(b,1/3)%1*4294967296|0);return function(f){for(var k=e.slice(b=0),n=unescape(encodeURI(f)),l=[],g=n.length,h=[],r,p;b<g;)h[b>>2]|=(n.charCodeAt(b)&255)<<8*(3-b++%4);g*=8;h[g>>5]|=128<<24-g%32;h[p=(g+64>>9<<4)+15]=g;for(b=0;b<p;b+=16){for(n=k.slice(c=0,8);64>c;n[4]+=r)l[c]=16>c?h[c+b]:(a(r=l[c-2],17)^a(r,19)^r>>>10)+(l[c-7]|0)+(a(r=l[c-15],7)^a(r,18)^r>>>3)+(l[c-16]|0),n.unshift((r= | ||
(n.pop()+(a(f=n[4],6)^a(f,11)^a(f,25))+((f&n[5]^~f&n[6])+d[c])|0)+(l[c++]|0))+(a(g=n[0],2)^a(g,13)^a(g,22))+(g&n[1]^n[1]&n[2]^n[2]&g));for(c=8;c--;)k[c]=n[c]+k[c]}for(n="";63>c;)n+=(k[++c>>3]>>4*(7-c%8)&15).toString(16);return n}}();d.unique=function(a){if(t(a)){for(var b=[],c=0;c<a.length;c++)-1===b.indexOf(a[c])&&b.push(a[c]);return b}return a};d.max=function(a){return t(a)?Math.max.apply({},a):a};d.min=function(a){return t(a)?Math.min.apply({},a):a};d.contains=function(a,b,c){if(t(a))for(var d= | ||
0;d<a.length;d++){var e=a[d];if(c&&e[c]===b[c]||e===b)return!0}return!1};d.msort=function(a,b){var c=b||{};if(-1===b||1===b||"asc"===b||"desc"===b)c={order:b};if(t(a)&&0<a.length&&w(c)){var d=c.sortBy||null,c=c.order||"asc",e="asc"===c||1===c?1:-1,f=!1;d&&a.filter(function(a){return a.hasOwnProperty(d)}).length===a.length&&(f=d);f?a.sort(function(a,b){return a[f]>b[f]?e:a[f]<b[f]?-1*e:0}):a.sort(function(a,b){return a>b?e:a<b?-1*e:0})}return a};d.round=function(a,b){return Math.round(a*Math.pow(10, | ||
b))/Math.pow(10,b)};d.inherits=Object.create;d.copies=function(a,b,c,q){c=c||!1;q=q||[];for(var e in a)if(!(0<q.length&&d.contains(q,e))&&(!c||c&&b.hasOwnProperty(e))){var f=a[e],k=b[e];w(k)&&w(f)||t(k)&&t(f)?b[e]=d.copies(f,b[e],c,q):b[e]=f}return b};d.clone=function(a){if(null==a||"object"!=typeof a)return a;if(a instanceof Date){var b=new Date;b.setTime(a.getTime());return b}if(a instanceof Array){b=[];a=a.slice(0);for(var c=0,q=a.length;c<q;++c)b[c]=d.clone(a[c]);return b}if(a instanceof Object){b= | ||
{};for(c in a)"clone"!=c&&a.hasOwnProperty(c)&&(b[c]=d.clone(a[c]));return b}return!1};d.bind=function(a,b){return function(){return b.apply(a,arguments)}};if("browser"==d.ENV){d.device=function(){function a(a){return a.test(b)}var b=navigator.userAgent.toLowerCase();return{isStandard:window.localStorage,isWebkit:-1<b.indexOf("applewebkit"),isGecko:-1<b.indexOf("gecko")&&-1==b.indexOf("khtml"),isChrome:-1<b.indexOf("applewebkit")&&-1<b.indexOf("chrome")&&-1===b.indexOf("midori"),isSafari:-1<b.indexOf("applewebkit")&& | ||
-1==b.indexOf("chrome")&&-1===b.indexOf("midori"),isFirefox:-1<b.indexOf("gecko")&&0<b.indexOf("firefox"),isMidori:-1<b.indexOf("midori"),isIE:window.attachEvent&&!window.opera,isOpera:window.opera,isLinux:-1!=b.indexOf("linux"),isWin:-1!=b.indexOf("win"),isMac:-1!=b.indexOf("mac"),isUnix:-1!=b.indexOf("x11"),isAndroid:a(/android/i),isIOS:a(/(ipad|iphone|ipod)/i),isKindle:a(/\W(kindle|silk)\W/i),isMobile:a(/(iphone|ipod|((?:android)?.*?mobile)|blackberry|nokia)/i),isTablet:a(/(ipad|android(?!.*mobile))/i), | ||
isTV:a(/googletv|sonydtv/i),isIPad:a(/ipad/i),isIPhone:a(/iphone/i),isIPod:a(/ipod/i),isWPhone:a(/iemobile/i)}}();var u=function(a){var b=(m(a)?document.getElementById(a):a)||null;b&&D(b)&&(b.hasClass=function(a){var b=!0,d=this.className.split(" ");a=a.split(" ");for(var f=0;f<a.length;f++)if(-1===d.indexOf(a[f])){b=!1;break}return b},b.addClass=function(a){a=a.split(" ");var b=this.className.split(" ");a=a.concat(b);this.className=d.unique(a).join(" ");return this},b.removeClass=function(a){var b= | ||
this.className.split(" ");a=a.split(" ");for(var d=0;d<a.length;d++)this.hasClass(a[d])&&b.splice(b.indexOf(a[d]),1);this.className=b.join(" ");return this},b.toggleClass=function(a){b.hasClass(a)?b.removeClass(a):b.addClass(a);return this},b.empty=function(){for(;b.firstChild;)b.removeChild(b.firstChild);return b},b.html=function(a){if(!a)return b.innerHTML;b.innerHTML=a;return b},b.text=function(a){if(!a)return b.innerText||b.textContent;b.innerText?b.innerText=a:b.textContent&&(b.textContent=a); | ||
return b},b.destroy=function(){this.parentNode&&this.parentNode.removeChild(this)});return b};d.dom={one:function(a){var b=null;(a=document.querySelector(a))&&(b=u(a));return b},all:function(a){var b=[];if(a=document.querySelectorAll(a))for(var c=0;c<a.length;c++)b.push(u(a[c]));return b},get:u,add:function(a,b){var c=b?d.element(b):document.body,q=document.createElement(a);c.appendChild(q);return u(q)},create:function(a){return u(document.createElement(a))}};d.event=function(){return{listen:function(a, | ||
b,c){"wheel"==b&&(b=d.device.isFirefox?"DOMMouseScroll":"mousewheel");a=m(a)?u(a):a;c=c||function(){};a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent&&a.attachEvent("on"+b,c)},ignore:function(a,b,c){a=m(a)?u(a):a;a.removeEventListener?a.removeEventListener(b,c,!1):a.detachEvent&&a.detachEvent("on"+b,c)},simulate:function(a,b){var c,d=m(a)?u(a):a;document.createEventObject?(c=document.createEventObject(),d.fireEvent("on"+b,c)):(c=document.createEvent("HTMLEvents"),c.initEvent(b,!0,!0), | ||
d.dispatchEvent(c))},exit:function(a){a.cancelBubble=!0;a.stopPropagation&&a.stopPropagation();a.preventDefault&&a.preventDefault();return!1},locate:function(a){a=a||window.event;(a=a.target||a.srcElement)&&3==a.nodeType&&(a=a.parentNode);return u(a)}}}()}d.now=function(){return new Date};d.time=function(){return(new Date).getTime()};d.date=function(){var a="D, M d, Y H:i:s A",b="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),c="January February March April May June July August September October November December".split(" "), | ||
q=function(){var a=(new Date).getTimezoneOffset(),b=Math.abs(a/60);return["GMT",0>a?"+":"-",d.leftPad(b,2)].join("")}(),e=function(f,e){var n=!1,l,g;e=e?(new Date(e)).getTime():d.time();f||(f=a);var h=function(a){return""+(10>a?"0"+a:a)};l=e instanceof Date?e:new Date(e);if(isNaN(l.getTime()))if(/^(\d+-\d+-\d+)\s(\d+:\d+:\d+)$/i.test(e))l=new Date(e.replace(" ","T"));else return e+" !";if(0<f.indexOf("a")||0<f.indexOf("A"))n=!0;g={Y:function(){return l.getFullYear()},y:function(){return(g.Y()+"").slice(-2)}, | ||
F:function(){return c[g.n()-1]},M:function(){return(g.F()+"").slice(0,3)},m:function(){return h(g.n())},n:function(){return l.getMonth()+1},S:function(){var a=g.j()+" ",b=a.charAt(a.length-2);return"1"===b?a+"st":"2"===b?a+"nd":"3"===b?a+"rd":a+"th"},j:function(){return l.getDate()},d:function(){return h(g.j())},t:function(){return(new Date(g.Y(),g.n(),0)).getDate()},w:function(){return l.getDay()},l:function(){return b[g.w()]},D:function(){return(g.l()+"").slice(0,3)},G:function(){return l.getHours()}, | ||
g:function(){return g.G()%12||12},h:function(){return h(g.g())},H:function(){return n?g.h():h(g.G())},i:function(){return h(l.getMinutes())},s:function(){return h(l.getSeconds())},a:function(){return 11<g.G()?"pm":"am"},A:function(){return g.a().toUpperCase()},O:function(){return q}};return f.replace(/\.*\\?([a-z])/gi,function(a,b){return g[a]?g[a]():b})};return{pattern:function(b){return b?a=b:a},utc:function(a){return(new Date(a||d.now())).toUTCString()},local:function(a){return e("D, j M Y H:i:s O", | ||
a)},strtotime:function(a){return(new Date(a)).getTime()},format:e,relativize:function(a){var b=a instanceof Date?a:new Date(a);a=new Date-b;b=parseInt(b,10);isNaN(b)&&(b=0);if(a<=b)return"Just now";var b=null,c={millisecond:1,second:1E3,minute:60,hour:60,day:24,month:30,year:12},d;for(d in c)if(a<c[d])break;else b=d,a/=c[d];a=Math.floor(a);1!==a&&(b+="s");return[a,b].join(" ")+" ago"}}}();d.scheduler=function(){function a(){var a=d.time(),b=Math.round(a/1E3),k=d.date.format("Y m d H i s",a),a=d.date.format("l", | ||
a);if(0<c.length)for(var n=c.length-1;0<=n;n--){var l=c[n],g;g=k;var h=a,r=b,p=l.time,m=Math.round(l.at/1E3);if(p.match(/^(sun|mon|tue|wed|thu|fri|sat)+(\w+)?(\s+)+(\d+(:\d)?)+$/gi)){p=p.split(" ");r=!1;if(1<p.length&&(m=d.trim(p[0]),p=d.trim(p[1]),h.match(new RegExp(m,"gi"))))for(h=p.split(":"),1===h.length&&(h=h.concat(["00","00"])),2===h.length&&(h=h.concat(["00"])),g=g.split(" ").slice(3,6),r=!0,m=0;m<g.length;m++)if(parseInt(g[m],10)!==parseInt(h[m],10)){r=!1;break}g=r}else if(p.match(/(d|h|m|s)/gi))g= | ||
parseInt(p,10),p=p.replace(g,""),h=0,"s"===p?h=1:"m"===p?h=60:"h"===p?h=3600:"d"===p&&(h=86400),h*=g,g=r-m,g=0<h&&0===g%h;else{h=p.split(" ");g=g.split(" ");m=r="";for(p=0;p<h.length;p++)"*"===h[p]&&(g[p]="*"),r+=h[p],m+=g[p];g=r===m}g&&(l.fn(),l.repeat||c.splice(n,1))}else clearInterval(q),q=null}function b(b,f,k){k=k||!1;c.push({fn:f,time:b,at:d.time(),repeat:!k});q||(q=setInterval(a,1E3))}var c=[],q;return{yearly:function(a,c){b("* "+a,c)},monthly:function(a,c){b("* * "+a,c)},daily:function(a, | ||
c){b("* * * "+a,c)},hourly:function(a,c){b("* * * * "+a,c)},every:function(a,c){b(a,c)},once:function(a,c){b(a,c,!0)}}}();"node"===d.ENV?module.exports=d:(v=v||window,C(v.define)&&v.define.amd&&v.define(function(){return d}),v.Bella=d)})(); |
1208984
10420