Difference between revisions of "MediaWiki:Common.js"
From CompetenceBase
(Created page with " $(document).ready(function() { // Listen for language changes from the ULS $(document).on('languagechange', function() { // Remove the 'uselang' parameter fro...") |
|||
Line 3: | Line 3: | ||
// Listen for language changes from the ULS | // Listen for language changes from the ULS | ||
$(document).on('languagechange', function() { | $(document).on('languagechange', function() { | ||
− | + | console.log('asfd'); | |
+ | |||
var url = new URL(window.location.href); | var url = new URL(window.location.href); | ||
url.searchParams.delete('uselang'); | url.searchParams.delete('uselang'); | ||
− | |||
window.history.replaceState({}, '', url.toString()); | window.history.replaceState({}, '', url.toString()); | ||
}); | }); | ||
− | |||
mw.hook('uls.language.change').add(function() { | mw.hook('uls.language.change').add(function() { | ||
// Manually trigger the language change event | // Manually trigger the language change event |
Revision as of 10:56, 5 August 2024
$(document).ready(function() { // Listen for language changes from the ULS $(document).on('languagechange', function() { console.log('asfd'); var url = new URL(window.location.href); url.searchParams.delete('uselang'); window.history.replaceState({}, '', url.toString()); }); mw.hook('uls.language.change').add(function() { // Manually trigger the language change event $(document).trigger('languagechange'); }); });