轩玮博客演示图:

轩玮博客提供部署教程:
代码路径
/wp-content/themes/zibll/header.php 加入以下引入代码
<!-- 引入VUE -->
<script src="https://unpkg.com/vue@2.6.14/dist/vue.min.js"></script>
<!-- 引入样式 -->
<script src="https://unpkg.com/element-ui@2.15.6/lib/index.js"></script>
<!-- 引入组件库 -->
<link rel="stylesheet" href="https://unpkg.com/element-ui@2.15.6/packages/theme-chalk/lib/index.css">
全部代码
Zibll主题设置 >> 全局&功能 >> 自定义代码 >> 自定义javascript代码 里面加入以下代码
根据你的需要选取部分或全部代码使用!
//复制Ctrl+C提醒
/*Copy Remind*/
document.addEventListener("copy", function(e) {
new Vue({
data: function() {
if((window.getSelection ? window.getSelection() : document.selection.createRange().text) != ''){
this.$notify({
title: "叮!复制成功",
message: "若要转载请务必保留原文链接!谢谢~",
position: 'bottom-right',
offset: 50,
showClose: true,
type: "success"
});
}else{
this.$notify({
title: "咦?复制失败",
message: "啊噢...你没还没选择内容呢!",
position: 'bottom-right',
offset: 50,
showClose: true,
type: "success"
});
}
return {
visible: false
}
}
})
})
//禁用鼠标右键菜单提醒
/*Right click prohibited*/
document.oncontextmenu = function () {
new Vue({
data:function(){
this.$notify({
title:"嘿!没有右键<a target="_blank" href="https://chenyu.me" title="View all posts in 菜单">菜单</a>",
message:"复制请用键盘<a target="_blank" href="https://chenyu.me" title="View all posts in 快捷">快捷</a>键[Ctrl+C]",
position: 'bottom-right',
offset: 50,
showClose: false,
type:"warning"
});
return{visible:false}
}
})
return false;
}
//禁用F12按键提醒(开发者工具快捷键)
/*Prohibit F12*/
document.onkeydown = function () {
if (window.event && window.event.keyCode == 123) {
event.keyCode = 0;
event.returnValue = false;
new Vue({
data:function(){
this.$notify({
title:"嘿!别瞎按",
message:"你按这个想干嘛!",
position: 'bottom-right',
offset: 50,
showClose: false,
type:"error"
});
return{visible:false}
}
})
return false;
}
//禁用Ctrl+Shift+I(开发者工具快捷键)
/*Prohibit Ctrl+Shift+I*/
if ((event.ctrlKey) && (event.shiftKey) && (event.keyCode == 73)) {
event.keyCode = 0;
event.returnValue = false;
new Vue({
data:function(){
this.$notify({
title:"嘿!这个也不行",
message:"还是按点别的吧!",
position: 'bottom-right',
offset: 50,
showClose: false,
type:"error"
});
return{visible:false}
}
})
return false;
}};
//禁用Ctrl+S(保存网页/文件)
/*Prohibit 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+U(查看网页源代码)
/*Prohibit Ctrl+U*/
if (event.ctrlKey && window.event.keyCode == 85) {
new Vue({
data: function() {
this.$notify({
title: "嘿!Brother",
message: "老弟,<a target="_blank" href="https://chenyu.me/2631.html" title="复制提醒、禁用F12、禁用Ctrl+S等">源码</a>得换方式获取哦~",
position: 'bottom-right',
offset: 50,
showClose: true,
type: "error"
});
return {
visible: false
}
}
})
return false;
}
//禁用左键选择
document.onselectstart = function () {
return false;
}
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。

评论(1)
教程很好用,谢谢!