Use localStorage.get/setItem in UI.
This commit is contained in:
parent
4997bca3fc
commit
f15b920850
@ -199,12 +199,12 @@
|
||||
|
||||
UI = {
|
||||
dialog: function(id, position, html) {
|
||||
var el, saved;
|
||||
var el;
|
||||
el = d.createElement('div');
|
||||
el.className = 'reply dialog';
|
||||
el.innerHTML = html;
|
||||
el.id = id;
|
||||
el.style.cssText = (saved = localStorage["" + Main.namespace + id + ".position"]) ? saved : position;
|
||||
el.style.cssText = localStorage.getItem("" + Main.namespace + id + ".position") || position;
|
||||
el.querySelector('.move').addEventListener('mousedown', UI.dragstart, false);
|
||||
return el;
|
||||
},
|
||||
@ -233,9 +233,7 @@
|
||||
return style.bottom = top === null ? '0px' : null;
|
||||
},
|
||||
dragend: function() {
|
||||
var el;
|
||||
el = UI.el;
|
||||
localStorage["" + Main.namespace + el.id + ".position"] = el.style.cssText;
|
||||
localStorage.setItem("" + Main.namespace + UI.el.id + ".position", UI.el.style.cssText);
|
||||
d.removeEventListener('mousemove', UI.drag, false);
|
||||
d.removeEventListener('mouseup', UI.dragend, false);
|
||||
return delete UI.el;
|
||||
|
||||
@ -164,15 +164,15 @@ UI =
|
||||
el = d.createElement 'div'
|
||||
el.className = 'reply dialog'
|
||||
el.innerHTML = html
|
||||
el.id = id
|
||||
el.style.cssText = if saved = localStorage["#{Main.namespace}#{id}.position"] then saved else position
|
||||
el.id = id
|
||||
el.style.cssText = localStorage.getItem("#{Main.namespace}#{id}.position") or position
|
||||
el.querySelector('.move').addEventListener 'mousedown', UI.dragstart, false
|
||||
el
|
||||
dragstart: (e) ->
|
||||
#prevent text selection
|
||||
e.preventDefault()
|
||||
UI.el = el = @parentNode
|
||||
d.addEventListener 'mousemove', UI.drag, false
|
||||
d.addEventListener 'mousemove', UI.drag, false
|
||||
d.addEventListener 'mouseup', UI.dragend, false
|
||||
#distance from pointer to el edge is constant; calculate it here.
|
||||
# XXX opera reports el.offsetLeft / el.offsetTop as 0
|
||||
@ -200,12 +200,8 @@ UI =
|
||||
style.right = if left is null then '0px' else null
|
||||
style.bottom = if top is null then '0px' else null
|
||||
dragend: ->
|
||||
#$ coffee -bpe '{a} = {b} = c'
|
||||
#var a, b;
|
||||
#a = (b = c.b, c).a;
|
||||
{el} = UI
|
||||
localStorage["#{Main.namespace}#{el.id}.position"] = el.style.cssText
|
||||
d.removeEventListener 'mousemove', UI.drag, false
|
||||
localStorage.setItem "#{Main.namespace}#{UI.el.id}.position", UI.el.style.cssText
|
||||
d.removeEventListener 'mousemove', UI.drag, false
|
||||
d.removeEventListener 'mouseup', UI.dragend, false
|
||||
delete UI.el
|
||||
hover: (e) ->
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user