自定义浮动功能面板分享按钮分享内容
<script src="https://g.yimenyun.net/cdn/jsbridge-mini.js"></script><script type="text/javascript">
jsBridge.ready(()=>{
var img = "";
for(var i=0;i<document.images.length;i++){
if(parseInt(document.images.width)>100 && parseInt(document.images.height)>100){
img=document.images.src;
break;
}
}
var shareInfo={
title : document.title,
link: location.href,
imgUrl: img,
desc: document.querySelector(".message").textContent.replaceAll("\n","").trim().substring(0,30),
success: function() {
jsBridge.toast("\u5206\u4eab\u6210\u529f");
},
cancel: function() {
jsBridge.toast("\u53d6\u6d88\u5206\u4eab\u6216\u5206\u4eab\u5931\u8d25");
}
}
jsBridge.onMenuShareTimeline(shareInfo);
jsBridge.onMenuShareFriend(shareInfo);
jsBridge.onMenuShareQQ (shareInfo);
jsBridge.onMenuShareQZone (shareInfo);
})
</script>
<div class="clear"></div>
<div class="btnBlue btnBlueEd">进入页面自动执行JS</div>
<div class="clear"></div>
<script type="text/javascript">
jsBridge.ready(()=>{
var img = "";
for(var i=0;i<document.images.length;i++){
if(parseInt(document.images.width)>100 && parseInt(document.images.height)>100){
//设置页面分享图片为宽大于100,高大于100像素
img=document.images.src;
break;
}
}
var shareInfo={
title : document.title,
link: location.href,
imgUrl: img,
desc: document.querySelector(".bz_message_table").textContent.replaceAll("\n","").trim().substring(0,30),
//设置分享出去的元素内容截取,以及字数限制30
success: function() {
jsBridge.toast("\u5206\u4eab\u6210\u529f");
},
cancel: function() {
jsBridge.toast("\u53d6\u6d88\u5206\u4eab\u6216\u5206\u4eab\u5931\u8d25");
}
}
jsBridge.onMenuShareTimeline(shareInfo);
jsBridge.onMenuShareFriend(shareInfo);
jsBridge.onMenuShareQQ (shareInfo);
jsBridge.onMenuShareQZone (shareInfo);
})
</script>
<div class="clear"></div>
<p class="bgBlueLight ">
下载<a href="https://www.yimenapp.com/doc/demo.cshtml">jsbridge-mini.js</a>上传服务器并引入,根据实际业务自定义JS策略,映射JS只会APP内生效!请<a href="https://bbs.yimenapp.com/thread-12583-1-1.html" class="openapp">下载APP</a>后<a href="intent://app#Intent;scheme=ltapp188269;package=com.yimenapp.dev;end" class="openapp">打开app</a>体验!
</p>
页:
[1]