MediaWiki:Common.js: Difference between revisions
From WikiMSK
No edit summary |
No edit summary |
||
Line 14: | Line 14: | ||
var gallery = document.querySelector('.gallerytext'); | var gallery = document.querySelector('.gallerytext'); | ||
var galleryText = gallery.innerText; | var galleryText = gallery.innerText; | ||
galleryText.indexOf("\n"); | galleryText = galleryText.slice(0,galleryText.indexOf("\n")); | ||
document.querySelector('.gallerytext').innerHTML = galleryText; | |||
} | } | ||
docReady(formatDPLGallery); | docReady(formatDPLGallery); |
Revision as of 19:08, 28 August 2020
/* Any JavaScript here will be loaded for all users on every page load. */
function docReady(fn) {
// see if DOM is already available
if (document.readyState === "complete" || document.readyState === "interactive") {
// call on next available tick
setTimeout(fn, 1);
} else {
document.addEventListener("DOMContentLoaded", fn);
}
}
function formatDPLGallery(){
var gallery = document.querySelector('.gallerytext');
var galleryText = gallery.innerText;
galleryText = galleryText.slice(0,galleryText.indexOf("\n"));
document.querySelector('.gallerytext').innerHTML = galleryText;
}
docReady(formatDPLGallery);