From cd4da296c241c1e4561034228dfa1772fd11aac0 Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Mon, 6 Mar 2023 02:34:13 +0000 Subject: [PATCH] mmv: Use mediawiki.router instead of underlying oojs-router module This is in preparation for merging the two modules in core and not exposing oojs-router directly. mediawiki.router is merely 1 line of code to hold a singleton, and indeed it appears there is no need for multiple instances to exist given it communicates exclusively to and from the 'window' object, which is also a global singleton. Change-Id: Ice09b523dfbefd67493175554eeb525771e8f29d --- extension.json | 6 +++--- resources/mmv/mmv.js | 7 ++++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/extension.json b/extension.json index d34722e43..0056406f9 100644 --- a/extension.json +++ b/extension.json @@ -96,11 +96,11 @@ "mediawiki.Title", "mediawiki.Uri", "mediawiki.jqueryMsg", + "mediawiki.router", "mediawiki.storage", "mediawiki.user", "mediawiki.util", "oojs", - "oojs-router", "jquery.fullscreen", "jquery.color", "jquery.tipsy", @@ -332,14 +332,14 @@ ], "dependencies": [ "mediawiki.api", + "mediawiki.router", "mediawiki.ui.button", "mediawiki.ui.icon", "mediawiki.Title", "mediawiki.user", "mediawiki.storage", "mmv.head", - "oojs", - "oojs-router" + "oojs" ], "messages": [ "multimediaviewer-view-expanded", diff --git a/resources/mmv/mmv.js b/resources/mmv/mmv.js index ab7f38b73..9f5b88d59 100644 --- a/resources/mmv/mmv.js +++ b/resources/mmv/mmv.js @@ -16,8 +16,9 @@ */ ( function () { - var MMVP, - comingFromHashChange = false; + var router = require( 'mediawiki.router' ); + var comingFromHashChange = false; + var MMVP; /** * Analyses the page, looks for image content and sets up the hooks @@ -83,7 +84,7 @@ /** * @property {OO.Router} router */ - this.router = new OO.Router(); + this.router = router; this.setupRouter(); comingFromHashChange = false;