繁體
|
簡體
Sclub交友聊天~加入聊天室當版主
(檢舉)
分享
新浪微博
QQ空间
人人网
腾讯微博
Facebook
Google+
Plurk
Twitter
Line
标题:
复制代码 功能,去flash化
[打印本页]
作者:
flashroad
时间:
2018-9-9 10:27
标题:
复制代码 功能,去flash化
【版权】
http://icode.258club.com/thread-85-1-1.html
作者:
flashroad
时间:
2018-9-9 10:28
标题:
编辑discuzcode模版
找到
function tpl_codedisp($discuzcodes, $code) {
}-->
<!--{block return}--><div class="blockcode"><div id="code$discuzcodes[codecount]"><ol><li>$code</ol></div><em onclick="copycode($('code$discuzcodes[codecount]'));">{lang discuzcode_copyclipboard}</em></div><!--{/block}-->
<!--{eval return $return;}-->
<!--{eval
}
复制
替换为
function tpl_codedisp($discuzcodes, $code) {
}-->
<!--{block return}--><div class="blockcode"><div class="uuid-code" id="code$discuzcodes[codecount]"><ol><li>$code</ol></div><em class="btn-copy" id="copyBT_code$discuzcodes[codecount]">复制</em></div><script>function copyArticle(event){const range = document.createRange();range.selectNode(document.getElementById('code$discuzcodes[codecount]'));const selection = window.getSelection();if(selection.rangeCount > 0) selection.removeAllRanges();selection.addRange(range);document.execCommand('copy');alert("复制成功!");}document.getElementById('copyBT_code$discuzcodes[codecount]').addEventListener('click', copyArticle, false);</script><!--{/block}-->
<!--{eval return $return;}-->
<!--{eval
}
复制
欢迎光临 flash之路-flash技术交流 (http://flashroad.joinbbs.net/)
Powered by Discuz! 7.2