From 0dead93606192d995c60b456430ee2e29a7e477b Mon Sep 17 00:00:00 2001 From: Cutls Date: Fri, 30 Aug 2019 01:46:30 +0900 Subject: [PATCH] Add: resizable menu --- app/css/master.css | 7 ++++--- app/js/ui/menu.js | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/app/css/master.css b/app/css/master.css index 3c4d21be..ea11f10d 100644 --- a/app/css/master.css +++ b/app/css/master.css @@ -332,13 +332,15 @@ blockquote:before, padding: 5px; border: thin solid gray; border-radius: 5px; + overflow: hidden; } #menu-wrapper { margin-left: -5px; display: flex; + height: calc(100% - 3.5rem); } #left-menu { - width: 170px; + width: 230px; } #left-menu div { padding-left: 5px; @@ -358,8 +360,7 @@ blockquote:before, background-color: var(--emphasized); } #right-menu { - width: 380px; - max-height: 375px; + width: 100%; overflow-y: scroll; overflow-x: hidden; padding: 5px; diff --git a/app/js/ui/menu.js b/app/js/ui/menu.js index 0ddea47f..258ea616 100644 --- a/app/js/ui/menu.js +++ b/app/js/ui/menu.js @@ -17,6 +17,16 @@ function menu() { } $('#menu').css("left", left + "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-bar").html("TheDesk " + localStorage.getItem("ver")); $(".menu-content").addClass("hide"); @@ -49,6 +59,14 @@ $(function () { 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() { postMessage(["openUrl", "https://docs.thedesk.top"], "*")