Replace uses of mw.Uri with browser native URL

Bug: T374314
Change-Id: I03bfc2618b5b499f9c65832f8af20a7a199e03ec
This commit is contained in:
Ebrahim Byagowi
2024-09-16 22:26:46 +03:30
parent a7b39f9398
commit f3cf477052
2 changed files with 5 additions and 5 deletions

View File

@@ -67,13 +67,13 @@
* @return {string}
*/
function currentUrlWithoutSetLang() {
var uri = new mw.Uri();
delete uri.query.setlang;
return uri.toString();
var url = new URL( location.href );
url.searchParams.remove( 'setlang' );
return url.toString();
}
function removeSetLangFromHistory() {
if ( 'setlang' in mw.Uri().query ) {
if ( new URL( location.href ).searchParams.has( 'setlang' ) ) {
history.replaceState( null, '', currentUrlWithoutSetLang() );
}
}