Yurik has uploaded a new change for review. https://gerrit.wikimedia.org/r/164454
Change subject: Per Timo: minor javascript optimizations ...................................................................... Per Timo: minor javascript optimizations * semicolon in the dynamically inserted javascript (zcmd=js-banner) * attach click event handler to the document instead of each anchor Change-Id: I8e65195c284a8299ff2d122217c26be5351974c5 --- M includes/ZeroSpecialPage.php M modules/interstitial.js 2 files changed, 3 insertions(+), 3 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ZeroBanner refs/changes/54/164454/1 diff --git a/includes/ZeroSpecialPage.php b/includes/ZeroSpecialPage.php index 6be0f08..0594a23 100644 --- a/includes/ZeroSpecialPage.php +++ b/includes/ZeroSpecialPage.php @@ -431,7 +431,7 @@ $bannerHtml = PageRendering::renderBanner( $state, $config, null, null, $isFilePage ); $cfg = PageRendering::getJsConfigBlock( $this, $id, $config, (bool)$bannerHtml ); if ( $bannerHtml ) { - $banner = 'document.write(' . Xml::encodeJsVar( $bannerHtml ) . ')'; + $banner = 'document.write(' . Xml::encodeJsVar( $bannerHtml ) . ');'; } } else { $cfg = PageRendering::getJsConfigBlock( $this, $id, $config, false ); diff --git a/modules/interstitial.js b/modules/interstitial.js index e4a6b15..864b589 100644 --- a/modules/interstitial.js +++ b/modules/interstitial.js @@ -71,12 +71,12 @@ } } ); - $( 'a' ).on( 'click', function ( ev ) { + $( document.body ).on( 'click', 'a', function ( ev ) { var knownSites = [ // a hardcoded list of our sites - avoids api call if not listed 'm.wikipedia', 'zero.wikipedia' ], - $target = $( this ), // onclick <a> element + $target = $( ev.target ), // onclick <a> element isSpecialCase = false, // true if interstitial should be shown despite not being a redirect search = $target.prop( 'search' ), // query part of the link target URL isImage = $target.hasClass( 'image' ), // is this a link to an image page -- To view, visit https://gerrit.wikimedia.org/r/164454 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I8e65195c284a8299ff2d122217c26be5351974c5 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/ZeroBanner Gerrit-Branch: master Gerrit-Owner: Yurik <yu...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits