nausharipov commented on code in PR #17638:
URL: https://github.com/apache/beam/pull/17638#discussion_r878304527


##########
website/www/site/assets/js/language-switch-v2.js:
##########
@@ -10,11 +10,26 @@
 // License for the specific language governing permissions and limitations 
under
 // the License.
 
+function getElPreviousPositionAndData(el) {
+    const clickedLangSwitchEl = el.target.closest(".language-switcher");
+    const elPreviousOffsetFromViewPort = 
clickedLangSwitchEl.getBoundingClientRect().top;
+    return {
+        elPreviousOffsetFromViewPort,
+        clickedLangSwitchEl,
+    }
+}
+
+function setScrollToNewPosition(clickedElData) {
+    const { elPreviousOffsetFromViewPort, clickedLangSwitchEl } = 
clickedElData;
+    const elCurrentHeight = window.pageYOffset + 
clickedLangSwitchEl.getBoundingClientRect().top;
+    $('html, body').scrollTop(elCurrentHeight - elPreviousOffsetFromViewPort);
+}
+
 $(document).ready(function() {
     function Switcher(conf) {
         var id = conf["class-prefix"],
-            def = conf["default"],
-            langs = [];
+          def = conf["default"],

Review Comment:
   please, format the file



##########
website/www/site/assets/js/language-switch-v2.js:
##########
@@ -10,11 +10,26 @@
 // License for the specific language governing permissions and limitations 
under
 // the License.
 
+function getElPreviousPositionAndData(el) {
+    const clickedLangSwitchEl = el.target.closest(".language-switcher");
+    const elPreviousOffsetFromViewPort = 
clickedLangSwitchEl.getBoundingClientRect().top;
+    return {
+        elPreviousOffsetFromViewPort,
+        clickedLangSwitchEl,
+    }
+}
+
+function setScrollToNewPosition(clickedElData) {
+    const { elPreviousOffsetFromViewPort, clickedLangSwitchEl } = 
clickedElData;
+    const elCurrentHeight = window.pageYOffset + 
clickedLangSwitchEl.getBoundingClientRect().top;
+    $('html, body').scrollTop(elCurrentHeight - elPreviousOffsetFromViewPort);
+}
+
 $(document).ready(function() {
     function Switcher(conf) {
         var id = conf["class-prefix"],
-            def = conf["default"],
-            langs = [];
+          def = conf["default"],

Review Comment:
   please, format files



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to