Use native URL API, instead of deprecated mw.Uri

Change-Id: Ia6bf82de647eb051f2719c13ceff5a2b07a3721f
This commit is contained in:
Ed Sanders 2024-03-05 22:08:59 +00:00
parent f5ebd41ec9
commit 1b5116d668
2 changed files with 6 additions and 12 deletions

View file

@ -344,7 +344,7 @@
"dependencies": [
"ext.echo.api",
"mediawiki.jqueryMsg",
"mediawiki.Uri"
"web2017-polyfills"
],
"messages": [
"echo-badge-count",

View file

@ -9,19 +9,13 @@ mw.echo.config.maxPrioritizedActions = 2;
*/
function initDesktop() {
'use strict';
var uri;
// Remove ?markasread=XYZ from the URL
try {
uri = new mw.Uri();
if ( uri.query.markasread !== undefined ) {
delete uri.query.markasread;
delete uri.query.markasreadwiki;
window.history.replaceState( null, document.title, uri );
}
} catch ( e ) {
// Catch problems when the URI is malformed (T261799)
// e.g. #/media/Fitxer:Campbells_Soup_Cans_MOMA_reduced_80%.jpg
var url = new URL( location.href );
if ( url.searchParams.has( 'markasread' ) ) {
url.searchParams.delete( 'markasread' );
url.searchParams.delete( 'markasreadwiki' );
history.replaceState( null, '', url );
}
// Activate ooui