mirror of
https://github.com/netbymatt/ws4kp.git
synced 2026-04-17 00:59:29 -07:00
only load custom.js if present
This commit is contained in:
@@ -2,8 +2,7 @@
|
||||
// it is intended to allow for customizations that do not get published back to the git repo
|
||||
// for example, changing the logo
|
||||
|
||||
// start running after all content is loaded
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
const customTask = () => {
|
||||
// get all of the logo images
|
||||
const logos = document.querySelectorAll('.logo img');
|
||||
// loop through each logo
|
||||
@@ -11,4 +10,16 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
// change the source
|
||||
elem.src = 'my-custom-logo.gif';
|
||||
});
|
||||
};
|
||||
|
||||
// start running after all content is loaded, or immediately if page content is already loaded
|
||||
if (document.readyState === 'loading') {
|
||||
// Loading hasn't finished yet
|
||||
document.addEventListener('DOMContentLoaded', customTask);
|
||||
} else {
|
||||
// `DOMContentLoaded` has already fired
|
||||
customTask();
|
||||
}
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user