-
Notifications
You must be signed in to change notification settings - Fork 592
/
outils.min.js
1 lines (1 loc) · 11.2 KB
/
outils.min.js
1
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.outils=t():e.outils=t()}(window,function(){return function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=5)}([function(e,t){e.exports=function(e,t){return new RegExp("(\\s|^)"+t+"(\\s|$)").test(e.className)}},function(e,t){e.exports=function(e,t,n){var o=new Date;o.setDate(o.getDate()+n),document.cookie=e+"="+t+";expires="+o}},function(e,t){e.exports=function(){return document.documentElement&&document.documentElement.scrollTop||document.body.scrollTop}},function(e,t){e.exports=function(e){return window.scrollTo(0,e),e}},function(e,t){e.exports=function(e,t,n,o){var r,i=0;return"boolean"!=typeof t&&(o=n,n=t,t=void 0),function(){var a=this,s=Number(new Date)-i,u=arguments;function f(){i=Number(new Date),n.apply(a,u)}o&&!r&&f(),r&&clearTimeout(r),void 0===o&&s>e?f():!0!==t&&(r=setTimeout(o?function(){r=void 0}:f,void 0===o?e-s:e))}}},function(e,t,n){var o={},r=n(6);r.keys().forEach(function(e){var t=e.substring(e.lastIndexOf("/")+1,e.lastIndexOf("."));o[t]=r(e)}),e.exports=o},function(e,t,n){var o={"./array/arrayEqual.js":7,"./class/addClass.js":8,"./class/hasClass.js":0,"./class/removeClass.js":9,"./cookie/getCookie.js":10,"./cookie/removeCookie.js":11,"./cookie/setCookie.js":1,"./device/getExplore.js":12,"./device/getOS.js":13,"./dom/getScrollTop.js":2,"./dom/offset.js":14,"./dom/scrollTo.js":15,"./dom/setScrollTop.js":3,"./dom/windowResize.js":16,"./function/debounce.js":17,"./function/throttle.js":4,"./keycode/getKeyName.js":18,"./object/deepClone.js":19,"./object/isEmptyObject.js":20,"./random/randomColor.js":21,"./random/randomNum.js":22,"./regexp/isColor.js":23,"./regexp/isEmail.js":24,"./regexp/isIdCard.js":25,"./regexp/isPhoneNum.js":26,"./regexp/isUrl.js":27,"./string/digitUppercase.js":28,"./support/isSupportWebP.js":29,"./time/formatPassTime.js":30,"./time/formatRemainTime.js":31,"./time/isLeapYear.js":32,"./time/isSameDay.js":33,"./time/monthDays.js":34,"./time/timeLeft.js":35,"./url/parseQueryString.js":36,"./url/stringfyQueryString.js":37};function r(e){var t=i(e);return n(t)}function i(e){var t=o[e];if(!(t+1)){var n=new Error("Cannot find module '"+e+"'");throw n.code="MODULE_NOT_FOUND",n}return t}r.keys=function(){return Object.keys(o)},r.resolve=i,e.exports=r,r.id=6},function(e,t){e.exports=function(e,t){if(e===t)return!0;if(e.length!=t.length)return!1;for(var n=0;n<e.length;++n)if(e[n]!==t[n])return!1;return!0}},function(e,t,n){var o=n(0);e.exports=function(e,t){o(e,t)||(e.className+=" "+t)}},function(e,t,n){var o=n(0);e.exports=function(e,t){if(o(e,t)){var n=new RegExp("(\\s|^)"+t+"(\\s|$)");e.className=e.className.replace(n," ")}}},function(e,t){e.exports=function(e){for(var t=document.cookie.replace(/\s/g,"").split(";"),n=0;n<t.length;n++){var o=t[n].split("=");if(o[0]==e)return decodeURIComponent(o[1])}return""}},function(e,t,n){var o=n(1);e.exports=function(e){o(e,"1",-1)}},function(e,t){e.exports=function(){var e,t={},n=navigator.userAgent.toLowerCase();return(e=n.match(/rv:([\d.]+)\) like gecko/))?t.ie=e[1]:(e=n.match(/msie ([\d\.]+)/))?t.ie=e[1]:(e=n.match(/edge\/([\d\.]+)/))?t.edge=e[1]:(e=n.match(/firefox\/([\d\.]+)/))?t.firefox=e[1]:(e=n.match(/(?:opera|opr).([\d\.]+)/))?t.opera=e[1]:(e=n.match(/chrome\/([\d\.]+)/))?t.chrome=e[1]:(e=n.match(/version\/([\d\.]+).*safari/))&&(t.safari=e[1]),t.ie?"IE: "+t.ie:t.edge?"EDGE: "+t.edge:t.firefox?"Firefox: "+t.firefox:t.chrome?"Chrome: "+t.chrome:t.opera?"Opera: "+t.opera:t.safari?"Safari: "+t.safari:"Unkonwn"}},function(e,t){e.exports=function(){var e="navigator"in window&&"userAgent"in navigator&&navigator.userAgent.toLowerCase()||"",t=("navigator"in window&&"vendor"in navigator&&navigator.vendor.toLowerCase(),"navigator"in window&&"appVersion"in navigator&&navigator.appVersion.toLowerCase()||"");return/iphone/i.test(e)||/ipad/i.test(e)||/ipod/i.test(e)?"ios":/android/i.test(e)?"android":/win/i.test(t)&&/phone/i.test(e)?"windowsPhone":/mac/i.test(t)?"MacOSX":/win/i.test(t)?"windows":/linux/i.test(t)?"linux":void 0}},function(e,t){e.exports=function(e){for(var t={left:0,top:0};e;)t.left+=e.offsetLeft,t.top+=e.offsetTop,e=e.offsetParent;return t}},function(e,t,n){var o=n(2),r=n(3),i=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(e){window.setTimeout(e,1e3/60)};e.exports=function e(t,n){if(n<0)r(t);else{var a=t-o();if(0!==a){var s=a/n*10;i(function(){Math.abs(s)>Math.abs(a)?r(o()+a):(r(o()+s),a>0&&o()>=t||a<0&&o()<=t||e(t,n-16))})}}}},function(e,t){e.exports=function(e,t){var n=window.innerHeight;e="function"==typeof e?e:function(){},t="function"==typeof t?t:function(){},window.addEventListener("resize",function(){var o=window.innerHeight;o===n&&e(),o<n&&t()})}},function(e,t,n){var o=n(4);e.exports=function(e,t,n){return void 0===n?o(e,t,!1):o(e,n,!1!==t)}},function(e,t){var n={8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"Caps Lock",27:"Escape",32:"Space",33:"Page Up",34:"Page Down",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",42:"Print Screen",45:"Insert",46:"Delete",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",65:"A",66:"B",67:"C",68:"D",69:"E",70:"F",71:"G",72:"H",73:"I",74:"J",75:"K",76:"L",77:"M",78:"N",79:"O",80:"P",81:"Q",82:"R",83:"S",84:"T",85:"U",86:"V",87:"W",88:"X",89:"Y",90:"Z",91:"Windows",93:"Right Click",96:"Numpad 0",97:"Numpad 1",98:"Numpad 2",99:"Numpad 3",100:"Numpad 4",101:"Numpad 5",102:"Numpad 6",103:"Numpad 7",104:"Numpad 8",105:"Numpad 9",106:"Numpad *",107:"Numpad +",109:"Numpad -",110:"Numpad .",111:"Numpad /",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"Num Lock",145:"Scroll Lock",182:"My Computer",183:"My Calculator",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"};e.exports=function(e){return n[e]?n[e]:(console.log("Unknow Key(Key Code:"+e+")"),"")}},function(e,t){var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};e.exports=function e(t){var o;if(null==t||"object"!=(void 0===t?"undefined":n(t)))return t;if(t instanceof Date)return(o=new Date).setTime(t.getTime()),o;if(t instanceof Array){o=[];for(var r=0,i=t.length;r<i;r++)o[r]=e(t[r]);return o}if(t instanceof Object){for(var a in o={},t)t.hasOwnProperty(a)&&(o[a]=e(t[a]));return o}throw new Error("Unable to copy values! Its type isn't supported.")}},function(e,t){var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};e.exports=function(e){return!(!e||"object"!==(void 0===e?"undefined":n(e))||Array.isArray(e)||Object.keys(e).length)}},function(e,t){e.exports=function(){return"#"+("00000"+(16777216*Math.random()<<0).toString(16)).slice(-6)}},function(e,t){e.exports=function(e,t){return e=Math.ceil(e),t=Math.floor(t),Math.floor(Math.random()*(t-e+1))+e}},function(e,t){e.exports=function(e){return/^(#([0-9a-fA-F]{3}){1,2}|[rR][gG][Bb](\((\s*(2[0-4]\d|25[0-5]|[01]?\d{1,2})\s*,){2}\s*(2[0-4]\d|25[0-5]|[01]?\d{1,2})\s*\)|[Aa]\((\s*(2[0-4]\d|25[0-5]|[01]?\d{1,2})\s*,){3}\s*([01]|0\.\d+)\s*\)))$/.test(e)}},function(e,t){e.exports=function(e){return/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/.test(e)}},function(e,t){e.exports=function(e){return/^(^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$)|(^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])((\d{4})|\d{3}[Xx])$)$/.test(e)}},function(e,t){e.exports=function(e){return/^(\+?0?86\-?)?1[3456789]\d{9}$/.test(e)}},function(e,t){e.exports=function(e){return/[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/i.test(e)}},function(e,t){e.exports=function(e){var t=["角","分"],n=["零","壹","贰","叁","肆","伍","陆","柒","捌","玖"],o=[["元","万","亿"],["","拾","佰","仟"]],r=e<0?"欠":"";e=Math.abs(e);for(var i="",a=0;a<t.length;a++)i+=(n[Math.floor(10*e*Math.pow(10,a))%10]+t[a]).replace(/零./,"");for(i=i||"整",e=Math.floor(e),a=0;a<o[0].length&&e>0;a++){for(var s="",u=0;u<o[1].length&&e>0;u++)s=n[e%10]+o[1][u]+s,e=Math.floor(e/10);i=s.replace(/(零.)*零$/,"").replace(/^$/,"零")+o[0][a]+i}return r+i.replace(/(零.)*零元/,"元").replace(/(零.)+/g,"零").replace(/^整$/,"零元整")}},function(e,t){e.exports=function(){return!![].map&&0==document.createElement("canvas").toDataURL("image/webp").indexOf("data:image/webp")}},function(e,t){e.exports=function(e){var t=Date.parse(new Date)-e,n=parseInt(t/864e5),o=parseInt(t/36e5),r=parseInt(t/6e4),i=parseInt(n/30),a=parseInt(i/12);return a?a+"年前":i?i+"个月前":n?n+"天前":o?o+"小时前":r?r+"分钟前":"刚刚"}},function(e,t){e.exports=function(e){var t=new Date,n=new Date(e).getTime()-t.getTime(),o=0,r=0,i=0,a=0;return n>=0&&(o=Math.floor(n/1e3/3600/24),r=Math.floor(n/1e3/60/60%24),i=Math.floor(n/1e3/60%60),a=Math.floor(n/1e3%60)),o+"天 "+r+"小时 "+i+"分钟 "+a+"秒"}},function(e,t){e.exports=function(e){return 0==e%4&&(e%100!=0||e%400==0)}},function(e,t){e.exports=function(e,t){t||(t=new Date);var n=e.getFullYear(),o=e.getMonth()+1,r=e.getDate(),i=t.getFullYear(),a=t.getMonth()+1;return r===t.getDate()&&o===a&&n===i}},function(e,t){e.exports=function(e){var t=(e=new Date(e)).getFullYear(),n=e.getMonth()+1;return new Date(t,n,0).getDate()}},function(e,t){e.exports=function(e,t){if(e&&t){var n;n=e instanceof Date?e:new Date(e.replace(/-/g,"/"));var o=(t instanceof Date?t:new Date(t.replace(/-/g,"/"))).getTime()-n.getTime(),r=0,i=0,a=0,s=0;return o>=0&&(r=Math.floor(o/1e3/3600/24),i=Math.floor(o/1e3/60/60%24),a=Math.floor(o/1e3/60%60),s=Math.floor(o/1e3%60)),{d:r,h:i,m:a,s:s}}}},function(e,t){e.exports=function(e){if(-1===(e=e||window.location.href).indexOf("?"))return{};var t="?"===e[0]?e.substr(1):e.substring(e.lastIndexOf("?")+1);if(""===t)return{};t=t.split("&");for(var n={},o=0;o<t.length;o++){var r=t[o].split("=");n[decodeURIComponent(r[0])]=decodeURIComponent(r[1]||"")}return n}},function(e,t){e.exports=function(e){if(!e)return"";var t=[];for(var n in e){var o=e[n];if(o instanceof Array)for(var r=0;r<o.length;++r)t.push(encodeURIComponent(n+"["+r+"]")+"="+encodeURIComponent(o[r]));else t.push(encodeURIComponent(n)+"="+encodeURIComponent(e[n]))}return t.join("&")}}])});