Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
javascript:document.addEventListener('paste', function(event){
var obj =;
if (!(obj instanceof HTMLTextAreaElement)) return;
var firstText = obj.value.substr(0, obj.selectionStart);
var latterText = obj.value.substr(obj.selectionEnd);
obj.addEventListener('input', function(evt){
evt.currentTarget.removeEventListener(evt.type, arguments.callee, false);
var pastedText = obj.value.substring(firstText.length, obj.value.length - latterText.length);
pastedText = pastedText.replace(/javascript:/g, '');
obj.value = firstText + pastedText + latterText;
}, false);
setTimeout を使わないのは気分
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.