js disabled mouse right button menus All In One
js disabled mouse right button menus All In One
// 禁用右键菜单
document.oncontextmenu = function (event) {
if (window.event) {
event = window.event;
}
try {
var the = event.srcElement;
if (!((the.tagName == "INPUT" && the.type.toLowerCase() == "text") || the.tagName == "TEXTAREA")) {
return false;
}
return true;
} catch (e) {
return false;
}
}
// 禁用 F12审查元素
document.onkeydown = function () {
if (window.event && window.event.keyCode == 123) {
event.keyCode = 0;
event.returnValue = false;
}
if (window.event && window.event.keyCode == 13) {
window.event.keyCode = 505;
}
if (window.event && window.event.keyCode == 8) {
window.event.returnValue = false;
}
}
// 禁用复制功能
document.oncopy = function (event) {
if (window.event) {
event = window.event;
}
try {
var the = event.srcElement;
if (!((the.tagName == "INPUT" && the.type.toLowerCase() == "text") || the.tagName == "TEXTAREA")) {
return false;
}
return true;
} catch (e) {
return false;
}
}
// 禁用选中, 剪切
document.oncut = function (event) {
if (window.event) {
event = window.event;
}
try {
var the = event.srcElement;
if (!((the.tagName == "INPUT" && the.type.toLowerCase() == "text") || the.tagName == "TEXTAREA")) {
return false;
}
return true;
} catch (e) {
return false;
}
}
网页可以屏蔽 F12
https://www.cnblogs.com/Marydon20170307/p/9122379.html
view-source:https://www.cnblogs.com/Marydon20170307/p/9122379.html
https://blog-static.cnblogs.com/files/Marydon20170307/include.min.js
https://blog-static.cnblogs.com/files/Marydon20170307/conclusion.min.js
clear selection
var object = this;
this.clearSelect = ("getSelection" in window)
? function () {
window.getSelection().removeAllRanges();
}
: function () {
document.selection.empty();
};
debugger
debugger
https://blog-static.cnblogs.com/files/Marydon20170307/ForbiddenDebug.min.js
full version
"use strict";
/**
*
* @author xgqfrms
* @license MIT
* @copyright xgqfrms
* @created 2018.11.30
* @modified 2018.11.30
*
* @description jquery & forbidden right `Ctrl` button
* @augments
* @example
*
*/
const Generator = (datas = [], debug = false) => {
let result = ``;
// do something...
return result;
};
export default ;
export {
,
};
var $get = function (id) {
return document.getElementById(id);
};
var payToMe_5yuan = "https://files.cnblogs.com/files/Marydon20170307/payToMe_5yuan.bmp";
var payToMe_8yuan = "https://files.cnblogs.com/files/Marydon20170307/payToMe_8yuan.bmp";
var payToMe_18yuan = "https://files.cnblogs.com/files/Marydon20170307/payToMe_18yuan.bmp";
var payToMe_28yuan = "https://files.cnblogs.com/files/Marydon20170307/payToMe_28yuan.bmp";
function CreatePageElement() {
var object = this;
this.createForbiddenCopyTipElement = function () {
var forbiddenCopyTipContainer = `
<div id="dotCopyTip" style="position: fixed;">
<div id="dct_children1">
<div id="dct_children1_textTip">
<span style="color:#FFF;">sorry,本博客所有代码禁止复制,原创代码需扫码支付方可获取!<span>
</div>
<a id="dct_children1_closeBtn" onclick="javascript:$(\'#dotCopyTip\').hide(); $(\'#maskCtrl\').hide();" href="javascript:;" title="关闭">关闭</a>
</div>
<div id="dct_children2">
<p>
1、先加好友再付费,
<a href="#article_head" id="dct_children2_click1" onclick="javascript:$(\'#dotCopyTip\').hide();$(\'#maskCtrl\').hide();">点我</a>
加好友
</p>
<p>
2、代码不能满足你的需求?加好友付费定制你的专属代码!
</p>
<p>
3、付费标准及方式,
<a href="javascript:;" id="dct_children2_click2" onclick="javascript:cpe.payButtonClick(\'pay\');">点我</a>
查看详情
</p>
</div>
</div>
`;
return forbiddenCopyTipContainer;
};
this.createPayElement = function () {
var payContainer = `
<div id="knowledgePay" style="position: fixed; left: 32%; bottom: 27%; width: 533px; height: 337px; text-align: center; background: #FAFAFF; z-index: 99999; border: solid 1px #a9a9a9; display: none;">
<div class="title">
<div>请扫描以下二维码支付打赏</div>
<a onclick="$(\'#knowledgePay\').hide();$(\'#maskCtrl\').hide();"onmouseover="this.style.backgroundColor=\'#DF0029\';"onmouseout="this.style.backgroundColor=\'\'" href="javascript:;"title="关闭"></a>
</div>
<div>
<div>
<select id="payType" style="display:none;pointer:cursor;" onchange="cpe.switchPayImg(this.value);">
<option value="0">请选择支付类型</option>
<option value="1">片断源码+技术支持</option>
<option value="2">项目源码+技术支持</option>
<option value="3">私人定制代码服务</option>
</select>
</div>
<img id="payImg" src="" alt="支持原创" />
</div>
</div>
`
return payContainer;
};
this.createDonateElement = function () {
var aTag = `
|<a href="javascript:;" onclick="cpe.payButtonClick(\'bottom\');" style="color:#7fff00;">捐赠</a>
`;
return aTag;
};
this.payButtonClick = function (param) {
if ('pay' == param) {
$('#dotCopyTip').hide();
$('#knowledgePay').show();
$('#payType').show();
$('#maskCtrl').show();
var payType = $get('payType').value;
if (0 == payType) {
$get('payImg').src = '';
}
} else if ('bottom' == param) {
$('#dotCopyTip').hide();
$('#maskCtrl').show();
$('#knowledgePay').css('display', 'block');
$('#payType').hide();
$get('payImg').src = payToMe_5yuan;
}
};
this.switchPayImg = function (num) {
if (1 == num) {
$get('payImg').src = payToMe_8yuan;
} else if (2 == num) {
$get('payImg').src = payToMe_18yuan;
} else if (3 == num) {
$get('payImg').src = payToMe_28yuan;
}
};
this.createPayButtonElement = function () {
var aTag = document.createElement('a');
var cssText = "color:#FFF;padding:4px 10px 4px 8px;border-color:#f57e42;text-decoration:none;background-color:#f57e42;border-radius:9px;display:inline-block;text-align:center;vertical-align:middle;font-size:12px;line-height:1.5;"; aTag.style.cssText = cssText;
aTag.onmouseover = "this.style.textDecoration='none';this.style.color='#666';";
aTag.onmouseout = "this.style.color='#FFF';";
aTag.href = "javascript:cpe.payButtonClick('bottom');";
aTag.innerHTML = " ¥ 我要打赏 ";
return aTag;
};
this.createHelpLikeTextElement = function () {
var spanTag = document.createElement('span');
spanTag.innerHTML = "对你有帮助?请帮忙点赞!";
return spanTag;
};
this.createSubscribeCommentElement = function () {
var subscribeComment = `
<a id="commentbox_opt_sub" href="javascript:void(0);" title="订阅后有新评论时会邮件通知您" onclick="commentManager.Subscribe();">订阅评论</a>
`;
return subscribeComment;
};
this.createMaskElement = function () {
var payTipMaskContainer = `
<div id="maskCtrl" style="position:fixed;z-index:99997;left:0;top:0;width:100%;height:100%;background:rgba(0,0,0,0.7);display:none;"></div>
`;
return payTipMaskContainer;
};
this.createStatisticsElement = function () {
var aTag = `
|<a href="https://www.51.la/?19366069" target="_blank" style="color:#7fff00;">站长统计</a>
`;
return aTag;
};
this.createViewsElement = function () {
var divTag = `
<div id="ajiang_51la"><script type="text/javascript" src="//quote.users.51.la/?id=19366069&mb=3"></script></div>
`;
return divTag;
}
}
function PageOperationCtrl() {
var object = this;
this.clearSelect = ("getSelection" in window)
? function () {
window.getSelection().removeAllRanges();
}
: function () {
document.selection.empty();
};
this.accessLimit = function () {
document.oncontextmenu = function () {
window.event.returnValue = false;
return false;
};
document.ondragstart = document.onselectstart = function () {
try {
$('.cnblogs_code').on({
selectstart: function () {
$('#dotCopyTip').show();
$('#maskCtrl').show();
return false;
},
dragstart: function () {
$('#dotCopyTip').show();
$('#maskCtrl').show();
return false;
},
})
.css('cursor', 'pointer');
$('.container').on({
selectstart: function () {
$('#dotCopyTip').show();
$('#maskCtrl').show();
window.event.returnValue = false;
return false;
},
dragstart: function () {
$('#dotCopyTip').show(); $('#maskCtrl').show();
window.event.returnValue = false;
return false;
},
});
} catch (e) {
//
};
window.event.returnValue = false;
return false;
};
document.documentElement.onkeydown = function (e) {
let currKey = 0;
let evt = e || window.event;
currKey = evt.keyCode || evt.which || evt.charCode;
if (currKey == 123) {
$('#dotCopyTip').show();
$('#maskCtrl').show();
}
window.event.cancelBubble = true;
window.event.returnValue = false;
return false;
};
document.oncopy = document.oncut = document.onpaste = function (e) {
window.event.returnValue = false;
return false;
}
}
}
function bbbbb() {
this.scrollLoad = function (imgId, imgSrc, distance, title) {
var img_source = $('#' + imgId).attr('src');
if ("" == img_source) {
var documentClientHeight = document.documentElement.clientHeight || window.innerHeight;
var imgOffsetTop = $('#' + imgId)[0].offsetTop;
if (imgOffsetTop < documentClientHeight) {
$('#' + imgId)[0].src = imgSrc;
$('#' + imgId)[0].title = title;
$('#' + imgId)[0].alt = title;
return;
}
var max_imgClientTop = $('#' + imgId)[0].getBoundingClientRect().top;
max_imgClientTop = parseInt(max_imgClientTop);
var max_imgClientDistance = max_imgClientTop - documentClientHeight;
distance = ((distance || 0) > max_imgClientDistance) ? max_imgClientDistance : distance;
if (distance == max_imgClientDistance) {
$('#' + imgId)[0].src = imgSrc;
$('#' + imgId)[0].title = title;
$('#' + imgId)[0].alt = title;
return ;
}
$(document).scroll(function () {
var scrollTop = document.body.scrollTop || document.documentElement.scrollTop;
var imgClientTop = $('#' + imgId)[0].getBoundingClientRect().top;
var clientHeight = documentClientHeight - imgClientTop;
if (-clientHeight <= distance || documentClientHeight >= imgClientTop) {
$('#' + imgId)[0].src = imgSrc;
$('#' + imgId)[0].title = title;
$('#' + imgId)[0].alt = title;
}
})
}
};
this.clickLoad = function (clickId, imgId, imgSrc) {
var img_source = $('#' + imgId).attr('src');
if ("" == img_source) {
$('#' + clickId).click(function () {
$('#' + imgId)[0].src = imgSrc;
});
}
};
}
function PageScrollCtrl() {
var heighss = 1300;
var firstStep = true;
var secStep = true;
var isIE = !!window.ActiveXObject;
var isIE8 = isIE && !!document.documentMode;
$(window).load(function () {
$.scrollUp(); $("#scrollUp").text("");
$("#scrollUp").attr("title", "回到顶部")
});
$(window).scroll(function () {
var $sbm = $("#sideBarMain");
var $sbar = $("#sideBar");
var $navc = $("#navigator");
var navH = $navc.offset().top;
var scroH = $(this).scrollTop();
if (scroH >= navH) {
if (firstStep) {
firstStep = false;
$navc.css({ "top": 0, "left": 0, "z-index": "1000" });
$navc.addClass("boxshadow");
}
if (!isIE8 && scroH > heighss && secStep && $sbm.width() > 2) {
secStep = false;
}
if (isIE8 && scroH > heighss && secStep && $sbm.width() > 2) {
secStep = false;
}
} else if (scroH < navH) {
if (!firstStep) {
firstStep = true;
$navc.css({ "margin": "0 auto" });
$navc.removeClass("boxshadow");
}
if (!isIE8 && scroH < heighss && (!secStep) && $sbm.width() < 3) {
secStep = true;
$sbar.show();
}
if (isIE8 && scroH < heighss && (!secStep) && $sbm.width() < 3) {
secStep = true;
}
}
});
}
// test
function ForbiddenDebug() {
var object = this;
this.isDebug = function () {
var timeLimit = 50;
var startTime = new Date();
debugger;
var endTime = new Date();
if (endTime - startTime > timeLimit) {
$('#topics').remove();
alert('\u68c0\u6d4b\u5230\u975e\u6cd5\u8c03\u8bd5\uff0c\u5373\u5c06\u5237\u65b0\u754c\u9762\uff01');
// 检测到非法调试,即将刷新界面!
window.location.reload();
}
};
this.consoleListener = function () {
setInterval(object.isDebug, 500);
}
}
var cpe=new CreatePageElement();
var poc = new PageOperationCtrl();
var ill = new bbbbb();
css3 & user-select
Chrome debug solution
- blank page & F12
- select DOM
- remove css
- remove Events
破解方法
- remove js event
- disabled css
(🐞 反爬虫测试!打击盗版⚠️)如果你看到这个信息, 说明这是一篇剽窃的文章,请访问 https://www.cnblogs.com/xgqfrms/ 查看原创文章!
refs
©xgqfrms 2012-2021
www.cnblogs.com/xgqfrms 发布文章使用:只允许注册用户才可以访问!
原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️!
本文首发于博客园,作者:xgqfrms,原文链接:https://www.cnblogs.com/xgqfrms/p/10043804.html
未经授权禁止转载,违者必究!