$(function(){ $(".listTable li").each(function(){ var bshare_url = $(this).find(".share-box").attr("data-url"); var bshare_title =$(this).find(".share-box").attr("data-title"); var share_urls = 'https://service.weibo.com/share/share.php?type=4&site=sinaminiblog&url='+location.origin+''+ bshare_url + '&title=' + encodeURIComponent(bshare_title); $(this).find("a.bds_tsina").off("click"); $(this).find("a.bds_tsina").attr('href', share_urls) $(this).find("a.bds_tsina").click(function(){ window.open(share_urls) }); }) ; var os = function(){ var ua = navigator.userAgent, isWindowsPhone = /(?:Windows Phone)/.test(ua), isSymbian = /(?:SymbianOS)/.test(ua) || isWindowsPhone, isAndroid = /(?:Android)/.test(ua), isFireFox = /(?:Firefox)/.test(ua), isChrome = /(?:Chrome|CriOS)/.test(ua), isTablet = /(?:iPad|PlayBook)/.test(ua) || (isAndroid && !/(?:Mobile)/.test(ua)) || (isFireFox && /(?:Tablet)/.test(ua)), isPhone = /(?:iPhone)/.test(ua) && !isTablet, isPc = !isPhone && !isAndroid && !isSymbian; return { isTablet: isTablet, isPhone: isPhone, isAndroid : isAndroid, isPc : isPc }; }(); /*主大图切换*/ $(".mbanner .focus").sudyfocus({ p:2, zWidth:1920, zHeight:825, title:{ isAutoWidth: true, active:true, href: true }, text:{ active: false, isAutoHeight: false, href: false }, response: true, speed:700, pagination: true, navigation: true, isNavHover: false, href:true, effect: 'fade' }); /*专题网站tab切换*/ $(".main .post-32").sudyTab({ handle:".news_con .news_title", content:".news_imgs a", trigger:"mouseenter", start:1, autoPlay:{ active:false } }); /*友情链接下拉*/ $(".botlinks").each(function(index, el){ $(el).find(".links-wrap").hover(function(){ $(this).addClass('wrap-open').children('.link-items').stop(true,true).slideDown(300); },function(){ $(this).removeClass('wrap-open').children('.link-items').stop(true,true).slideUp(100); }); }); $(".main .post-21").find(".news").each(function(){ var times = $(this).find(".news_date").data("times").split("-"); $(this).find(".news_year").text(times[2]); $(this).find(".news_days").text(getMonthEN(times[1])); //$(this).find(".news_days").text(getMonthEN(marth).slice(0,3)); }); function getMonthEN(n){ var num = parseInt(n, 10), month = ""; if (num == 1) { month = "January" } if (num == 2) { month = "February" } if (num == 3) { month = "March" } if (num == 4) { month = "April" } if (num == 5) { month = "May" } if (num == 6) { month = "June" } if (num == 7) { month = "July" } if (num == 8) { month = "August" } if (num == 9) { month = "September" } if (num == 10) { month = "October" } if (num == 11) { month = "November" } if (num == 12) { month = "December" } return month; } /*复旦百科*/ if(os.isAndroid || os.isPhone || os.isTablet){ var $box = $(".main .post-41").find(".boxm"); $(".main .post-41").sudyTab({ handle:".tit .title", content:".con .boxm,.more_btn .more_text", trigger:"click", start:1, autoPlay:{ active:false }, callback:function(index){ $box.eq(index).find(".news_conbox .news_list").slick({ dots: false, infinite: true, autoplay:false, slide: 'li', slidesToShow:1, slidesToScroll:1, responsive: [ { breakpoint: 999, settings: { slide: 'li', slidesToShow: 1, slidesToScroll: 1 } }, { breakpoint: 600, settings: { slide: 'li', slidesToShow:1, slidesToScroll: 1 } } ] }); } }); }else{ var $box = $(".main .post-41").find(".boxm"); $(".main .post-41").sudyTab({ handle:".tit .title", content:".con .boxm,.more_btn .more_text", trigger:"click", start:1, autoPlay:{ active:false }, callback:function(index){ //$box.eq(index).find(".news_conbox").unslick(); $box.eq(index).find(".news_conbox").slick({ dots: false, infinite: true, autoplay:false, slide: 'div.news_con', slidesToShow:1, slidesToScroll:1, responsive: [ { breakpoint: 1170, settings: { slide: 'div.news_con', slidesToShow: 1, slidesToScroll: 1, infinite: true } }, { breakpoint: 999, settings: { slide: 'li', slidesToShow: 1, slidesToScroll: 1 } }, { breakpoint: 600, settings: { slide: 'li', slidesToShow:1, slidesToScroll: 1 } } ] }); } }); } $box.find('.news_con').each(function(){ var _this = $(this); _this.find(".news:first").addClass("active"); _this.find(".news").hover(function(){ $(this).siblings().removeClass("active"); $(this).addClass("active"); },function(){ _this.find(".news:first").siblings().removeClass("active"); _this.find(".news:first").addClass("active"); }); }); /** * 分享 * @param node * @param ask * @param hide */ var shareFuc = function (node, ask, hide) { var infoNode = ask ? $(node) : $(node).parents('#share_list'); //var bshare_url = infoNode.attr("data-url") || window.location.href, var bshare_url = infoNode.attr("data-url"), bshare_title = infoNode.attr("data-title") || "", bshare_summary = infoNode.attr("data-summary") || "", type = $(node).attr('data-name'), bshare_pic = infoNode.attr('data-pic') || ""; var share_url = 'https://bshare.optimix.asia/barCode?site=' + type + '&url='+location.origin+''+ bshare_url + '&title=' + encodeURIComponent(bshare_title); var share_urls = 'https://bshare.optimix.asia/bshare_redirect?type=4&site=' + type + '&url='+location.origin+''+ bshare_url + '&title=' + encodeURIComponent(bshare_title); /*var share_url = 'http://api.bshare.cn/share/' + type + '?url=' + bshare_url + '&title=' + encodeURIComponent(bshare_title) + '&summary=' + encodeURIComponent(bshare_summary) + '&pic=' + bshare_pic;*/ if (type == 'weixin') { var weixin = $(node).parents('#share_list').find('.weixin-layer'); var left = $(node).position().left - 10 - 35; if (hide) { weixin.hide(); return; } weixin.find('img').attr({'src': share_url,}); weixin.css('left', left); weixin.fadeIn("fast"); } else if (type == 'like') { if ($(node).hasClass('haslike')) { alert('您已经喜欢过了!'); } else { var likeNum = parseInt($(node).find('span').text()); $(node).addClass('haslike').find('span').text(likeNum + 1); $('.share-layer').find('.like-share').addClass('haslike').find('span').text(likeNum + 1); } } else { window.open(share_urls, '_blank'); } }; var shareBind = function (nodelist){ nodelist.each(function (idx, node){ var type = $(node).attr('data-name'); var ev = type == 'weixin' ? 'hover' : 'click'; if (type == 'weixin') { $(node).hover(function (){ shareFuc(this); }, function () { shareFuc(this, null, true); }) } else { $(node).on('click', function (){ shareFuc(this); }) } }) }; var index = 0; //////////////////////////////////////////////////////////////////////////////////////// //var siteURL = (document.getElementById("version").src).match(/(.*)(?=\/fws_seach)/)[0]; /*$(".main .post-11 .con.news_tu").fwsSearch({ url:'/_wp3services/generalQuery?queryObj=articles', siteId:3, columnId:'1247', rows:10, displayType:'list', field: [ {title:"状态",children:"精品+最新+最热",type:"0"} ], conditFeild:[ {type:"0", field:"f5", judge:"="} ], orderData:[ {field: 'top', type: 'desc'}, {field: "publishTime", type: "desc"} ], returnInfosdata:[ {field: "title",pattern: [{name: "lp",value: "30"}], name: "title"}, {field: "titles", name: "title"}, {field: "publishTime",pattern: [{name: "d",value: "yyyy-MM-dd"}],name: "publishTime"}, {field: "summary",name: "summary"}, {field: "source",name: "source"}, {field: "visitCount",name: "visitCount"}, {field: "imgPath", name: "imgPath"}, {field: "mircImgPath", name: "mircImgPath"}, {field: "url", name: "url"}, {field: "category",name: "category"}, {field: "categoryId",name: "categoryId"}, {field: "creator",name: "creator"}, {field: "author",name: "author"}, {field: "imgLogo",name: "imgLogo"}, {field: "f5",name: "f5"}, {field: "f6",name: "f6"} ], showType: null, tpl:function(data){ if((w1imgJsons.toString()).search(data.titles) == -1){ index++; var category = ''; if(data.category !== undefined){ category = data.category.split(',')[0]; category = ''; } var random_bg = Math.floor(Math.random()*12+0); var random_imgs = '/_upload/tpl/00/04/4/template4/random_imgs/'+random_bg+'.jpg'; if(data.imgPath == '' || data.imgPath == undefined){ data.imgPath = random_imgs; } if(index>6)return false; return '
'+datas[i].t1+'
'+datas[i].t2+'
'+datas[i].t3+'
'+datas[i].t1+'
'+datas[i].t2+'
'+datas[i].t3+'
'+datas[i].t1+'
'+datas[i].t2+'
'+datas[i].t3+'