演示地址:http://music.25wz.cn/test.html?url=www.wuquejs.cn
使用:建个html文件把下面代码复制进去,访问你建的html文件后面加?url=网址。
<!DOCTYPE html>
</div>
</section>
</body>
<script src="https://cdn.bootcss.com/jquery/1.8.2/jquery.min.js"></script>
<script src="https://3gimg.qq.com/tele_safe/static/Lib/clipboard.min.js"></script>
<script>
var UA = navigator.userAgent
if (UA.toLowerCase().indexOf('mobile') >= 0) {
$('#mobile').show()
} else {
$('#pc').show()
}
function getParams(name){
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
var r = window.location.search.substr(1).match(reg);
if (r != null) return decodeURIComponent(r[2]);
return '';
}
var url = getParams('url')
var showUrl = url
if(url.length > 100) {
showUrl = url.slice(0, 30) + '...'
$('.ui-arrow').show()
$('#copy-btn').show()
$('.ui-arrow').on('click', function() {
$('#url').html('')
var coUrl = url.length > 200 ? url.slice(0, 200) + '...' : url
document.getElementById('url').appendChild(document.createTextNode(coUrl))
})
var clipboard = new ClipboardJS('#copy-btn', {
text: function(trigger) {
return url
}
})
clipboard.on('success', function(e) {
$('.copy-result').show()
setTimeout(function(){$('.copy-result').hide()}, 1000)
})
clipboard.on('error', function(e) {
MtaH5.clickStat('copyerror', {
'action': e.action,
'trigger': e.trigger
})
})
}
document.getElementById('url').appendChild(document.createTextNode(showUrl))
$('body').on('copy', function(e) {
MtaH5.clickStat('copy',{'url':url})
})
// 申诉
$('#complain').on('click', function() {
MtaH5 && MtaH5.clickStat("complain")
if (UA.toLowerCase().indexOf('mobile') >= 0) {
window.location.href = 'https://guanjia.qq.com/online_server/m_complain.html?url='+ escape(url)
} else {
window.location.href = 'https://guanjia.qq.com/online_server/complain_url.html?url='+ escape(url)
}
})
$('#rule').on('click', function() {
window.open('https://urlsec.qq.com/eviltype.html', '_self')
})
$('#guide').on('click', function() {
window.open('https://kf.qq.com/product/QQ.html', '_self')
})
</script>
<script>
function copyUrl2()
{
var Url2=document.getElementById("biao1").innerText;
var oInput = document.createElement('input');
oInput.value = Url2;
document.body.appendChild(oInput);
oInput.select(); // 选择对象
document.execCommand("Copy"); // 执行浏览器复制命令
oInput.className = 'oInput';
oInput.style.display='none';
alert('复制成功');
}
</script>
</html>