save separator sizing in localStorage if available
This commit is contained in:
parent
7cc20ce471
commit
3ffa6a3237
|
@ -24,16 +24,17 @@ class MailCatcher
|
||||||
@loadMessageAnalysis @selectedMessage()
|
@loadMessageAnalysis @selectedMessage()
|
||||||
|
|
||||||
$('#resizer').live
|
$('#resizer').live
|
||||||
mousedown: (e) ->
|
mousedown: (e) =>
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
$(window).bind events =
|
$(window).bind events =
|
||||||
mouseup: (e) ->
|
mouseup: (e) =>
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
$(window).unbind events
|
$(window).unbind events
|
||||||
mousemove: (e) ->
|
mousemove: (e) =>
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
$('#messages').css
|
@resizeTo e.clientY
|
||||||
height: e.clientY - $('#messages').offset().top
|
|
||||||
|
@resizeToSaved()
|
||||||
|
|
||||||
$('nav.app .clear a').live 'click', (e) =>
|
$('nav.app .clear a').live 'click', (e) =>
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
|
@ -307,5 +308,16 @@ class MailCatcher
|
||||||
unless @refreshInterval?
|
unless @refreshInterval?
|
||||||
@refreshInterval = setInterval (=> @refresh()), 1000
|
@refreshInterval = setInterval (=> @refresh()), 1000
|
||||||
|
|
||||||
|
resizeToSavedKey: 'mailcatcherSeparatorHeight'
|
||||||
|
|
||||||
|
resizeTo: (height) ->
|
||||||
|
$('#messages').css
|
||||||
|
height: height - $('#messages').offset().top
|
||||||
|
window.localStorage?.setItem(@resizeToSavedKey, height)
|
||||||
|
|
||||||
|
resizeToSaved: ->
|
||||||
|
height = parseInt(window.localStorage?.getItem(@resizeToSavedKey))
|
||||||
|
unless isNaN height
|
||||||
|
@resizeTo height
|
||||||
|
|
||||||
$ -> window.MailCatcher = new MailCatcher
|
$ -> window.MailCatcher = new MailCatcher
|
||||||
|
|
|
@ -58,13 +58,12 @@
|
||||||
},
|
},
|
||||||
mousemove: function(e) {
|
mousemove: function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
return $('#messages').css({
|
return _this.resizeTo(e.clientY);
|
||||||
height: e.clientY - $('#messages').offset().top
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
this.resizeToSaved();
|
||||||
$('nav.app .clear a').live('click', function(e) {
|
$('nav.app .clear a').live('click', function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
if (confirm("You will lose all your received messages.\n\nAre you sure you want to clear all messages?")) {
|
if (confirm("You will lose all your received messages.\n\nAre you sure you want to clear all messages?")) {
|
||||||
|
@ -397,6 +396,24 @@
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
MailCatcher.prototype.resizeToSavedKey = 'mailcatcherSeparatorHeight';
|
||||||
|
|
||||||
|
MailCatcher.prototype.resizeTo = function(height) {
|
||||||
|
var _ref;
|
||||||
|
$('#messages').css({
|
||||||
|
height: height - $('#messages').offset().top
|
||||||
|
});
|
||||||
|
return (_ref = window.localStorage) != null ? _ref.setItem(this.resizeToSavedKey, height) : void 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
MailCatcher.prototype.resizeToSaved = function() {
|
||||||
|
var height, _ref;
|
||||||
|
height = parseInt((_ref = window.localStorage) != null ? _ref.getItem(this.resizeToSavedKey) : void 0);
|
||||||
|
if (!isNaN(height)) {
|
||||||
|
return this.resizeTo(height);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
return MailCatcher;
|
return MailCatcher;
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|
Loading…
Reference in New Issue