UI.js 5.4 KB

1
  1. (function(d,f){var c={site:"/",ie:function(){return d.browser.msie?parseInt(d.browser.version):99},js:function(a,b,g){var e=b.substring(b.lastIndexOf("/")+1),e=0<e.indexOf("?")?e.substring(0,e.indexOf("?")):e,e=e.replace(/[^a-z0-9]/gi,"");0==a?"function"==typeof g&&g():(this.temp[e]||(this.temp[e]=this.temp[e]||[]),this.temp[e].push(g),null==document.getElementById(e)&&(a=f.createElement("script"),a.type="text/javascript",a.id=e,a.anysc=!0,a.src=b+"?_\x3d"+(new Date).getTime(),f.all?a.onreadystatechange=function(){if("complete"==this.readyState||"loaded"==this.readyState)for(var a=c.temp[e],b=0;b<a.length;b++)"function"==typeof a[b]&&a[b]()}:a.onload=function(){for(var a=c.temp[e],b=0;b<a.length;b++)"function"==typeof a[b]&&a[b]()},f.getElementsByTagName("head")[0].appendChild(a)))},jsArr:function(a,b){var c=function(a,b,d){if(b>=a.length)"function"==typeof d&&d();else{var h=document.createElement("script");h.anysc=!0;h.src=a[b];h.charset="utf-8";h.all?h.onreadystatechange=function(){if("complete"==this.readyState||"loaded"==this.readyState)b++,c(a,b,d)}:h.onload=function(){b++;c(a,b,d)};f.getElementsByTagName("head")[0].appendChild(h)}};c(a,0,b)},css:function(a,b,c){if(0==a)"function"==typeof c&&c();else if(a=(-1==b.indexOf("?")?b.substring(b.lastIndexOf("/")+1):b.substring(b.lastIndexOf("/")+1,b.indexOf("?"))).replace(".css",""),!document.getElementById(a)){var d=f.createElement("link");d.id=a;d.rel="stylesheet";d.anysc=!0;d.href=b;f.all?d.onreadystatechange=function(){"complete"!=this.readyState&&"loaded"!=this.readyState||"function"!=typeof c||c()}:d.onload=function(){"function"==typeof c&&c()};f.getElementsByTagName("head")[0].appendChild(d)}},ie:function(){return d.browser.msie?parseInt(d.browser.version):9999},getJSON:function(a,b,c){this.js(!d[a],b,function(){"function"==typeof c&&c()})},cache:{},extend:{},temp:{},get:{dialog:function(a){var b=d(this),g=a.to;c.js(!b.openDialog,c.site+"js/min/ui/dialog.js",function(){g?(delete a.to,d(g).click(function(){b.openDialog(a)})):b.openDialog(a)})},htmlSelect:function(a){var b=this;c.js(!c.extend.htmlSelect,c.site+"js/min/ui/htmlSelect.js",function(){c.extend.htmlSelect.call(b,a)})},star:function(a){var b=this;c.css(!c.extend.star,c.site+"js/min/ui/star/jquery.rating.css");c.js(!c.extend.star,c.site+"js/min/ui/star/jquery.rating.js",function(){d(b).rating()})},draw:function(a){var b=this;c.js(!d.fn.bindDraw,c.site+"js/min/ui/draw.js",function(){d(b).bindDraw(a)})},lvtip:function(a){var b=this;c.js(!c.extend.lvtip,c.site+"js/min/ui/lvtip.js",function(){c.extend.lvtip.call(b,a)})},validate:function(a){var b=this;c.js(!c.extend.validate,c.site+"js/min/ui/validate.js",function(){c.extend.validate.call(b,a)})},date:function(a){var b=this;c.js(!window.WdatePicker,c.site+"js/min/ui/My97DatePicker/WdatePicker.js",function(){b.onclick=function(){WdatePicker(a)}})},floatDiv:function(a){var b=this;c.js(!c.extend.floatDiv,c.site+"plugin/jquery.floatDiv.js",function(){c.extend.floatDiv.call(b,a)})}},firstLoad:function(){}};d.confirm=function(a,b,d,e){c.js(!c.extend.confirm,c.site+"js/min/ui/confirm.js",function(){c.extend.confirm(a,b,d,e)})};d.confirmF=function(a,b,g,e){if(getCookie("updateTishi"))"function"==typeof b&&b();else{var f=function(a){"function"==typeof b&&b();a(!0);0<d("#check_tishi:checked").length&&addCookie("updateTishi")};a="\x3cp\x3e"+a+'\x3c/p\x3e\x3cp class\x3d"icon_align rt_align"\x3e\x3cinput class\x3d"check_tishi" value\x3d"" name\x3d"" type\x3d"checkbox" id\x3d"check_tishi"\x3e\u4e0d\u518d\u63d0\u793a\x3c/p\x3e';c.js(!c.extend.confirm,c.site+"js/min/ui/confirm.js",function(){c.extend.confirm(a,f,g,e)})}};d.alert=function(a,b,d){c.js(!c.extend.alert,c.site+"js/min/ui/confirm.js",function(){c.extend.alert(a,b,d)})};d.loadState=function(a,b,d){c.js(!c.extend.loading,c.site+"js/ui/loading.js",function(){c.extend.loading(a,b,d||{})})};d.mathjax=function(a){c.js(!window.afterLoad,c.site+"js/min/ui/latexToMathJax.js")};d.loadSuccess=function(a,b){d.loadState(1,a,b)};d.loadError=function(a,b){d.loadState(2,a,b)};d.loading=function(a,b){d.loadState(3,a,b)};d.loadInfo=function(a,b){d.loadState(4,a,b)};d.autoSaveInfo=function(a,b){var c=new Date,e=c.getHours(),f=c.getMinutes(),c=c.getSeconds();10>e&&(e="0"+e);10>f&&(f="0"+f);10>c&&(c="0"+c);e="\u5df2\u4e8e"+e+"\u70b9"+f+"\u5206"+c+"\u79d2\u81ea\u52a8\u4fdd\u5b58\u6210\u529f\uff01";d("#autoSaveTip").remove();d("body").append('\x3cdiv id\x3d"autoSaveTip" class\x3d"autoSaveTip2"\x3e'+(a||e)+"\x3c/div\x3e");d("#autoSaveTip").delay(b||2500).fadeOut(400)};d.fn.ui=function(a,b){"function"==typeof c.get[a]&&(b=b||{},this.each(function(){c.get[a].call(this,b)}));return this};var l=function(a,b){var c=0,e;for(e in a)d(e)[0]&&(c+=d(e).size());var f=0,k=0;for(e in a)d(e).each(function(){this&&(f++,common_validate.call(this,a[e],function(){k++;k==f&&k==c&&b&&b()}))});return!0};d.fn.validate=function(a,b){c.js(!c.extend.validate,c.site+"js/min/ui/validate.js");for(var f in a)d(f).ui("validate",a[f]);d(this).click(function(){l(a,function(){"function"==typeof b&&b()});return!1})};d.validate=function(a){for(var b in a)d(b).ui("validate",a[b])};d.validateGo=function(a,b){c.js(!c.extend.validate,c.site+"js/min/ui/validate.js",function(){l(a,function(){"function"==typeof b&&b()})})};window.UI=c})(jQuery,document);function errortip(d,f){window.error_tip?error_tip(d,f):UI.js(!UI.extend.validate,UI.site+"js/min/ui/validate.js",function(){error_tip(d,f)});setTimeout(function(){$("[validate\x3dmsg]").fadeOut(200,function(){$(this).remove()})},2E3)};