Add: resizable menu

This commit is contained in:
Cutls 2019-08-30 01:46:30 +09:00
parent 5d6e8cf9b3
commit 0dead93606
2 changed files with 22 additions and 3 deletions

View File

@ -332,13 +332,15 @@ blockquote:before,
padding: 5px; padding: 5px;
border: thin solid gray; border: thin solid gray;
border-radius: 5px; border-radius: 5px;
overflow: hidden;
} }
#menu-wrapper { #menu-wrapper {
margin-left: -5px; margin-left: -5px;
display: flex; display: flex;
height: calc(100% - 3.5rem);
} }
#left-menu { #left-menu {
width: 170px; width: 230px;
} }
#left-menu div { #left-menu div {
padding-left: 5px; padding-left: 5px;
@ -358,8 +360,7 @@ blockquote:before,
background-color: var(--emphasized); background-color: var(--emphasized);
} }
#right-menu { #right-menu {
width: 380px; width: 100%;
max-height: 375px;
overflow-y: scroll; overflow-y: scroll;
overflow-x: hidden; overflow-x: hidden;
padding: 5px; padding: 5px;

View File

@ -17,6 +17,16 @@ function menu() {
} }
$('#menu').css("left", left + "px") $('#menu').css("left", left + "px")
$('#menu').css("top", top + "px") $('#menu').css("top", top + "px")
var height = localStorage.getItem("menu-height");
var width = localStorage.getItem("menu-width");
if(height){
$('#menu').css("height", height + "px")
}else{
$('#menu').css("height", "460px")
}
if(width){
$('#menu').css("width", width + "px")
}
$('#menu').fadeIn(); $('#menu').fadeIn();
$("#menu-bar").html("TheDesk " + localStorage.getItem("ver")); $("#menu-bar").html("TheDesk " + localStorage.getItem("ver"));
$(".menu-content").addClass("hide"); $(".menu-content").addClass("hide");
@ -49,6 +59,14 @@ $(function () {
localStorage.setItem("menu-top", top); localStorage.setItem("menu-top", top);
} }
}); });
$("#menu").resizable({
minHeight: 150,
minWidth: 200,
stop: function (event, ui) {
localStorage.setItem("menu-height", ui.size.height);
localStorage.setItem("menu-width", ui.size.width);
}
});
}); });
function help() { function help() {
postMessage(["openUrl", "https://docs.thedesk.top"], "*") postMessage(["openUrl", "https://docs.thedesk.top"], "*")