MediaWiki:Common.js: Difference between revisions
Jump to navigation
Jump to search
Preload video fix. Fix for disappearing videos. Tag: Reverted |
No edit summary |
||
| (One intermediate revision by the same user not shown) | |||
| Line 1: | Line 1: | ||
/* Any JavaScript here will be loaded for all users on every page load. */ | /* Any JavaScript here will be loaded for all users on every page load. */ | ||
const observer = new MutationObserver((mutations) => { | |||
mutations.forEach((mutation) => { | |||
mutation.addedNodes.forEach((node) => { | |||
if (node.tagName === 'VIDEO') { | |||
node.setAttribute('preload', 'none'); | |||
} | |||
} | |||
}); | }); | ||
}); | }); | ||
}); | }); | ||
// Start observing the document for changes? | |||
observer.observe(document.body, { childList: true, subtree: true }); | |||
Latest revision as of 22:43, 10 December 2024
/* Any JavaScript here will be loaded for all users on every page load. */
const observer = new MutationObserver((mutations) => {
mutations.forEach((mutation) => {
mutation.addedNodes.forEach((node) => {
if (node.tagName === 'VIDEO') {
node.setAttribute('preload', 'none');
}
});
});
});
// Start observing the document for changes?
observer.observe(document.body, { childList: true, subtree: true });