MediaWiki:Common.js: Difference between revisions
From Emmy The Robot Fandom Wiki
Content added Content deleted
No edit summary |
No edit summary |
||
Line 14:
searchInput.setAttribute('id', 'mediawiki-text-parser-input');
searchInput.setAttribute('placeholder', 'Type to searchmol');
// Set the width of the search input field as a percentage
searchInput.style.width = '50%'; // You can adjust the percentage here
document.getElementById('mw-content-text').insertBefore(searchInput, document.getElementById('mw-content-text').firstChild);
Line 24 ⟶ 28:
// Get all rows in the table
var rows = table.
|
Revision as of 19:24, 10 May 2024
if ( mw.config.get( 'wgPageName' ) === 'Main_Page' ) {
document.getElementsByTagName('br')[0].remove();
}
if ( mw.config.get( 'wgPageName' ) === 'Main_Page' ) {
document.getElementsByTagName('h1')[0].remove();
}
// Function to initialize the text parsing and filtering functionality
function initializeTextParser() {
// Create a search input field
var searchInput = document.createElement('input');
searchInput.setAttribute('type', 'text');
searchInput.setAttribute('id', 'mediawiki-text-parser-input');
searchInput.setAttribute('placeholder', 'Type to searchmol');
// Set the width of the search input field as a percentage
searchInput.style.width = '50%'; // You can adjust the percentage here
document.getElementById('mw-content-text').insertBefore(searchInput, document.getElementById('mw-content-text').firstChild);
// Get the table
var table = document.querySelector('table.wikitable.sortable.mw-datatable.jquery-tablesorter');
// Attach an event listener to the search input field
searchInput.addEventListener('input', function() {
var searchText = this.value.toLowerCase();
// Get all rows in the table
var rows = table.query