You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 line
16 KiB
1 line
16 KiB
2 years ago
|
$(function(){$(".win-homepage").click(function(){if(document.all){document.body.style.behavior="url(#default#homepage)";document.body.setHomePage(document.URL)}else{alert("设置首页失败,请手动设置!")}});$(".win-favorite").click(function(){var sURL=document.URL;var sTitle=document.title;try{window.external.addFavorite(sURL,sTitle)}catch(e){try{window.sidebar.addPanel(sTitle,sURL,"")}catch(e){alert("加入收藏失败,请使用Ctrl+D进行添加")}}});$(".win-forward").click(function(){window.history.forward(1)});$(".win-back").click(function(){window.history.back(-1)});$(".win-backtop").click(function(){$("body,html").animate({scrollTop:0},1000);return false});$(".win-refresh").click(function(){window.location.reload()});$(".win-print").click(function(){window.print()});$(".win-close").click(function(){window.close()});$(".checkall").click(function(){var e=$(this);var name=e.attr("name");var checkfor=e.attr("checkfor");var type;if(checkfor!=""&&checkfor!=null&&checkfor!=undefined){type=e.closest("form").find("input[name='"+checkfor+"']")}else{type=e.closest("form").find("input[type='checkbox']")}if(name=="checkall"){$(type).each(function(index,element){element.checked=true});e.attr("name","ok")}else{$(type).each(function(index,element){element.checked=false});e.attr("name","checkall")}});$(".dropdown-toggle").click(function(){$(this).closest(".button-group, .drop").addClass("open")});$(".dropdown-hover").hover(function(){$(".button-group, .drop").removeClass("open");$(this).closest(".button-group, .drop").addClass("open")},function(){});$(document).bind("click",function(e){if($(e.target).closest(".button-group.open, .drop.open").length==0){$(".button-group, .drop").removeClass("open")}});$checkplaceholder=function(){var input=document.createElement("input");return"placeholder" in input};if(!$checkplaceholder()){$("textarea[placeholder], input[placeholder]").each(function(index,element){if($(element).attr("placeholder")||$emptyplaceholder(element)){$(element).val($(element).attr("placeholder"));$(element).data("pintuerholder",$(element).css("color"));$(element).css("color","rgb(169,169,169)");$(element).focus(function(){$hideplaceholder($(this))});$(element).blur(function(){$showplaceholder($(this))})}})}$emptyplaceholder=function(element){var $content=$(element).val();return($content.length===0)||$content==$(element).attr("placeholder")};$showplaceholder=function(element){if(($(element).val().length===0||$(element).val()==$(element).attr("placeholder"))&&$(element).attr("type")!="password"){$(element).val($(element).attr("placeholder"));$(element).data("pintuerholder",$(element).css("color"));$(element).css("color","rgb(169,169,169)")}};var $hideplaceholder=function(element){if($(element).data("pintuerholder")){$(element).val("");$(element).css("color",$(element).data("pintuerholder"));$(element).removeData("pintuerholder")}};$("textarea, input, select").blur(function(){var e=$(this);if(e.attr("data-validate")){e.closest(".field").find(".input-help").remove();var $checkdata=e.attr("data-validate").split(",");var $checkvalue=e.val();var $checkstate=true;var $checktext="";if(e.attr("placeholder")==$checkvalue){$checkvalue=""}if($checkvalue!=""||e.attr("data-validate").indexOf("required")>=0){for(var i=0;i<$checkdata.length;i++){var $checktype=$checkdata[i].split(":");if(!$pintuercheck(e,$checktype[0],$checkvalue)){$checkstate=false;$checktext=$checktext+"<li>"+$checktype[1]+"</li>"}}}if($checkstate){e.closest(".form-group").removeClass("check-error");e.parent().find(".input-help").remove();e.closest(".form-group").addClass("check-success")}else{e.closest(".form-group").removeClass("check-success");e.closest(".form-group").addClass("check-error");e.closest(".field").append('<div class="input-help"><ul>'+$checktext+"</ul></div>")}}});$pintuercheck=function(element,type,value){$pintu=value.replace(/(^\s*)|(\s*$)/g,"");switch(type){case"required":return/[^(^\s*)|(\s*$)]/.test($pintu);break;case"chinese":return/^[\u0391-\uFFE5]+$/.test($pintu);break;case"number":return/^([+-]?)\d*\.?\d+$/.test($pintu);break;case
|