|
|
|
@ -8,6 +8,7 @@ define(["dojo/_base/declare"], function (declare) {
|
|
|
|
|
headlines: [],
|
|
|
|
|
current_first_id: 0,
|
|
|
|
|
_scroll_reset_timeout: false,
|
|
|
|
|
line_scroll_offset: 120, /* px */
|
|
|
|
|
sticky_header_observer: new IntersectionObserver(
|
|
|
|
|
(entries, observer) => {
|
|
|
|
|
entries.forEach((entry) => {
|
|
|
|
@ -363,23 +364,26 @@ define(["dojo/_base/declare"], function (declare) {
|
|
|
|
|
|
|
|
|
|
if (hl.active) {
|
|
|
|
|
new_row.addClassName("active");
|
|
|
|
|
Article.unpack(new_row);
|
|
|
|
|
|
|
|
|
|
if (App.isCombinedMode())
|
|
|
|
|
Article.cdmMoveToId(id, {noscroll: true});
|
|
|
|
|
else
|
|
|
|
|
Article.view(id);
|
|
|
|
|
|
|
|
|
|
Article.unpack(row);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (hl.selected) this.select("all", id);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$$(".cdm .header-sticky-guard").each((e) => { this.sticky_header_observer.observe(e) });
|
|
|
|
|
$$(".cdm .header-sticky-guard").each((e) => {
|
|
|
|
|
this.sticky_header_observer.observe(e)
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (App.getInitParam("cdm_expanded"))
|
|
|
|
|
$$("#headlines-frame > div[id*=RROW].cdm").each((e) => { this.unpack_observer.observe(e) });
|
|
|
|
|
$$("#headlines-frame > div[id*=RROW].cdm").each((e) => {
|
|
|
|
|
this.unpack_observer.observe(e)
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
render: function (headlines, hl) {
|
|
|
|
@ -689,10 +693,14 @@ define(["dojo/_base/declare"], function (declare) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$$(".cdm .header-sticky-guard").each((e) => { this.sticky_header_observer.observe(e) });
|
|
|
|
|
$$(".cdm .header-sticky-guard").each((e) => {
|
|
|
|
|
this.sticky_header_observer.observe(e)
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (App.getInitParam("cdm_expanded"))
|
|
|
|
|
$$("#headlines-frame > div[id*=RROW].cdm").each((e) => { this.unpack_observer.observe(e) });
|
|
|
|
|
$$("#headlines-frame > div[id*=RROW].cdm").each((e) => {
|
|
|
|
|
this.unpack_observer.observe(e)
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
console.error("Invalid object received: " + transport.responseText);
|
|
|
|
@ -799,21 +807,20 @@ define(["dojo/_base/declare"], function (declare) {
|
|
|
|
|
const noexpand = params.noexpand || false;
|
|
|
|
|
const event = params.event;
|
|
|
|
|
|
|
|
|
|
const rows = Headlines.getLoaded();
|
|
|
|
|
|
|
|
|
|
let prev_id = false;
|
|
|
|
|
let next_id = false;
|
|
|
|
|
|
|
|
|
|
const active_row = $("RROW-" + Article.getActive());
|
|
|
|
|
|
|
|
|
|
if (!active_row) {
|
|
|
|
|
if (!active_row)
|
|
|
|
|
Article.setActive(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!Article.getActive() || (active_row && !Headlines.isChildVisible(active_row, $("headlines-frame")))) {
|
|
|
|
|
next_id = Headlines.firstVisible();
|
|
|
|
|
prev_id = next_id;
|
|
|
|
|
} else {
|
|
|
|
|
const rows = Headlines.getLoaded();
|
|
|
|
|
|
|
|
|
|
for (let i = 0; i < rows.length; i++) {
|
|
|
|
|
if (rows[i] == Article.getActive()) {
|
|
|
|
|
|
|
|
|
@ -831,47 +838,31 @@ define(["dojo/_base/declare"], function (declare) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
console.log("cur: " + Article.getActive() + " next: " + next_id);
|
|
|
|
|
console.log("cur: " + Article.getActive() + " next: " + next_id + " prev:" + prev_id);
|
|
|
|
|
|
|
|
|
|
if (mode === "next") {
|
|
|
|
|
if (next_id || Article.getActive()) {
|
|
|
|
|
if (next_id) {
|
|
|
|
|
if (App.isCombinedMode()) {
|
|
|
|
|
|
|
|
|
|
//const row = $("RROW-" + Article.getActive());
|
|
|
|
|
const ctr = $("headlines-frame");
|
|
|
|
|
|
|
|
|
|
if (noscroll) {
|
|
|
|
|
Article.setActive(next_id);
|
|
|
|
|
Article.cdmMoveToId(next_id, {event: event, noscroll: noscroll});
|
|
|
|
|
} else if (next_id) {
|
|
|
|
|
Article.scroll(ctr.offsetHeight / 2, event);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} else if (next_id) {
|
|
|
|
|
} else {
|
|
|
|
|
Headlines.correctHeadlinesOffset(next_id);
|
|
|
|
|
Article.view(next_id, noexpand);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (mode === "prev") {
|
|
|
|
|
} else if (mode === "prev") {
|
|
|
|
|
if (prev_id || Article.getActive()) {
|
|
|
|
|
if (App.isCombinedMode()) {
|
|
|
|
|
|
|
|
|
|
const row = $("RROW-" + Article.getActive());
|
|
|
|
|
//const prev_row = $("RROW-" + prev_id);
|
|
|
|
|
const ctr = $("headlines-frame");
|
|
|
|
|
|
|
|
|
|
if (noscroll) {
|
|
|
|
|
if (row && Math.round(row.offsetTop) < Math.round(ctr.scrollTop)) {
|
|
|
|
|
Article.cdmMoveToId(Article.getActive(), {force: noscroll, event: event});
|
|
|
|
|
} else if (prev_id) {
|
|
|
|
|
Article.setActive(prev_id);
|
|
|
|
|
Article.cdmMoveToId(prev_id, {force: noscroll, event: event, noscroll: noscroll});
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
Article.scroll(-ctr.offsetHeight / 2, event);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} else if (prev_id) {
|
|
|
|
|
Headlines.correctHeadlinesOffset(prev_id);
|
|
|
|
@ -1360,21 +1351,11 @@ define(["dojo/_base/declare"], function (declare) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
scrollByPages: function (offset, event) {
|
|
|
|
|
const elem = $("headlines-frame");
|
|
|
|
|
|
|
|
|
|
if (event && event.repeat) {
|
|
|
|
|
elem.addClassName("forbid-smooth-scroll");
|
|
|
|
|
window.clearTimeout(this._scroll_reset_timeout);
|
|
|
|
|
|
|
|
|
|
this._scroll_reset_timeout = window.setTimeout(() => {
|
|
|
|
|
if (elem) elem.removeClassName("forbid-smooth-scroll");
|
|
|
|
|
}, 250)
|
|
|
|
|
} else {
|
|
|
|
|
elem.removeClassName("forbid-smooth-scroll");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
elem.scrollTop += elem.offsetHeight * offset * 0.99;
|
|
|
|
|
scrollByPages: function (page_offset, event) {
|
|
|
|
|
App.Scrollable.scrollByPages($("headlines-frame"), page_offset, event);
|
|
|
|
|
},
|
|
|
|
|
scroll: function (offset, event) {
|
|
|
|
|
App.Scrollable.scroll($("headlines-frame"), offset, event);
|
|
|
|
|
},
|
|
|
|
|
initHeadlinesMenu: function () {
|
|
|
|
|
if (!dijit.byId("headlinesMenu")) {
|
|
|
|
|