Difference between revisions of "MediaWiki:MainMenu.js"

From Tycoon Gaming
(Moved TestJs from Common.js to here)
 
m (mainmenutest.css added)
Line 1: Line 1:
 +
mw.loader.load('/wiki/MediaWiki:MainMenuTest.css?action=raw&ctype=text/css', 'text/css');
 +
 
$( document ).ready(function() {
 
$( document ).ready(function() {
 
// Check if we're on the 'User:Donald/MainMenuTest' page
 
// Check if we're on the 'User:Donald/MainMenuTest' page

Revision as of 12:39, 10 November 2023

mw.loader.load('/wiki/MediaWiki:MainMenuTest.css?action=raw&ctype=text/css', 'text/css');

$( document ).ready(function() {
	// 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="/wiki/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;
    	}
	}
});