JGonera has uploaded a new change for review.
https://gerrit.wikimedia.org/r/95988
Change subject: Don't run Router#checkRoutes externally
......................................................................
Don't run Router#checkRoutes externally
This causes callbacks for routes to be called too many times.
Bug: 56973
Change-Id: I467ffb1e7c7cc9bf58437673ff5ed8177a359430
---
M javascripts/modules/mediaViewer.js
1 file changed, 13 insertions(+), 15 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend
refs/changes/88/95988/1
diff --git a/javascripts/modules/mediaViewer.js
b/javascripts/modules/mediaViewer.js
index da4de50..a458430 100644
--- a/javascripts/modules/mediaViewer.js
+++ b/javascripts/modules/mediaViewer.js
@@ -96,20 +96,20 @@
}
} );
- M.router.route( /^image\/(.+)$/, function( hrefPart ) {
- // FIXME: replace hrefPart with title when we get rid of
History.js
- // (which apart from slashes doesn't like dots...)
- var $a = $( 'a[href*="' + hrefPart + '"]' ), title = $a.data(
'title' );
-
- if ( title ) {
- new ImageOverlay( {
- title: $a.data( 'title' ),
- caption: $a.siblings( '.thumbcaption' ).text()
- } ).show();
- }
- } );
-
function init( $el ) {
+ M.router.route( /^image\/(.+)$/, function( hrefPart ) {
+ // FIXME: replace hrefPart with title when we get rid
of History.js
+ // (which apart from slashes doesn't like dots...)
+ var $a = $( 'a[href*="' + hrefPart + '"]' ), title =
$a.data( 'title' );
+
+ if ( title ) {
+ new ImageOverlay( {
+ title: $a.data( 'title' ),
+ caption: $a.siblings( '.thumbcaption'
).text()
+ } ).show();
+ }
+ } );
+
$el.find( 'a.image, a.thumbimage' ).each( function() {
var $a = $( this ),
// FIXME: change to /[^\/]+$/ when we get rid
of History.js
@@ -120,8 +120,6 @@
$a.attr( 'href', '#image/' + match[2] );
}
} );
-
- M.router.checkRoute();
}
// FIXME: this should bind to only 1-2 events
--
To view, visit https://gerrit.wikimedia.org/r/95988
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I467ffb1e7c7cc9bf58437673ff5ed8177a359430
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: JGonera <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits