WordPress如何禁止用户以各种方式获取代码

2024-11-06 0 1,201

正文:

今日,我将与大家探讨如何有效阻止用户通过不同途径获取 WordPress 网站代码的策略。

演示截图:

WordPress如何禁止用户以各种方式获取代码

使用指南

若您希望在子比平台的主题设置中嵌入自定义代码,以实现更加丰富的功能和视觉效果,请按照以下步骤操作:

1. 引入 Vue.js 和 Element UI 框架:
– 打开子比平台的主题设置界面。
– 进入“自定义代码”部分,找到“自定义底部HTML 代码”选项。
– 将以下代码粘贴至该区域:


# 汇站网
# https://www.huizhanii.com/?p=38923
<script src="https://cdn.jsdelivr.net/npm/vue@2.6.14/dist/vue.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/element-ui@2.15.6/lib/index.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/element-ui@2.15.6/packages/theme-chalk/lib/index.css">

– 保存设置。

2. 添加自定义JavaScript代码:


# 汇站网
# https://www.huizhanii.com/?p=38923
//禁止用户以各种方式获取代码
/*ctrl+u*/
document.onkeydown=function(){if(event.ctrlKey&&window.event.keyCode==85){new Vue({data:function(){this.$notify({title:"嘿!别瞎按",message:"老弟,想偷我源码?~",position:'bottom-right',offset:50,showClose:true,type:"error"});return{visible:false}}})
return false;}
/*f 12*/
if(window.event&&window.event.keyCode==123){event.keyCode=0;event.returnValue=false;new Vue({data:function(){this.$notify({title:"嘿!Bingo~",message:"老弟,试试 Alt+Shift+Fn+F4",position:'bottom-right',offset:50,showClose:true,type:"error"});return{visible:false}}})
return false;}
/*ctrl+s*/
if(event.ctrlKey&&window.event.keyCode==83){new Vue({data:function(){this.$notify({title:"嘿!你瞧瞧你",message:"网页得换方法保存哦~",position:'bottom-right',offset:50,showClose:true,type:"error"});return{visible:false}}})
return false;}
/*ctrl+shift+i*/
if((event.ctrlKey)&&(event.shiftKey)&&(event.keyCode==73)){new Vue({data:function(){this.$notify({title:"嘿!哈哈哈",message:"老弟,调试方法也得换换哟~",position:'bottom-right',offset:50,showClose:true,type:"error"});return{visible:false}}})
return false;}
/*f5*/
if(window.event&&window.event.keyCode==116){event.keyCode=0;event.returnValue=false;new Vue({data:function(){this.$notify({title:"嘿!喂喂喂",message:"浏览器自带刷新按钮不香吗?",position:'bottom-right',offset:50,showClose:true,type:"warning"});return{visible:false}}})
return false;}}
/*复制 tips*/
document.addEventListener("copy",function(e){new Vue({data:function(){this.$notify({title:"叮!复制成功",message:"若要转载必须保留本站原文链接!",position:'bottom-right',offset:50,showClose:true,type:"success"});return{visible:false}}})})
/* 禁用右键菜单并提醒 */
document.oncontextmenu = function (){new Vue({data:function(){this.$notify({title:"嘿!没有右键菜单",message:"复制请用键盘快捷键 Ctrl+C",position:'bottom-right',offset:50,showClose:true,type:"warning"});return{visible:false}}})
return false;}

– 在“自定义代码”部分,找到“自定义javascript 代码”选项。
– 将您的 JavaScript 代码粘贴至该区域。
– 保存设置。

通过以上步骤,您即可在子比平台中灵活运用 Vue.js 和 Element UI 框架,打造个性化的页面效果。

本文章已结束,如转载请注明:汇站网 » WordPress 如何禁止用户以各种方式获取代码

收藏 (0)

微信支付 微信扫一扫

支付宝支付 支付宝扫一扫

打赏二维码
点赞 (0)

站长资源下载中心-找源码上汇站

常见问题
  • 如果付款后没有弹出下载页面,多刷新几下,有问题联系客服!
查看详情
  • 本站所有资源版权均属于原作者所有,这里所提供资源均只能用于参考学习用,请勿直接商用。若由于商用引起版权纠纷,一切责任均由使用者承担。
查看详情

相关文章

联系官方客服

为您解决烦忧 - 24小时在线 专业服务