var paramarr = getparamarr('exlayoutscript'); $(document).ready(function () { var showtype=paramarr['showtype']; if(showtype=='0') { $(".online-qq").floatadv(); } else { $(".online-qq-lx").floatadv(); } $('img#logopic').css("backgroundimage", "none"); // 日期 if($(".wel").length>0) { var thisis= t("今天是"); if(paramarr['language']>1) { thisis+=" "; } var welcome=t("欢迎光临本站"); var reg=new regexp(thisis+'[\\s\\s]*'+welcome); if($(".wel").html().match(reg)||$(".wel").html().match("{默认欢迎词}")) { $.get("/base/getcurtime", function(data){ var defaultmsg=$.format("{0}{1},{2} ", thisis, data, welcome); $(".wel").html($(".wel").html().replace(reg,defaultmsg).replace("{默认欢迎词}",defaultmsg)); }) } } }); jquery.fn.floatadv = function (loaded) { var obj = this; body_height = parseint($(window).height()); block_height = parseint(obj.height()); top_position = parseint((body_height / 2) - (block_height / 2) + $(window).scrolltop()); if (body_height < block_height) { top_position = 0 + $(window).scrolltop(); }; if (!loaded) { obj.css({ 'position': 'absolute' }); obj.css({ 'top': top_position }); $(window).bind('resize', function () { obj.floatadv(!loaded); }); $(window).bind('scroll', function () { obj.floatadv(!loaded); }); } else { obj.stop(); obj.css({ 'position': 'absolute' }); obj.animate({ 'top': top_position }, 400, 'linear'); } } //控制banner显示位置 var place= paramarr['bannerplace']; if (place==0)//不显示 { $("#banner").remove(); } var place2= paramarr['hotwithbanner']; var navlayout=paramarr['navlayout']; if(place!=0&&navlayout<=1) { if (place == 2&&place2 == 0)//在banner上方 { $("#hot").before($("#banner")); $("#banner").before($("#topnav")); } else if (place == 2&&place2 == 1) { $("#banner").before($("#topnav")); $("#banner").before($("#hot")); } else if(place == 1&&place2 == 0) { $("#topnav").before($("#banner")); $("#hot").before($("#topnav")); } else if(place == 1&&place2 == 1) { $("#topnav").before($("#banner")); $("#banner").before($("#hot")); } } if(place!=0&&navlayout>1) { if (place2 == 0)//在banner上方 { $("#hot").before($("#banner")); } else if (place2 == 1) { $("#banner").before($("#hot")); } } function hiddsub(sender) { $('#'+sender).removeclass(); $('#' + sender).addclass('sub'); } function showsub(sender) { $('#' + sender).removeclass(); $('#' + sender).addclass('sub2'); } function closeqq(sender) { $('.online-qq').css("display", "none"); } //自动关闭提示框 function showtip(str) { var msgw, msgh, bordercolor; msgw = 350;//提示窗口的宽度 msgh = 80;//提示窗口的高度 bordercolor = "#336699";//提示窗口的边框颜色 //创建提示窗口的div var msgobj = document.createelement("div") msgobj.setattribute("id", "alertmsgdiv"); msgobj.setattribute("align", "center"); msgobj.style.background = "white"; msgobj.style.border = "1px solid " + bordercolor; msgobj.style.position = "absolute"; msgobj.style.left = "50%"; msgobj.style.font = "12px/1.6em verdana, geneva, arial, helvetica, sans-serif"; //窗口距离左侧和顶端的距离 msgobj.style.marginleft = "-225px"; //窗口被卷去的高+(屏幕可用工作区高/2)-150 var scrolltop = window.pageyoffset //用于ff || document.documentelement.scrolltop || document.body.scrolltop || 0; msgobj.style.top = scrolltop + (window.screen.availheight / 2) - 150 + "px"; msgobj.style.width = msgw + "px"; msgobj.style.height = msgh + "px"; msgobj.style.textalign = "center"; msgobj.style.lineheight = "25px"; msgobj.style.zindex = "10001"; document.body.appendchild(msgobj); //提示信息标题 var title = document.createelement("h4"); title.setattribute("id", "alertmsgtitle"); title.setattribute("align", "left"); title.style.margin = "0"; title.style.padding = "3px"; title.style.background = bordercolor; title.style.filter = "progid:dximagetransform.microsoft.alpha(startx=20, starty=20, finishx=100, finishy=100,style=1,opacity=75,finishopacity=100);"; title.style.opacity = "0.75"; title.style.border = "1px solid " + bordercolor; title.style.height = "18px"; title.style.font = "12px verdana, geneva, arial, helvetica, sans-serif"; title.style.color = "white"; title.innerhtml = t("提示信息"); document.getelementbyid("alertmsgdiv").appendchild(title); //提示信息 var txt = document.createelement("p"); txt.setattribute("id", "msgtxt"); txt.style.margin = "16px 0"; txt.innerhtml = str; document.getelementbyid("alertmsgdiv").appendchild(txt); //设置关闭时间 window.settimeout("closetip()", 3000); } function closetip() { document.getelementbyid("alertmsgdiv").removechild(document.getelementbyid("alertmsgtitle")); document.body.removechild(document.getelementbyid("alertmsgdiv")); } function setbutton() { $("#btnsubmit").attr({ "disabled": "disabled" }); } var submitsuccess = function (d) { if (d) { var success = t("提交成功"); showtip(success); document.location.reload(); } else { var fail = t("提交失败"); alert(fail); }; }; var submitfailure = function (xhr, status) { console.log(xhr.responsetext); $("#btnsubmit").removeattr('disabled'); alert(t("失败") + "!\r\n=================================\r\n" + xhr.responsetext) }; if ($(".intro-info-img").length > 0){ $(".intro-info-img").scrollloading(); } if ($(".b-pic").length > 0) { $(".b-pic").scrollloading(); } //from _layoutscrolling if ($("#fullpage img").length > 0) { $('#fullpage img').each(function () { var url = $(this).attr("data-url"); $(this).attr("src", url); }); } function diyformpressfunc(event, key, target) { if (event.which === 13) { diyformsearch(key, target); } } function diyformsearch(key, target) { var input = $('#word_' + key); if ($(input).val()) { var baseurl = $(input).parent('.searchdiyformbox').attr('data-src'); var url = $.format("{0}?word={1}", baseurl, $(input).val()); window.open(url, target); } else { alert(t("请输入搜索词")); } }