diff --git a/4chan_x.js b/4chan_x.js index 056ab67d5..18f5079c0 100644 --- a/4chan_x.js +++ b/4chan_x.js @@ -179,6 +179,7 @@ move: function(e) { var el, rect; ui.el = el = e.target.parentNode; + document.body.className = 'noselect'; rect = el.getBoundingClientRect(); ui.dx = e.clientX - rect.left; ui.dy = e.clientY - rect.top; @@ -216,7 +217,8 @@ el = ui.el; id = el.id; localStorage["" + id + "Left"] = el.style.left; - return localStorage["" + id + "Top"] = el.style.top; + localStorage["" + id + "Top"] = el.style.top; + return document.body.className = ''; } }; d = document; @@ -2237,6 +2239,14 @@ #watcher > div:last-child {\ padding: 0 5px 5px 5px;\ }\ +\ + body.noselect {\ + -webkit-user-select: none;\ + -khtml-user-select: none;\ + -moz-user-select: none;\ + -o-user-select: none;\ + user-select: none;\ + }\ ' }; main.init(); diff --git a/script.coffee b/script.coffee index 7572257ed..366389f94 100644 --- a/script.coffee +++ b/script.coffee @@ -98,6 +98,7 @@ ui = el move: (e) -> ui.el = el = e.target.parentNode + document.body.className = 'noselect' #distance from pointer to el edge is constant; calculate it here. # XXX opera reports el.offsetLeft / el.offsetTop as 0 rect = el.getBoundingClientRect() @@ -129,6 +130,7 @@ ui = {id} = el localStorage["#{id}Left"] = el.style.left localStorage["#{id}Top"] = el.style.top + document.body.className = '' #convenience d = document @@ -1757,6 +1759,14 @@ main = #watcher > div:last-child { padding: 0 5px 5px 5px; } + + body.noselect { + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -o-user-select: none; + user-select: none; + } ' main.init()