/*H-ui.js v2.3 date:9:53 2015-07-17 by:guojunhui*/ if (navigator.userAgent.match(/IEMobile\/10\.0/)) { var msViewportStyle = document.createElement("style") msViewportStyle.appendChild( document.createTextNode( "@-ms-viewport{width:auto!important}" ) ) document.getElementsByTagName("head")[0].appendChild(msViewportStyle); } /*添加收藏 收藏本站 */ /*收藏主站*/ function addFavorite(name,site){ try{window.external.addFavorite(site,name);} catch(e){ try{window.sidebar.addPanel(name,site,"");} catch(e){alert("加入收藏失败,请使用Ctrl+D进行添加");} } } /*收藏页面 收藏本页 */ function addFavoritepage(){var sURL=window.location.href;var sTitle=document.title;try{window.external.addFavorite(sURL,sTitle);}catch(e){try{window.sidebar.addPanel(sTitle,sURL,"");}catch(e){alert("加入收藏失败,请使用Ctrl+D进行添加");}}} /*设为首页*/ function setHome(obj){ try{obj.style.behavior="url(#default#homepage)";obj.setHomePage(webSite);} catch(e){if(window.netscape){ try {netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");} catch(e){alert("此操作被浏览器拒绝!\n请在浏览器地址栏输入\"about:config\"并回车\n然后将 [signed.applets.codebase_principal_support]的值设置为'true',双击即可。");} var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch); prefs.setCharPref('browser.startup.homepage',url);}} } /*滚动*/ function marquee(height,speed,delay){ var scrollT; var pause = false; var ScrollBox = document.getElementById("marquee"); if(document.getElementById("holder").offsetHeight <= height) return; var _tmp = ScrollBox.innerHTML.replace('holder', 'holder2'); ScrollBox.innerHTML += _tmp; ScrollBox.onmouseover = function(){pause = true}; ScrollBox.onmouseout = function(){pause = false}; ScrollBox.scrollTop = 0; function start(){ scrollT = setInterval(scrolling,speed); if(!pause) ScrollBox.scrollTop += 2; } function scrolling(){ if(ScrollBox.scrollTop % height != 0){ ScrollBox.scrollTop += 2; if(ScrollBox.scrollTop >= ScrollBox.scrollHeight/2) ScrollBox.scrollTop = 0; } else{ clearInterval(scrollT); setTimeout(start,delay); } } setTimeout(start,delay); } /*隐藏显示密码*/ (function ( $ ) { $.fn.togglePassword = function( options ) { var s = $.extend( $.fn.togglePassword.defaults, options ), input = $( this ); $( s.el ).on( s.ev, function() { "password" == $( input ).attr( "type" ) ? $( input ).attr( "type", "text" ) : $( input ).attr( "type", "password" ); }); }; $.fn.togglePassword.defaults = { ev: "click" }; }( jQuery )); !function ($) { "use strict"; $(function () { $.support.transition = (function () { var transitionEnd = (function () { var el = document.createElement('bootstrap'), transEndEventNames = { 'WebkitTransition' : 'webkitTransitionEnd', 'MozTransition' : 'transitionend', 'OTransition' : 'oTransitionEnd otransitionend', 'transition' : 'transitionend' }, name for (name in transEndEventNames){ if (el.style[name] !== undefined) { return transEndEventNames[name] } } }()) return transitionEnd && { end: transitionEnd } })() }); }(window.jQuery); /*左侧菜单-隐藏显示*/ function displaynavbar(obj){ if($(obj).hasClass("open")){ $(obj).removeClass("open"); $("body").removeClass("big-page"); }else{ $(obj).addClass("open"); $("body").addClass("big-page"); } } /*模拟下拉菜单*/ jQuery.Huiselect = function(divselectid,inputselectid) { var inputselect = $(inputselectid); $(divselectid+" cite").click(function(){ var ul = $(divselectid+" ul"); ul.slideToggle(); }); $(divselectid+" ul li a").click(function(){ var txt = $(this).text(); $(divselectid+" cite").html(txt); var value = $(this).attr("selectid"); inputselect.val(value); $(divselectid+" ul").hide(); }); $(document).click(function(){$(divselectid+" ul").hide();}); }; /*hover*/ jQuery.Huihover =function(obj) { $(obj).hover(function(){$(this).addClass("hover");},function(){$(this).removeClass("hover");}); }; /*得到失去焦点*/ jQuery.Huifocusblur = function(obj) { $(obj).focus(function() {$(this).addClass("focus").removeClass("inputError");}); $(obj).blur(function() {$(this).removeClass("focus");}); }; /*tab选项卡*/ jQuery.Huitab =function(tabBar,tabCon,class_name,tabEvent,i){ var $tab_menu=$(tabBar); // 初始化操作 $tab_menu.removeClass(class_name); $(tabBar).eq(i).addClass(class_name); $(tabCon).hide(); $(tabCon).eq(i).show(); $tab_menu.on(tabEvent,function(){ $tab_menu.removeClass(class_name); $(this).addClass(class_name); var index=$tab_menu.index(this); $(tabCon).hide(); $(tabCon).eq(index).show(); }); } /*折叠*/ jQuery.Huifold = function(obj,obj_c,speed,obj_type,Event){ if(obj_type == 2){ $(obj+":first").find("b").html("-"); $(obj_c+":first").show(); } $(obj).on(Event,function(){ if($(this).next().is(":visible")){ if(obj_type == 2){ return false; }else{ $(this).next().slideUp(speed).end().removeClass("selected"); if($(this).find("b")){ $(this).find("b").html("+"); } } } else{ if(obj_type == 3){ $(this).next().slideDown(speed).end().addClass("selected"); if($(this).find("b")){ $(this).find("b").html("-"); } }else{ $(obj_c).slideUp(speed); $(obj).removeClass("selected"); if($(this).find("b")){ $(obj).find("b").html("+"); } $(this).next().slideDown(speed).end().addClass("selected"); if($(this).find("b")){ $(this).find("b").html("-"); } } } }); } /*返回顶部*/ var $backToTopEle=$(' ').appendTo($("body")).click(function(){ $("html, body").animate({ scrollTop: 0 }, 120); }); var $backToTopFun = function() { var st = $(document).scrollTop(), winh = $(window).height(); (st > 0)? $backToTopEle.show(): $backToTopEle.hide(); /*IE6下的定位*/ if(!window.XMLHttpRequest){ $backToTopEle.css("top", st + winh - 166); } }; /*textarea 字数限制*/ function textarealength(obj,maxlength){ var v = $(obj).val(); var l = v.length; if( l > maxlength){ v = v.substring(0,maxlength); } $(obj).parent().find(".textarea-length").text(v.length); } /*Huimodalalert*/ function Huimodal_alert(info,speed){ $(document.body).append( '
' ); $("#modal-alert").fadeIn(); setTimeout("Huimodal_alert_hide()",speed); } function Huimodal_alert_hide() { $("#modal-alert").fadeOut("normal",function(){ $("#modal-alert").remove(); }); } /*设置cookie*/ function setCookie(name, value, Days){ if(Days == null || Days == ''){ Days = 300; } var exp = new Date(); exp.setTime(exp.getTime() + Days*24*60*60*1000); document.cookie = name + "="+ escape (value) + "; path=/;expires=" + exp.toGMTString(); } /*获取cookie*/ function getCookie(name) { var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)"); if(arr=document.cookie.match(reg)) return unescape(arr[2]); else return null; } $(function(){ /*****表单*****/ $.Huifocusblur(".input-text,.textarea"); /*按钮loading*/ $('.btn-loading').click(function () { var $btn = $(this); var btnval = $btn.val(); $btn.addClass("disabled").val("loading").attr("disabled","disabled"); setTimeout(function(){ $btn.removeClass("disabled").val(btnval).removeAttr("disabled"); }, 3000); }); /**/ $.Huiselect("#divselect","#inputselect"); /*全选*/ $("table thead th input:checkbox").on("click" , function(){ $(this).closest("table").find("tr > td:first-child input:checkbox").prop("checked",$("table thead th input:checkbox").prop("checked")); }); /*上传*/ $(document).on("change",".input-file",function(){ var uploadVal=$(this).val(); $(this).parent().find(".upload-url").val(uploadVal).focus().blur(); }); /*下拉菜单*/ $(document).on("mouseenter",".dropDown",function(){ $(this).addClass("hover"); }); $(document).on("mouseleave",".dropDown",function(){ $(this).removeClass("hover"); }); $(document).on("mouseenter",".dropDown_hover",function(){ $(this).addClass("open"); }); $(document).on("mouseleave",".dropDown_hover",function(){ $(this).removeClass("open"); }); $(document).on("click",".dropDown-menu li a",function(){ $(".dropDown").removeClass('open'); }); $(document).on('click', function(event){ var e_t = $(event.target).parents('.dropDown_click'); if($(".dropDown_click").hasClass('open')){ if(e_t.hasClass('open')){ e_t.removeClass('open'); return; } $(".dropDown_click").removeClass('open'); e_t.toggleClass('open'); }else{ e_t.toggleClass('open'); } }); /*搜索框*/ $.Huifocusblur('.searchTxt'); $.Huihover('.ac_results li'); $(".ac_results li").click(function (event){ $(".searchTxt").addClass("focus").val($(this).find("p").text()); $(".ac_results").hide(); //$(".form-search").submit();/*提交表单*/ b_onclick();/*临时测试*/ return false; }); $(".searchTxt").focus(function(){$(".ac_results").show();return false;}); $(".ac_results").blur(function(){$(this).hide();}); $("body").click(function(){$(".ac_results").hide();}); $(".searchTxt").click(function(){$(".ac_results").show();return false;}); function BindEnter(obj){ var searchBtn = $("#searchBtn"); if(obj.keyCode == 13){searchBtn.click();obj.returnValue = false;} } /*tag标签*/ var tags_a = $(".tags a"); tags_a.each(function(){ var x = 9; var y = 0; var rand = parseInt(Math.random() * (x - y + 1) + y); $(this).addClass("tags"+rand); }); /*对联广告*/ var dual = $(".dual"); var dual_close = $("a.dual_close"); var screen_w = screen.width; if(screen_w>1024){dual.show();} $(window).scroll(function(){ var scrollTop = $(window).scrollTop(); dual.stop().animate({top:scrollTop+260}); }); dual_close.click(function(){ $(this).parent().hide(); return false; }); /*顶部展开定时自动关闭广告*/ $("#banner").slideDown("slow"); /*图片预览*/ $("a.preview").hover( function(){ $(this).addClass("active"); $("#tooltip-preview").remove(); var winW=$(window).width(); var winW5=winW/2; this.myTitle = this.title; this.title = ""; var midimg = $(this).attr('data-preview'); if(midimg ==''){return false;} else{ var imgT=$(this).parents(".imgItem").offset().top; var imgL=$(this).parents(".imgItem").offset().left; var imgW=$(this).parents(".imgItem").width(); var imgH=$(this).parents(".imgItem").height(); var ww=(imgL+imgW/2); if(ww < winW5){ var tooltipLeft=(imgW+imgL)+"px"; } else{ var tooltipRight=(winW-imgL)+"px"; } var tooltip_keleyi_com = "