禁止右键部分代码
- 站点记录
- 2024-11-17
- 149热度
- 0评论
温馨提示:
本文最后更新时间2025-05-05 19:14,已超过26天没有更新,若内容或图片失效,请留言反馈。
本文最后更新时间2025-05-05 19:14,已超过26天没有更新,若内容或图片失效,请留言反馈。
<script>
document.onkeydown = function(event) {
if (event.ctrlKey && event.keyCode == 83) { // Ctrl + S
event.preventDefault();
new Vue({
data: function() {
this.$notify({
title: \\\"哎!你瞧瞧你\\\",
message: \\\"网页得换方法保存哦~\\\",
position: \\\'bottom-right\\\',
offset: 50,
showClose: true,
type: \\\"error\\\"
});
return {
visible: false
}
}
})
return false;
}
if (event.ctrlKey && event.keyCode == 85) { // Ctrl + U
event.preventDefault();
new Vue({
data: function() {
this.$notify({
title: \\\"嘿!Brother\\\",
message: \\\"老弟,源码得换方式获取哦~\\\",
position: \\\'bottom-right\\\',
offset: 50,
showClose: true,
type: \\\"error\\\"
});
return {
visible: false
}
}
})
return false;
}
if (event.ctrlKey && event.keyCode == 70) { // Ctrl + F
event.preventDefault();
new Vue({
data: function() {
this.$notify({
title: \\\"嘿!Brother\\\",
message: \\\"老弟,别搜了\\\",
position: \\\'bottom-right\\\',
offset: 50,
showClose: true,
type: \\\"error\\\"
});
return {
visible: false
}
}
})
return false;
}
if (event.ctrlKey && event.keyCode == 80) { // Ctrl + P
event.preventDefault();
new Vue({
data: function() {
this.$notify({
title: \\\"嘿!Brother\\\",
message: \\\"老弟,别打印了\\\",
position: \\\'bottom-right\\\',
offset: 50,
showClose: true,
type: \\\"error\\\"
});
return {
visible: false
}
}
})
return false;
}
if (event.ctrlKey && event.shiftKey && event.keyCode == 73) { // Ctrl + Shift + I
event.preventDefault();
new Vue({
data: function() {
this.$notify({
title: \\\"呐!这个也不行\\\",
message: \\\"还是按点别的吧!\\\",
position: \\\'bottom-right\\\',
offset: 50,
showClose: false,
type: \\\"error\\\"
});
return {
visible: false
}
}
})
return false;
}
if (event.keyCode == 123) { // F12
event.preventDefault();
new Vue({
data: function() {
this.$notify({
title: \\\"呃!别瞎按\\\",
message: \\\"你按这个想干嘛!F12已经禁止咯\\\",
position: \\\'bottom-right\\\',
offset: 50,
showClose: false,
type: \\\"error\\\"
});
return {
visible: false
}
}
})
return false;
}
};
</script>
<script>
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
}
}
})
})
</script>