From 8190c7aac7b2e501e1d5cb723c1e96fc20ff70b3 Mon Sep 17 00:00:00 2001 From: j433866 Date: Tue, 7 May 2019 15:36:42 +0100 Subject: [PATCH] Add maximise output button --- src/web/Manager.mjs | 2 +- src/web/OutputWaiter.mjs | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/web/Manager.mjs b/src/web/Manager.mjs index 851eaa53..ad57f015 100755 --- a/src/web/Manager.mjs +++ b/src/web/Manager.mjs @@ -185,7 +185,7 @@ class Manager { document.getElementById("copy-output").addEventListener("click", this.output.copyClick.bind(this.output)); document.getElementById("switch").addEventListener("click", this.output.switchClick.bind(this.output)); document.getElementById("undo-switch").addEventListener("click", this.output.undoSwitchClick.bind(this.output)); - // document.getElementById("maximise-output").addEventListener("click", this.output.maximiseOutputClick.bind(this.output)); + document.getElementById("maximise-output").addEventListener("click", this.output.maximiseOutputClick.bind(this.output)); document.getElementById("magic").addEventListener("click", this.output.magicClick.bind(this.output)); document.getElementById("output-text").addEventListener("scroll", this.highlighter.outputScroll.bind(this.highlighter)); document.getElementById("output-text").addEventListener("mouseup", this.highlighter.outputMouseup.bind(this.highlighter)); diff --git a/src/web/OutputWaiter.mjs b/src/web/OutputWaiter.mjs index 3013f841..6d272d9e 100755 --- a/src/web/OutputWaiter.mjs +++ b/src/web/OutputWaiter.mjs @@ -1184,6 +1184,29 @@ class OutputWaiter { } }); } + + /** + * Handler for maximise output click events. + * Resizes the output frame to be as large as possible, or restores it to its original size. + */ + maximiseOutputClick(e) { + const el = e.target.id === "maximise-output" ? e.target : e.target.parentNode; + + if (el.getAttribute("data-original-title").indexOf("Maximise") === 0) { + this.app.initialiseSplitter(true); + this.app.columnSplitter.collapse(0); + this.app.columnSplitter.collapse(1); + this.app.ioSplitter.collapse(0); + + $(el).attr("data-original-title", "Restore output pane"); + el.querySelector("i").innerHTML = "fullscreen_exit"; + } else { + $(el).attr("data-original-title", "Maximise output pane"); + el.querySelector("i").innerHTML = "fullscreen"; + this.app.initialiseSplitter(false); + this.app.resetLayout(); + } + } } export default OutputWaiter;