From 4f6f54cf458550112b4fb52c40c23e64d6150772 Mon Sep 17 00:00:00 2001 From: Norman Walsh Date: Wed, 3 Jun 2020 07:26:39 +0100 Subject: [PATCH] Inject version numbers into CSS/JS --- build.gradle | 8 ++++++++ src/main/resources/css/xsltexplorer.css | 6 +++++- src/main/resources/js/xsltexplorer.js | 10 +++++----- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/build.gradle b/build.gradle index a1329cc..42e5f24 100644 --- a/build.gradle +++ b/build.gradle @@ -215,6 +215,14 @@ task copyResources(type: Copy) { include "css/**" include "js/**" into "${buildDir}" + filter { String line -> + if (line.indexOf("@@") >= 0) { + line = line + .replace("@@TITLE@@", xsltExplorerTitle) + .replace("@@VERSION@@", xsltExplorerVersion) + } + line + } doFirst { mkdir "${buildDir}" } diff --git a/src/main/resources/css/xsltexplorer.css b/src/main/resources/css/xsltexplorer.css index 1f83e06..ecc3d0c 100644 --- a/src/main/resources/css/xsltexplorer.css +++ b/src/main/resources/css/xsltexplorer.css @@ -1,4 +1,8 @@ -/* XSLT Explorer CSS */ +/* @@TITLE@@ CSS version @@VERSION@@. + * + * See https://xslt.xmlexplorer.com/ + * + */ @import url("https://fonts.googleapis.com/css?family=B612+Mono&display=swap"); @import url("https://fonts.googleapis.com/css?family=Noto+Sans&display=swap"); diff --git a/src/main/resources/js/xsltexplorer.js b/src/main/resources/js/xsltexplorer.js index cb9f12f..24e4385 100644 --- a/src/main/resources/js/xsltexplorer.js +++ b/src/main/resources/js/xsltexplorer.js @@ -1,4 +1,8 @@ -/* XSLT Explorer JS */ +/* @@TITLE@@ JS version @@VERSION@@. + * + * See https://xslt.xmlexplorer.com/ + * + */ document.querySelectorAll("a").forEach(function(anchor) { anchor.onclick = function () { @@ -97,9 +101,6 @@ function toggleInstructions(div, classes) { }); const style = window.getComputedStyle(div); - - console.log(match, style.display, div); - if (match) { if (style.display === "none") { div.style.display = "block"; @@ -153,7 +154,6 @@ function checkVisible(anchor) { const style = window.getComputedStyle(target); if (style.display === "none") { - console.log("make visible:", target); if (target.tagName === "SPAN") { target.style.display = "inline"; } else {