1 |
- (function($,d){var ui={site:"/",ie:function(){if($.browser.msie){return parseInt($.browser.version)}return 99},js:function(temp1,url,callback){var var_key=url.substring(url.lastIndexOf("/")+1);var_key=var_key.indexOf("?")>0?var_key.substring(0,var_key.indexOf("?")):var_key;var_key=var_key.replace(/[^a-z0-9]/gi,"");if(temp1==false){typeof callback=="function"&&callback();return}if(!this.temp[var_key]){this.temp[var_key]=this.temp[var_key]||[]}this.temp[var_key].push(callback);if(document.getElementById(var_key)==null){var elt=d.createElement("script");elt.type="text/javascript";elt.id=var_key;elt.anysc=true;elt.src=url+"?_="+(new Date).getTime();if(!d.all){elt.onload=function(){var tmp=ui.temp[var_key];for(var i=0;i<tmp.length;i++){typeof tmp[i]=="function"&&tmp[i]()}}}else{elt.onreadystatechange=function(){if(this.readyState=="complete"||this.readyState=="loaded"){var tmp=ui.temp[var_key];for(var i=0;i<tmp.length;i++){typeof tmp[i]=="function"&&tmp[i]()}}}}d.getElementsByTagName("head")[0].appendChild(elt)}},jsArr:function(arr,call){var loop=function(arr,i,call){if(i>=arr.length){typeof call=="function"&&call();return}var elt=document.createElement("script");elt.anysc=true;elt.src=arr[i];elt.charset="utf-8";if(elt.all){elt.onreadystatechange=function(){if(this.readyState=="complete"||this.readyState=="loaded"){i++;loop(arr,i,call)}}}else{elt.onload=function(){i++;loop(arr,i,call)}}d.getElementsByTagName("head")[0].appendChild(elt)};loop(arr,0,call)},css:function(temp1,url,callback){if(temp1==false){typeof callback=="function"&&callback();return}var id=(url.indexOf("?")==-1?url.substring(url.lastIndexOf("/")+1):url.substring(url.lastIndexOf("/")+1,url.indexOf("?"))).replace(".css","");if(document.getElementById(id)){return}var elt=d.createElement("link");elt.id=id;elt.rel="stylesheet";elt.anysc=true;elt.href=url;if(!d.all){elt.onload=function(){typeof callback=="function"&&callback()}}else{elt.onreadystatechange=function(){if(this.readyState=="complete"||this.readyState=="loaded"){typeof callback=="function"&&callback()}}}d.getElementsByTagName("head")[0].appendChild(elt)},ie:function(){if($.browser.msie){return parseInt($.browser.version)}else{return 9999}},getJSON:function(key,url,callback){this.js(!$[key],url,function(){typeof callback=="function"&&callback()})},cache:{},extend:{},temp:{},get:{dialog:function(opt){var thisObj=$(this);var selector=opt.to;ui.js(!thisObj.openDialog,ui.site+"js/min/ui/dialog.js",function(){if(selector){delete opt.to;$(selector).click(function(){thisObj.openDialog(opt)})}else{thisObj.openDialog(opt)}})},htmlSelect:function(opt){var _this=this;ui.js(!ui.extend.htmlSelect,ui.site+"js/min/ui/htmlSelect.js",function(){ui.extend.htmlSelect.call(_this,opt)})},star:function(opt){var _this=this;ui.css(!ui.extend.star,ui.site+"js/min/ui/star/jquery.rating.css");ui.js(!ui.extend.star,ui.site+"js/min/ui/star/jquery.rating.js",function(){$(_this).rating()})},draw:function(opt){var _this=this;ui.js(!$.fn.bindDraw,ui.site+"js/min/ui/draw.js",function(){$(_this).bindDraw(opt)})},lvtip:function(opt){var _this=this;ui.js(!ui.extend.lvtip,ui.site+"js/min/ui/lvtip.js",function(){ui.extend.lvtip.call(_this,opt)})},validate:function(opt){var _this=this;ui.js(!ui.extend.validate,ui.site+"js/min/ui/validate.js",function(){ui.extend.validate.call(_this,opt)})},date:function(opt){var _this=this;ui.js(!window.WdatePicker,ui.site+"js/min/ui/My97DatePicker/WdatePicker.js",function(){_this.onclick=function(){WdatePicker(opt)}})},floatDiv:function(opt){var _this=this;ui.js(!ui.extend.floatDiv,ui.site+"plugin/jquery.floatDiv.js",function(){ui.extend.floatDiv.call(_this,opt)})}},firstLoad:function(){}};$.confirm=function(text,callback1,callback2,callback3){ui.js(!ui.extend.confirm,ui.site+"js/min/ui/confirm.js",function(){ui.extend.confirm(text,callback1,callback2,callback3)})};$.confirmF=function(text,callback1,callback2,callback3){if(!getCookie("updateTishi")){var callYes=function(call){typeof callback1=="function"&&callback1();call(true);if($("#check_tishi:checked").length>0){addCookie("updateTishi")}};text="<p>"+text+"</p>"+'<p class="icon_align rt_align"><input class="check_tishi" value="" name="" type="checkbox" id="check_tishi">不再提示</p>';ui.js(!ui.extend.confirm,ui.site+"js/min/ui/confirm.js",function(){ui.extend.confirm(text,callYes,callback2,callback3)})}else{typeof callback1=="function"&&callback1()}};$.alert=function(text,callback1,callback2){ui.js(!ui.extend.alert,ui.site+"js/min/ui/confirm.js",function(){ui.extend.alert(text,callback1,callback2)})};$.loadState=function(type,text,opt){ui.js(!ui.extend.loading,ui.site+"js/ui/loading.js",function(){ui.extend.loading(type,text,opt||{})})};$.mathjax=function(opt){var _this=this;ui.js(!window.afterLoad,ui.site+"js/min/ui/latexToMathJax.js")};$.loadSuccess=function(text,opt){$.loadState(1,text,opt)};$.loadError=function(text,opt){$.loadState(2,text,opt)};$.loading=function(text,opt){$.loadState(3,text,opt)};$.loadInfo=function(text,opt){$.loadState(4,text,opt)};$.autoSaveInfo=function(content,speed){var date=new Date;var h=date.getHours();var m=date.getMinutes();var s=date.getSeconds();if(h<10)h="0"+h;if(m<10)m="0"+m;if(s<10)s="0"+s;var str="已于"+h+"点"+m+"分"+s+"秒自动保存成功!";$("#autoSaveTip").remove();$("body").append('<div id="autoSaveTip" class="autoSaveTip2">'+(content||str)+"</div>");$("#autoSaveTip").delay(speed||2500).fadeOut(400)};$.fn.ui=function(type,opt){if(typeof ui.get[type]=="function"){opt=opt||{};this.each(function(){ui.get[type].call(this,opt)})}return this};var validate=function(obj,callback){var d=document;var len=0;for(var n in obj){if($(n)[0]){len+=$(n).size()}}var i=0,j=0,fbl=true;for(var n in obj){$(n).each(function(){var elt=this;if(elt){i++;var bl=common_validate.call(elt,obj[n],function(){j++;if(j==i&&j==len){callback&&callback()}});if(!bl){fbl=false}}});if(!fbl){}}return true};$.fn.validate=function(obj,callback){ui.js(!ui.extend.validate,ui.site+"js/min/ui/validate.js");for(var n in obj){$(n).ui("validate",obj[n])}$(this).click(function(){validate(obj,function(){typeof callback=="function"&&callback()});return false})};$.validate=function(obj){for(var n in obj){$(n).ui("validate",obj[n])}};$.validateGo=function(obj,callback){ui.js(!ui.extend.validate,ui.site+"js/min/ui/validate.js",function(){validate(obj,function(){typeof callback=="function"&&callback()})})};window.UI=ui})(jQuery,document);function errortip(elt,msg){if(!window.error_tip){UI.js(!UI.extend.validate,UI.site+"js/min/ui/validate.js",function(){error_tip(elt,msg)})}else{error_tip(elt,msg)}setTimeout(function(){$("[validate=msg]").fadeOut(200,function(){$(this).remove()})},2e3)}
|