js & disabled mouse right button menus

网页可以屏蔽 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


  1. var object = this;
  2. this.clearSelect = ("getSelection" in window)
  3. ? function () {
  4. window.getSelection().removeAllRanges();
  5. }
  6. : function () {
  7. document.selection.empty();
  8. };

debugger

debugger

https://blog-static.cnblogs.com/files/Marydon20170307/ForbiddenDebug.min.js

full version


  1. "use strict";
  2. /**
  3. *
  4. * @author xgqfrms
  5. * @license MIT
  6. * @copyright xgqfrms
  7. * @created 2018.11.30
  8. * @modified 2018.11.30
  9. *
  10. * @description jquery & forbidden right `Ctrl` button
  11. * @augments
  12. * @example
  13. *
  14. */
  15. const Generator = (datas = [], debug = false) => {
  16. let result = ``;
  17. // do something...
  18. return result;
  19. };
  20. export default ;
  21. export {
  22. ,
  23. };
  24. var $get = function (id) {
  25. return document.getElementById(id);
  26. };
  27. var payToMe_5yuan = "https://files.cnblogs.com/files/Marydon20170307/payToMe_5yuan.bmp";
  28. var payToMe_8yuan = "https://files.cnblogs.com/files/Marydon20170307/payToMe_8yuan.bmp";
  29. var payToMe_18yuan = "https://files.cnblogs.com/files/Marydon20170307/payToMe_18yuan.bmp";
  30. var payToMe_28yuan = "https://files.cnblogs.com/files/Marydon20170307/payToMe_28yuan.bmp";
  31. function CreatePageElement() {
  32. var object = this;
  33. this.createForbiddenCopyTipElement = function () {
  34. var forbiddenCopyTipContainer = `
  35. <div id="dotCopyTip" style="position: fixed;">
  36. <div id="dct_children1">
  37. <div id="dct_children1_textTip">
  38. <span style="color:#FFF;">sorry,本博客所有代码禁止复制,原创代码需扫码支付方可获取!<span>
  39. </div>
  40. <a id="dct_children1_closeBtn" onclick="javascript:$(\'#dotCopyTip\').hide(); $(\'#maskCtrl\').hide();" href="javascript:;" title="关闭">关闭</a>
  41. </div>
  42. <div id="dct_children2">
  43. <p>
  44. 1、先加好友再付费,
  45. <a href="#article_head" id="dct_children2_click1" onclick="javascript:$(\'#dotCopyTip\').hide();$(\'#maskCtrl\').hide();">点我</a>
  46. 加好友
  47. </p>
  48. <p>
  49. 2、代码不能满足你的需求?加好友付费定制你的专属代码!
  50. </p>
  51. <p>
  52. 3、付费标准及方式,
  53. <a href="javascript:;" id="dct_children2_click2" onclick="javascript:cpe.payButtonClick(\'pay\');">点我</a>
  54. 查看详情
  55. </p>
  56. </div>
  57. </div>
  58. `;
  59. return forbiddenCopyTipContainer;
  60. };
  61. this.createPayElement = function () {
  62. var payContainer = `
  63. <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;">
  64. <div class="title">
  65. <div>请扫描以下二维码支付打赏</div>
  66. <a onclick="$(\'#knowledgePay\').hide();$(\'#maskCtrl\').hide();"onmouseover="this.style.backgroundColor=\'#DF0029\';"onmouseout="this.style.backgroundColor=\'\'" href="javascript:;"title="关闭"></a>
  67. </div>
  68. <div>
  69. <div>
  70. <select id="payType" style="display:none;pointer:cursor;" onchange="cpe.switchPayImg(this.value);">
  71. <option value="0">请选择支付类型</option>
  72. <option value="1">片断源码+技术支持</option>
  73. <option value="2">项目源码+技术支持</option>
  74. <option value="3">私人定制代码服务</option>
  75. </select>
  76. </div>
  77. <img id="payImg" src="" alt="支持原创" />
  78. </div>
  79. </div>
  80. `
  81. return payContainer;
  82. };
  83. this.createDonateElement = function () {
  84. var aTag = `
  85. |<a href="javascript:;" onclick="cpe.payButtonClick(\'bottom\');" style="color:#7fff00;">捐赠</a>
  86. `;
  87. return aTag;
  88. };
  89. this.payButtonClick = function (param) {
  90. if ('pay' == param) {
  91. $('#dotCopyTip').hide();
  92. $('#knowledgePay').show();
  93. $('#payType').show();
  94. $('#maskCtrl').show();
  95. var payType = $get('payType').value;
  96. if (0 == payType) {
  97. $get('payImg').src = '';
  98. }
  99. } else if ('bottom' == param) {
  100. $('#dotCopyTip').hide();
  101. $('#maskCtrl').show();
  102. $('#knowledgePay').css('display', 'block');
  103. $('#payType').hide();
  104. $get('payImg').src = payToMe_5yuan;
  105. }
  106. };
  107. this.switchPayImg = function (num) {
  108. if (1 == num) {
  109. $get('payImg').src = payToMe_8yuan;
  110. } else if (2 == num) {
  111. $get('payImg').src = payToMe_18yuan;
  112. } else if (3 == num) {
  113. $get('payImg').src = payToMe_28yuan;
  114. }
  115. };
  116. this.createPayButtonElement = function () {
  117. var aTag = document.createElement('a');
  118. 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;
  119. aTag.onmouseover = "this.style.textDecoration='none';this.style.color='#666';";
  120. aTag.onmouseout = "this.style.color='#FFF';";
  121. aTag.href = "javascript:cpe.payButtonClick('bottom');";
  122. aTag.innerHTML = " ¥ 我要打赏 ";
  123. return aTag;
  124. };
  125. this.createHelpLikeTextElement = function () {
  126. var spanTag = document.createElement('span');
  127. spanTag.innerHTML = "对你有帮助?请帮忙点赞!";
  128. return spanTag;
  129. };
  130. this.createSubscribeCommentElement = function () {
  131. var subscribeComment = `
  132. <a id="commentbox_opt_sub" href="javascript:void(0);" title="订阅后有新评论时会邮件通知您" onclick="commentManager.Subscribe();">订阅评论</a>
  133. `;
  134. return subscribeComment;
  135. };
  136. this.createMaskElement = function () {
  137. var payTipMaskContainer = `
  138. <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>
  139. `;
  140. return payTipMaskContainer;
  141. };
  142. this.createStatisticsElement = function () {
  143. var aTag = `
  144. |<a href="https://www.51.la/?19366069" target="_blank" style="color:#7fff00;">站长统计</a>
  145. `;
  146. return aTag;
  147. };
  148. this.createViewsElement = function () {
  149. var divTag = `
  150. <div id="ajiang_51la"><script type="text/javascript" src="//quote.users.51.la/?id=19366069&mb=3"></script></div>
  151. `;
  152. return divTag;
  153. }
  154. }
  155. function PageOperationCtrl() {
  156. var object = this;
  157. this.clearSelect = ("getSelection" in window)
  158. ? function () {
  159. window.getSelection().removeAllRanges();
  160. }
  161. : function () {
  162. document.selection.empty();
  163. };
  164. this.accessLimit = function () {
  165. document.oncontextmenu = function () {
  166. window.event.returnValue = false;
  167. return false;
  168. };
  169. document.ondragstart = document.onselectstart = function () {
  170. try {
  171. $('.cnblogs_code').on({
  172. selectstart: function () {
  173. $('#dotCopyTip').show();
  174. $('#maskCtrl').show();
  175. return false;
  176. },
  177. dragstart: function () {
  178. $('#dotCopyTip').show();
  179. $('#maskCtrl').show();
  180. return false;
  181. },
  182. })
  183. .css('cursor', 'pointer');
  184. $('.container').on({
  185. selectstart: function () {
  186. $('#dotCopyTip').show();
  187. $('#maskCtrl').show();
  188. window.event.returnValue = false;
  189. return false;
  190. },
  191. dragstart: function () {
  192. $('#dotCopyTip').show(); $('#maskCtrl').show();
  193. window.event.returnValue = false;
  194. return false;
  195. },
  196. });
  197. } catch (e) {
  198. //
  199. };
  200. window.event.returnValue = false;
  201. return false;
  202. };
  203. document.documentElement.onkeydown = function (e) {
  204. let currKey = 0;
  205. let evt = e || window.event;
  206. currKey = evt.keyCode || evt.which || evt.charCode;
  207. if (currKey == 123) {
  208. $('#dotCopyTip').show();
  209. $('#maskCtrl').show();
  210. }
  211. window.event.cancelBubble = true;
  212. window.event.returnValue = false;
  213. return false;
  214. };
  215. document.oncopy = document.oncut = document.onpaste = function (e) {
  216. window.event.returnValue = false;
  217. return false;
  218. }
  219. }
  220. }
  221. function bbbbb() {
  222. this.scrollLoad = function (imgId, imgSrc, distance, title) {
  223. var img_source = $('#' + imgId).attr('src');
  224. if ("" == img_source) {
  225. var documentClientHeight = document.documentElement.clientHeight || window.innerHeight;
  226. var imgOffsetTop = $('#' + imgId)[0].offsetTop;
  227. if (imgOffsetTop < documentClientHeight) {
  228. $('#' + imgId)[0].src = imgSrc;
  229. $('#' + imgId)[0].title = title;
  230. $('#' + imgId)[0].alt = title;
  231. return;
  232. }
  233. var max_imgClientTop = $('#' + imgId)[0].getBoundingClientRect().top;
  234. max_imgClientTop = parseInt(max_imgClientTop);
  235. var max_imgClientDistance = max_imgClientTop - documentClientHeight;
  236. distance = ((distance || 0) > max_imgClientDistance) ? max_imgClientDistance : distance;
  237. if (distance == max_imgClientDistance) {
  238. $('#' + imgId)[0].src = imgSrc;
  239. $('#' + imgId)[0].title = title;
  240. $('#' + imgId)[0].alt = title;
  241. return ;
  242. }
  243. $(document).scroll(function () {
  244. var scrollTop = document.body.scrollTop || document.documentElement.scrollTop;
  245. var imgClientTop = $('#' + imgId)[0].getBoundingClientRect().top;
  246. var clientHeight = documentClientHeight - imgClientTop;
  247. if (-clientHeight <= distance || documentClientHeight >= imgClientTop) {
  248. $('#' + imgId)[0].src = imgSrc;
  249. $('#' + imgId)[0].title = title;
  250. $('#' + imgId)[0].alt = title;
  251. }
  252. })
  253. }
  254. };
  255. this.clickLoad = function (clickId, imgId, imgSrc) {
  256. var img_source = $('#' + imgId).attr('src');
  257. if ("" == img_source) {
  258. $('#' + clickId).click(function () {
  259. $('#' + imgId)[0].src = imgSrc;
  260. });
  261. }
  262. };
  263. }
  264. function PageScrollCtrl() {
  265. var heighss = 1300;
  266. var firstStep = true;
  267. var secStep = true;
  268. var isIE = !!window.ActiveXObject;
  269. var isIE8 = isIE && !!document.documentMode;
  270. $(window).load(function () {
  271. $.scrollUp(); $("#scrollUp").text("");
  272. $("#scrollUp").attr("title", "回到顶部")
  273. });
  274. $(window).scroll(function () {
  275. var $sbm = $("#sideBarMain");
  276. var $sbar = $("#sideBar");
  277. var $navc = $("#navigator");
  278. var navH = $navc.offset().top;
  279. var scroH = $(this).scrollTop();
  280. if (scroH >= navH) {
  281. if (firstStep) {
  282. firstStep = false;
  283. $navc.css({ "top": 0, "left": 0, "z-index": "1000" });
  284. $navc.addClass("boxshadow");
  285. }
  286. if (!isIE8 && scroH > heighss && secStep && $sbm.width() > 2) {
  287. secStep = false;
  288. }
  289. if (isIE8 && scroH > heighss && secStep && $sbm.width() > 2) {
  290. secStep = false;
  291. }
  292. } else if (scroH < navH) {
  293. if (!firstStep) {
  294. firstStep = true;
  295. $navc.css({ "margin": "0 auto" });
  296. $navc.removeClass("boxshadow");
  297. }
  298. if (!isIE8 && scroH < heighss && (!secStep) && $sbm.width() < 3) {
  299. secStep = true;
  300. $sbar.show();
  301. }
  302. if (isIE8 && scroH < heighss && (!secStep) && $sbm.width() < 3) {
  303. secStep = true;
  304. }
  305. }
  306. });
  307. }
  308. // test
  309. function ForbiddenDebug() {
  310. var object = this;
  311. this.isDebug = function () {
  312. var timeLimit = 50;
  313. var startTime = new Date();
  314. debugger;
  315. var endTime = new Date();
  316. if (endTime - startTime > timeLimit) {
  317. $('#topics').remove();
  318. alert('\u68c0\u6d4b\u5230\u975e\u6cd5\u8c03\u8bd5\uff0c\u5373\u5c06\u5237\u65b0\u754c\u9762\uff01');
  319. // 检测到非法调试,即将刷新界面!
  320. window.location.reload();
  321. }
  322. };
  323. this.consoleListener = function () {
  324. setInterval(object.isDebug, 500);
  325. }
  326. }
  327. var cpe=new CreatePageElement();
  328. var poc = new PageOperationCtrl();
  329. var ill = new bbbbb();

