From 396909932d7ec1ab075d46fed5f85ece7d6e0d68 Mon Sep 17 00:00:00 2001 From: Juan del Peral Date: Tue, 30 Jan 2024 11:37:32 +0100 Subject: [PATCH 1/2] Adding autoSwitch for diff browsers proofer --- src/diffenator2/templates/_base.html | 10 ++++++++-- src/diffenator2/templates/diffbrowsers_proofer.html | 4 ++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/diffenator2/templates/_base.html b/src/diffenator2/templates/_base.html index 693e908..4e5602e 100644 --- a/src/diffenator2/templates/_base.html +++ b/src/diffenator2/templates/_base.html @@ -193,10 +193,16 @@

{% block content_name %}{% endblock %}

POSITION = "old" fontToggle = document.getElementById("font-toggle") - function switchFonts() { + function switchFonts(isClickEvent) { + + // when a click triggers the action stop autoSwitching + if (isClickEvent && autoSwitch) { + clearInterval(autoSwitch); + } + boxTitles = document.getElementsByClassName("box-title") items = document.getElementsByClassName("box-text"); - + if (POSITION === "old") { POSITION = "new" for (item of boxTitles) { diff --git a/src/diffenator2/templates/diffbrowsers_proofer.html b/src/diffenator2/templates/diffbrowsers_proofer.html index 484e992..10c6d23 100644 --- a/src/diffenator2/templates/diffbrowsers_proofer.html +++ b/src/diffenator2/templates/diffbrowsers_proofer.html @@ -277,5 +277,9 @@

Glyphset: {{ glyph_set }}

} } +const autoSwitch = setInterval(function () { + switchFonts(); +}, 1250); + {% endblock %} \ No newline at end of file From bcb841a1c4a2b3783f88fb62c348529007cc0d87 Mon Sep 17 00:00:00 2001 From: Juan del Peral Date: Tue, 13 Feb 2024 16:00:04 +0100 Subject: [PATCH 2/2] blind test, trying to fix js ReferenceError --- src/diffenator2/templates/_base.html | 15 +++++++++------ .../templates/diffbrowsers_proofer.html | 14 +++++++------- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/src/diffenator2/templates/_base.html b/src/diffenator2/templates/_base.html index 4e5602e..7d3d4d7 100644 --- a/src/diffenator2/templates/_base.html +++ b/src/diffenator2/templates/_base.html @@ -31,7 +31,7 @@ } .box-text{ } - + #nav{ position: fixed; right: 20px; @@ -42,7 +42,7 @@ .nav-item{ display: block; cursor: pointer; - -webkit-user-select: none; /* Safari */ + -webkit-user-select: none; /* Safari */ -moz-user-select: none; /* Firefox */ -ms-user-select: none; /* IE10+/Edge */ user-select: none; /* Standard */ @@ -193,6 +193,9 @@

{% block content_name %}{% endblock %}

POSITION = "old" fontToggle = document.getElementById("font-toggle") + + const autoSwitch = null; + function switchFonts(isClickEvent) { // when a click triggers the action stop autoSwitching @@ -240,11 +243,11 @@

{% block content_name %}{% endblock %}

'ss09', 'ss10', 'ss11', 'ss12', 'ss13', 'ss14', 'ss15', 'ss16', 'ss17', 'ss18', 'ss19', 'ss20' ] - + var otPanel = document.getElementById("ot-panel") for (i=0; i{% block content_name %}{% endblock %} disableKerning = true } } - } + } var boxText = document.getElementsByClassName("box-text") var otString = res.join(", ") @@ -302,7 +305,7 @@

{% block content_name %}{% endblock %}

for (i=0; iGlyphset: {{ glyph_set }} {% endfor %} - + {% endfor %} {% endfor %} -{% endfor %} +{% endfor %} @@ -108,13 +108,13 @@

Glyphset: {{ glyph_set }}

{% endfor %} {% endfor %} -{% endfor %} +{% endfor %} {% endblock %} {% block js %} - + state = "line-by-line" function viewMode() { var viewButton = document.getElementById("view-button") @@ -140,7 +140,7 @@

Glyphset: {{ glyph_set }}

} } document.getElementById("view-button").addEventListener("click", viewMode) - + var ptSelector = document.getElementById("pt-selector"); ptSelector.addEventListener("change", function(e) { var newPtSize = e.target.value @@ -266,7 +266,7 @@

Glyphset: {{ glyph_set }}

var width = longestLine() var container = document.getElementById("side-by-side") var subContainers = container.getElementsByClassName("box-side-by-side") - + var containerWidth = (width * subContainers.length) + 100 container.style.width = containerWidth + "pt" @@ -277,7 +277,7 @@

Glyphset: {{ glyph_set }}

} } -const autoSwitch = setInterval(function () { +autoSwitch = setInterval(function () { switchFonts(); }, 1250);