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

@@ -326,7 +326,7 @@
"mediawiki.api", "mediawiki.api",
"mediawiki.jqueryMsg", "mediawiki.jqueryMsg",
"@wikimedia/codex", "@wikimedia/codex",
"mediawiki.Uri" "web2017-polyfills"
], ],
"messages": [ "messages": [
"ext-uls-setlang-error", "ext-uls-setlang-error",

View File

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