b l o g g i n s p a c e wiki
Difference between revisions of "MediaWiki:Common.js"
Jump to navigation
Jump to search
| Line 22: | Line 22: | ||
var searchHtml = | var searchHtml = | ||
'<div class="sitenotice-search" style="margin: 1.2em auto 0.6em; max-width: 500px; text-align: center | '<div class="sitenotice-search" style="margin: 1.2em auto 0.6em; max-width: 500px; text-align: center; ">' + | ||
'<form action="' + mw.config.get('wgScript') + '?title=Special:Search" method="get">' + | '<form action="' + mw.config.get('wgScript') + '?title=Special:Search" method="get">' + | ||
'<input type="search" name="search" placeholder="search here, bub..." ' + | '<input type="search" name="search" placeholder="search here, bub..." ' + | ||
'class="sitenotice-search-input" style="width: 80%; max-width: 500px; height: | 'class="sitenotice-search-input" style="width: 80%; max-width: 500px; height: 3em; ' + | ||
'padding: 0 1.1em; font-size: 1.1em; background-color: #fff; font-weight: 400; font-family: Tahoma, Arial, sans-serif; border: 1px solid #FF69B4; border-radius: 0px;" />' + | 'padding: 0 1.1em; font-size: 1.1em; background-color: #fff; font-weight: 400; font-family: Tahoma, Arial, sans-serif; border: 1px solid #FF69B4; border-radius: 0px;" />' + | ||
// '<input type="submit" value="Go" style="height: 2.4em; margin-left: -1px; border-radius: 0 3px 3px 0;">' + | // '<input type="submit" value="Go" style="height: 2.4em; margin-left: -1px; border-radius: 0 3px 3px 0;">' + | ||
Revision as of 23:45, 13 January 2026
/* Any JavaScript here will be loaded for all users on every page load. */
$(function() {
$('#p-search').clone().appendTo('#mw-panel .portal:first');
});
// Custom sitenotice search bar - Vector legacy - places search BELOW existing notice text
( function () {
'use strict';
mw.hook( 'wikipage.content' ).add( function ( $content ) {
// Don't add twice
if ( document.querySelector( '.sitenotice-search' ) ) return;
var $siteNotice = $( '#siteNotice' );
// If #siteNotice is missing (rare), create it
if ( $siteNotice.length === 0 ) {
$siteNotice = $( '<div id="siteNotice"></div>' );
$( '#mw-content-text' ).before( $siteNotice );
console.log( 'Created new #siteNotice' );
}
var searchHtml =
'<div class="sitenotice-search" style="margin: 1.2em auto 0.6em; max-width: 500px; text-align: center; ">' +
'<form action="' + mw.config.get('wgScript') + '?title=Special:Search" method="get">' +
'<input type="search" name="search" placeholder="search here, bub..." ' +
'class="sitenotice-search-input" style="width: 80%; max-width: 500px; height: 3em; ' +
'padding: 0 1.1em; font-size: 1.1em; background-color: #fff; font-weight: 400; font-family: Tahoma, Arial, sans-serif; border: 1px solid #FF69B4; border-radius: 0px;" />' +
// '<input type="submit" value="Go" style="height: 2.4em; margin-left: -1px; border-radius: 0 3px 3px 0;">' +
'</form>' +
'</div>';
$siteNotice.append( searchHtml ); // ← Changed from .prepend() to .append()
console.log( 'Sitenotice search bar added BELOW existing content' );
} );
}() );