Difference between revisions of "MediaWiki:Common.js"
From Tycoon Gaming
m |
m |
||
Line 11: | Line 11: | ||
} | } | ||
− | + | // Check if we're on the 'User:Donald/MainMenuTest' page | |
− | + | if (mw.config.get('wgPageName') === 'User:Donald/MainMenuTest') { | |
− | + | // Create the search form HTML | |
− | + | console.log("test Successful"); | |
− | + | var searchFormHTML = '<form action="/index.php" method="get">' + | |
− | |||
'<input type="hidden" name="title" value="Special:Search">' + | '<input type="hidden" name="title" value="Special:Search">' + | ||
'<input type="text" name="search" placeholder="Search the wiki" />' + | '<input type="text" name="search" placeholder="Search the wiki" />' + | ||
Line 22: | Line 21: | ||
'</form>'; | '</form>'; | ||
− | + | // Identify the element where you want to add the search form | |
− | + | var pageElement = document.getElementById('testaddsearchbar'); // Replace 'someElementID' with the actual ID | |
− | + | // Insert the search form HTML into the identified element | |
− | + | if (pageElement) { | |
− | + | pageElement.innerHTML = searchFormHTML; | |
− | + | } | |
− | + | } | |
− | |||
}); | }); |
Revision as of 01:44, 10 November 2023
mw.loader.load( '/wiki/index.php?title=Mediawiki:Middleclick.js&action=raw&ctype=text/javascript'); mw.loader.load( '/wiki/index.php?title=MediaWiki:LastPage.js&action=raw&ctype=text/javascript'); mw.loader.load( '/wiki/index.php?title=MediaWiki:MoveTOC.js&action=raw&ctype=text/javascript'); $( document ).ready(function() { if ( window.location !== window.parent.location ) { const elem = document.getElementById('p-personal-container'); elem.style.display = 'none'; } // Check if we're on the 'User:Donald/MainMenuTest' page if (mw.config.get('wgPageName') === 'User:Donald/MainMenuTest') { // Create the search form HTML console.log("test Successful"); var searchFormHTML = '<form action="/index.php" method="get">' + '<input type="hidden" name="title" value="Special:Search">' + '<input type="text" name="search" placeholder="Search the wiki" />' + '<input type="submit" value="Go" />' + '</form>'; // Identify the element where you want to add the search form var pageElement = document.getElementById('testaddsearchbar'); // Replace 'someElementID' with the actual ID // Insert the search form HTML into the identified element if (pageElement) { pageElement.innerHTML = searchFormHTML; } } });