Revert "mmv.js: Store comingFromHashChange as a class property"

This reverts commit b5ed0e6c04.

Reason for revert: Caused T379835

Bug: T379835
Change-Id: I5ad84928417588d777fc40bad04d8e693a1bc257
This commit is contained in:
Jdlrobson 2024-11-13 23:11:46 +00:00
parent b5ed0e6c04
commit 2e4bd06f6b

View file

@ -44,6 +44,7 @@ const ThumbnailWidthCalculator = require( './mmv.ThumbnailWidthCalculator.js' );
const { extensions, useThumbnailGuessing } = require( './config.json' ); const { extensions, useThumbnailGuessing } = require( './config.json' );
const router = require( 'mediawiki.router' ); const router = require( 'mediawiki.router' );
let comingFromHashChange = false;
/** /**
* Analyses the page, looks for image content and sets up the hooks * Analyses the page, looks for image content and sets up the hooks
@ -95,7 +96,7 @@ class MultimediaViewer {
*/ */
this.router = router; this.router = router;
this.setupRouter(); this.setupRouter();
this.comingFromHashChange = false; comingFromHashChange = false;
/** /**
* UI object used to display the pictures in the page. * UI object used to display the pictures in the page.
@ -685,8 +686,8 @@ class MultimediaViewer {
this.viewLogger.recordViewDuration(); this.viewLogger.recordViewDuration();
this.viewLogger.unattach(); this.viewLogger.unattach();
if ( this.comingFromHashChange ) { if ( comingFromHashChange ) {
this.comingFromHashChange = false; comingFromHashChange = false;
} else { } else {
this.router.back(); this.router.back();
} }
@ -706,7 +707,7 @@ class MultimediaViewer {
// handle empty hashes, and anchor links (page sections, possibly including /) // handle empty hashes, and anchor links (page sections, possibly including /)
this.router.addRoute( /.*$/, () => { this.router.addRoute( /.*$/, () => {
if ( this.isOpen ) { if ( this.isOpen ) {
this.comingFromHashChange = true; comingFromHashChange = true;
document.title = this.createDocumentTitle( null ); document.title = this.createDocumentTitle( null );
if ( this.ui ) { if ( this.ui ) {
// FIXME triggers mmv-close event, which calls viewer.close() // FIXME triggers mmv-close event, which calls viewer.close()