index-website-static/assets/js/onload.js

35 lines
806 B
JavaScript
Raw Normal View History

2025-12-23 17:29:27 +01:00
import { headerToggle, headerScrollVisibility } from './header.js';
2025-12-23 19:17:52 +01:00
import { copyLink } from './share.js';
2025-12-23 17:29:27 +01:00
// TEMP, with includeHTML() --------------------------------------
2025-12-16 18:00:01 +01:00
2025-12-19 12:33:59 +01:00
window.onload = async function () {
2025-12-23 17:29:27 +01:00
await runIncludeHTML();
initAfterLoad();
2025-12-16 18:00:01 +01:00
};
2025-12-19 12:33:59 +01:00
function runIncludeHTML() {
if (typeof includeHTML === "function") {
const result = includeHTML();
if (result instanceof Promise) {
return result;
}
}
return Promise.resolve();
}
2025-12-23 17:29:27 +01:00
/// INIT --------------------------------------------------------
2025-12-19 12:33:59 +01:00
// Note: une fois que IncludeHTML() est supprimé, on peut supprimer tout le temp au dessus
// remplacer `function initAfterLoad()` par ↓
2025-12-23 19:17:52 +01:00
// window.onload = async function () { }
2025-12-19 12:33:59 +01:00
function initAfterLoad() {
headerToggle();
2025-12-23 17:29:27 +01:00
headerScrollVisibility();
2025-12-23 19:17:52 +01:00
copyLink();
2025-12-19 12:33:59 +01:00
}