Headlines.move: add params.force_previous to always move to previous article in CDM

master
Andrew Dolgov 5 years ago
parent 2deb9c555e
commit d63329baa1

@ -796,6 +796,7 @@ define(["dojo/_base/declare"], function (declare) {
const noscroll = params.noscroll || false; const noscroll = params.noscroll || false;
const noexpand = params.noexpand || false; const noexpand = params.noexpand || false;
const force_previous = params.force_previous || false;
const event = params.event; const event = params.event;
let prev_id = false; let prev_id = false;
@ -848,7 +849,7 @@ define(["dojo/_base/declare"], function (declare) {
const ctr = $("headlines-frame"); const ctr = $("headlines-frame");
const delta_px = Math.max(row.offsetTop, ctr.scrollTop) - Math.min(row.offsetTop, ctr.scrollTop); 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.setActive(current_id);
Article.cdmMoveToId(current_id, {force: noscroll, event: event}); Article.cdmMoveToId(current_id, {force: noscroll, event: event});
} else if (prev_id) { } else if (prev_id) {

Loading…
Cancel
Save