Skip to content

Instantly share code, notes, and snippets.

@mahpah
Last active February 3, 2017 03:15
Show Gist options
  • Save mahpah/ddf80764850b5a3304e92218aeb81e12 to your computer and use it in GitHub Desktop.
Save mahpah/ddf80764850b5a3304e92218aeb81e12 to your computer and use it in GitHub Desktop.
all thing public
function removeListener(target) {
for (let key in target) {
if (key.match(/^on/)) {
target[key] = null;
}
}
}
removeListener(document)
removeListener(document.body)
function listenSelect(p) {
p.style.webkitUserSelect = 'initial'
p.style.msUserSelect = 'initial'
p.style.userSelect = 'initial'
p.style.pointerEvents = 'auto'
}
let ps = document.querySelectorAll('p,h1,h2,h3,h4,h5,h6,span')
Array.from(ps).forEach(listenSelect)
/**
javascript:(function()%7Bfunction%20removeListener(a)%7Bfor(var%20b%20in%20a)b.match(%2F%5Eon%2F)%26%26(a%5Bb%5D%3Dnull)%7Dfunction%20listenSelect(a)%7Ba.style.webkitUserSelect%3D%22initial%22%2Ca.style.msUserSelect%3D%22initial%22%2Ca.style.userSelect%3D%22initial%22%2Ca.style.pointerEvents%3D%22auto%22%7DremoveListener(document)%2CremoveListener(document.body)%3Bvar%20ps%3Ddocument.querySelectorAll(%22p%2Ch1%2Ch2%2Ch3%2Ch4%2Ch5%2Ch6%2Cspan%22)%3BArray.from(ps).forEach(listenSelect)%7D)()
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment