Erm, some of that was unnecessary.
This commit is contained in:
parent
0cd3e95989
commit
f098f19a11
@ -236,7 +236,9 @@
|
||||
innerHTML: html,
|
||||
id: id
|
||||
});
|
||||
el.style.cssText = localStorage.getItem("" + g.NAMESPACE + id + ".position") || position;
|
||||
$.get("" + id + ".position", position, function(item) {
|
||||
return el.style.cssText = item["" + id + ".position"];
|
||||
});
|
||||
move = $('.move', el);
|
||||
$.on(move, 'touchstart mousedown', dragstart);
|
||||
_ref = move.children;
|
||||
@ -571,18 +573,17 @@
|
||||
$.off(d, 'mousemove', this.move);
|
||||
$.off(d, 'mouseup', this.up);
|
||||
}
|
||||
return localStorage.setItem("" + g.NAMESPACE + this.id + ".position", this.style.cssText);
|
||||
return $.set("" + this.id + ".position", this.style.cssText);
|
||||
};
|
||||
hoverstart = function(_arg) {
|
||||
var asapTest, cb, close, el, endEvents, latestEvent, o, root;
|
||||
var asapTest, cb, el, endEvents, latestEvent, o, root;
|
||||
|
||||
root = _arg.root, el = _arg.el, latestEvent = _arg.latestEvent, endEvents = _arg.endEvents, asapTest = _arg.asapTest, cb = _arg.cb, close = _arg.close;
|
||||
root = _arg.root, el = _arg.el, latestEvent = _arg.latestEvent, endEvents = _arg.endEvents, asapTest = _arg.asapTest, cb = _arg.cb;
|
||||
o = {
|
||||
root: root,
|
||||
el: el,
|
||||
style: el.style,
|
||||
cb: cb,
|
||||
close: close,
|
||||
endEvents: endEvents,
|
||||
latestEvent: latestEvent,
|
||||
clientHeight: doc.clientHeight,
|
||||
@ -606,9 +607,9 @@
|
||||
this.latestEvent = e;
|
||||
height = this.el.offsetHeight;
|
||||
clientX = e.clientX, clientY = e.clientY;
|
||||
top = clientY + (close ? 0 : -120);
|
||||
top = clientY - 120;
|
||||
top = this.clientHeight <= height || top <= 0 ? 0 : top + height >= this.clientHeight ? this.clientHeight - height : top;
|
||||
_ref = clientX <= this.clientWidth - 400 ? [clientX + (this.close ? 15 : 45) + 'px', null] : [null, this.clientWidth - clientX + 45 + 'px'], left = _ref[0], right = _ref[1];
|
||||
_ref = clientX <= this.clientWidth - 400 ? [clientX + 45 + 'px', null] : [null, this.clientWidth - clientX + 45 + 'px'], left = _ref[0], right = _ref[1];
|
||||
style = this.style;
|
||||
style.top = top + 'px';
|
||||
style.left = left;
|
||||
|
||||
@ -233,7 +233,9 @@
|
||||
innerHTML: html,
|
||||
id: id
|
||||
});
|
||||
el.style.cssText = localStorage.getItem("" + g.NAMESPACE + id + ".position") || position;
|
||||
$.get("" + id + ".position", position, function(item) {
|
||||
return el.style.cssText = item["" + id + ".position"];
|
||||
});
|
||||
move = $('.move', el);
|
||||
$.on(move, 'touchstart mousedown', dragstart);
|
||||
_ref = move.children;
|
||||
@ -568,18 +570,17 @@
|
||||
$.off(d, 'mousemove', this.move);
|
||||
$.off(d, 'mouseup', this.up);
|
||||
}
|
||||
return localStorage.setItem("" + g.NAMESPACE + this.id + ".position", this.style.cssText);
|
||||
return $.set("" + this.id + ".position", this.style.cssText);
|
||||
};
|
||||
hoverstart = function(_arg) {
|
||||
var asapTest, cb, close, el, endEvents, latestEvent, o, root;
|
||||
var asapTest, cb, el, endEvents, latestEvent, o, root;
|
||||
|
||||
root = _arg.root, el = _arg.el, latestEvent = _arg.latestEvent, endEvents = _arg.endEvents, asapTest = _arg.asapTest, cb = _arg.cb, close = _arg.close;
|
||||
root = _arg.root, el = _arg.el, latestEvent = _arg.latestEvent, endEvents = _arg.endEvents, asapTest = _arg.asapTest, cb = _arg.cb;
|
||||
o = {
|
||||
root: root,
|
||||
el: el,
|
||||
style: el.style,
|
||||
cb: cb,
|
||||
close: close,
|
||||
endEvents: endEvents,
|
||||
latestEvent: latestEvent,
|
||||
clientHeight: doc.clientHeight,
|
||||
@ -603,9 +604,9 @@
|
||||
this.latestEvent = e;
|
||||
height = this.el.offsetHeight;
|
||||
clientX = e.clientX, clientY = e.clientY;
|
||||
top = clientY + (close ? 0 : -120);
|
||||
top = clientY - 120;
|
||||
top = this.clientHeight <= height || top <= 0 ? 0 : top + height >= this.clientHeight ? this.clientHeight - height : top;
|
||||
_ref = clientX <= this.clientWidth - 400 ? [clientX + (this.close ? 15 : 45) + 'px', null] : [null, this.clientWidth - clientX + 45 + 'px'], left = _ref[0], right = _ref[1];
|
||||
_ref = clientX <= this.clientWidth - 400 ? [clientX + 45 + 'px', null] : [null, this.clientWidth - clientX + 45 + 'px'], left = _ref[0], right = _ref[1];
|
||||
style = this.style;
|
||||
style.top = top + 'px';
|
||||
style.left = left;
|
||||
|
||||
@ -210,7 +210,9 @@
|
||||
innerHTML: html,
|
||||
id: id
|
||||
});
|
||||
el.style.cssText = localStorage.getItem("" + g.NAMESPACE + id + ".position") || position;
|
||||
$.get("" + id + ".position", position, function(item) {
|
||||
return el.style.cssText = item["" + id + ".position"];
|
||||
});
|
||||
move = $('.move', el);
|
||||
$.on(move, 'touchstart mousedown', dragstart);
|
||||
_ref = move.children;
|
||||
@ -545,18 +547,17 @@
|
||||
$.off(d, 'mousemove', this.move);
|
||||
$.off(d, 'mouseup', this.up);
|
||||
}
|
||||
return localStorage.setItem("" + g.NAMESPACE + this.id + ".position", this.style.cssText);
|
||||
return $.set("" + this.id + ".position", this.style.cssText);
|
||||
};
|
||||
hoverstart = function(_arg) {
|
||||
var asapTest, cb, close, el, endEvents, latestEvent, o, root;
|
||||
var asapTest, cb, el, endEvents, latestEvent, o, root;
|
||||
|
||||
root = _arg.root, el = _arg.el, latestEvent = _arg.latestEvent, endEvents = _arg.endEvents, asapTest = _arg.asapTest, cb = _arg.cb, close = _arg.close;
|
||||
root = _arg.root, el = _arg.el, latestEvent = _arg.latestEvent, endEvents = _arg.endEvents, asapTest = _arg.asapTest, cb = _arg.cb;
|
||||
o = {
|
||||
root: root,
|
||||
el: el,
|
||||
style: el.style,
|
||||
cb: cb,
|
||||
close: close,
|
||||
endEvents: endEvents,
|
||||
latestEvent: latestEvent,
|
||||
clientHeight: doc.clientHeight,
|
||||
@ -580,9 +581,9 @@
|
||||
this.latestEvent = e;
|
||||
height = this.el.offsetHeight;
|
||||
clientX = e.clientX, clientY = e.clientY;
|
||||
top = clientY + (close ? 0 : -120);
|
||||
top = clientY - 120;
|
||||
top = this.clientHeight <= height || top <= 0 ? 0 : top + height >= this.clientHeight ? this.clientHeight - height : top;
|
||||
_ref = clientX <= this.clientWidth - 400 ? [clientX + (this.close ? 15 : 45) + 'px', null] : [null, this.clientWidth - clientX + 45 + 'px'], left = _ref[0], right = _ref[1];
|
||||
_ref = clientX <= this.clientWidth - 400 ? [clientX + 45 + 'px', null] : [null, this.clientWidth - clientX + 45 + 'px'], left = _ref[0], right = _ref[1];
|
||||
style = this.style;
|
||||
style.top = top + 'px';
|
||||
style.left = left;
|
||||
|
||||
@ -4,7 +4,8 @@ UI = do ->
|
||||
className: 'dialog'
|
||||
innerHTML: html
|
||||
id: id
|
||||
el.style.cssText = localStorage.getItem("#{g.NAMESPACE}#{id}.position") or position
|
||||
$.get "#{id}.position", position, (item) ->
|
||||
el.style.cssText = item["#{id}.position"]
|
||||
move = $ '.move', el
|
||||
$.on move, 'touchstart mousedown', dragstart
|
||||
for child in move.children
|
||||
@ -192,6 +193,7 @@ UI = do ->
|
||||
@parseEntry subEntry
|
||||
return
|
||||
|
||||
|
||||
dragstart = (e) ->
|
||||
return if e.type is 'mousedown' and e.button isnt 0 # not LMB
|
||||
# prevent text selection
|
||||
@ -225,13 +227,11 @@ UI = do ->
|
||||
o.up = dragend.bind o
|
||||
$.on d, 'mousemove', o.move
|
||||
$.on d, 'mouseup', o.up
|
||||
|
||||
touchmove = (e) ->
|
||||
for touch in e.changedTouches
|
||||
if touch.identifier is @identifier
|
||||
drag.call @, touch
|
||||
return
|
||||
|
||||
drag = (e) ->
|
||||
{clientX, clientY} = e
|
||||
|
||||
@ -265,13 +265,11 @@ UI = do ->
|
||||
style.right = right
|
||||
style.top = top
|
||||
style.bottom = bottom
|
||||
|
||||
touchend = (e) ->
|
||||
for touch in e.changedTouches
|
||||
if touch.identifier is @identifier
|
||||
dragend.call @
|
||||
return
|
||||
|
||||
dragend = ->
|
||||
if @isTouching
|
||||
$.off d, 'touchmove', @move
|
||||
@ -279,15 +277,14 @@ UI = do ->
|
||||
else # mouseup
|
||||
$.off d, 'mousemove', @move
|
||||
$.off d, 'mouseup', @up
|
||||
localStorage.setItem "#{g.NAMESPACE}#{@id}.position", @style.cssText
|
||||
$.set "#{@id}.position", @style.cssText
|
||||
|
||||
hoverstart = ({root, el, latestEvent, endEvents, asapTest, cb, close}) ->
|
||||
hoverstart = ({root, el, latestEvent, endEvents, asapTest, cb}) ->
|
||||
o = {
|
||||
root: root
|
||||
el: el
|
||||
style: el.style
|
||||
cb: cb
|
||||
close: close
|
||||
endEvents: endEvents
|
||||
latestEvent: latestEvent
|
||||
clientHeight: doc.clientHeight
|
||||
@ -303,13 +300,12 @@ UI = do ->
|
||||
|
||||
$.on root, endEvents, o.hoverend
|
||||
$.on root, 'mousemove', o.hover
|
||||
|
||||
hover = (e) ->
|
||||
@latestEvent = e
|
||||
height = @el.offsetHeight
|
||||
{clientX, clientY} = e
|
||||
|
||||
top = clientY + (if close then 0 else -120)
|
||||
top = clientY - 120
|
||||
top = if @clientHeight <= height or top <= 0
|
||||
0
|
||||
else if top + height >= @clientHeight
|
||||
@ -318,7 +314,7 @@ UI = do ->
|
||||
top
|
||||
|
||||
[left, right] = if clientX <= @clientWidth - 400
|
||||
[clientX + (if @close then 15 else 45) + 'px', null]
|
||||
[clientX + 45 + 'px', null]
|
||||
else
|
||||
[null, @clientWidth - clientX + 45 + 'px']
|
||||
|
||||
@ -326,7 +322,6 @@ UI = do ->
|
||||
style.top = top + 'px'
|
||||
style.left = left
|
||||
style.right = right
|
||||
|
||||
hoverend = ->
|
||||
$.rm @el
|
||||
$.off @root, @endEvents, @hoverend
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user