jenkins-bot has submitted this change and it was merged. Change subject: Correctly place the QuickSurvey panel ......................................................................
Correctly place the QuickSurvey panel * On small screens (768px or less), place panel after the first paragraph. If that's not possible fallback to the default insert order. * Make sure inserting before the first thumb works on both desktop and mobile. Bug: T113651 Change-Id: Iad47e72ff5eaae82ec51546255d8c6ba274fad8e --- M resources/ext.quicksurveys.init/init.js 1 file changed, 21 insertions(+), 8 deletions(-) Approvals: Jdlrobson: Looks good to me, approved jenkins-bot: Verified diff --git a/resources/ext.quicksurveys.init/init.js b/resources/ext.quicksurveys.init/init.js index 08d2bc8..f7e9d9a 100644 --- a/resources/ext.quicksurveys.init/init.js +++ b/resources/ext.quicksurveys.init/init.js @@ -26,21 +26,34 @@ /** * Insert the quick survey panel into the article either (in priority order) + * (on small screens) after the first paragraph, + * before the infobox, * before the first instance of a thumbnail, * before the first instance of a heading - * or at the end of the article when no headings nor thumbnails exist + * or at the end of the article when no headings nor thumbnails exist. + * * @param {jQuery.Object} $panel */ function insertPanel( $panel ) { - var $bodyContent = $( '.mw-content-ltr, .mw-content-rtl' ), - $place = $bodyContent - .find( '.infobox, > .thumb, > h1, > h2, > h3, > h4, > h5, > h6' ) - .eq( 0 ); + var $bodyContent = $( '#bodyContent' ), + $place; - if ( $place.length ) { - $panel.insertBefore( $place ); + if ( window.innerWidth <= 768 ) { + $place = $bodyContent.find( '> div > p' ).eq( 0 ); + } + + if ( $place && $place.length ) { + $panel.appendTo( $place ); } else { - $panel.appendTo( $bodyContent ); + $place = $bodyContent + // Account for the Mobile Frontend section wrapper around .thumb. + .find( '.infobox, > div > .thumb, > .thumb, > h1, > h2, > h3, > h4, > h5, > h6' ) + .eq( 0 ); + if ( $place.length ) { + $panel.insertBefore( $place ); + } else { + $panel.appendTo( $bodyContent ); + } } } -- To view, visit https://gerrit.wikimedia.org/r/240921 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Iad47e72ff5eaae82ec51546255d8c6ba274fad8e Gerrit-PatchSet: 4 Gerrit-Project: mediawiki/extensions/QuickSurveys Gerrit-Branch: dev Gerrit-Owner: Robmoen <rm...@wikimedia.org> Gerrit-Reviewer: Bmansurov <bmansu...@wikimedia.org> Gerrit-Reviewer: Jdlrobson <jrob...@wikimedia.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits