MediaWiki:Common.js: Difference between revisions
From Emmy The Robot Fandom Wiki
Content added Content deleted
No edit summary |
No edit summary |
||
Line 13: | Line 13: | ||
searchInput.setAttribute('type', 'text'); |
searchInput.setAttribute('type', 'text'); |
||
searchInput.setAttribute('id', 'mediawiki-text-parser-input'); |
searchInput.setAttribute('id', 'mediawiki-text-parser-input'); |
||
searchInput.setAttribute('placeholder', 'Type to |
searchInput.setAttribute('placeholder', 'Type to searchmol'); |
||
document.getElementById('mw-content-text').insertBefore(searchInput, document.getElementById('mw-content-text').firstChild); |
document.getElementById('mw-content-text').insertBefore(searchInput, document.getElementById('mw-content-text').firstChild); |
||
Line 60: | Line 60: | ||
// Call the initializeTextParser function when the DOM is ready |
// Call the initializeTextParser function when the DOM is ready |
||
function initializeTextParserOnLoad() { |
function initializeTextParserOnLoad() { |
||
var pageTitle = document.title; |
|||
if (document.readyState === "complete" || (document.readyState !== "loading" && !document.documentElement.doScroll)) { |
|||
if (pageTitle === "List of fan Nandroids" || pageTitle === "List of fan stories") { |
|||
// The DOM has already loaded, so call initializeTextParser immediately |
|||
initializeTextParser(); |
initializeTextParser(); |
||
} else { |
|||
// Wait for the DOMContentLoaded event to call initializeTextParser |
|||
document.addEventListener('DOMContentLoaded', initializeTextParser); |
|||
} |
} |
||
} |
} |