UNPKG

eapp

Version:
1 lines 3.13 kB
var Ibox,iboxLoad;!function(){var u={},a=[],l={},f=".";overrideBy=function(t,e){var o=e.exports._id_;if(0==t.indexOf(o+f))return iboxLoad(t);var r=o+"@"+t;return u[r]||(u[r]={id:r,factory:u[t].factory,build:!1}),iboxLoad(r,"@")},iboxLoad=function(t,e){if(e=e||f,!u[t])throw"模块:"+t+"不存在!";var o=null;if(0<t.indexOf(e)){var r=t.lastIndexOf(e),n=t.slice(0,r);o=iboxLoad(n,e)}else if(t in l){throw"不能循环引用:"+(a.slice(l[t]).join("->")+"->"+t)}if(0==u[t].build)try{l[t]=a.length,a.push(t);var i=function(r,t){var e=r.factory;return r.exports={_id_:r.id,getId:function(){return r.id}},r.super=t,r.build=!0,e(function(t){var e=t;if("."===t.charAt(0)){var o=r.id.lastIndexOf(f);e=r.id.slice(0,o),"./"!=t&&(e+=f+t.slice(2))}return iboxLoad(e)},r.exports,r),r.exports.overrideBy=function(t){return overrideBy(t,r)},r.exports}(u[t],o);if(null!=o&&null!=o&&""!=o){var c=Ibox.utils.clone(o);i=Ibox.utils.extend(c,i),u[t].exports=i}return i}finally{delete l[t],a.pop()}return u[t].exports},(Ibox=function(t,e){if(u[t])throw"模块:"+t+"已经定义了!";u[t]={id:t,factory:e,build:!1}}).remove=function(t){delete u[t]},Ibox.map=u}(),Ibox("Ibox-utils",function(t,r,e){var n=!0,i=1;function o(t,e,o){n&&(o=o||"",e=e||"",1==i?2==t?console.warn(e,o):3==t?console.error(e,o):console.log(e,o):alert(e+JSON.stringify(o)))}r.setDebug=function(t,e){n=t,i=e||i},r.extend=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var o,r,n=!0;r=("boolean"==typeof t[0]?(n=t[0],o=t[1],t.splice(0,2)):(o=t[0],t.splice(0,1)),t);for(var i=0;i<r.length;i+=1){var c=t[i];if(null!=c)for(var u=Object.keys(Object(c)),a=0,l=u.length;a<l;a+=1){var f=u[a],s=Object.getOwnPropertyDescriptor(c,f);void 0!==s&&s.enumerable&&(n?this.isObject(o[f])&&this.isObject(c[f])?this.extend(o[f],c[f]):!this.isObject(o[f])&&this.isObject(c[f])?(o[f]={},this.extend(o[f],c[f])):o[f]=c[f]:o[f]=c[f])}}return o},r.isObject=function(t){return"object"==typeof t&&null!==t&&t.constructor&&t.constructor===Object},r.typeName=function(t){return Object.prototype.toString.call(t).slice(8,-1)},r.isArray=Array.isArray||function(t){return"Array"===r.typeName(t)},r.isDate=function(t){return t instanceof Date},r.clone=function(t){if(!t||"function"==typeof t||r.isDate(t)||"object"!=typeof t)return t;var e,o;if(r.isArray(t)){for(e=[],o=0;o<t.length;++o)e.push(r.clone(t[o]));return e}for(o in e={},t)o in e&&e[o]===t[o]||void 0===t[o]||"unknown"==typeof t[o]||(e[o]=r.clone(t[o]));return e},r.isEmpty=function(t){return null==t||null==t||""===t},r.showLog=function(t,e){o(1,t,e)},r.showWarnLog=function(t,e){o(2,t,e)},r.showErrorLog=function(t,e){o(3,t,e)},r.saveItem=function(t,e){window.localStorage.setItem(t,e)},r.removeItem=function(t){window.localStorage.removeItem(t)},r.getItem=function(t){return window.localStorage.getItem(t)},r.getItemJO=function(t){try{var e=r.getItem(t);return JSON.parse(e)}catch(t){return r.showErrorLog("getItemJO--\x3e",t),null}},r.addJavaScript=function(t,e,o){var r=document.createElement("script");r.onload=e,r.onerror=o,r.src=t,document.head.appendChild(r)}}),Ibox("Ibox",function(){}),Ibox.utils=iboxLoad("Ibox-utils");