PageSourceSearch

https://www.ntv.cn/Public/pc/js/share.js

js ntv.cn collected 2026-10-02 15:08:41 UTC 3,630 bytes, 111 lines download raw bytes

1//微信分享
2function share(flag){
3	if (!flag) return ;
4	var shareUrl = window.location.href.split('#')[0];
5	var shareImg = 'https://www.ntv.cn//Public/pc/images/logo.jpg';
6	if($('#wx_pic').length > 0 && $('#wx_pic').attr('src')){
7	    shareImg = $('#wx_pic').attr('src')
8	}
9	var shareTitle = $("h2").text();
10	if(shareTitle == ""){
11	    shareTitle = document.title;
12	}
13    
14	$.ajax({
15		url: 'https://rmtapi.ntv.cn/jhxtapi/app/WechatShare/getShareSignature',
16		type: 'post',
17		data: {url:shareUrl},
18		dataType: 'json',
19		success: function(res) {
20			var json = res.data;
21			wx.config({
22				debug: false,
23				// appId: 'wxd9cd53936e29779d', // 必填,公众号的唯一标识
24				appId: json.appId, // 必填,公众号的唯一标识
25				timestamp: json.timestamp, // 必填,生成签名的时间戳
26				nonceStr: json.noncestr, // 必填,生成签名的随机串
27				signature: json.signature,// 必填,签名,见附录1
28				jsApiList: ['onMenuShareAppMessage','onMenuShareQQ','onMenuShareTimeline','onMenuShareWeibo','onMenuShareQZone'] // 必填,需要使用的JS接口列表,所有JS接口列表见附录2
29			});
30			
31			//===
32			wx.ready(function(){
33				//微信好友
34				wx.onMenuShareAppMessage({
35					title: shareTitle, // 分享标题
36					desc: "农视网—中央新闻网站 三农资讯聚合服务平台", // 分享描述
37					link: shareUrl, // 分享链接
38					imgUrl: shareImg, // 分享图标
39					type: 'link', // 分享类型,music、video或link,不填默认为link
40					dataUrl: '', // 如果type是music或video,则要提供数据链接,默认为空
41					success: function () { 
42						// 用户确认分享后执行的回调函数
43						//setShare();
44					},
45					cancel: function () { 
46						// 用户取消分享后执行的回调函数
47					}
48				});
49				//朋友圈
50				wx.onMenuShareTimeline({
51					title: shareTitle, // 分享标题
52					link: shareUrl, // 分享链接
53					imgUrl: shareImg, // 分享图标
54					success: function () { 
55						// 用户确认分享后执行的回调函数
56					//	setShare();
57					},
58					cancel: function () { 
59						// 用户取消分享后执行的回调函数
60					}
61				});
62				//分享到QQ
63				wx.onMenuShareQQ({
64					title: shareTitle, // 分享标题
65					desc: "农视网—中央新闻网站 三农资讯聚合服务平台", // 分享描述
66					link: shareUrl, // 分享链接
67					imgUrl: shareImg, // 分享图标
68					success: function () { 
69					   // 用户确认分享后执行的回调函数
70					  // setShare();
71					},
72					cancel: function () { 
73					   // 用户取消分享后执行的回调函数
74					}
75				});
76				//分享到腾讯微博
77				wx.onMenuShareWeibo({
78					title: shareTitle, // 分享标题
79					desc: "农视网—中央新闻网站 三农资讯聚合服务平台", // 分享描述
80					link: shareUrl, // 分享链接
81					imgUrl: shareImg, // 分享图标
82					success: function () { 
83					    // 用户确认分享后执行的回调函数
84					  // setShare();
85					},
86					cancel: function () { 
87					    // 用户取消分享后执行的回调函数
88					}
89				});
90				//分享到QQ空间
91				wx.onMenuShareQZone({
92					title: shareTitle, // 分享标题
93					desc: "农视网—中央新闻网站 三农资讯聚合服务平台", // 分享描述
94					link: shareUrl, // 分享链接
95					imgUrl: shareImg, // 分享图标
96					success: function () { 
97					    // 用户确认分享后执行的回调函数
98					   //setShare();
99					},
100					cancel: function () { 
101						// 用户取消分享后执行的回调函数
102					}
103				});
104			});
105		}
106	});
107}
108
109setTimeout(function () {
110  share(true)
111}, 1000)

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.