diff options
author | Wu Cheng-Han | 2015-09-25 18:37:40 +0800 |
---|---|---|
committer | Wu Cheng-Han | 2015-09-25 18:37:40 +0800 |
commit | c900703d759758bc7844b0b709dc96b0226856e7 (patch) | |
tree | b13a40e3c935bb1218eeab5dee88a5fcc82076e7 /public | |
parent | db956cc2982a13e3232f39270963beacac2f38cd (diff) |
Updated windowResize, page unload, page error and minor some tweaks for performance
Diffstat (limited to 'public')
-rw-r--r-- | public/js/index.js | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/public/js/index.js b/public/js/index.js index c3f9c431..fca95828 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -400,7 +400,6 @@ $(document).ready(function () { clearMap(); } checkEditorStyle(); - changeMode(currentMode); /* we need this only on touch devices */ if (isTouchDevice) { /* cache dom references */ @@ -423,13 +422,18 @@ $(document).ready(function () { }); //when page resize $(window).resize(function () { + checkLayout(); + checkEditorStyle(); + checkTocStyle(); + checkCursorMenu(); + windowResize(); }); //when page unload $(window).unload(function () { - writeHistory(ui.area.markdown); + updateHistoryInner(); }); $(window).error(function () { - setNeedRefresh(); + //setNeedRefresh(); }); //when page hash change @@ -460,9 +464,11 @@ var windowResizeDebounce = 200; var windowResize = _.debounce(windowResizeInner, windowResizeDebounce); function windowResizeInner() { + checkLayout(); checkResponsive(); checkEditorStyle(); checkTocStyle(); + checkCursorMenu(); //refresh editor if (loaded) { editor.setOption('viewportMargin', Infinity); @@ -480,6 +486,11 @@ function windowResizeInner() { } } +function checkLayout() { + var navbarHieght = $('.navbar').outerHeight(); + $('body').css('padding-top', navbarHieght + 'px'); +} + function editorHasFocus() { return $(editor.getInputField()).is(":focus"); } |