From 08e35c69904f27c450b7eac0da4209fb980203cd Mon Sep 17 00:00:00 2001 From: tophf Date: Mon, 1 Feb 2016 17:09:31 +0200 Subject: [PATCH] Narrow-width editor on touchscreens: toggle lint report via click --- edit.html | 3 +++ edit.js | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/edit.html b/edit.html index 33fc617e..86116d2d 100644 --- a/edit.html +++ b/edit.html @@ -455,6 +455,9 @@ #lint > div { max-height: 0; } + #lint.collapsed > div { + display: none; + } #lint:hover > div { margin-top: 1em; max-height: 30vh; diff --git a/edit.js b/edit.js index 43685dea..962105d0 100644 --- a/edit.js +++ b/edit.js @@ -979,6 +979,10 @@ function gotoLintIssue(event) { }); } +function toggleLintReport() { + document.getElementById("lint").classList.toggle("collapsed"); +} + function beautify(event) { if (exports.css_beautify) { // thanks to csslint's definition of 'exports' doBeautify(); @@ -1135,6 +1139,11 @@ function initHooks() { document.getElementById("lint").addEventListener("click", gotoLintIssue); window.addEventListener("resize", resizeLintReport); + // touch devices don't have onHover events so the element we'll be toggled via clicking (touching) + if ("ontouchstart" in document.body) { + document.querySelector("#lint h2").addEventListener("click", toggleLintReport); + } + setupGlobalSearch(); setCleanGlobal(); updateTitle();