MediaWiki:Common.js: Difference between revisions
Appearance
No edit summary |
No edit summary |
||
| Line 14: | Line 14: | ||
document.head.appendChild(script); | document.head.appendChild(script); | ||
}); | }); | ||
function initFotoramaWhenReady() { | |||
if (typeof jQuery !== 'undefined' && jQuery().fotorama) { | |||
jQuery('.fotorama').fotorama(); | |||
} else { | |||
setTimeout(initFotoramaWhenReady, 100); // Wiederhole alle 100 ms | |||
} | |||
} | |||
initFotoramaWhenReady(); | |||
Revision as of 22:08, 17 June 2025
/* Das folgende JavaScript wird für alle Benutzer geladen. */
// Fotorama JS und CSS nachladen
mw.loader.using('mediawiki.util', function () {
// CSS laden
var css = document.createElement('link');
css.rel = 'stylesheet';
css.href = 'https://cdnjs.cloudflare.com/ajax/libs/fotorama/4.6.4/fotorama.css';
document.head.appendChild(css);
// JS laden
var script = document.createElement('script');
script.src = 'https://cdnjs.cloudflare.com/ajax/libs/fotorama/4.6.4/fotorama.js';
script.async = true;
document.head.appendChild(script);
});
function initFotoramaWhenReady() {
if (typeof jQuery !== 'undefined' && jQuery().fotorama) {
jQuery('.fotorama').fotorama();
} else {
setTimeout(initFotoramaWhenReady, 100); // Wiederhole alle 100 ms
}
}
initFotoramaWhenReady();