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": [ "dependencies": [
"ext.echo.api", "ext.echo.api",
"mediawiki.jqueryMsg", "mediawiki.jqueryMsg",
"mediawiki.Uri" "web2017-polyfills"
], ],
"messages": [ "messages": [
"echo-badge-count", "echo-badge-count",

View file

@ -9,19 +9,13 @@ mw.echo.config.maxPrioritizedActions = 2;
*/ */
function initDesktop() { function initDesktop() {
'use strict'; 'use strict';
var uri;
// Remove ?markasread=XYZ from the URL // Remove ?markasread=XYZ from the URL
try { var url = new URL( location.href );
uri = new mw.Uri(); if ( url.searchParams.has( 'markasread' ) ) {
if ( uri.query.markasread !== undefined ) { url.searchParams.delete( 'markasread' );
delete uri.query.markasread; url.searchParams.delete( 'markasreadwiki' );
delete uri.query.markasreadwiki; history.replaceState( null, '', url );
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
} }
// Activate ooui // Activate ooui