MediaWiki:Common.js: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
| 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. */ | ||
/* ── | /* ── DIAGNOSTIC: Watch what TMH does to the video element ── */ | ||
$(function () { | $(function () { | ||
if ($('.training-video-wrap').length === 0) return; | if ($('.training-video-wrap').length === 0) return; | ||
function | function startWatching() { | ||
var video = document.querySelector('.mw-file-element'); | var video = document.querySelector('.mw-file-element'); | ||
if (video) { | if (!video) { | ||
setTimeout(startWatching, 100); | |||
return; | |||
return | |||
} | } | ||
console.log('=== TMH DIAGNOSTIC STARTED ==='); | |||
console.log('Initial video attributes:'); | |||
for (var i = 0; i < video.attributes.length; i++) { | |||
var | console.log(' ' + video.attributes[i].name + '="' + video.attributes[i].value + '"'); | ||
} | |||
/* Watch for any attribute changes on the video element */ | |||
var observer = new MutationObserver(function (mutations) { | |||
mutations.forEach(function (mutation) { | |||
if (mutation.type === 'attributes') { | |||
console.log('ATTR CHANGED: ' + mutation.attributeName + ' = "' + mutation.target.getAttribute(mutation.attributeName) + '" (was: "' + mutation.oldValue + '")'); | |||
} | |||
if (mutation.type === 'childList') { | |||
}); | console.log('CHILD ADDED/REMOVED on: ' + mutation.target.className); | ||
} | |||
}); | |||
}); | |||
observer.observe(video, { | |||
attributes: true, | |||
attributeOldValue: true, | |||
childList: true, | |||
subtree: true | |||
}); | |||
/* Also watch the parent container */ | |||
var parent = document.querySelector('.mw-tmh-player'); | |||
if (parent) { | |||
observer.observe(parent, { | |||
attributes: true, | |||
attributeOldValue: true, | |||
childList: true, | |||
subtree: false | |||
}); | |||
} | } | ||
console.log('=== NOW WATCHING FOR CHANGES ==='); | |||
} | } | ||
startWatching(); | |||
}); | }); | ||
Revision as of 08:18, 22 April 2026
/* Any JavaScript here will be loaded for all users on every page load. */
/* ── DIAGNOSTIC: Watch what TMH does to the video element ── */
$(function () {
if ($('.training-video-wrap').length === 0) return;
function startWatching() {
var video = document.querySelector('.mw-file-element');
if (!video) {
setTimeout(startWatching, 100);
return;
}
console.log('=== TMH DIAGNOSTIC STARTED ===');
console.log('Initial video attributes:');
for (var i = 0; i < video.attributes.length; i++) {
console.log(' ' + video.attributes[i].name + '="' + video.attributes[i].value + '"');
}
/* Watch for any attribute changes on the video element */
var observer = new MutationObserver(function (mutations) {
mutations.forEach(function (mutation) {
if (mutation.type === 'attributes') {
console.log('ATTR CHANGED: ' + mutation.attributeName + ' = "' + mutation.target.getAttribute(mutation.attributeName) + '" (was: "' + mutation.oldValue + '")');
}
if (mutation.type === 'childList') {
console.log('CHILD ADDED/REMOVED on: ' + mutation.target.className);
}
});
});
observer.observe(video, {
attributes: true,
attributeOldValue: true,
childList: true,
subtree: true
});
/* Also watch the parent container */
var parent = document.querySelector('.mw-tmh-player');
if (parent) {
observer.observe(parent, {
attributes: true,
attributeOldValue: true,
childList: true,
subtree: false
});
}
console.log('=== NOW WATCHING FOR CHANGES ===');
}
startWatching();
});