1 |
- !function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.comutils=n():e.comutils=n()}("undefined"!=typeof self?self:this,function(){return function(e){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}var t={};return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get: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,n){return Object.prototype.hasOwnProperty.call(e,n)},n.p="",n(n.s=2)}([function(e,n){var t=function(e){return Object.prototype.toString.call(e).slice(8,-1)};e.exports=t},function(e,n){var t=function(e,n){return Math.floor(Math.random()*(n-e+1)+e)};e.exports=t},function(e,n,t){var o=t(3),r=t(4),i=t(5),a=t(6),s=t(7),u=t(8),c=t(9),f=t(10),l=t(11),d=t(12),p=t(13),m=t(14),v=t(15),g=t(16),h=t(17),w=t(18),x=t(19),y=t(0),b=t(20),A=t(21),T=t(22),S=t(1),I=t(23),R=t(24),C=t(25),E=t(26);e.exports={classApi:o,copyObj:r,isEmail:i,isIdCard:a,isPhoneNum:s,isUrl:u,priceSubstr:c,cookieApi:f,scrollApi:l,getOs:x,localStorageApi:d,formatTime:p,formatPassTime:m,throttle:v,debounce:g,isWeixin:h,mobileType:w,typeOf:y,secretInfo:b,getUrlParams:A,stringfyQs:T,getRandom:S,shuffle:I,arrayEqual:R,animationFrame:C,prefixStyle:E}},function(e,n){var t={isElement:function(e){return e&&e.nodeType===Node.ELEMENT_NODE},hasClass:function(e,n){return new RegExp("(\\s|^)"+n+"(\\s|$)").test(e.className)},addClass:function(e,n){this.hasClass(e,n)||(e.className+=" "+n)},removeClass:function(e,n){if(this.hasClass(e,n)){var t=new RegExp("(\\s|^)"+n+"(\\s|$)");e.className=e.className.replace(t," ")}},toggleClass:function(e,n){if(this.hasClass(e,n)){var t=new RegExp("(\\s|^)"+n+"(\\s|$)");e.className=e.className.replace(t," ")}else e.className+=" "+n}};e.exports=t},function(e,n){function t(){Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)});var e=void 0,n=void 0,r=void 0,i=void 0,a=void 0,s=void 0,u=1,c=arguments[0]||{},f=!1,l=arguments.length;if("boolean"==typeof c&&(f=c,c=arguments[1]||{},u++),"object"!==(void 0===c?"undefined":o(c))&&"function"!=typeof c&&(c={}),u===l)return c;for(;u<l;u++)if(null!=(n=arguments[u]))for(e in n)r=c[e],i=n[e],a=Array.isArray(i),f&&i&&("object"===(void 0===i?"undefined":o(i))||a)?(a?(a=!1,s=r&&Array.isArray(r)?r:[]):s=r&&"object"===(void 0===r?"undefined":o(r))?r:{},c[e]=t(f,s,i)):i!==undefined&&(c[e]=i);return c}var o="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=t},function(e,n){var t=function(e){return/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/.test(e)};e.exports=t},function(e,n){var t=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)};e.exports=t},function(e,n){var t=function(e){return/^(0|86|17951)?(13[0-9]|15[012356789]|17[678]|18[0-9]|14[57])[0-9]{8}$/.test(e)};e.exports=t},function(e,n){var t=function(e){return/[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&\/\/=]*)/i.test(e)};e.exports=t},function(e,n){var t=function(){var e=arguments.length>0&&arguments[0]!==undefined?arguments[0]:"0",n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0,t=arguments.length>2&&arguments[2]!==undefined?arguments[2]:",";if(parseInt(e)!=e&&0!==n&&"."===t)throw new Error("symbol can not same as .");return e=(+e).toFixed(0===n?1:n),e=e.toString().replace(/(\d)(?=(\d{3})+\.)/g,"$1"+t),n?e:e.substring(0,e.lastIndexOf("."))};e.exports=t},function(e,n){var t={set:function(e,n,t,o,r,i){if(!e||/^(?:expires|max\-age|path|domain|secure)$/i.test(e))return!1;var a="";if(t)switch(t.constructor){case Number:a=t===Infinity?"; expires=Fri, 31 Dec 9999 23:59:59 GMT":"; max-age="+t;break;case String:a="; expires="+t;break;case Date:a="; expires="+t.toUTCString()}return document.cookie=encodeURIComponent(e)+"="+encodeURIComponent(n)+a+(r?"; domain="+r:"")+(o?"; path="+o:"")+(i?"; secure":""),!0},get:function(e){return decodeURIComponent(document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*"+encodeURIComponent(e).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=\\s*([^;]*).*$)|^.*$"),"$1"))||null},has:function(e){return new RegExp("(?:^|;\\s*)"+encodeURIComponent(e).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=").test(document.cookie)},remove:function(e,n,t){return!(!e||!this.has(e))&&(document.cookie=encodeURIComponent(e)+"=; expires=Thu, 01 Jan 1970 00:00:00 GMT"+(t?"; domain="+t:"")+(n?"; path="+n:""),!0)},keys:function(){for(var e=document.cookie.replace(/((?:^|\s*;)[^\=]+)(?=;|$)|^\s*|\s*(?:\=[^;]*)?(?:\1|$)/g,"").split(/\s*(?:\=[^;]*)?;\s*/),n=0;n<e.length;n++)e[n]=decodeURIComponent(e[n]);return e}};e.exports=t},function(e,n){var t=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(e){window.setTimeout(e,1e3/60)}}(),o={getScrollTop:function(){return document.documentElement&&document.documentElement.scrollTop||document.body.scrollTop},setScrollTop:function(e){e&&window.scrollTo(0,e)},scrollTo:function(e){var n=this,o=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0,r=arguments.length>2&&arguments[2]!==undefined?arguments[2]:4,i=e-this.getScrollTop();if(0!==i){if(o<=0)return void this.setScrollTop(e);var a=i/o*10;t(function(){if(Math.abs(a)>Math.abs(i))return void n.setScrollTop(n.getScrollTop()+i);n.setScrollTop(n.getScrollTop()+a),i>0&&n.getScrollTop()>=e||i<0&&n.getScrollTop()<=e||n.scrollTo(e,o-16/r)})}}};e.exports=o},function(e,n){var t={set:function(e,n){var t=arguments.length>2&&arguments[2]!==undefined?arguments[2]:+new Date+18e5,o={val:n,exp:t};localStorage.setItem(e,JSON.stringify(o))},get:function(e){var n=localStorage.getItem(e);if(!n)return"";var t=JSON.parse(n);return+new Date>t.exp?(this.remove(e),""):t.val},remove:function(e){localStorage.removeItem(e)},clear:function(){localStorage.clear()}};e.exports=t},function(e,n){function t(e){return"[object Date]"===Object.prototype.toString.call(e)}var o=function(e){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:"yyyy-MM-dd hh:mm:ss";!1===t(e)&&(e=new Date(+e));var o={"M+":e.getMonth()+1,"d+":e.getDate(),"h+":e.getHours(),"m+":e.getMinutes(),"s+":e.getSeconds(),"q+":Math.floor((e.getMonth()+3)/3),S:e.getMilliseconds()};/(y+)/.test(n)&&(n=n.replace(RegExp.$1,(e.getFullYear()+"").substr(4-RegExp.$1.length)));for(var r in o)new RegExp("("+r+")").test(n)&&(n=n.replace(RegExp.$1,1==RegExp.$1.length?o[r]:("00"+o[r]).substr((""+o[r]).length)));return n};e.exports=o},function(e,n){var t=function(e){var n=void 0,t=parseInt(e/864e5)<10?"0"+parseInt(e/864e5):""+parseInt(e/864e5);n=e-864e5*t;var o=parseInt(n/36e5)<10?"0"+parseInt(n/36e5):""+parseInt(n/36e5);n-=36e5*o;var r=parseInt(n/6e4)<10?"0"+parseInt(n/6e4):""+parseInt(n/6e4);return n-=6e4*r,[t,o,r,parseInt(n/1e3)<10?"0"+parseInt(n/1e3):""+parseInt(n/1e3)]};e.exports=t},function(e,n){var t=function(e){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:500,t=e,o=void 0,r=!0;return function(){var e=this,i=arguments;if(r&&(t.apply(this,i),r=!1),o)return!1;o=setTimeout(function(){clearTimeout(o),o=null,t.apply(e,i)},n)}};e.exports=t},function(e,n){var t=function(e){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:500,t=void 0;return function(){for(var o=this,r=arguments.length,i=Array(r),a=0;a<r;a++)i[a]=arguments[a];t&&clearTimeout(t),t=setTimeout(function(){e.apply(o,i)},n)}};e.exports=t},function(e,n){var t=function(){return"micromessenger"==navigator.userAgent.toLowerCase().match(/MicroMessenger/i)};e.exports=t},function(e,n){var t=function(){var e=navigator.userAgent,n=e.indexOf("Android")>-1||e.indexOf("Adr")>-1,t=!!e.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);return n?"android":t?"iphone":void 0};e.exports=t},function(e,n){var t=function(){var e=navigator.userAgent.toLowerCase(),n="ipad"==e.match(/ipad/i),t="iphone os"==e.match(/iphone os/i),o="midp"==e.match(/midp/i),r="rv:1.2.3.4"==e.match(/rv:1.2.3.4/i),i="ucweb"==e.match(/ucweb/i),a="android"==e.match(/android/i),s="windows ce"==e.match(/windows ce/i),u="windows mobile"==e.match(/windows mobile/i);return n||t||o||r||i||a||s||u?"mobile":"web"};e.exports=t},function(e,n,t){var o=t(0),r=function(e){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:3,t=arguments.length>2&&arguments[2]!==undefined?arguments[2]:3,r=arguments.length>3&&arguments[3]!==undefined?arguments[3]:"*";if("Number"===o(e)&&(e=""+e),"String"!==o(e))throw new Error("参数类型错误");if(e.length<7)throw new Error("参数长度需要大于7");var i=new RegExp("^([a-zA-Z\\d]{"+n+"})([a-zA-Z\\d]+)([a-zA-Z\\d]{"+t+"})$");return e.replace(i,function(e,n,t,o){for(var i="";i.length<t.length;)i+=r;return n+i+o})};e.exports=r},function(e,n){var t=function(e){for(var n={},t=location.search.substring(1),o=t.split("&"),r=0,i=o.length;r<i;r++){var a=o[r],s=a.split("="),u=s[0],c=s[1];"undefined"==typeof n[u]?n[u]=c:"string"==typeof n[u]?n[u]=[n[u],c]:n[u].push(c)}return e?n[e]:n};e.exports=t},function(e,n){var t=function(e){if(!e)return"";var n=[];for(var t in e){var o=e[t];if(o instanceof Array)for(var r=0;r<o.length;++r)n.push(encodeURIComponent(t+"["+r+"]")+"="+encodeURIComponent(o[r]));else n.push(encodeURIComponent(t)+"="+encodeURIComponent(e[t]))}return n.join("&")};e.exports=t},function(e,n,t){var o=t(1),r=function(e){for(var n=e.slice(),t=0,r=n.length;t<r;t++){var i=o(0,t),a=n[t];n[t]=n[i],n[i]=a}return n};e.exports=r},function(e,n){var t=function(e,n){if(e===n)return!0;if(e.length!==n.length)return!1;for(var t=0;t<e.length;++t)if(e[t]!==n[t])return!1;return!0};e.exports=t},function(e,n){var t=function(){window.cancelAnimationFrame=function(){return window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.oCancelAnimationFrame||window.msCancelAnimationFrame||function(e){return window.clearTimeout(e)}}(),window.requestAnimationFrame=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(e){return window.setTimeout(e,1e3/60)}}()};e.exports=t},function(e,n){function t(e){return!1!==r&&("standard"===r?e:r+e.charAt(0).toUpperCase()+e.substr(1))}var o=document.createElement("div").style,r=function(){var e={webkit:"webkitTransform",Moz:"MozTransform",O:"OTransform",ms:"msTransform",standard:"transform"};for(var n in e)if(o[e[n]]!==undefined)return n;return!1}();e.exports=t}])});
|