From d63329baa1fa9cb00ff642d96a0f412ca25f72c7 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Tue, 19 May 2020 09:21:07 +0300 Subject: [PATCH] Headlines.move: add params.force_previous to always move to previous article in CDM --- js/Headlines.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/js/Headlines.js b/js/Headlines.js index d8abf74ea..0e929fe30 100755 --- a/js/Headlines.js +++ b/js/Headlines.js @@ -796,6 +796,7 @@ define(["dojo/_base/declare"], function (declare) { const noscroll = params.noscroll || false; const noexpand = params.noexpand || false; + const force_previous = params.force_previous || false; const event = params.event; let prev_id = false; @@ -848,12 +849,12 @@ define(["dojo/_base/declare"], function (declare) { const ctr = $("headlines-frame"); const delta_px = Math.max(row.offsetTop, ctr.scrollTop) - Math.min(row.offsetTop, ctr.scrollTop); - if (row && delta_px > 16) { + if (!force_previous && row && delta_px > 16) { Article.setActive(current_id); Article.cdmMoveToId(current_id, {force: noscroll, event: event}); } else if (prev_id) { - Article.setActive(prev_id); - Article.cdmMoveToId(prev_id, {force: noscroll, event: event, noscroll: noscroll}); + Article.setActive(prev_id); + Article.cdmMoveToId(prev_id, {force: noscroll, event: event, noscroll: noscroll}); } }); } else if (prev_id) {