From 5c52fb61b3b3df8b0984893daa1f6eca3ab12a51 Mon Sep 17 00:00:00 2001
From: tobi6112 <22715034+tobi6112@users.noreply.github.com>
Date: Sun, 1 Aug 2021 19:15:31 +0200
Subject: [PATCH] Override next/prev functions to prevent site from scrolling
(Fixes #42)
---
src/module/WidescreenMode.js | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/src/module/WidescreenMode.js b/src/module/WidescreenMode.js
index 26f783c..2982c1e 100644
--- a/src/module/WidescreenMode.js
+++ b/src/module/WidescreenMode.js
@@ -306,6 +306,30 @@ export default class WidescreenMode {
return `
${result}
`;
};
+
+ // Override next - original code - adjustments are commented
+ p.View.Stream.Main.prototype.next = function (ev) {
+ var $next = this.getNextItem(this.$currentItem);
+ if (!$next.length) {
+ return false;
+ }
+ // Dont use a scrollTo value, to prevent the page from scrolling
+ this.showItem($next, null);
+ p.navigateTo($next.attr('href').substr(1), p.NAVIGATE.SILENT);
+ return false;
+ };
+
+ // Override prev - original code - adjustments are commented
+ p.View.Stream.Main.prototype.prev = function (ev) {
+ var $prev = this.getPrevItem(this.$currentItem);
+ if (!$prev.length) {
+ return false;
+ }
+ // Dont use a scrollTo value, to prevent the page from scrolling
+ this.showItem($next, null);
+ p.navigateTo($prev.attr('href').substr(1), p.NAVIGATE.SILENT);
+ return false;
+ };
}
calculateBenisUntilTop(up, down, date) {