This commit is contained in:
Nicolas Stepien 2013-02-23 16:12:40 +01:00
parent a796597108
commit e8c54cc6e0
2 changed files with 32 additions and 10 deletions

View File

@ -6029,24 +6029,34 @@
};
_Class.prototype.select = function() {
var data, rectEl, rectList, _i, _len, _ref, _ref1;
if ((_ref = QR.selected) != null) {
_ref.el.id = null;
var name, rectEl, rectList, _i, _len, _ref;
if (QR.selected) {
QR.selected.el.id = null;
QR.selected.forceSave();
}
QR.selected = this;
this.el.id = 'selected';
rectEl = this.el.getBoundingClientRect();
rectList = this.el.parentNode.getBoundingClientRect();
this.el.parentNode.scrollLeft += rectEl.left + rectEl.width / 2 - rectList.left - rectList.width / 2;
_ref1 = ['name', 'email', 'sub', 'com'];
for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
data = _ref1[_i];
$("[name=" + data + "]", QR.el).value = this[data];
_ref = ['name', 'email', 'sub', 'com'];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
name = _ref[_i];
$("[name=" + name + "]", QR.el).value = this[name];
}
QR.characterCount.call($('textarea', QR.el));
return $('#spoiler', QR.el).checked = this.spoiler;
};
_Class.prototype.forceSave = function() {
var name, _i, _len, _ref;
_ref = ['name', 'email', 'sub', 'com'];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
name = _ref[_i];
this[name] = $("[name=" + name + "]", QR.el).value;
}
};
_Class.prototype.dragStart = function() {
return $.addClass(this, 'drag');
};
@ -6325,6 +6335,9 @@
return;
}
reply = QR.replies[0];
if (reply === QR.selected) {
reply.forceSave();
}
if (g.BOARD.ID === 'f' && g.VIEW === 'index') {
filetag = QR.threadSelector.value;
threadID = 'new';

View File

@ -407,7 +407,9 @@ QR =
return unless window.URL
URL.revokeObjectURL @url
select: ->
QR.selected?.el.id = null
if QR.selected
QR.selected.el.id = null
QR.selected.forceSave()
QR.selected = @
@el.id = 'selected'
# Scroll the list to center the focused reply.
@ -415,10 +417,16 @@ QR =
rectList = @el.parentNode.getBoundingClientRect()
@el.parentNode.scrollLeft += rectEl.left + rectEl.width/2 - rectList.left - rectList.width/2
# Load this reply's values.
for data in ['name', 'email', 'sub', 'com']
$("[name=#{data}]", QR.el).value = @[data]
for name in ['name', 'email', 'sub', 'com']
$("[name=#{name}]", QR.el).value = @[name]
QR.characterCount.call $ 'textarea', QR.el
$('#spoiler', QR.el).checked = @spoiler
forceSave: ->
# Do this in case people use extensions
# that do not trigger the `input` event.
for name in ['name', 'email', 'sub', 'com']
@[name] = $("[name=#{name}]", QR.el).value
return
dragStart: ->
$.addClass @, 'drag'
dragEnter: ->
@ -632,6 +640,7 @@ QR =
return
reply = QR.replies[0]
reply.forceSave() if reply is QR.selected
if g.BOARD.ID is 'f' and g.VIEW is 'index'
filetag = QR.threadSelector.value
threadID = 'new'