From 1aaf2ddfa710620aee3d5647c2c00334a33cfd66 Mon Sep 17 00:00:00 2001 From: Arnav Angarkar Date: Sat, 6 Dec 2025 01:16:19 +0530 Subject: [PATCH] fix: prevent schedule page auto-scroll with updated widget - Updated pretalx-schedule.min.js with new widget supporting disable-auto-scroll - Added disable-auto-scroll attribute to schedule.html pretalx-schedule element - Fixed template syntax by putting all Django template tags on single lines The widget changes are from fossasia/eventyay-talk-schedule fix/disable-auto-scroll branch. Fixes #1430 --- .../agenda/templates/agenda/schedule.html | 124 ++++++++---------- .../static/agenda/js/pretalx-schedule.min.js | 27 ++-- 2 files changed, 77 insertions(+), 74 deletions(-) diff --git a/app/eventyay/agenda/templates/agenda/schedule.html b/app/eventyay/agenda/templates/agenda/schedule.html index e3198982c3..dd4357214b 100644 --- a/app/eventyay/agenda/templates/agenda/schedule.html +++ b/app/eventyay/agenda/templates/agenda/schedule.html @@ -5,81 +5,73 @@ {% load static %} {% load phrases %} -{% block container_width %} {% if not show_talk_list %}main-schedule{% else %}list-schedule{% endif %}{% endblock container_width %} +{% block container_width %}{% if not show_talk_list %}main-schedule{% else %}list-schedule{% endif %}{% endblock container_width %} {% block agenda_custom_header %} - + {% endblock agenda_custom_header %} {% block header_right %} - + {% endblock header_right %} {% block agenda_content %} -
- {% if schedule != schedule.event.current_schedule %} -
- - {% if not schedule.version %} - {{ phrases.schedule.wip_version }} - {% else %} - {{ phrases.schedule.old_version }} - {% endif %} - {% if request.event.current_schedule %} - {% phrase "phrases.schedule.current_version" current_url=schedule.event.urls.schedule %} - {% endif %} - -
- {% endif %} +
+ {% if schedule != schedule.event.current_schedule %} +
+ + {% if not schedule.version %} + {{ phrases.schedule.wip_version }} + {% else %} + {{ phrases.schedule.old_version }} + {% endif %} + {% if request.event.current_schedule %} + {% phrase "phrases.schedule.current_version" current_url=schedule.event.urls.schedule %} + {% endif %} + +
+ {% endif %} - + - - +
{% endblock agenda_content %} diff --git a/app/eventyay/static/agenda/js/pretalx-schedule.min.js b/app/eventyay/static/agenda/js/pretalx-schedule.min.js index 8e432a3742..2fce031e51 100644 --- a/app/eventyay/static/agenda/js/pretalx-schedule.min.js +++ b/app/eventyay/static/agenda/js/pretalx-schedule.min.js @@ -18594,7 +18594,8 @@ const T_ = ".c-linear-schedule{display:flex;flex-direction:column;min-height:0}. currentDay: String, now: Object, scrollParent: Element, - onHomeServer: Boolean + onHomeServer: Boolean, + disableAutoScroll: Boolean }, data() { return { @@ -18633,7 +18634,7 @@ const T_ = ".c-linear-schedule{display:flex;flex-direction:column;min-height:0}. } let t = !1; const n = window.location.hash.slice(1); - if (n && n.length === 10 && de.fromISO(n, { zone: this.timezone }) && (t = !0), t) return; + if (n && n.length === 10 && de.fromISO(n, { zone: this.timezone }) && (t = !0), t || this.disableAutoScroll) return; const r = this.sessionBuckets.findIndex((a) => this.now < a.date); if (r < 0) return; const i = this.sessionBuckets[Math.max(0, r - 1)], u = ((o = (s = this.$refs[this.getBucketName(i.date)]) == null ? void 0 : s[0]) == null ? void 0 : o.offsetTop) - 90; @@ -18784,7 +18785,8 @@ const H_ = '.c-grid-schedule{flex:auto;background-color:#fafafa}.c-grid-schedule locale: String, hasAmPm: Boolean, scrollParent: Element, - onHomeServer: Boolean + onHomeServer: Boolean, + disableAutoScroll: Boolean }, data() { return { @@ -18898,7 +18900,7 @@ const H_ = '.c-grid-schedule{flex:auto;background-color:#fafafa}.c-grid-schedule await this.$nextTick(); let e = !1; const t = window.location.hash.slice(1); - if (t && t.length === 10 && de.fromISO(t, { zone: this.timezone }) && (e = !0), e || !this.$refs.now) return; + if (t && t.length === 10 && de.fromISO(t, { zone: this.timezone }) && (e = !0), e || !this.$refs.now || this.disableAutoScroll) return; const n = this.$refs.now.offsetTop + this.getOffsetTop(); this.scrollParent ? this.scrollParent.scrollTop = n : window.scroll({ top: n }); }, @@ -18978,10 +18980,11 @@ function $_(e, t, n, r, i, u) { scrollParent: n.scrollParent, favs: n.favs, onHomeServer: n.onHomeServer, + disableAutoScroll: n.disableAutoScroll, onChangeDay: t[0] || (t[0] = (a) => e.$emit("changeDay", a)), onFav: t[1] || (t[1] = (a) => e.$emit("fav", a)), onUnfav: t[2] || (t[2] = (a) => e.$emit("unfav", a)) - }, null, 8, ["sessions", "rooms", "currentDay", "now", "hasAmPm", "timezone", "locale", "scrollParent", "favs", "onHomeServer"]))), 128)) + }, null, 8, ["sessions", "rooms", "currentDay", "now", "hasAmPm", "timezone", "locale", "scrollParent", "favs", "onHomeServer", "disableAutoScroll"]))), 128)) ]); } const Z_ = { @@ -19002,7 +19005,8 @@ const Z_ = { locale: String, hasAmPm: Boolean, scrollParent: Element, - onHomeServer: Boolean + onHomeServer: Boolean, + disableAutoScroll: Boolean }, computed: { gridGroups() { @@ -19614,10 +19618,11 @@ function h6(e, t, n, r, i, u) { scrollParent: e.scrollParent, favs: i.favs, onHomeServer: i.onHomeServer, + disableAutoScroll: n.disableAutoScroll, onChangeDay: t[4] || (t[4] = (h) => u.setCurrentDay(h)), onFav: t[5] || (t[5] = (h) => u.fav(h)), onUnfav: t[6] || (t[6] = (h) => u.unfav(h)) - }, null, 8, ["sessions", "rooms", "days", "currentDay", "now", "hasAmPm", "timezone", "locale", "scrollParent", "favs", "onHomeServer"])) : (N(), ct(l, { + }, null, 8, ["sessions", "rooms", "days", "currentDay", "now", "hasAmPm", "timezone", "locale", "scrollParent", "favs", "onHomeServer", "disableAutoScroll"])) : (N(), ct(l, { key: 2, sessions: u.sessions, rooms: u.rooms, @@ -19629,10 +19634,11 @@ function h6(e, t, n, r, i, u) { scrollParent: e.scrollParent, favs: i.favs, onHomeServer: i.onHomeServer, + disableAutoScroll: n.disableAutoScroll, onChangeDay: t[7] || (t[7] = (h) => u.setCurrentDay(h)), onFav: t[8] || (t[8] = (h) => u.fav(h)), onUnfav: t[9] || (t[9] = (h) => u.unfav(h)) - }, null, 8, ["sessions", "rooms", "currentDay", "now", "hasAmPm", "timezone", "locale", "scrollParent", "favs", "onHomeServer"])) + }, null, 8, ["sessions", "rooms", "currentDay", "now", "hasAmPm", "timezone", "locale", "scrollParent", "favs", "onHomeServer", "disableAutoScroll"])) ], 64)) : (N(), ct(f, { key: 2, size: "huge", @@ -19703,6 +19709,11 @@ const p6 = 'html{font-size:14px;font-size:87.5%}body{font-family:Roboto,Helvetic dateFilter: { type: String, default: "" + }, + // Disable auto-scroll to current time on page load + disableAutoScroll: { + type: Boolean, + default: !1 } }, provide() {