css3 & user-select

Chrome debug solution

  1. blank page & F12
  2. select DOM
  3. remove css
  4. remove Events

js & disabled mouse right button menus的更多相关文章

  1. js & listen mouse click

    js & listen mouse click how to listen mouse click in js https://www.kirupa.com/html5/mouse_event ...

  2. js & disabled right click & disabled right menu

    js & disabled right click (() => { const log = console.log; log(`disabled copy`); document.bo ...

  3. Bootstrap的js插件之按钮(button)

    1)属性: data-loading-text="载入中..."--使button呈现载入状态: data-toggle="button"--使按钮可以切换状态 ...

  4. js中submit和button的区别

    今天写一个js验证 遇到点小坑 记录一下 button-普通按钮,submit-提交按钮. submit是button的一个特例,也是button的一种,它把提交这个动作自动集成了,submit和bu ...

  5. js点击按钮button效果(波效果)

    Material Design风格纯js按钮点击波特效 演示效果 html部分: <button data-ripple> Demo button 6 </button> cs ...

  6. JS实现 点击button(copy) 复制对应的网址——类似于复制推广链接

    <form action=""> <input type="text" class="share-input" value ...

  7. 点滴积累【JS】---JS小功能(button选择颜色)

    效果: 代码: <head runat="server"> <title></title> <style type="text/ ...

  8. JS和JQuery实现Button绑定键盘Enter事件实现提交

    JavaScript实现方法 document.onkeydown = function(e) { if (!e) e = window.event;//火狐中是 window.event if (( ...

  9. bootstrap插件学习-bootstrap.button.js

    先看bootstrap.button.js的结构 var Button = function ( element, options ){} //构造器 Button.prototype = {} // ...

随机推荐

  1. 路由器基础设置之ospf

    我们将以上面的拓扑图来进行实验,要用ospf的协议达到全网互通的效果 router1: enable 进入特权模式 config t 进入全局配置模式 interface L0 ip address ...

  2. 汉化manjaro下的火狐浏览器

    1.下载 汉化包 sudo pacman -S firefox-i18n-zh-cn 2.查看add-ons下的language选项有没有已安装的包 3.在浏览器的地址栏输入 搜索intl.local ...

  3. jQuery最重要的知识点

    1.各种常见的选择器.2.对于属性的操作.[重点] 2.1)获取或设置属性的值: prop(); 2.2 ) 添加.删除.切换样式: addClass/removeClass/toggleClass ...

  4. js函数的节流和防抖

    js函数的节流和防抖 用户浏览页面时会不可避免的触发一些高频度触发事件(例如页面 scroll ,屏幕 resize,监听用户输入等),这些事件会频繁触发浏览器的重拍(reflow)和重绘(repai ...

  5. C# WebClient 使用http免费代理

    static void Main(string[] args) { WebClient client = new WebClient(); client.Encoding = Encoding.Get ...

  6. IO复用——select系统调用

    1.select函数 此函数用于在一段时间内,监听用户感兴趣的文件描述符上的可读.可写和异常等事件. #include<sys/select.h> int select(int nfds, ...

  7. CS61B sp2018笔记 | Lists

    Lists csdn同作者原创地址 1. IntLists   下面我们来一步一步的实现List类,首先你可以实现一个最简单的版本: public class IntList { public int ...

  8. Yearning和inception搭建MySQL审核平台

    前言 采用开源Yearning和inception开源软件,搭建用于MYSQL审核及线上MYSQL语句更新的审核平台. 功能说明 Yearning: 基于Vue.js与Django的整套mysql-s ...

  9. HBase java API 的使用范例(增,删,查,扫描)

    编辑pom.xml <dependency> <groupId>org.apache.hbase</groupId> <artifactId>hbase ...

  10. PHP.42-TP框架商城应用实例-后台17-商品属性3-商品分类的修改与删除

    商品分类的修改 1.改表单Goods/edit.html,加下拉框 2.因为商品属性修改涉及商品属性表goods_attr{id,attr_value,attr_id,goods_id}与属性表att ...