jeesite.min.js 3.58 KB
/*!
 * Copyright &copy; 2012-2014 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
 * 
 * 通用公共方法
 * @author ThinkGem
 * @version 2014-4-29
 */
$(document).ready(function(){try{$("a").bind("focus",function(){if(this.blur){this.blur()}});$("select").select2()}catch(a){}});function include(c,m,e){if(document.getElementById(c)==null){var a=typeof e=="string"?[e]:e;for(var f=0;f<a.length;f++){var b=a[f].replace(/^\s|\s$/g,"");var h=b.split(".");var d=h[h.length-1].toLowerCase();var k=d=="css";var l=k?"link":"script";var g=k?" type='text/css' rel='stylesheet' ":" type='text/javascript' ";var j=(k?"href":"src")+"='"+m+b+"'";document.write("<"+l+(f==0?" id="+c:"")+g+j+"></"+l+">")}}}function getQueryString(b,a){var c=new RegExp("(^|&)"+b+"=([^&]*)(&|$)","i");if(a==""){a=window.location.search}else{a=a.substring(a.indexOf("?"))}r=a.substr(1).match(c);if(r!=null){return unescape(r[2])}return null}function getDictLabel(d,c,a){for(var b=0;b<d.length;b++){var e=d[b];if(e.value==c){return e.label}}return a}function windowOpen(d,c,e,a){var g=parseInt((window.screen.height-a)/2,10),f=parseInt((window.screen.width-e)/2,10),b="location=no,menubar=no,toolbar=no,dependent=yes,minimizable=no,modal=yes,alwaysRaised=yes,resizable=yes,scrollbars=yes,width="+e+",height="+a+",top="+g+",left="+f;window.open(d,c,b)}function resetTip(){top.$.jBox.tip.mess=null}function closeTip(){top.$.jBox.closeTip()}function showTip(d,b,c,a){resetTip();setTimeout(function(){top.$.jBox.tip(d,(b==undefined||b==""?"info":b),{opacity:0,timeout:c==undefined?2000:c})},a==undefined?500:a)}function loading(a){if(a==undefined||a==""){a="正在提交,请稍等..."}resetTip();top.$.jBox.tip(a,"loading",{opacity:0})}function alertx(b,a){top.$.jBox.info(b,"提示",{closed:function(){if(typeof a=="function"){a()}}});top.$(".jbox-body .jbox-icon").css("top","55px")}function confirmx(c,b,a){top.$.jBox.confirm(c,"系统提示",function(d,e,g){if(d=="ok"){if(typeof b=="function"){b()}else{resetTip();location=b}}},{buttonsFocus:1,closed:function(){if(typeof a=="function"){a()}}});top.$(".jbox-body .jbox-icon").css("top","55px");
return false}function promptx(d,c,b,a){top.$.jBox("<div class='form-search' style='padding:20px;text-align:center;'>"+c+":<input type='text' id='txt' name='txt'/></div>",{title:d,submit:function(e,g,i){if(i.txt==""){top.$.jBox.tip("请输入"+c+"。","error");return false}if(typeof b=="function"){b()}else{resetTip();location=b+encodeURIComponent(i.txt)}},closed:function(){if(typeof a=="function"){a()}}});return false}function addTabPage(e,a,d,c,b){top.$.fn.jerichoTab.addTab({tabFirer:c,title:e,closeable:d==undefined,data:{dataType:"iframe",dataLink:a}}).loadData(b!=undefined)}function cookie(b,j,m){if(typeof j!="undefined"){m=m||{};if(j===null){j="";m.expires=-1}var e="";if(m.expires&&(typeof m.expires=="number"||m.expires.toUTCString)){var f;if(typeof m.expires=="number"){f=new Date();f.setTime(f.getTime()+(m.expires*24*60*60*1000))}else{f=m.expires}e="; expires="+f.toUTCString()}var l=m.path?"; path="+m.path:"";var g=m.domain?"; domain="+m.domain:"";var a=m.secure?"; secure":"";document.cookie=[b,"=",encodeURIComponent(j),e,l,g,a].join("")}else{var d=null;if(document.cookie&&document.cookie!=""){var k=document.cookie.split(";");for(var h=0;h<k.length;h++){var c=jQuery.trim(k[h]);if(c.substring(0,b.length+1)==(b+"=")){d=decodeURIComponent(c.substring(b.length+1));break}}}return d}}function pad(b,c){var a=b.toString().length;while(a<c){b="0"+b;a++}return b}function strToDate(a){return new Date(a.replace(/-/g,"/"))}function addDate(a,b){a=a.valueOf();a=a+b*24*60*60*1000;return new Date(a)};