Skip to content

Commit

Permalink
Ninja shit.
Browse files Browse the repository at this point in the history
  • Loading branch information
oldestlivingboy committed May 29, 2016
1 parent d810436 commit 655e979
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 43 deletions.
26 changes: 25 additions & 1 deletion opera/chrome/scripts/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,29 @@ new MutationObserver(function(mutations) {

(document.body || root).appendChild(protectedpaste);
var shim = document.createElement('script');
shim.src = chrome.extension.getURL('scripts/shim.js');
shim.textContent =
'var _addEventListener = EventTarget.prototype.addEventListener; \n\
var _execCommand = document.execCommand; \n\
var protectedpaste = document.getElementsByName(\'protectedpaste\')[0]; \n\
\n\
EventTarget.prototype.addEventListener = \n\
function(type, listener, useCapture) { \n\
if (type == \'copy\') \n\
_addEventListener.call(this, type, function() { \n\
protectedpaste.value = true; \n\
}); \n\
else _addEventListener.call(this, type, listener, useCapture); \n\
} \n\
\n\
document.execCommand = function(command, showUI, commandValue) { \n\
var returnValue; \n\
\n\
if (command == \'copy\') protectedpaste.value = true; \n\
else { \n\
_execCommand.call(document, command, showUI, commandValue); \n\
returnValue = true; \n\
} \n\
\n\
return returnValue; \n\
}';
(document.head || root).appendChild(shim);
42 changes: 0 additions & 42 deletions opera/chrome/scripts/shim.js

This file was deleted.

0 comments on commit 655e979

Please sign in to comment.