Fix up create*Window functions to be more mobile-friendly

I was surprised to see that the site is already pretty mobile-friendly.
The main issue was the quick reply, new thread, and report
windows - they were all hard-coded to be 500px, 500px, and 360px wide
respectively. Now, those hard-coded widths are the default but if the
viewport is thinner than that, the new window will size itself down with
some padding.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
2022-07-12 16:48:21 -07:00
parent 1eb960cb23
commit a38162a8df

View File

@@ -73,10 +73,11 @@ function openReplyWindow(replyUrl) {
return getReplyWindow(); return getReplyWindow();
} }
let width = Math.min(window.top.innerWidth - 20, 500);
let replyWindow = window.top.jsFrame.create({ let replyWindow = window.top.jsFrame.create({
title: "New Reply", title: "New Reply",
name: replyWindowName, name: replyWindowName,
width: 500, width: width,
url: replyUrl url: replyUrl
}); });
$(replyWindow.iframe, "iframe").on("load", () => { $(replyWindow.iframe, "iframe").on("load", () => {
@@ -123,10 +124,11 @@ function openPostWindow(postUrl) {
if (window.top.jsFrame.containsWindowName(postWindowName)) { if (window.top.jsFrame.containsWindowName(postWindowName)) {
return; return;
} }
let width = Math.min(window.top.innerWidth - 20, 500);
let postWindow = window.top.jsFrame.create({ let postWindow = window.top.jsFrame.create({
title: "New Thread", title: "New Thread",
name: postWindowName, name: postWindowName,
width: 500, width: width,
url: postUrl, url: postUrl,
}); });
$(postWindow.iframe, "iframe").on("load", () => { $(postWindow.iframe, "iframe").on("load", () => {
@@ -153,10 +155,11 @@ function openReportWindow(reportUrl) {
if (window.top.jsFrame.containsWindowName(reportWindowName)) { if (window.top.jsFrame.containsWindowName(reportWindowName)) {
getReportWindow().closeFrame(); getReportWindow().closeFrame();
} }
let width = Math.min(window.top.innerWidth - 20, 360);
let reportWindow = window.top.jsFrame.create({ let reportWindow = window.top.jsFrame.create({
url: reportUrl, url: reportUrl,
name: reportWindowName, name: reportWindowName,
width: 360, width: width,
}); });
$(reportWindow.iframe, "iframe").on("load", () => { $(reportWindow.iframe, "iframe").on("load", () => {
fitWindowToContent(reportWindow); fitWindowToContent(reportWindow);