User:Krinkle/Scripts/VectorSearchNav.js
< User:Krinkle | Scripts
Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Press Ctrl-F5.
/**
* VectorSearchNav: Put the search bar in the left column.
*
* Version 2018-09-15
* From https://meta.wikimedia.org/wiki/User:Krinkle/Scripts/VectorSearchNav.js
*
* Copyright 2010-2018 Timo Tijhof
*
* @license MIT
* @stats [[File:Krinkle_VectorSearchNav.js]]
*/
/* global $, mw */
$(function () {
var $search = $('#p-search');
var $preferred = $('#p-navigation');
// Avoid confusion by other scripts
$search.removeAttr('id');
// Move bar to the left
if ($preferred.length) {
$preferred.after($search);
} else {
$search.prependTo('#mw-panel');
}
// Make it look like a portal
$search.attr('class', 'portal');
$search.find('#searchform').attr('class', 'body').css({ 'padding-top': '0.6em' });
$search.find('#simpleSearch').css({ width: 'auto', margin: '0' });
// Fix up the dropdown menu
$('div.vectorMenu ul').css('right', '0');
$('#right-navigation').css('margin-right', '1em');
mw.util.addCSS('.suggestions { left: 19px !important; right: auto !important; }');
});