Replies array, reply class.
This commit is contained in:
parent
fcb7c20012
commit
962e9d301d
@ -1299,11 +1299,32 @@
|
|||||||
qr.error("" + file.name + ": Unsupported file type.");
|
qr.error("" + file.name + ": Unsupported file type.");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
new qr.reply(file);
|
||||||
}
|
}
|
||||||
return $.addClass(qr.el, 'dump');
|
return $.addClass(qr.el, 'dump');
|
||||||
},
|
},
|
||||||
|
replies: [],
|
||||||
|
reply: (function() {
|
||||||
|
|
||||||
|
function _Class(file) {
|
||||||
|
var name, _ref;
|
||||||
|
this.file = file;
|
||||||
|
this.com = null;
|
||||||
|
for (name in qr.inputs) {
|
||||||
|
this[name] = ((_ref = qr.replies[qr.replies.length - 1]) != null ? _ref[name] : void 0) || $.get("qr_" + name, null);
|
||||||
|
}
|
||||||
|
qr.replies.push(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
_Class.prototype.load = function() {
|
||||||
|
return log(this);
|
||||||
|
};
|
||||||
|
|
||||||
|
return _Class;
|
||||||
|
|
||||||
|
})(),
|
||||||
dialog: function() {
|
dialog: function() {
|
||||||
var input, mimeTypes, name, thread, threads, _i, _len, _ref, _ref2;
|
var mimeTypes, thread, threads, _i, _len, _ref;
|
||||||
if (!g.REPLY) {
|
if (!g.REPLY) {
|
||||||
threads = '<option value=new>New thread</option>';
|
threads = '<option value=new>New thread</option>';
|
||||||
_ref = $$('.op');
|
_ref = $$('.op');
|
||||||
@ -1342,11 +1363,7 @@
|
|||||||
email: $('[name=email]', qr.el)
|
email: $('[name=email]', qr.el)
|
||||||
};
|
};
|
||||||
if (conf['Remember Subject']) qr.inputs.subject = $('[name=subject]', qr.el);
|
if (conf['Remember Subject']) qr.inputs.subject = $('[name=subject]', qr.el);
|
||||||
_ref2 = qr.inputs;
|
new qr.reply().load();
|
||||||
for (name in _ref2) {
|
|
||||||
input = _ref2[name];
|
|
||||||
input.value = $.get("qr_" + name, null);
|
|
||||||
}
|
|
||||||
$.on(window, 'storage', function(e) {
|
$.on(window, 'storage', function(e) {
|
||||||
var match;
|
var match;
|
||||||
if (match = e.key.match(/qr_(.+)$/)) {
|
if (match = e.key.match(/qr_(.+)$/)) {
|
||||||
|
|||||||
@ -950,7 +950,8 @@ qr =
|
|||||||
else if -1 is qr.mimeTypes.indexOf file.type
|
else if -1 is qr.mimeTypes.indexOf file.type
|
||||||
qr.error 'Unsupported file type.'
|
qr.error 'Unsupported file type.'
|
||||||
else
|
else
|
||||||
# modify selected reply's file
|
# set or modify selected reply's file
|
||||||
|
# qr.replies[?].file = file
|
||||||
return
|
return
|
||||||
for file in @files
|
for file in @files
|
||||||
if file.size > @max
|
if file.size > @max
|
||||||
@ -959,10 +960,20 @@ qr =
|
|||||||
else if -1 is qr.mimeTypes.indexOf file.type
|
else if -1 is qr.mimeTypes.indexOf file.type
|
||||||
qr.error "#{file.name}: Unsupported file type."
|
qr.error "#{file.name}: Unsupported file type."
|
||||||
break
|
break
|
||||||
# add new reply
|
new qr.reply file
|
||||||
# set reply's file
|
|
||||||
$.addClass qr.el, 'dump'
|
$.addClass qr.el, 'dump'
|
||||||
|
|
||||||
|
replies: []
|
||||||
|
reply: class
|
||||||
|
constructor: (@file) ->
|
||||||
|
@com = null
|
||||||
|
for name of qr.inputs
|
||||||
|
@[name] = qr.replies[qr.replies.length-1]?[name] or $.get "qr_#{name}", null
|
||||||
|
qr.replies.push @
|
||||||
|
load: ->
|
||||||
|
# load reply's data in the QR dialog
|
||||||
|
log @
|
||||||
|
|
||||||
dialog: ->
|
dialog: ->
|
||||||
# create a new thread or select thread to reply to
|
# create a new thread or select thread to reply to
|
||||||
unless g.REPLY
|
unless g.REPLY
|
||||||
@ -1094,8 +1105,7 @@ textarea.field {
|
|||||||
name: $ '[name=name]', qr.el
|
name: $ '[name=name]', qr.el
|
||||||
email: $ '[name=email]', qr.el
|
email: $ '[name=email]', qr.el
|
||||||
qr.inputs.subject = $ '[name=subject]', qr.el if conf['Remember Subject']
|
qr.inputs.subject = $ '[name=subject]', qr.el if conf['Remember Subject']
|
||||||
for name, input of qr.inputs
|
new qr.reply().load()
|
||||||
input.value = $.get "qr_#{name}", null
|
|
||||||
# sync between tabs
|
# sync between tabs
|
||||||
$.on window, 'storage', (e) ->
|
$.on window, 'storage', (e) ->
|
||||||
if match = e.key.match /qr_(.+)$/
|
if match = e.key.match /qr_(.+)$/
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user