if (!Array.prototype.indexOf) { Array.prototype.indexOf = function (elt /*, from*/) { var len = this.length >>> 0; var from = Number(arguments[1]) || 0; from = (from < 0) ? Math.ceil(from) : Math.floor(from); if (from < 0) from += len; for (; from < len; from++) { if (from in this && this[from] === elt) return from; } return -1; }; } $(function () { var siteCode = $('#sitecode').val(), channelId = $('#channelId').val(); var setting; //load zpfl channel // 鍒犻櫎url涓寚瀹氱殑鍙傛暟,骞惰繑鍥炲垹闄ゅ弬鏁板悗鐨勫畬鏁磚rl function delParam (name) { var loca = window.location; var baseUrl = loca.origin + loca.pathname + "?"; var query = loca.search.substr(1); if (query.indexOf(name) > -1) { var obj = {} var arr = query.split("&"); for (var i = 0; i < arr.length; i++) { arr[i] = arr[i].split("="); obj[arr[i][0]] = arr[i][1]; }; delete obj[name]; var url = baseUrl + JSON.stringify(obj).replace(/[\"\{\}]/g, "").replace(/\:/g, "=").replace(/\,/g, "&"); return url }; } var pageRequestParams = getRequestParams(); var isPCViewType = pageRequestParams.viewport_type === "pc"; if (isPCViewType) { document.getElementById("viewport").setAttribute('content', ''); // $('.viewportApp a').attr("href",window.location.protocol +"//" +window.location.host +window.location.pathname); var deleteParam = delParam('viewport_type') $('.viewportApp a').attr("href", deleteParam); $('.viewportApp').show(); } $('.version .app').attr("href", window.location.href); var url = window.location.search; if (url.indexOf("?") != -1) { $('.version .pc').attr("href", window.location.href + "&viewport_type=pc"); } else { $('.version .pc').attr("href", window.location.protocol + "//" + window.location.host + window.location.pathname + "?viewport_type=pc"); } // 鏈夌綉绔欓椤电殑鎶娾€滃勾搴︽姤琛ㄢ€濆彇鍑烘潵 var ndbbSites = [ "sthjsite", "fgwsite", "nyjsite", "czjsite", "rsjsite", "jyjsite", "wjwsite", "gajsite", "zjjsite", "jtjsite", "sjjsite", "zhxzjsite", "lyjsite", "zwzxsite", "tjjsite", "swjsite", "zgjsite", "wljsite", "yzqsite", "jyqsite", "12345" ]; if (ndbbSites.indexOf(siteCode) != -1) { $("#ndbb_left").show(); } else { $("#ndbb_left").hide(); $('#logolink').attr('href', 'javascript:;') $('#logolink').removeAttr("target") } $('#ysqDownLoadHref').attr('href', 'http://www.sanya.gov.cn/sanyasite/nbxggd/200905/d0d5b455295b4e44a8de29aea2181343/files/3b54e52498494bd1b940604449fac89e.doc'); $.ajax({ type: 'GET', url: '/u/channel/tree/' + siteCode + '?channelId=' + channelId, dataType: "jsonp", jsonp: "JsonpCallBack", jsonpCallback: "callbackZPFLList1", success: function (data) { var dataList = data.list; var filteredData = dataList.filter(item => item.code !== "xxgknb" && item.code !== "xxgkzn" && item.code !== "wzndbb"); loadZPFLDatas(filteredData); } }); function loadZPFLDatas (zpflDatas) { $.ajax({ type: 'GET', url: '/u/search/zpflStat/' + siteCode, dataType: "jsonp", jsonp: "JsonpCallBack", jsonpCallback: "callbackZPFLStat1", success: function (data) { loadZPFLStat(zpflDatas, data); } }); } //zpflDatas----channel's info //data----channel has article function loadZPFLStat (zpflDatas, data) { var n = 0, pidArr = new Array(), emptyChannelIds = [], len = zpflDatas.length, item, statItem = data[0], code, jggkIsJump, ldxxIsJump; //count sub channel manuscript count var topDict = {}, topDictCodeId = {}, topCountDict = {}; //topDict 鐩稿悓鐖秈d鐨勬爮鐩斁鍦ㄤ竴涓暟缁勯噷闈 //topDictCodeId 鍒楀嚭姣忎釜 鏍忕洰鐨刬d:鏍忕洰浠e彿s var skipEmptyChannelCodes = ["xzxk", "xzcf", "ybzcxx"], skipEmptyChannelIds = []; var channelsIsJump = ["tsjyxx"], channelsIsJumpIds = []; for (var i = 0; i < zpflDatas.length; i++) { var temp = zpflDatas[i]; // if(hideChannelCodes.indexOf(temp.code) > -1){ // zpflDatas.splice(i,1); // } if (!topDict[temp.pId]) { topDict[temp.pId] = []; } if (skipEmptyChannelCodes.indexOf(temp.code) > -1) { skipEmptyChannelIds.push(temp.id); } if (channelsIsJump.indexOf(temp.code) > -1) { channelsIsJumpIds.push(temp.id); } topDict[temp.pId].push(temp.code); if (!topDictCodeId[temp.id]) { topDictCodeId[temp.id] = temp.code; } } //topCountDict 璁$畻鍑烘湁浜岀骇鏍忕洰鐨勭埗鏍忕洰淇℃伅鍏紑鏂囩珷鏁 for (var topId in topDict) { var topCode = topDictCodeId[topId]; if (!topCode || statItem[topCode]) continue; //root id topCountDict[topCode] = 0; for (var i = 0; i < topDict[topId].length; i++) { var tempCode = topDict[topId][i]; topCountDict[topCode] += statItem[tempCode] ? statItem[tempCode] : 0; } } //\end for (var i = 0; i < zpflDatas.length; i++) { item = zpflDatas[i]; var itemCN = item.name, code = item.code; jggkIsJump = item.url.indexOf('null') < 0 && code != 'xxgknb'; if (!jggkIsJump) { item.url = ''; } if (!!statItem[code] || !!topCountDict[code] || skipEmptyChannelCodes.indexOf(code) > -1 || channelsIsJump.indexOf(code) > -1) { if (topCountDict[code]) { // item.name = item.name+'('+ ((statItem[code] ? statItem[code] : 0)+ topCountDict[code])+')'; if (statItem[code]) { item.url = '/sanyasite/xhtml/newxxgk/newxxgk_rigth_list.shtml?#zpfl' + code; // item.url = "'/'+siteCode+'/'+code+'/newxxgk_rigth_list.html'?#zpfl"+code; item.target = "new"; } // item.name = item.name+'('+ topCountDict[code] +')'; item.name = item.name; } else { if (!jggkIsJump) { if (code == 'jggk' || code == 'jggkzmg' || code == 'xfjdxx' || code == 'tsjyxx') { if (code == 'jggk' || code == 'jggkzmg') { item.url = '/' + siteCode + '/' + code + '/dzjg.shtml'; } if (code == 'xfjdxx') { item.url = '/' + siteCode + '/' + code + '/newxxgk_xfjd.shtml'; } if (code == 'tsjyxx' && siteCode == 'gsxzgljsite') { item.url = '/' + siteCode + '/' + code + '/newxxgk_tsjy.shtml'; } } else { // item.url = '/'+siteCode+'/'+code+'/xxgk_rigth_list.shtml'; // item.url = '/'+siteCode+'/newxxgk_rigth_list.shtml?channelCode='+code; // item.url = '/'+siteCode+'/zfxxgk/newxxgk_rigth_list.shtml?channelCode='+code+'&totalPage='+pageIndex; item.url = '/' + siteCode + '/zfxxgk/newxxgk_rigth_list.shtml?channelCode=' + code + "&cn=" + encodeURI(itemCN); } item.target = "new"; //item.name = item.name+'('+ statItem[code]+')'; } if (skipEmptyChannelCodes.indexOf(code) > -1 && (['sthjsite'].indexOf(siteCode) == -1)) { item.url = "javscript:void(0);"; } } pidArr.push(item.pId); } else { if (!jggkIsJump) { emptyChannelIds.push({ index: i, id: item.id }); } } } //杩囨护鎺夋病鏈夋枃绔犵殑鏍忕洰 for (var j = 0; j < emptyChannelIds.length; j++) { var allSubChannelsEmpty = true; for (var k = 0; k < pidArr.length; k++) { if (skipEmptyChannelIds.indexOf(pidArr[k]) > -1 || skipEmptyChannelIds.indexOf(emptyChannelIds[j]) > -1 || channelsIsJumpIds.indexOf(emptyChannelIds[j]) > -1) { continue; } if (emptyChannelIds[j].id == pidArr[k]) { allSubChannelsEmpty = false; } } if (allSubChannelsEmpty) { zpflDatas.splice(emptyChannelIds[j].index - n, 1); n++; } } setting = { view: { dblClickExpand: false }, data: { simpleData: { enable: true } }, callback: { onClick: onNodeClick } }; function onNodeClick (e, treeId, treeNode) { var zTree = $.fn.zTree.getZTreeObj("treeDemo"); zTree.expandNode(treeNode); } // $.fn.zTree.init($("#treeDemo"), setting, zpflDatas); // $("#new").attr("src","/"+ siteCode + "/zfxxgk/newxxgk_rigth_list.shtml?channelCode=bmwjxx&cn=閮ㄩ棬鏂囦欢"); $.fn.zTree.init($("#treeDemo"), setting, zpflDatas); var Params = getRequestParams(); var xxgk_code = Params.xxgk; var xxgk_cn = Params.xxgk_cn; if (!xxgk_code) { xxgk_code = "bmwjxx"; xxgk_cn = "閮ㄩ棬鏂囦欢"; } if (xxgk_code == 'xfjdxx' || xxgk_code == 'tsjyxx') { if(xxgk_code == 'xfjdxx'){ $("#new").attr("src", "/" + siteCode + '/' + xxgk_code + "/newxxgk_xfjd.shtml"); } if(xxgk_code == 'tsjyxx' && siteCode == 'gsxzgljsite'){ $("#new").attr("src", "/" + siteCode + '/' + xxgk_code + "/newxxgk_tsjy.shtml"); } } else { $("#new").attr("src", "/" + siteCode + "/zfxxgk/newxxgk_rigth_list.shtml?channelCode=" + xxgk_code + "&cn=" + xxgk_cn); } } $('.l_menu li .last .inactive').click(function () { if ($(this).hasClass('active')) { $('.inactive').removeClass('active').next('ul').slideUp('500'); } else { $('.inactive.active').removeClass('active').next('ul').slideUp('500'); $(this).addClass('active').next('ul').slideDown('500'); } }); // 鑾峰彇渚濈敵璇风殑閾炬帴 var ysqSites = ['jyqzwzxsite', 'jyqsthjsite', 'yzqsthjsite', 'yzqmzswjsite', 'yzqzwzxsite','zwzxsite'] $.getJSON('/b/sgs/config', { sitecode: site }, function (configData) { window.SiteConfig = configData; if (ysqSites.indexOf(siteCode) == -1) { $("#ysgkLink").attr("href", configData.ysq_path); } else { $("#ysq_left").css({ 'display': 'none' }); } }); // 鍒ゆ柇鍖哄悇閮ㄩ棬锛堝湴鏂归儴闂ㄥ钩鍙伴摼鎺ュ彸杈瑰睍绀虹殑鍐呭锛 if (siteCode.indexOf('jyq') != -1) { $("#jyq").css({ 'display': 'block' }); $("#sgbm").css({ 'display': 'none' }); } else if (siteCode.indexOf('tyq') != -1) { $("#tyq").css({ 'display': 'block' }); $("#sgbm").css({ 'display': 'none' }); } else if (siteCode.indexOf('htq') != -1) { $("#htq").css({ 'display': 'block' }); $("#sgbm").css({ 'display': 'none' }); } else if (siteCode.indexOf('yzq') != -1) { $("#yzq").css({ 'display': 'block' }); $("#sgbm").css({ 'display': 'none' }); } else { $("#sgbm").css({ 'display': 'block' }); } // 闄や簡鍖烘斂搴溿€佸叕瀹夊眬锛屼慨鏀光€濇斂绛栤€滃彸渚р€濋儴闂ㄦ枃浠垛€滅殑閾炬帴 var qzfSites = [ "jyqsite", "htqsite", "tyqsite", "yzqsite"]; if (qzfSites.indexOf(siteCode) == -1) { $('#fl .lby .lby-lm1 a,#fl .lby .lby-lm3 a').attr({ "href": window.location.protocol + "//" + window.location.host + window.location.pathname + "?gklb=zdgknr&xxgk=bmwjxx&xxgk_cn=閮ㄩ棬鏂囦欢", "target": "_self" }); } // 璁剧疆甯傛斂鍔℃湇鍔′腑蹇冩悳绱㈡爣璇嗙爜 if (siteCode == 'zwzxsite') { $('#WEBSITEID').attr('value', '4602000014'); } // 鍒犻櫎甯傛秷闃插眬淇℃伅鍏紑椤甸潰搴曢儴鐨勨€滄垜涓烘斂搴滄壘閿欌€ if (siteCode == 'xfjsite') { $(".jiucuo").remove(); } // 鏀垮簻淇℃伅鍏紑鍒跺害 changeHref("gkzd-box"); function changeHref (className) { $("." + className + " .lby-lm6 a").each(function () { if ($(this).attr("data-url").indexOf("http") >= 0) { $(this).attr("href", $(this).attr("data-url")); } else { $(this).attr("href",window.location.protocol + "//" + "www.sanya.gov.cn" + $(this).attr("data-url")); } }) } // 鍙充晶娣诲姞鈥滃畨鍏ㄧ敓浜т妇鎶ョ郴缁熲€濇诞鍔ㄥ浘 if (siteCode == 'aqscjdjsite') { $("body").append('
鍏抽棴
'); $("#aqscjb .close").click(function () { $("#aqscjb").hide(); }); } }); /*鍒楄〃鍒ゆ柇缁勯厤鍒嗙被*/ var hash = window.location.hash.split('#')[1]; var sitecode = $('#sitecode').val(); if (hash && hash != 'xxgk') { var url = ''; $('.yiji li').each(function () { var self = $(this); var data_id = self.attr('data-id'); if (hash == data_id) { url = self.children('a').attr('href'); $('#new').attr('src', url); return false; } else { window["new"].location.href = '/' + sitecode + '/' + hash + '/newxxgk_rigth_list.shtml'; } }); }