diff --git a/builds/appchan-x.user.js b/builds/appchan-x.user.js index d64029427..9f4e20d05 100644 --- a/builds/appchan-x.user.js +++ b/builds/appchan-x.user.js @@ -7085,8 +7085,8 @@ return $.set("" + this.id + ".position", this.style.cssText); }; hoverstart = function(_arg) { - var asapTest, cb, el, endEvents, height, latestEvent, noRemove, o, root, _ref; - root = _arg.root, el = _arg.el, latestEvent = _arg.latestEvent, endEvents = _arg.endEvents, asapTest = _arg.asapTest, height = _arg.height, cb = _arg.cb, noRemove = _arg.noRemove; + var asapTest, cb, el, endEvents, height, latestEvent, noRemove, o, offsetX, offsetY, root, _ref; + root = _arg.root, el = _arg.el, latestEvent = _arg.latestEvent, endEvents = _arg.endEvents, asapTest = _arg.asapTest, height = _arg.height, cb = _arg.cb, noRemove = _arg.noRemove, offsetX = _arg.offsetX, offsetY = _arg.offsetY; o = { root: root, el: el, @@ -7097,7 +7097,9 @@ latestEvent: latestEvent, clientHeight: doc.clientHeight, clientWidth: doc.clientWidth, - noRemove: noRemove + noRemove: noRemove, + offsetX: offsetX || 45, + offsetY: offsetY || -120 }; o.hover = hover.bind(o); o.hoverend = hoverend.bind(o); @@ -7125,12 +7127,12 @@ this.latestEvent = e; height = this.height || this.el.offsetHeight; clientX = e.clientX, clientY = e.clientY; - top = this.isImage ? Math.max(0, clientY * (this.clientHeight - height) / this.clientHeight) : Math.max(0, Math.min(this.clientHeight - height, clientY - 120)); + top = this.isImage ? Math.max(0, clientY * (this.clientHeight - height) / this.clientHeight) : Math.max(0, Math.min(this.clientHeight - height, clientY + this.offsetY)); threshold = this.clientWidth / 2; if (!this.isImage) { threshold = Math.max(threshold, this.clientWidth - 400); } - _ref = clientX <= threshold ? [clientX + 45 + 'px', null] : [null, this.clientWidth - clientX + 45 + 'px'], left = _ref[0], right = _ref[1]; + _ref = clientX <= threshold ? [clientX + this.offsetX + 'px', null] : [null, this.clientWidth - clientX + this.offsetX + 'px'], left = _ref[0], right = _ref[1]; style = this.style; style.top = top + 'px'; style.left = left; diff --git a/builds/crx/script.js b/builds/crx/script.js index ddc0dee9a..15430f7b2 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -7114,8 +7114,8 @@ return $.set("" + this.id + ".position", this.style.cssText); }; hoverstart = function(_arg) { - var asapTest, cb, el, endEvents, height, latestEvent, noRemove, o, root, _ref; - root = _arg.root, el = _arg.el, latestEvent = _arg.latestEvent, endEvents = _arg.endEvents, asapTest = _arg.asapTest, height = _arg.height, cb = _arg.cb, noRemove = _arg.noRemove; + var asapTest, cb, el, endEvents, height, latestEvent, noRemove, o, offsetX, offsetY, root, _ref; + root = _arg.root, el = _arg.el, latestEvent = _arg.latestEvent, endEvents = _arg.endEvents, asapTest = _arg.asapTest, height = _arg.height, cb = _arg.cb, noRemove = _arg.noRemove, offsetX = _arg.offsetX, offsetY = _arg.offsetY; o = { root: root, el: el, @@ -7126,7 +7126,9 @@ latestEvent: latestEvent, clientHeight: doc.clientHeight, clientWidth: doc.clientWidth, - noRemove: noRemove + noRemove: noRemove, + offsetX: offsetX || 45, + offsetY: offsetY || -120 }; o.hover = hover.bind(o); o.hoverend = hoverend.bind(o); @@ -7148,12 +7150,12 @@ this.latestEvent = e; height = this.height || this.el.offsetHeight; clientX = e.clientX, clientY = e.clientY; - top = this.isImage ? Math.max(0, clientY * (this.clientHeight - height) / this.clientHeight) : Math.max(0, Math.min(this.clientHeight - height, clientY - 120)); + top = this.isImage ? Math.max(0, clientY * (this.clientHeight - height) / this.clientHeight) : Math.max(0, Math.min(this.clientHeight - height, clientY + this.offsetY)); threshold = this.clientWidth / 2; if (!this.isImage) { threshold = Math.max(threshold, this.clientWidth - 400); } - _ref = clientX <= threshold ? [clientX + 45 + 'px', null] : [null, this.clientWidth - clientX + 45 + 'px'], left = _ref[0], right = _ref[1]; + _ref = clientX <= threshold ? [clientX + this.offsetX + 'px', null] : [null, this.clientWidth - clientX + this.offsetX + 'px'], left = _ref[0], right = _ref[1]; style = this.style; style.top = top + 'px'; style.left = left; diff --git a/src/General/UI.coffee b/src/General/UI.coffee index 877632bcb..3299077cd 100755 --- a/src/General/UI.coffee +++ b/src/General/UI.coffee @@ -307,7 +307,7 @@ UI = do -> $.off d, 'mouseup', @up $.set "#{@id}.position", @style.cssText - hoverstart = ({root, el, latestEvent, endEvents, asapTest, height, cb, noRemove}) -> + hoverstart = ({root, el, latestEvent, endEvents, asapTest, height, cb, noRemove, offsetX, offsetY}) -> o = { root el @@ -319,6 +319,8 @@ UI = do -> clientHeight: doc.clientHeight clientWidth: doc.clientWidth noRemove + offsetX: offsetX or 45 + offsetY: offsetY or -120 } o.hover = hover.bind o o.hoverend = hoverend.bind o @@ -332,6 +334,7 @@ UI = do -> if $.x 'ancestor::div[contains(@class,"inline")][1]', root $.on d, 'keydown', o.hoverend $.on root, 'mousemove', o.hover + <% if (type === 'userscript') { %> # Workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=674955 o.workaround = (e) -> o.hoverend(e) unless root.contains e.target @@ -345,14 +348,14 @@ UI = do -> top = if @isImage Math.max 0, clientY * (@clientHeight - height) / @clientHeight else - Math.max 0, Math.min(@clientHeight - height, clientY - 120) + Math.max 0, Math.min(@clientHeight - height, clientY + @offsetY) threshold = @clientWidth / 2 threshold = Math.max threshold, @clientWidth - 400 unless @isImage [left, right] = if clientX <= threshold - [clientX + 45 + 'px', null] + [clientX + @offsetX + 'px', null] else - [null, @clientWidth - clientX + 45 + 'px'] + [null, @clientWidth - clientX + @offsetX + 'px'] {style} = @ style.top = top + 'px'