rename cdmScrollToId to cdmMoveToId
prevent smooth scrolling when going directly to an article
This commit is contained in:
parent
2558fcbe21
commit
a802649d53
|
@ -290,7 +290,11 @@ define(["dojo/_base/declare"], function (declare) {
|
|||
|
||||
dialog.show();
|
||||
},
|
||||
cdmScrollToId: function (id, force, event, immediate) {
|
||||
cdmMoveToId: function (id, params) {
|
||||
const force = params.force || true;
|
||||
const event = params.event || null;
|
||||
const noscroll = params.noscroll || false;
|
||||
|
||||
const ctr = $("headlines-frame");
|
||||
const e = $("RROW-" + id);
|
||||
const is_expanded = App.getInitParam("cdm_expanded");
|
||||
|
@ -300,7 +304,7 @@ define(["dojo/_base/declare"], function (declare) {
|
|||
if (force || is_expanded || e.offsetTop + e.offsetHeight > (ctr.scrollTop + ctr.offsetHeight) ||
|
||||
e.offsetTop < ctr.scrollTop) {
|
||||
|
||||
if (immediate || event && event.repeat || !is_expanded) {
|
||||
if (noscroll || event && event.repeat || !is_expanded) {
|
||||
ctr.addClassName("forbid-smooth-scroll");
|
||||
window.clearTimeout(this._scroll_reset_timeout);
|
||||
|
||||
|
|
|
@ -185,7 +185,7 @@ define(["dojo/_base/declare"], function (declare) {
|
|||
|
||||
Headlines.toggleUnread(id, 0);
|
||||
} else {
|
||||
Article.cdmScrollToId(id);
|
||||
Article.cdmMoveToId(id);
|
||||
}
|
||||
|
||||
} else if (in_body) {
|
||||
|
@ -333,7 +333,7 @@ define(["dojo/_base/declare"], function (declare) {
|
|||
ft.setAttribute("data-article-id", id);
|
||||
ft.innerHTML = header.innerHTML;
|
||||
|
||||
ft.select(".dijitCheckBox")[0].outerHTML = "<i class=\"material-icons icon-anchor\" onclick=\"Article.cdmScrollToId(" + id + ", true)\">expand_more</i>";
|
||||
ft.select(".dijitCheckBox")[0].outerHTML = "<i class=\"material-icons icon-anchor\" onclick=\"Article.cdmMoveToId(" + id + ")\">expand_more</i>";
|
||||
|
||||
this.initFloatingMenu();
|
||||
|
||||
|
@ -415,7 +415,7 @@ define(["dojo/_base/declare"], function (declare) {
|
|||
new_row.addClassName("active");
|
||||
|
||||
if (App.isCombinedMode())
|
||||
Article.cdmScrollToId(id, true, null, true);
|
||||
Article.cdmMoveToId(id, {noscroll: true});
|
||||
else
|
||||
Article.view(id);
|
||||
}
|
||||
|
@ -884,11 +884,11 @@ define(["dojo/_base/declare"], function (declare) {
|
|||
//const row = $("RROW-" + Article.getActive());
|
||||
const ctr = $("headlines-frame");
|
||||
|
||||
if (!noscroll) {
|
||||
Article.scroll(ctr.offsetHeight / 2, event);
|
||||
} else if (next_id) {
|
||||
if (noscroll) {
|
||||
Article.setActive(next_id);
|
||||
Article.cdmScrollToId(next_id, true, event);
|
||||
Article.cdmMoveToId(next_id, { event: event, noscroll: noscroll });
|
||||
} else if (next_id) {
|
||||
Article.scroll(ctr.offsetHeight / 2, event);
|
||||
}
|
||||
|
||||
} else if (next_id) {
|
||||
|
@ -906,15 +906,15 @@ define(["dojo/_base/declare"], function (declare) {
|
|||
//const prev_row = $("RROW-" + prev_id);
|
||||
const ctr = $("headlines-frame");
|
||||
|
||||
if (!noscroll) {
|
||||
Article.scroll(-ctr.offsetHeight / 2, event);
|
||||
} else {
|
||||
if (noscroll) {
|
||||
if (row && Math.round(row.offsetTop) < Math.round(ctr.scrollTop)) {
|
||||
Article.cdmScrollToId(Article.getActive(), noscroll, event);
|
||||
Article.cdmMoveToId(Article.getActive(), { force: noscroll, event: event });
|
||||
} else if (prev_id) {
|
||||
Article.setActive(prev_id);
|
||||
Article.cdmScrollToId(prev_id, noscroll, event);
|
||||
Article.cdmMoveToId(prev_id, { force: noscroll, event: event, noscroll: noscroll });
|
||||
}
|
||||
} else {
|
||||
Article.scroll(-ctr.offsetHeight / 2, event);
|
||||
}
|
||||
|
||||
} else if (prev_id) {
|
||||
|
|
|
@ -9,7 +9,7 @@ Plugins.Af_Readability = {
|
|||
content.innerHTML = content.getAttribute(self.orig_attr_name);
|
||||
content.removeAttribute(self.orig_attr_name);
|
||||
|
||||
if (App.isCombinedMode()) Article.cdmScrollToId(id);
|
||||
if (App.isCombinedMode()) Article.cdmMoveToId(id);
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ Plugins.Af_Readability = {
|
|||
content.innerHTML = reply.content;
|
||||
Notify.close();
|
||||
|
||||
if (App.isCombinedMode()) Article.cdmScrollToId(id);
|
||||
if (App.isCombinedMode()) Article.cdmMoveToId(id);
|
||||
|
||||
} else {
|
||||
Notify.error("Unable to fetch full text for this article");
|
||||
|
|
Loading…
Reference in New Issue