mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/MultimediaViewer
synced 2024-11-27 17:40:06 +00:00
mmv.js: Store comingFromHashChange as a class property
Code in mmv.bootstrap.js sets viewer.comingFromHashChange directly, assuming it to be a class property, not a local variable. Change-Id: I8b10243768118e84d916f50f1a48ff10463d1db4
This commit is contained in:
parent
995bb6da2b
commit
b5ed0e6c04
|
@ -44,7 +44,6 @@ 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
|
||||||
|
@ -96,7 +95,7 @@ class MultimediaViewer {
|
||||||
*/
|
*/
|
||||||
this.router = router;
|
this.router = router;
|
||||||
this.setupRouter();
|
this.setupRouter();
|
||||||
comingFromHashChange = false;
|
this.comingFromHashChange = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* UI object used to display the pictures in the page.
|
* UI object used to display the pictures in the page.
|
||||||
|
@ -686,8 +685,8 @@ class MultimediaViewer {
|
||||||
this.viewLogger.recordViewDuration();
|
this.viewLogger.recordViewDuration();
|
||||||
this.viewLogger.unattach();
|
this.viewLogger.unattach();
|
||||||
|
|
||||||
if ( comingFromHashChange ) {
|
if ( this.comingFromHashChange ) {
|
||||||
comingFromHashChange = false;
|
this.comingFromHashChange = false;
|
||||||
} else {
|
} else {
|
||||||
this.router.back();
|
this.router.back();
|
||||||
}
|
}
|
||||||
|
@ -707,7 +706,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 ) {
|
||||||
comingFromHashChange = true;
|
this.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()
|
||||||
|
|
Loading…
Reference in a new issue