Allow Copy and Context Menu Continued

Allow Copy (include hot keys and some css) & Context Menu. Disable (remove) copy text protection and allow copy for all sites. Thanks Lex1 for example http://lexi.ucoz.ru/buttons.html

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name	Allow Copy and Context Menu Continued
// @version	7.3.4
// @author	Anonimous
// @namespace	https://greasyfork.org/en/users/16081-lolipop
// @description	Allow Copy (include hot keys and some css) & Context Menu. Disable (remove) copy text protection and allow copy for all sites. Thanks Lex1 for example http://lexi.ucoz.ru/buttons.html
// @include	*
// @license      GPL version 3 or any later version; www.gnu.org/licenses/gpl-3.0.en.html
// @grant	none
// @run-at	document-start
// ==/UserScript==

;(function(){

	/* handler names */
	/*
	 * NOTE! 'drag', 'dragend', 'dragstart' - when drag text, use alt + selection for text or add them to array
	 */
	var handlerNameArr = ['contextmenu', 'copy', 'cut', 'paste', 'mousedown', 'mouseup', 'beforeunload', 'beforeprint', 'keyup', 'keydown', 'select', 'selectstart'];

	/* remove protection of window */
	var removeProtection = function removeProtectionName(protectedWindow) {

		/*
		 * document object in frames is same as window https://developer.mozilla.org/en-US/docs/Web/API/Window/frames
		 * frames == iframe + frame
		 */
	
		for(var i=0; i < handlerNameArr.length; i++){
			var handlerName = handlerNameArr[i];
			var handlerOnName = 'on' + handlerName;
			
			if(protectedWindow[handlerOnName])
				protectedWindow[handlerOnName] = null;
			protectedWindow.addEventListener(handlerName, function(e){ e.stopPropagation(); }, true);
		}

	};
	
	/* remove css protection */
	var removeCssProtection = function removeCssProtectionName() {
		var cssStyle = '* { -moz-user-select: text !important; user-select: text !important; } ';
		
		//GreaseMonkey only
		/* @grant	GM_addStyle need */
		//GM_addStyle(cssStyle);
		
		var style = document.createElement('style');
		
		style.type = 'text/css';
		style.innerHTML = cssStyle;
		document.head.appendChild(style);
	};

	/* remove main window protection */
	removeProtection(window);

	/* remove frame window protection */
	var frameList = window.frames;

	for(var i = 0; i < frameList.length; i++) {
		try{
			removeProtection(frameList[i]);
		} catch(e){
		}
	}
	
	removeCssProtection();

})();