From e5df9cb7306289f0aecf6f3b9ec4af3a9314f47d Mon Sep 17 00:00:00 2001 From: ansuz Date: Mon, 4 Apr 2022 13:55:00 +0530 Subject: [PATCH] display a notice if bower dependencies fail to load for the checkup page --- www/checkup/dependency-warning.js | 17 +++++++++++++++++ www/checkup/index.html | 1 + 2 files changed, 18 insertions(+) create mode 100644 www/checkup/dependency-warning.js diff --git a/www/checkup/dependency-warning.js b/www/checkup/dependency-warning.js new file mode 100644 index 000000000..0b11fcf1e --- /dev/null +++ b/www/checkup/dependency-warning.js @@ -0,0 +1,17 @@ +(function () { + var first = true; + window.addEventListener('error', function (ev) { + if (!ev) { return; } + var srcElement = ev.srcElement; + if (!srcElement) { return; } + var nodeName = srcElement.nodeName; + if (nodeName !== 'SCRIPT') { return; } + var src = srcElement.src; + if (!/\/bower_components\/.*/.test(src)) { return; } + if (first) { + document.write(`

It's possible that this server's administrators forgot to install its client-side dependencies with 'bower update'.

`); + first = false; + } + document.write(`

Failed to load ${src}.

`); + }, true); +}()); diff --git a/www/checkup/index.html b/www/checkup/index.html index 04a9502d3..9015d10f2 100644 --- a/www/checkup/index.html +++ b/www/checkup/index.html @@ -3,6 +3,7 @@ +