[MediaWiki-commits] [Gerrit] Scroll all the way up when first section in ToC clicked. - change (apps...wikipedia)
Dbrant has uploaded a new change for review. https://gerrit.wikimedia.org/r/173011 Change subject: Scroll all the way up when first section in ToC clicked. .. Scroll all the way up when first section in ToC clicked. Also properly update index.html and preview.html in the www folder to remove zoomability, viz: https://gerrit.wikimedia.org/r/171850 Bug: 73327 Change-Id: Icd9c15244ca79683f3817c66ff430d7351c040f8 --- M wikipedia/assets/bundle.js M wikipedia/assets/preview.html M www/index.html M www/js/sections.js M www/preview.html 5 files changed, 21 insertions(+), 9 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/apps/android/wikipedia refs/changes/11/173011/1 diff --git a/wikipedia/assets/bundle.js b/wikipedia/assets/bundle.js index b1c9e0a..a79b2e7 100644 --- a/wikipedia/assets/bundle.js +++ b/wikipedia/assets/bundle.js @@ -554,9 +554,15 @@ }); function scrollToSection( anchor ) { -var el = document.getElementById( anchor ); -var scrollY = el.offsetTop - 48; -window.scrollTo( 0, scrollY ); +if (anchor === heading_0) { +// if it's the first section, then scroll all the way to the top, since there could +// be a lead image, native title components, etc. +window.scrollTo( 0, 0 ); +} else { +var el = document.getElementById( anchor ); +var scrollY = el.offsetTop - 48; +window.scrollTo( 0, scrollY ); +} } /** diff --git a/wikipedia/assets/preview.html b/wikipedia/assets/preview.html index 064b0ec..2ab4da3 100644 --- a/wikipedia/assets/preview.html +++ b/wikipedia/assets/preview.html @@ -4,7 +4,7 @@ base href=https://wikipedia.org; / !-- Force links to resolve with https as protocol, rather than file:// -- script src=file:///android_asset/preview.js/script -meta name=viewport content=width=device-width, initial-scale=1.0, user-scalable=yes, minimum-scale=0.25, maximum-scale=1.6 / +meta name=viewport content=width=device-width, user-scalable=no / /head body div id=content class=content/div diff --git a/www/index.html b/www/index.html index 3130185..5ca4005 100644 --- a/www/index.html +++ b/www/index.html @@ -4,7 +4,7 @@ base href=https://wikipedia.org; / !-- Force links to resolve with https as protocol, rather than file:// -- script src=file:///android_asset/bundle.js/script -meta name=viewport content=width=device-width, initial-scale=1.0, user-scalable=yes, minimum-scale=0.25, maximum-scale=1.6 / +meta name=viewport content=width=device-width, user-scalable=no / /head body div id=content class=content/div diff --git a/www/js/sections.js b/www/js/sections.js index 57fc1a4..53b02f6 100644 --- a/www/js/sections.js +++ b/www/js/sections.js @@ -139,9 +139,15 @@ }); function scrollToSection( anchor ) { -var el = document.getElementById( anchor ); -var scrollY = el.offsetTop - 48; -window.scrollTo( 0, scrollY ); +if (anchor === heading_0) { +// if it's the first section, then scroll all the way to the top, since there could +// be a lead image, native title components, etc. +window.scrollTo( 0, 0 ); +} else { +var el = document.getElementById( anchor ); +var scrollY = el.offsetTop - 48; +window.scrollTo( 0, scrollY ); +} } /** diff --git a/www/preview.html b/www/preview.html index 064b0ec..2ab4da3 100644 --- a/www/preview.html +++ b/www/preview.html @@ -4,7 +4,7 @@ base href=https://wikipedia.org; / !-- Force links to resolve with https as protocol, rather than file:// -- script src=file:///android_asset/preview.js/script -meta name=viewport content=width=device-width, initial-scale=1.0, user-scalable=yes, minimum-scale=0.25, maximum-scale=1.6 / +meta name=viewport content=width=device-width, user-scalable=no / /head body div id=content class=content/div -- To view, visit https://gerrit.wikimedia.org/r/173011 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Icd9c15244ca79683f3817c66ff430d7351c040f8 Gerrit-PatchSet: 1 Gerrit-Project: apps/android/wikipedia Gerrit-Branch: master Gerrit-Owner: Dbrant dbr...@wikimedia.org ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Scroll all the way up when first section in ToC clicked. - change (apps...wikipedia)
BearND has submitted this change and it was merged. Change subject: Scroll all the way up when first section in ToC clicked. .. Scroll all the way up when first section in ToC clicked. Also properly update index.html and preview.html in the www folder to remove zoomability, viz: https://gerrit.wikimedia.org/r/171850 Bug: 73327 Change-Id: Icd9c15244ca79683f3817c66ff430d7351c040f8 --- M wikipedia/assets/bundle.js M wikipedia/assets/preview.html M www/index.html M www/js/sections.js M www/preview.html 5 files changed, 21 insertions(+), 9 deletions(-) Approvals: BearND: Looks good to me, approved jenkins-bot: Verified diff --git a/wikipedia/assets/bundle.js b/wikipedia/assets/bundle.js index b1c9e0a..a79b2e7 100644 --- a/wikipedia/assets/bundle.js +++ b/wikipedia/assets/bundle.js @@ -554,9 +554,15 @@ }); function scrollToSection( anchor ) { -var el = document.getElementById( anchor ); -var scrollY = el.offsetTop - 48; -window.scrollTo( 0, scrollY ); +if (anchor === heading_0) { +// if it's the first section, then scroll all the way to the top, since there could +// be a lead image, native title components, etc. +window.scrollTo( 0, 0 ); +} else { +var el = document.getElementById( anchor ); +var scrollY = el.offsetTop - 48; +window.scrollTo( 0, scrollY ); +} } /** diff --git a/wikipedia/assets/preview.html b/wikipedia/assets/preview.html index 064b0ec..2ab4da3 100644 --- a/wikipedia/assets/preview.html +++ b/wikipedia/assets/preview.html @@ -4,7 +4,7 @@ base href=https://wikipedia.org; / !-- Force links to resolve with https as protocol, rather than file:// -- script src=file:///android_asset/preview.js/script -meta name=viewport content=width=device-width, initial-scale=1.0, user-scalable=yes, minimum-scale=0.25, maximum-scale=1.6 / +meta name=viewport content=width=device-width, user-scalable=no / /head body div id=content class=content/div diff --git a/www/index.html b/www/index.html index 3130185..5ca4005 100644 --- a/www/index.html +++ b/www/index.html @@ -4,7 +4,7 @@ base href=https://wikipedia.org; / !-- Force links to resolve with https as protocol, rather than file:// -- script src=file:///android_asset/bundle.js/script -meta name=viewport content=width=device-width, initial-scale=1.0, user-scalable=yes, minimum-scale=0.25, maximum-scale=1.6 / +meta name=viewport content=width=device-width, user-scalable=no / /head body div id=content class=content/div diff --git a/www/js/sections.js b/www/js/sections.js index 57fc1a4..53b02f6 100644 --- a/www/js/sections.js +++ b/www/js/sections.js @@ -139,9 +139,15 @@ }); function scrollToSection( anchor ) { -var el = document.getElementById( anchor ); -var scrollY = el.offsetTop - 48; -window.scrollTo( 0, scrollY ); +if (anchor === heading_0) { +// if it's the first section, then scroll all the way to the top, since there could +// be a lead image, native title components, etc. +window.scrollTo( 0, 0 ); +} else { +var el = document.getElementById( anchor ); +var scrollY = el.offsetTop - 48; +window.scrollTo( 0, scrollY ); +} } /** diff --git a/www/preview.html b/www/preview.html index 064b0ec..2ab4da3 100644 --- a/www/preview.html +++ b/www/preview.html @@ -4,7 +4,7 @@ base href=https://wikipedia.org; / !-- Force links to resolve with https as protocol, rather than file:// -- script src=file:///android_asset/preview.js/script -meta name=viewport content=width=device-width, initial-scale=1.0, user-scalable=yes, minimum-scale=0.25, maximum-scale=1.6 / +meta name=viewport content=width=device-width, user-scalable=no / /head body div id=content class=content/div -- To view, visit https://gerrit.wikimedia.org/r/173011 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Icd9c15244ca79683f3817c66ff430d7351c040f8 Gerrit-PatchSet: 2 Gerrit-Project: apps/android/wikipedia Gerrit-Branch: master Gerrit-Owner: Dbrant dbr...@wikimedia.org Gerrit-Reviewer: BearND bsitzm...@wikimedia.org Gerrit-Reviewer: Brion VIBBER br...@wikimedia.org Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits