var option = { isDebug: false, loginstate_normal_template: "鐧 褰旤/a> 娉 鍐孅/a>", loginstate_ucenter_template: "閫€ 鍑裹/a>" }; $(function () { if ( (typeof(oc) !== "undefined") ) { oc.init(oc.base_url,"userinfo",null,option); } }); function logout(){ console.log('logout') oc.Logout() } var sub_key ='index'; var sub_navs = { 'xinwen':[ {text:'绾㈡柊闂?,href:'https://news.changsha.cn/xctt/html/110040/list.shtml'} ,{text:'缁挎柊闂?,href:'https://news.changsha.cn/xctt/html/110187/list.shtml'} ,{text:'姗欐柊闂?,href:'https://news.changsha.cn/xctt/html/110186/list.shtml'} ,{text:'榛戞柊闂?,href:'https://news.changsha.cn/xctt/html/110188/list.shtml'} ] ,'dongting':[ {text:'鏄熻景鎾姤',href:'https://s.changsha.cn/html/112305/list.html'} // ,{text:'鎬荤紪杈戝涔?,href:'https://s.changsha.cn/html/112306/list.html'} ,{text:'鐣欏0鏈?,href:'https://s.changsha.cn/html/112307/list.html'} //,{text:'鏄熷疂鏁呬簨灞?,href:'https://app.changsha.cn/html/111396/list.html'} ] ,'shiting':[ {text:'鏂伴椈',href:'https://v.changsha.cn/html/112249/newlist.html'} ,{text:'澶寸瓑鑸?,href:'https://v.changsha.cn/html/112250/newlist.html'} ,{text:'鐩存挱',href:'https://v.changsha.cn/html/111106/newlist.html'} ,{text:'闀挎矙24灏忔椂',href:'https://v.changsha.cn/html/114405/newslist.shtml'} ,{text:'婕仈',href:'https://v.changsha.cn/html/112785/list.html'} ,{text:'缃戝墽',href:'https://v.changsha.cn/html/112251/newlist.html'} ,{text:'鑸媿',href:'https://v.changsha.cn/html/112252/newlist.html'} ,{text:'鏄熻景鍏冨畤瀹?,href:' https://news.changsha.cn/xctt/html/114854/index.shtml'} ] ,'faxian':[ //{text:'闀挎矙瀹d紶缃?,href:'https://www.csxcw.cn'} {text:'鏂囨槑缃?,href:'http://cs.wenming.cn'} ,{text:'鍜岀綉',href:'http://www.hewang.gov.cn'} ,{text:'寤夋磥闀挎矙',href:'http://www.ljcs.gov.cn/index.html'} ,{text:'瀹夊叏闀挎矙',href:'https://news.changsha.cn/zt2019/html/112985/list.html'} //,{text:'涓洪暱娌欓瀹夌尞璁?,href:'https://news.changsha.cn/zt2019/html/112801/index.html'} ,{text:'涓洪暱娌欓瀹夌尞璁?,href:'http://www.changsha.cn/html/112101/20210810/106335.html'} ,{text:'闀挎矙娓e湡浜嬪姟涓績',href:'https://news.changsha.cn/zt2019/html/112871/index.shtml'} ,{text:'琛楀潑',href:'https://news.changsha.cn/xctt/html/112481/list.shtml'} ,{text:'寰',href:'https://news.changsha.cn/html/100131/list.shtml'} ,{text:'鍥炬噦',href:'https://news.changsha.cn/html/110064/list.shtml'} ,{text:'鍩庤',href:'https://v.changsha.cn/html/111104/index.html'} ,{text:'鑸',href:'https://v.changsha.cn/html/111103/list.html'} ] } function change_nav(k){ var sub = sub_navs.hasOwnProperty(k) == true ? sub_navs[k] : []; var html = ''; for (var i = 0; i < sub.length; i++) { html += ''+sub[i].text+'' }; $("#sec_nav").show(); if ( html == '') { // wanwey $("#sec_nav").animate({height:"0px","border-top-width":"0px"}); $('.selected::before').css({'background-image':'url(/upload/template_attachment/images112086/nav_hover1.png)'}) }else{ $("#sec_nav").animate({height:"36px","border-top-width":"1px"}); $('.nav_list .selected').addClass("selectedmore") } $("#sec_nav li").html(""+html + ""); a = $("#change_nav .selected").offset().left; b= ($(document).width()-1200)/2 c = a - b w = $("#sec_nav span").width() z= c-w/2; if(z+w>1200){ $("#sec_nav span").css('margin-left',1200-w +'px'); }else{ $("#sec_nav span").css('margin-left',z +'px'); } } if( sub_key != '' ){ $("#change_nav li").each(function(){ var key = $(this).data('key') if( key == sub_key ){ $(this).addClass('selected').siblings().removeClass('selected'); } }) change_nav(sub_key) } var show_nav = null; var clear_nav = null; $("#change_nav").on("mouseover","li",function(){ if ( clear_nav !== null ) { clearTimeout(clear_nav) } if ( show_nav !== null ) { clearTimeout(show_nav) } var key = $(this).data('key') var that = this; show_nav = setTimeout(function(){ $(that).addClass('selected').siblings().removeClass('selected').removeClass('selectedmore'); change_nav(key) },300) }) $("#change_nav").on("mouseout","li",function(){ if ( show_nav !== null ) { clearTimeout(show_nav) } }) $("body").on("mouseover",".main_nav",function(){ if ( clear_nav !== null ) { clearTimeout(clear_nav) } }) $("body").on("mouseout",".main_nav",function(){ clear_nav = setTimeout(function(){ $("#change_nav li").each(function(){ $(this).removeClass('selected').removeClass('selectedmore'); var key = $(this).data('key') if( key == sub_key ){ $(this).addClass('selected'); } }) change_nav(sub_key) },1000) }) $(".language .zh").hover(function(){ $(this).addClass('cur').siblings().removeClass('cur'); },function(){ }) $(".language .en").hover(function(){ $(this).addClass('cur').siblings().removeClass('cur'); },function(){ $(this).removeClass('cur').siblings().removeClass('cur'); $(".language .zh").addClass('cur'); }) $(".language .en").click(function(){ location.href = 'http://en.changsha.cn/'; }) $("#search").click(function(event){ var search_keyword = $("#search_keyword").val(); search_keyword = $.trim(search_keyword) if( search_keyword == '' ){ return; } window.open("https://live.changsha.cn/search/?Source=鏄熻景&Key=" + search_keyword,"_blank"); // window.open("http://so.changsha.cn/search.php?q=" + search_keyword,"_blank"); }) $('#search_keyword').bind('keypress',function(event){ if( event.keyCode == "13" ){ var search_keyword = $(this).val(); search_keyword = $.trim(search_keyword) if( search_keyword == '' ){ return; } window.open("https://live.changsha.cn/search/?Key=" + search_keyword,"_blank"); // window.open("http://so.changsha.cn/search.php?q=" + search_keyword,"_blank"); } }); //瀵艰埅缁撴潫 $('.hotlist').mouseenter(function(){ $('.right_news_with_hit .days a').removeClass('selected_day'); $(this).addClass('selected_day'); var key = $(this).data("key"); switch(key){ case 'hotlist2': $("#hotlist1").hide(); $("#hotlist3").hide(); $("#hotlist2").show(); break; case 'hotlist3': $("#hotlist1").hide(); $("#hotlist2").hide(); $("#hotlist3").show(); break; default: $("#hotlist2").hide(); $("#hotlist3").hide(); $("#hotlist1").show(); break; } }); $(function(){ $('.hotlist').eq(0).addClass('selected_day'); }) $("#PageList").on('click','p',function(event){ event.preventDefault(); event.stopPropagation(); var href = $(this).children().attr('href'); window.open(href,"_blank"); }) $("#PageList").on('click',".tag_ad",function(event){ event.preventDefault(); event.stopPropagation(); // console.log('all_count',pager.options.all_count) var max = pager.options.all_count < 60 ? pager.options.all_count : 60; var min = 30; // var p = parseInt(Math.random()*(max-min+1)+min,10); var p = Math.ceil(Math.random()*(max-min) + min); // console.log('p',p) var api = "/default.php?secu=public&mod=interface&a=news_list&siteid=17&channel_id=112091&state=30&is_encrypt=0&haschild=0&only_client=0&ps=1&p=" + p; var that = $(this); $.ajax({ type: "GET", url: "https://icms3api.changsha.cn" + api, dataType: "json", error: function(){ that.parent().html('') return }, success: function(res){ if ( !res.result ) { that.parent().html('') return } var data = res.result[0]; var temp = $("#PageTemplate").html(); for (var key in data) { if (key == 'CreateDate') { data[key] = dayjsDate(data[key]); } var reg = new RegExp("{f_" + key + "}", "ig"); if (data[key] == 'undefined' || data[key] == null) { temp = temp.replace(reg, ''); } else { temp = temp.replace(reg, data[key]); } } temp = temp.replace('
  • ', ''); temp = temp.replace('
  • ', ''); that.parent().removeClass('list_ad').html(temp) $(".contant .title").each(function(){ if ( $(this).data('sub') != 1 ) { var text = $(this).text(); $(this).data('sub',1) if( text.length > 30 ){ $(this).children().text(text.substr(0,28) + '...'); } } }) $(".contant p").each(function(){ if ( $(this).children().data('sub') != 1 ) { var text = $(this).children().text(); $(this).children().data('sub',1) if( text.length > 74 ){ $(this).children().text(text.substr(0,72) + '...'); } } }) $(".new_source_" + data.DocumentNewsId).each(function(){ icms_site.setNameAndUrl(this) }) } }); }) //婊氬姩鍒嗛〉 var scrollflag = true; window.onload=function(){ $(window).scroll(function(){ if( scrollflag == false ){ return; } 銆€銆€var scrollTop = $(this).scrollTop(); 銆€銆€var scrollHeight = $(document).height(); 銆€銆€var windowHeight = $(this).height(); var bool = scrollTop + windowHeight >= (scrollHeight - 300); // console.log('scrollTop',scrollTop) // console.log('scrollHeight',scrollHeight) // console.log('windowHeight',windowHeight) if ( bool ) { // console.log(bool) $("#loading").show(); scrollflag = false; pager.getMore(); 銆€銆€} }); } function dayjsDate(showdate){ if ( !dayjs ) { return showdate; }; return dayjs(showdate).format('YYYY-MM-DD'); // var now = dayjs().format('YYYY-MM-DD') // var show = dayjs(showdate).format('YYYY-MM-DD') // var bool = dayjs(show).isBefore(dayjs(now)) // if ( bool ) { // return show; // } // return dayjs(showdate).fromNow() } function change_list(text){ var style = text == 'style_card' ? text : 'style_list'; $(".change_list").each(function(){ $(this).removeClass('selected'); }) $("#liststyle_selecter ." + text).addClass('selected'); if ( style == 'style_card' ) { $("#left_list").removeClass('list_list').addClass('card_list'); $(".list_ad").show(); }else{ $("#left_list").removeClass('card_list').addClass('list_list'); $(".list_ad").hide(); } } function successcallback(){ $("#PageList .right").each(function(){ var isshow = $(this).data('isshow'); if ( isshow != '1' ) { var showdate = $(this).text(); showdate = dayjsDate(showdate); $(this).text(showdate).data('isshow','1'); } }) $(".contant .title").each(function(){ if ( $(this).data('sub') != 1 ) { var text = $(this).text(); $(this).data('sub',1) if( text.length > 30 ){ $(this).children().text(text.substr(0,28) + '...'); } } }) $(".contant p").each(function(){ if ( $(this).children().data('sub') != 1 ) { var text = $(this).children().text(); $(this).children().data('sub',1) if( text.length > 74 ){ $(this).children().text(text.substr(0,72) + '...'); } } }) $("#PageList .time a").each(function(){ if ( $(this).data('issite') != 1 ) { icms_site.setNameAndUrl(this) } }) var page_no = pager.options.page_no; var all_page = pager.options.all_page; if ( all_page == 0 || page_no == parseInt(all_page - 1) ) { $("#loading").html('娌℃湁鏇村浜咟/a>'); return; }; if ( page_no >= 9 ) { $("#loading").html('鏌ョ湅鏇村'); return; }; $("#loading").hide(); scrollflag = true; } function live_search(){ var search_keyword = document.getElementById("search_keyword").value; search_keyword = $.trim(search_keyword) if( search_keyword == '' ){ return; } window.open("https://live.changsha.cn/search/?Source=鏄熻景&Key=" + search_keyword,"_blank"); }