display a notice if bower dependencies fail to load for the checkup page

This commit is contained in:
ansuz 2022-04-04 13:55:00 +05:30
parent 404b89eb28
commit e5df9cb730
2 changed files with 18 additions and 0 deletions

View File

@ -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(`<p>It's possible that this server's administrators forgot to install its client-side dependencies with 'bower update'.</p>`);
first = false;
}
document.write(`<p>Failed to load <code>${src}</code>.</p>`);
}, true);
}());

View File

@ -3,6 +3,7 @@
<head>
<meta content="text/html; charset=utf-8" http-equiv="content-type"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<script type="text/javascript" src="/checkup/dependency-warning.js?ver=1.0.0"></script>
<script data-bootload="main.js" data-main="/common/boot.js" src="/bower_components/requirejs/require.js"></script>
</head>
<body>