place(re,paramName+'='+replaceWith); nUrl = updateQueryStringParameter(nUrl,paramName,replaceWith) return nUrl } function updateQueryStringParameter(uri, key, value) { if(!value&&value !== 0) { return uri; } var re = new RegExp("([?&])" + key + "=.*?(&|$)", "i"); var separator = uri.indexOf('?') !== -1 ? "&" : "?"; if (uri.match(re)) { return uri.replace(re, '$1' + key + "=" + value + '$2'); } else { return uri + separator + key + "=" + value; } } if (currentLiveStatusFresh){ window.location.href = replaceParamVal('t',Math.random()) } else { currentLiveStatus = $.cookie(curPageParams) } }) $(".rbSearchDiv").click(function () { showOrHideGlobalSearch() }) $(".global-search .global-search-header .global-search-header-close").click(function () { showOrHideGlobalSearch() }) hotkeys.filter = function(event){ return true; } hotkeys('*', function (event, handler){ var visible = $(".global-search").is(":visible") if (event.key == 'F4'){ // event.preventDefault() // showOrHideGlobalSearch() return; } //字母 65~90 数字 48~57 小键盘数字 96~105 中文输入法 229 if ($(".global-search").is(":visible") && (event.keyCode >= 65 && event.keyCode <= 90) || (event.keyCode >= 48 && event.keyCode <= 57) || (event.keyCode >= 96 && event.keyCode <= 105) || event.keyCode == 229){ $(".global-search .global-search-input input").focus() return } if (visible && ['ArrowDown','ArrowUp','ArrowLeft','ArrowRight'].indexOf(event.key) != -1){ event.preventDefault() var pos1 = $(".global-search .global-search-types span.active").index(); var pos2 = $(".global-search .global-search-list ul.active li.active").index(); var length1 = $(".global-search .global-search-types span").length; var length2 = $(".global-search .global-search-list ul.active li").length; // if (event.key == 'ArrowLeft'){ // pos1--; // if (pos1 < 0){ // pos1 = length1 - 1 // } // $(".global-search .global-search-types span").eq(pos1).click() // } // if (event.key == 'ArrowRight'){ // pos1++; // if (pos1 >= length1){ // pos1 = 0 // } // $(".global-search .global-search-types span").eq(pos1).click() // } if (event.key == 'ArrowDown'){ pos2++; if (pos2 >= length2){ pos2 = 0 } if ($(".global-search .global-search-list ul.active li").eq(pos2).attr('data-code')){ $(".global-search .global-search-list ul.active li").eq(pos2).addClass('active').siblings().removeClass('active') } } if (event.key == 'ArrowUp'){ pos2--; if (pos2 < 0){ pos2 = length2 - 1 } if ($(".global-search .global-search-list ul.active li").eq(pos2).attr('data-code')){ $(".global-search .global-search-list ul.active li").eq(pos2).addClass('active').siblings().removeClass('active') } } var t = $(".global-search .global-search-list").offset().top $(".global-search .global-search-list").animate({scrollTop: pos2*($(".global-search .global-search-list ul.active li").height())+'px'}, 100) } if (visible && event.key == 'Enter'){ // var type = $(".global-search .global-search-types span.active").attr('data-type') var type = $(".global-search .global-search-list ul.active li.active").attr('data-type') var code = $(".global-search .global-search-list ul.active li.active").attr('data-code') var url = '' if (code){ if (type == 'gp'){ url = 'https://www.aniu.com/gp_'+code+'.shtml' } if (type == 'bk'){ url = 'https://www.aniu.com/Bk_detail_id_'+code+'.shtml' } if (type == 'jj'){ url = 'https://www.aniu.com/fund_detail_'+code+'.shtml' } } if (url){ window.open(url) } } }); $(".global-search .global-search-types span").click(function () { $(this).addClass('active').siblings().removeClass('active') var type = $(this).attr('data-type') $(".global-search .global-search-list .global-search-list-"+type).addClass('active').siblings().removeClass('active') }) var lastTimeStamp $(".global-search .global-search-input").on('input propertychange focus','input',function (event) { var _this = this lastTimeStamp = event.timeStamp; setTimeout(function(){ //设时延迟0.5s执行 if(lastTimeStamp-event.timeStamp==0) { var val = $(_this).val() var obj = $(".global-search .global-search-list ul.global-search-list-gp") var obj1 = $(".global-search .global-search-list ul.global-search-list-bk") var obj2 = $(".global-search .global-search-list ul.global-search-list-jj") var emptyHtml = '
  • 暂无数据

  • ' if (!val){ $(_this).val('') $(_this).attr('data-code','') return } var showTab = [0,0,0] $.ajax({ type: "get", url: '/Index_ajaxItemSearch.shtml', data: {keyword: val,type:1,pNo:1,t:Math.random()}, dataType:'json', success: function (rs) { obj.empty(); var html = '' if (rs && typeof rs.items != "undefined" && rs.items.length > 0){ var arr = arrayMerge(rs.items) if (arr.length > 5){ arr = arr.splice(0,5) } $.each(arr, function (key, val) { var gpmc = currentLiveStatus == '1' ? dealStockName(val.gpmc,2) : val.gpmc var gpdm = currentLiveStatus == '1' ? dealStockCode(val.gpdm) : val.gpdm var classStr = '' if (key == 0){ classStr = 'active' } html += '
  • '+gpdm + '  ' + gpmc + '-股票
  • '; }); showTab[0] = 1 }else { // html += emptyHtml // showTab[0] = 0 } // obj.html(html) $.ajax({ type: "get", url: '/Index_ajaxItemSearch.shtml', data: {keyword: val,type:2,pNo:1,t:Math.random()}, dataType:'json', success: function (rs) { obj1.empty(); // var html = '' if (rs && typeof rs.items != "undefined" && rs.items.length > 0){ var arr = arrayMerge(rs.items) if (arr.length > 5){ arr = arr.splice(0,5) } $.each(arr, function (key, val) { var classStr = '' if (key == 0 && html == ''){ classStr = 'active' } html += '
  • ' + val.indexcode + '  ' + val.indexname + '-板块
  • '; }); showTab[1] = 1 } else { // showTab[1] = 0 // html += emptyHtml } // obj1.html(html) $.ajax({ type: "get", url: '/Index_ajaxItemSearch.shtml', data: {keyword: val,type:8,pNo:1,t:Math.random()}, dataType:'json', success: function (rs) { obj2.empty(); // var html = '' if (rs && typeof rs.items != "undefined" && rs.items.length > 0){ var arr = rs.items if (arr.length > 5){ arr = arr.splice(0,5) } $.each(arr, function (key, val) { var classStr = '' if (key == 0 && html == ''){ classStr = 'active' } var jjmc = currentLiveStatus == '1' ? dealStockName(val.jjmc,3) : val.jjmc var jjdm = currentLiveStatus == '1' ? dealStockCode(val.jjdm) : val.jjdm html += '
  • ' + jjdm + '  ' + jjmc + '-基金
  • '; }); showTab[2] = 1 } else { // showTab[2] = 0 // html += emptyHtml } // obj2.html(html) obj.html(html) // if (showTab[0] == 0 && (showTab[1]==1 || showTab[2]==1)){ // if (showTab[1]==1){ // $(".global-search .global-search-types span").eq(1).click() // } else if (showTab[2]==1) { // $(".global-search .global-search-types span").eq(2).click() // } // } } }); } }); } }); } },750); }) $(".global-search").on('click','.global-search-list li',function () { var code = $(this).attr('data-code').toString() if (!code){ return; } var type = $(this).attr('data-type') var url = '' if (type == 'gp'){ url = 'https://www.aniu.com/gp_'+code+'.shtml' } if (type == 'bk'){ url = 'https://www.aniu.com/Bk_detail_id_'+code+'.shtml' } if (type == 'jj'){ url = 'https://www.aniu.com/fund_detail_'+code+'.shtml' } if (url){ window.open(url) } }) $("body").on('focus','input,textarea',function (e) { if($(e.target).attr('data-type') != 'global-search' && $(".global-search").is(":visible")){ showOrHideGlobalSearch() } }) // $("body").on("shown.bs.select",'#exchangeParam2,#exchangeParam2big',function (e, clickedIndex, isSelected, previousValue) { // if($(".global-search").is(":visible")){ // showOrHideGlobalSearch() // } // }) function getNonReadCount(){ $.ajax({ type:'post', url:'https://www.aniu.com/User_getNonReadCount', data:{t:Math.random()}, dataType:'jsonp', success:function (rs){ if (rs.code == '0'){ if (rs.data > 0){ $(".rightBanner .rightBannerLink .msg-num").html(rs.data).show() if (rs.data > 99){ $(".rightBanner .rightBannerLink .msg-num").css('width','24px') } else { $(".rightBanner .rightBannerLink .msg-num").css('width','20px') } } else { $(".rightBanner .rightBannerLink .msg-num").html(rs.data).hide() } } } }) } function getKsxgAuth(){ $.ajax({ url:'/Api_ksxgAuth', data:{t:Math.random()}, dataType:'json', success:function (rs) { if (rs.code == '0' && rs.data == 1){ $("#ksxg_menu_li").show() $(".hotfk").show() setTimeout(function(){ $(".jumptoksxg").show() },1000) // setTimeout(function(){ // $(".jumptoksxg").show() // },3000) setInterval(function(){ $(".jumptoksxg").show() },1500) } } }) } function getXghcAuth(){ $.ajax({ url:'/Api_xghcAuth', data:{t:Math.random()}, dataType:'json', success:function (rs) { if (rs.code == '0' && rs.data){ $("#xghc_menu_li").show() } } }) } function getSczsAuth(){ $.ajax({ url:'/Api_sczsAuth', data:{t:Math.random()}, dataType:'json', success:function (rs) { if (rs.code == '0' && rs.data == 1){ $("#sczsonemenu").show() } } }) } function hasVipAuth(){ $.ajax({ url:"/Ajaxrequest_hasVipPower", data:{t:Math.random()}, success:function (rs) { if (rs.code == 0 && rs.data == 1){ $("#lhxj_menu_a").show() } } }) } if (common.user.isLogin(2,0)){ getNonReadCount() setInterval(function () { getNonReadCount() },90000) $("#zxstock").show() $("#bk_jqrd").show() $("#bk_qsdt").show() $("#zxMenu").show() $("#bk_zxbk").show() $("#my_package").show() $("#ksxj_menu_a").show() $("#zxjj_menu_a").show() getKsxgAuth() getXghcAuth() getSczsAuth() hasVipAuth() } $(document).ready(function () { $(document).keydown(function (event) { if ((event.ctrlKey === true || event.metaKey === true) && (event.which === 61 || event.which === 107 || event.which === 173 || event.which === 109 || event.which === 187 || event.which === 189 || event.which === 48)) { setTimeout(function(){ window.location.reload() },1000) } }); $(window).bind('mousewheel DOMMouseScroll', function (event) { if (event.ctrlKey === true || event.metaKey) { setTimeout(function(){ window.location.reload() },1000) } }); });