Allow Copy and Contex Menu Continued

Allow Copy (include hot keys and some css) & Contex Menu. Thanks Lex1 for example http://lexi.ucoz.ru/buttons.html

当前为 2015-09-20 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Allow Copy and Contex Menu Continued
  3. // @version 5
  4. // @author Anonimous
  5. // @namespace https://gf.qytechs.cn/en/users/16081-lolipop
  6. // @description Allow Copy (include hot keys and some css) & Contex Menu. Thanks Lex1 for example http://lexi.ucoz.ru/buttons.html
  7. // @include *
  8. // @license GPL version 3 or any later version; www.gnu.org/licenses/gpl-3.0.en.html
  9. // @grant none
  10. // @run-at document-start
  11. // ==/UserScript==
  12.  
  13. ;(function(){
  14.  
  15. /* handler names */
  16. var handlerNameArr = ['contextmenu', 'copy', 'cut', 'paste', 'mousedown', 'mouseup', 'beforeunload', 'beforeprint', 'keyup', 'keydown'];
  17.  
  18. /* remove protection of window */
  19. var removeProtection = function removeProtectionName(protectedWindow) {
  20.  
  21. /*
  22. * document object in frames is same as window https://developer.mozilla.org/en-US/docs/Web/API/Window/frames
  23. * frames == iframe + frame
  24. */
  25. for(var i=0; i < handlerNameArr.length; i++){
  26. var handlerName = handlerNameArr[i];
  27. var handlerOnName = 'on' + handlerName;
  28. if(protectedWindow[handlerName])
  29. protectedWindow[handlerName] = null;
  30. protectedWindow.addEventListener(handlerName, function(e){ e.stopPropagation(); }, true);
  31. }
  32.  
  33. };
  34. var removeCssProtection = function removeCssProtectionName() {
  35. var cssStyle = '* { -moz-user-select: text !important; user-select: text !important; } ';
  36. //GreaseMonkey only
  37. /* @grant GM_addStyle need */
  38. //GM_addStyle(cssStyle);
  39. var style = document.createElement('style');
  40. style.type = 'text/css';
  41. style.innerHTML = cssStyle;
  42. document.head.appendChild(style)
  43. };
  44.  
  45. /* remove main window protection */
  46. removeProtection(window);
  47.  
  48. /* remove frame window protection */
  49. var frameList = window.frames;
  50.  
  51. for(var i = 0; i < frameList.length; i++) {
  52. try{
  53. removeProtection(frameList[i]);
  54. } catch(e){
  55. }
  56. }
  57. /* remove css protection */
  58. GM_addStyle('* { -moz-user-select: text !important; user-select: text !important; } ');
  59. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址