Allow Copy and Contex Menu Continued

Allow Copy (include hot keys and some css) & Contex Menu. Disable (remove) copy text protection and allow copy for all sites. 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 6.1
  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. Disable (remove) copy text protection and allow copy for all sites. 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. /* remove css protection */
  35. var removeCssProtection = function removeCssProtectionName() {
  36. var cssStyle = '* { -moz-user-select: text !important; user-select: text !important; } ';
  37. //GreaseMonkey only
  38. /* @grant GM_addStyle need */
  39. //GM_addStyle(cssStyle);
  40. var style = document.createElement('style');
  41. style.type = 'text/css';
  42. style.innerHTML = cssStyle;
  43. document.head.appendChild(style)
  44. };
  45.  
  46. /* remove main window protection */
  47. removeProtection(window);
  48.  
  49. /* remove frame window protection */
  50. var frameList = window.frames;
  51.  
  52. for(var i = 0; i < frameList.length; i++) {
  53. try{
  54. removeProtection(frameList[i]);
  55. } catch(e){
  56. }
  57. }
  58.  
  59. })();

QingJ © 2025

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