cache editor resizing and use as default

pull/1/head
d11e9 9 years ago
parent 3ff5f35557
commit bdb5a09f8c
  1. 17
      index.html

@ -258,11 +258,10 @@ input[readonly] {
// ----------------- resizeable ui ---------------
var EDITOR_SIZE_CACHE_KEY = "editor-size-cache";
var dragging = false;
$('#dragbar').mousedown(function(e){
e.preventDefault();
dragging = true;
var main = $('#righthand-panel');
var ghostbar = $('<div id="ghostbar">', {
@ -279,18 +278,28 @@ input[readonly] {
var $body = $('body');
function setEditorSize (delta) {
$('#righthand-panel').css("width", delta);
$('#editor').css("right", delta);
}
$(document).mouseup(function(e){
if (dragging) {
var delta = $body.width() - e.pageX+2;
$('#righthand-panel').css("width", delta);
$('#editor').css("right", delta);
setEditorSize( delta )
$('#ghostbar').remove();
$(document).unbind('mousemove');
dragging = false;
window.localStorage.setItem( EDITOR_SIZE_CACHE_KEY, delta );
onResize();
}
});
// set cached defaults
var cachedSize = window.localStorage.getItem( EDITOR_SIZE_CACHE_KEY );
if (cachedSize) {
setEditorSize( cachedSize )
}
// ----------------- editor ----------------------

Loading…
Cancel
Save