Introduce a Node build system for minified CSS/JS with content hashes, add PWA support, i18n helpers, accessibility improvements, and more translatable strings. Move theme configuration from bookmarks to localStorage, add Playwright tests, and set up CI workflows.
This commit is contained in:
Vendored
+62
@@ -0,0 +1,62 @@
|
||||
(function () {
|
||||
var loaded = false;
|
||||
var tried = {};
|
||||
|
||||
function toAbsolute(url) {
|
||||
try {
|
||||
return new URL(url, window.location.href).toString();
|
||||
} catch (e) {
|
||||
return url;
|
||||
}
|
||||
}
|
||||
|
||||
function loadNext(candidates, index) {
|
||||
if (loaded || index >= candidates.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
var src = toAbsolute(candidates[index]);
|
||||
if (tried[src]) {
|
||||
loadNext(candidates, index + 1);
|
||||
return;
|
||||
}
|
||||
tried[src] = true;
|
||||
|
||||
var script = document.createElement('script');
|
||||
script.src = src;
|
||||
script.async = false;
|
||||
script.onload = function () {
|
||||
loaded = true;
|
||||
};
|
||||
script.onerror = function () {
|
||||
script.remove();
|
||||
loadNext(candidates, index + 1);
|
||||
};
|
||||
document.head.appendChild(script);
|
||||
}
|
||||
|
||||
var rootPath = (window.shaarli && window.shaarli.rootPath) || '';
|
||||
var basePath = (window.shaarli && window.shaarli.basePath) || '';
|
||||
var assetPath = (window.shaarli && window.shaarli.assetPath) || '';
|
||||
|
||||
var candidates = [];
|
||||
|
||||
if (assetPath) {
|
||||
candidates.push(assetPath.replace(/\/tpl\/shaarli-pro\/?$/, '/tpl/default') + '/js/metadata.min.js');
|
||||
}
|
||||
|
||||
if (basePath) {
|
||||
candidates.push(basePath + '/tpl/default/js/metadata.min.js');
|
||||
candidates.push(basePath + '/js/metadata.min.js');
|
||||
}
|
||||
|
||||
if (rootPath) {
|
||||
candidates.push(rootPath + '/tpl/default/js/metadata.min.js');
|
||||
candidates.push(rootPath + '/js/metadata.min.js');
|
||||
}
|
||||
|
||||
candidates.push('/js/metadata.min.js');
|
||||
candidates.push('/tpl/default/js/metadata.min.js');
|
||||
|
||||
loadNext(candidates, 0);
|
||||
})();
|
||||
Reference in New Issue
Block a user