mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-09-05 20:54:27 +08:00
Merge pull request #1182 from mlorb/ml-sci-2459
Fix position of navigation bar is not saved [SCI-2459]
This commit is contained in:
commit
c17a947969
1 changed files with 19 additions and 1 deletions
|
@ -1,6 +1,7 @@
|
|||
(function(global) {
|
||||
'use strict';
|
||||
global.SideBarToggle = (function() {
|
||||
var STORAGE_TOGGLE_KEY = "scinote-sidebar-toggled";
|
||||
|
||||
function show() {
|
||||
$('#wrapper').removeClass('hidden2');
|
||||
|
@ -12,6 +13,7 @@
|
|||
{ 'margin-left': '-280px', 'padding-left': '294px' }
|
||||
);
|
||||
$('#toggle-sidebar-btn').attr('data-shown', '');
|
||||
sessionStorage.setItem(STORAGE_TOGGLE_KEY, "un-toggled");
|
||||
}
|
||||
|
||||
function hide() {
|
||||
|
@ -25,6 +27,7 @@
|
|||
'padding-left': '14px'
|
||||
});
|
||||
$('#toggle-sidebar-btn').removeAttr('data-shown');
|
||||
sessionStorage.setItem(STORAGE_TOGGLE_KEY, "toggled");
|
||||
}
|
||||
|
||||
function toggle() {
|
||||
|
@ -41,11 +44,26 @@
|
|||
return btn.is('[data-shown]');
|
||||
}
|
||||
|
||||
function isToggledStorage() {
|
||||
var val = sessionStorage.getItem(STORAGE_TOGGLE_KEY);
|
||||
if (val === null) {
|
||||
return null;
|
||||
}
|
||||
return val === "toggled";
|
||||
}
|
||||
|
||||
return Object.freeze({
|
||||
show: show,
|
||||
hide: hide,
|
||||
toggle: toggle,
|
||||
isShown: isShown
|
||||
isShown: isShown,
|
||||
isToggledStorage: isToggledStorage
|
||||
})
|
||||
})();
|
||||
|
||||
$(document).ready(function() {
|
||||
if (SideBarToggle.isToggledStorage()) {
|
||||
SideBarToggle.hide();;
|
||||
}
|
||||
})
|
||||
})(window);
|
||||
|
|
Loading…
Add table
Reference in a new issue