2020-12-27 00:07:09 +01:00
|
|
|
const MOBILE_NAV_PAGE_SIZE = 500; // px
|
2020-12-13 00:12:06 +01:00
|
|
|
const MOBILE_NAV_TOGGLE_TIME = 300; // msec
|
|
|
|
const TEXTAREA_MIN_SIZE = 120; // px
|
|
|
|
|
2020-12-27 00:07:09 +01:00
|
|
|
function toggle_mobile_nav() {
|
|
|
|
$("nav").slideToggle(MOBILE_NAV_TOGGLE_TIME);
|
2020-12-13 00:12:06 +01:00
|
|
|
}
|
|
|
|
|
2020-12-27 00:07:09 +01:00
|
|
|
function check_mobile_nav_window_size() {
|
2020-12-13 00:12:06 +01:00
|
|
|
if(window.innerWidth > MOBILE_NAV_PAGE_SIZE) {
|
2020-12-27 00:07:09 +01:00
|
|
|
$("nav").show(0);
|
|
|
|
$("#mobile_nav_trigger").hide(0);
|
2020-12-13 00:12:06 +01:00
|
|
|
}
|
|
|
|
else {
|
2020-12-27 00:07:09 +01:00
|
|
|
$("nav").hide(0);
|
|
|
|
$("#mobile_nav_trigger").show(0);
|
2020-12-13 00:12:06 +01:00
|
|
|
}
|
2020-12-27 00:07:09 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
$(window).resize(check_mobile_nav_window_size);
|
|
|
|
check_mobile_nav_window_size();
|
2020-12-13 00:12:06 +01:00
|
|
|
|
2020-12-27 00:07:09 +01:00
|
|
|
$("textarea").each(function () {
|
|
|
|
this.style.height = Math.max(this.scrollHeight, TEXTAREA_MIN_SIZE) + "px";
|
|
|
|
this.style.resize = "none";
|
|
|
|
this.style.overflowY = "hidden";
|
|
|
|
}).on("input", function () {
|
|
|
|
this.style.height = "auto";
|
|
|
|
this.style.height = Math.max(this.scrollHeight, TEXTAREA_MIN_SIZE) + "px";
|
2020-12-13 00:12:06 +01:00
|
|
|
});
|