MediaWiki:Common.js: Difference between revisions
Appearance
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
/* Any JavaScript here will be loaded for all users on every page load. */ | /* Any JavaScript here will be loaded for all users on every page load. */ | ||
// Wait for the document to be fully loaded | |||
mw.hook('wikipage.content').add(function() { | |||
// Check if we're on a search results page | |||
if (mw.config.get('wgCanonicalSpecialPageName') === 'Search') { | |||
// Small delay to ensure all search elements are loaded | |||
setTimeout(function() { | |||
// | // Target the Content pages tab specifically | ||
var | var contentPagesTab = document.querySelector('.search-types a[data-target="mw-search-content"]') || | ||
document.querySelector('.search-types a:nth-child(1)'); | |||
// | // Click the tab if found | ||
if (contentPagesTab) { | |||
} | contentPagesTab.click(); | ||
} | console.log('Search tab switched to Content pages'); | ||
} else { | |||
console.log('Content pages tab not found'); | |||
} | |||
}, 100); | |||
} | |||
}); | }); |