35 lines
1.3 KiB
JavaScript
35 lines
1.3 KiB
JavaScript
|
document.write("<script src='https://res.wx.qq.com/open/js/jweixin-1.4.0.js'></script>");
|
|||
|
document.write("<script src='https://uploads.dahe.cn/lxx/2020/hnrbwap/wxshare.js'></script>");
|
|||
|
|
|||
|
|
|||
|
$(function(){
|
|||
|
var ua = navigator.userAgent.toLowerCase();//获取判断用的对象
|
|||
|
if (ua.match(/micromessenger/i) != "micromessenger") {return;}// 非微信不执行以下脚本
|
|||
|
|
|||
|
var shortImg,shareTitle,shareDesc,shareLink;
|
|||
|
shortImg = "https://uploads.dahe.cn/lxx/2020/hnrbwap/logo.png";
|
|||
|
|
|||
|
//版面页面
|
|||
|
if (location.href.indexOf("node")>=0){
|
|||
|
shareTitle = "河南日报电子版";
|
|||
|
shareDesc = $("title").html();
|
|||
|
shareLink = window.location.href.split("node_")[0]+"node_"+$('.swiper-wrapper .swiper-slide-active img.paperMap').attr('usemap').replace("#PagetupMap","")+".htm";
|
|||
|
}
|
|||
|
|
|||
|
//文章页面
|
|||
|
if (location.href.indexOf("content")>=0){
|
|||
|
shareTitle = $("#articleTitle").html().replace(/<\s*br\s*[/]*>/g," ").replace(/<\s*br\s*[/]*>/g," ");
|
|||
|
shareDesc = $("#content").html().replace(/\s+|<.*?>| /ig, '').substring(0, 50);
|
|||
|
shareDesc = shareDesc==""?"": shareDesc + "......";
|
|||
|
shareLink = window.location.href;
|
|||
|
}
|
|||
|
|
|||
|
//今日版面总览
|
|||
|
if (location.href.indexOf("index")>=0){
|
|||
|
shareTitle = "河南日报数字报";
|
|||
|
shareDesc = "今日版面总览";
|
|||
|
shareLink = window.location.href;
|
|||
|
}
|
|||
|
wxshare(shareTitle,shareDesc,shortImg)
|
|||
|
});
|