mirror of
https://github.com/moparisthebest/mailcatcher
synced 2024-11-16 22:25:25 -05:00
no need for «existential operator» for results of jquery selector methods
This commit is contained in:
parent
0a4775092a
commit
2e35d0cc9d
@ -60,24 +60,24 @@ class MailCatcher
|
|||||||
|
|
||||||
key 'up', =>
|
key 'up', =>
|
||||||
if @selectedMessage()
|
if @selectedMessage()
|
||||||
@loadMessage $('#messages tr.selected')?.prev()?.data('message-id')
|
@loadMessage $('#messages tr.selected').prev().data('message-id')
|
||||||
else
|
else
|
||||||
@loadMessage $('#messages tbody tr[data-message-id]:first')?.data('message-id')
|
@loadMessage $('#messages tbody tr[data-message-id]:first').data('message-id')
|
||||||
false
|
false
|
||||||
|
|
||||||
key 'down', =>
|
key 'down', =>
|
||||||
if @selectedMessage()
|
if @selectedMessage()
|
||||||
@loadMessage $('#messages tr.selected')?.next()?.data('message-id')
|
@loadMessage $('#messages tr.selected').next().data('message-id')
|
||||||
else
|
else
|
||||||
@loadMessage $('#messages tbody tr[data-message-id]:first')?.data('message-id')
|
@loadMessage $('#messages tbody tr[data-message-id]:first').data('message-id')
|
||||||
false
|
false
|
||||||
|
|
||||||
key '⌘+up, ctrl+up', =>
|
key '⌘+up, ctrl+up', =>
|
||||||
@loadMessage $('#messages tbody tr[data-message-id]:first')?.data('message-id')
|
@loadMessage $('#messages tbody tr[data-message-id]:first').data('message-id')
|
||||||
false
|
false
|
||||||
|
|
||||||
key '⌘+down, ctrl+down', =>
|
key '⌘+down, ctrl+down', =>
|
||||||
@loadMessage $('#messages tbody tr[data-message-id]:last')?.data('message-id')
|
@loadMessage $('#messages tbody tr[data-message-id]:last').data('message-id')
|
||||||
false
|
false
|
||||||
|
|
||||||
key 'left', =>
|
key 'left', =>
|
||||||
@ -96,7 +96,7 @@ class MailCatcher
|
|||||||
type: 'DELETE'
|
type: 'DELETE'
|
||||||
success: =>
|
success: =>
|
||||||
messageRow = $("#messages tbody tr[data-message-id='#{id}']")
|
messageRow = $("#messages tbody tr[data-message-id='#{id}']")
|
||||||
switchTo = messageRow.next()?.data('message-id') || messageRow.prev()?.data('message-id')
|
switchTo = messageRow.next().data('message-id') || messageRow.prev().data('message-id')
|
||||||
messageRow.remove()
|
messageRow.remove()
|
||||||
if switchTo
|
if switchTo
|
||||||
@loadMessage switchTo
|
@loadMessage switchTo
|
||||||
|
@ -87,31 +87,27 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
key('up', function() {
|
key('up', function() {
|
||||||
var _ref, _ref1, _ref2;
|
|
||||||
if (_this.selectedMessage()) {
|
if (_this.selectedMessage()) {
|
||||||
_this.loadMessage((_ref = $('#messages tr.selected')) != null ? (_ref1 = _ref.prev()) != null ? _ref1.data('message-id') : void 0 : void 0);
|
_this.loadMessage($('#messages tr.selected').prev().data('message-id'));
|
||||||
} else {
|
} else {
|
||||||
_this.loadMessage((_ref2 = $('#messages tbody tr[data-message-id]:first')) != null ? _ref2.data('message-id') : void 0);
|
_this.loadMessage($('#messages tbody tr[data-message-id]:first').data('message-id'));
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
key('down', function() {
|
key('down', function() {
|
||||||
var _ref, _ref1, _ref2;
|
|
||||||
if (_this.selectedMessage()) {
|
if (_this.selectedMessage()) {
|
||||||
_this.loadMessage((_ref = $('#messages tr.selected')) != null ? (_ref1 = _ref.next()) != null ? _ref1.data('message-id') : void 0 : void 0);
|
_this.loadMessage($('#messages tr.selected').next().data('message-id'));
|
||||||
} else {
|
} else {
|
||||||
_this.loadMessage((_ref2 = $('#messages tbody tr[data-message-id]:first')) != null ? _ref2.data('message-id') : void 0);
|
_this.loadMessage($('#messages tbody tr[data-message-id]:first').data('message-id'));
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
key('⌘+up, ctrl+up', function() {
|
key('⌘+up, ctrl+up', function() {
|
||||||
var _ref;
|
_this.loadMessage($('#messages tbody tr[data-message-id]:first').data('message-id'));
|
||||||
_this.loadMessage((_ref = $('#messages tbody tr[data-message-id]:first')) != null ? _ref.data('message-id') : void 0);
|
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
key('⌘+down, ctrl+down', function() {
|
key('⌘+down, ctrl+down', function() {
|
||||||
var _ref;
|
_this.loadMessage($('#messages tbody tr[data-message-id]:last').data('message-id'));
|
||||||
_this.loadMessage((_ref = $('#messages tbody tr[data-message-id]:last')) != null ? _ref.data('message-id') : void 0);
|
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
key('left', function() {
|
key('left', function() {
|
||||||
@ -130,9 +126,9 @@
|
|||||||
url: '/messages/' + id,
|
url: '/messages/' + id,
|
||||||
type: 'DELETE',
|
type: 'DELETE',
|
||||||
success: function() {
|
success: function() {
|
||||||
var messageRow, switchTo, _ref, _ref1;
|
var messageRow, switchTo;
|
||||||
messageRow = $("#messages tbody tr[data-message-id='" + id + "']");
|
messageRow = $("#messages tbody tr[data-message-id='" + id + "']");
|
||||||
switchTo = ((_ref = messageRow.next()) != null ? _ref.data('message-id') : void 0) || ((_ref1 = messageRow.prev()) != null ? _ref1.data('message-id') : void 0);
|
switchTo = messageRow.next().data('message-id') || messageRow.prev().data('message-id');
|
||||||
messageRow.remove();
|
messageRow.remove();
|
||||||
if (switchTo) {
|
if (switchTo) {
|
||||||
return _this.loadMessage(switchTo);
|
return _this.loadMessage(switchTo);
|
||||||
|
Loading…
Reference in New Issue
Block a user