Bmansurov has uploaded a new change for review.
https://gerrit.wikimedia.org/r/221848
Change subject: Search overlay: do not navigate away from the page when a
watchstar is clicked
......................................................................
Search overlay: do not navigate away from the page when a watchstar is clicked
The patch updates the watchstar in search overlay when clicked and
lets the user stay on the page.
Also remove outdated comments and move the navigation logic from the init
script to SearchOverlay.js where it's used.
Bug: T103742
Change-Id: Ifa5147fd86014c1295ed2bf808c4a0ea7d634074
---
M resources/mobile.search/SearchOverlay.js
M resources/mobile.search/init.js
2 files changed, 10 insertions(+), 18 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend
refs/changes/48/221848/1
diff --git a/resources/mobile.search/SearchOverlay.js
b/resources/mobile.search/SearchOverlay.js
index 550b6aa..04198b0 100644
--- a/resources/mobile.search/SearchOverlay.js
+++ b/resources/mobile.search/SearchOverlay.js
@@ -80,7 +80,7 @@
'click .overlay-content > div':
'onClickOverlayContentDiv',
'touchstart .results': 'hideKeyboardOnScroll',
'mousedown .results': 'hideKeyboardOnScroll',
- 'click .results li': 'onClickResult'
+ 'click .results a': 'onClickResult'
} ),
/**
@@ -195,7 +195,8 @@
* @param {jQuery.Event} ev
*/
onClickResult: function ( ev ) {
- var $result = $( ev.target ).closest( 'li' );
+ var $link = $( ev.currentTarget ),
+ $result = $link.closest( 'li' );
/**
* @event search-result-click Fired when the user
clicks a search result
@@ -211,6 +212,13 @@
resultIndex: this.$results.index( $result ),
originalEvent: ev
} );
+
+ // FIXME: ugly hack that removes search from browser
history when navigating
+ // to search results (we can't rely on History API yet)
+ ev.preventDefault();
+ router.back().done( function () {
+ window.location.href = $link.attr( 'href' );
+ } );
},
/** @inheritdoc */
diff --git a/resources/mobile.search/init.js b/resources/mobile.search/init.js
index 75a72c7..66cb024 100644
--- a/resources/mobile.search/init.js
+++ b/resources/mobile.search/init.js
@@ -62,22 +62,6 @@
.prop( 'readonly', true );
}
- // FIXME: ugly hack that removes search from browser history when
navigating
- // to search results (we can't rely on History API yet)
- // alpha does it differently in lazyload.js
- if ( !context.isAlphaGroupMember() ) {
- M.on( 'search-result-click', function ( ev ) {
- var href = $( ev.result ).find( 'a' )
- .attr( 'href' );
-
- ev.originalEvent.preventDefault();
-
- router.back().done( function () {
- window.location.href = href;
- } );
- } );
- }
-
M.require( 'modules/search/MobileWebSearchLogger' ).register();
}( mw.mobileFrontend, jQuery ) );
--
To view, visit https://gerrit.wikimedia.org/r/221848
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifa5147fd86014c1295ed2bf808c4a0ea7d634074
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Bmansurov <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits