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
Tag: Reverted |
|||
| Line 35: | Line 35: | ||
} ); | } ); | ||
}() ); | }() ); | ||
// Make sitenotice search text hot pink | |||
$(function() { | |||
mw.hook('wikipage.content').add(function() { | |||
$('<style>') | |||
.text(` | |||
.sitenotice-search-input { | |||
color: #FF69B4 !important; | |||
} | |||
.sitenotice-search-input::placeholder, | |||
.sitenotice-search-input::-webkit-input-placeholder { | |||
color: #FF69B4aa !important; /* softer pink for placeholder */ | |||
} | |||
`) | |||
.appendTo('head'); | |||
}); | |||
}); | |||
Revision as of 23:52, 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-color: #FF69B4; font-size: 1.3em; 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' );
} );
}() );
// Make sitenotice search text hot pink
$(function() {
mw.hook('wikipage.content').add(function() {
$('<style>')
.text(`
.sitenotice-search-input {
color: #FF69B4 !important;
}
.sitenotice-search-input::placeholder,
.sitenotice-search-input::-webkit-input-placeholder {
color: #FF69B4aa !important; /* softer pink for placeholder */
}
`)
.appendTo('head');
});
});