qr.open function, use a classier close symbol.

This commit is contained in:
Nicolas Stepien 2011-12-26 17:16:06 +01:00
parent 430d22fc16
commit 2c9c2a2aac
2 changed files with 17 additions and 12 deletions

View File

@ -1195,17 +1195,20 @@
}); });
if (conf['Persistent QR']) return qr.dialog(); if (conf['Persistent QR']) return qr.dialog();
}, },
open: function() {
if (qr.el) {
return qr.el.hidden = false;
} else {
return qr.dialog();
}
},
close: function() { close: function() {
return qr.el.hidden = true; return qr.el.hidden = true;
}, },
quote: function(e) { quote: function(e) {
var caretPos, id, s, sel, ta, text, _ref; var caretPos, id, s, sel, ta, text, _ref;
if (e != null) e.preventDefault(); if (e != null) e.preventDefault();
if (qr.el) { qr.open();
qr.el.hidden = false;
} else {
qr.dialog();
}
id = this.textContent; id = this.textContent;
text = ">>" + id + "\n"; text = ">>" + id + "\n";
sel = window.getSelection(); sel = window.getSelection();
@ -1220,7 +1223,7 @@
return ta.selectionEnd = ta.selectionStart = caretPos + text.length; return ta.selectionEnd = ta.selectionStart = caretPos + text.length;
}, },
dialog: function() { dialog: function() {
qr.el = ui.dialog('qr', 'top:0;right:0;', '<div class=move><a class=close>x</a></div><textarea></textarea>'); qr.el = ui.dialog('qr', 'top:0;right:0;', '<div class=move><a class=close></a></div><textarea></textarea>');
$.on($('.close', qr.el), 'click', qr.close); $.on($('.close', qr.el), 'click', qr.close);
return $.add(d.body, qr.el); return $.add(d.body, qr.el);
} }

View File

@ -870,16 +870,18 @@ qr =
if conf['Persistent QR'] if conf['Persistent QR']
qr.dialog() qr.dialog()
open: ->
if qr.el
qr.el.hidden = false
else
qr.dialog()
close: -> close: ->
qr.el.hidden = true qr.el.hidden = true
quote: (e) -> quote: (e) ->
e?.preventDefault() e?.preventDefault()
qr.open()
if qr.el
qr.el.hidden = false
else
qr.dialog()
id = @textContent id = @textContent
text = ">>#{id}\n" text = ">>#{id}\n"
@ -898,7 +900,7 @@ qr =
ta.selectionEnd = ta.selectionStart = caretPos + text.length ta.selectionEnd = ta.selectionStart = caretPos + text.length
dialog: -> dialog: ->
qr.el = ui.dialog 'qr', 'top:0;right:0;', '<div class=move><a class=close>x</a></div><textarea></textarea>' qr.el = ui.dialog 'qr', 'top:0;right:0;', '<div class=move><a class=close></a></div><textarea></textarea>'
$.on $('.close', qr.el), 'click', qr.close $.on $('.close', qr.el), 'click', qr.close
$.add d.body, qr.el $.add d.body, qr.el