mirror of https://tt-rss.org/git/tt-rss.git
fix fatal error in previous because of event not being passed via Headlines.move()
scrollbypages, etc: make event optional anyway
This commit is contained in:
parent
e7dd634183
commit
44ef447c0f
|
@ -338,7 +338,7 @@ define(["dojo/_base/declare"], function (declare) {
|
||||||
elem = $("headlines-frame");
|
elem = $("headlines-frame");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.repeat) {
|
if (event && event.repeat) {
|
||||||
elem.addClassName("forbid-smooth-scroll");
|
elem.addClassName("forbid-smooth-scroll");
|
||||||
window.clearTimeout(this._scroll_reset_timeout);
|
window.clearTimeout(this._scroll_reset_timeout);
|
||||||
|
|
||||||
|
|
|
@ -806,7 +806,13 @@ define(["dojo/_base/declare"], function (declare) {
|
||||||
if (row)
|
if (row)
|
||||||
row.toggleClassName("published");
|
row.toggleClassName("published");
|
||||||
},
|
},
|
||||||
move: function (mode, noscroll, noexpand) {
|
move: function (mode, params) {
|
||||||
|
params = params || {};
|
||||||
|
|
||||||
|
const noscroll = params.noscroll || false;
|
||||||
|
const noexpand = params.noexpand || false;
|
||||||
|
const event = params.event;
|
||||||
|
|
||||||
const rows = Headlines.getLoaded();
|
const rows = Headlines.getLoaded();
|
||||||
|
|
||||||
let prev_id = false;
|
let prev_id = false;
|
||||||
|
@ -849,7 +855,7 @@ define(["dojo/_base/declare"], function (declare) {
|
||||||
if (!noscroll && article && article.offsetTop + article.offsetHeight >
|
if (!noscroll && article && article.offsetTop + article.offsetHeight >
|
||||||
ctr.scrollTop + ctr.offsetHeight) {
|
ctr.scrollTop + ctr.offsetHeight) {
|
||||||
|
|
||||||
Article.scroll(ctr.offsetHeight / 4);
|
Article.scroll(ctr.offsetHeight / 4, event);
|
||||||
|
|
||||||
} else if (next_id) {
|
} else if (next_id) {
|
||||||
Article.setActive(next_id);
|
Article.setActive(next_id);
|
||||||
|
@ -872,10 +878,10 @@ define(["dojo/_base/declare"], function (declare) {
|
||||||
const ctr = $("headlines-frame");
|
const ctr = $("headlines-frame");
|
||||||
|
|
||||||
if (!noscroll && article && article.offsetTop < ctr.scrollTop) {
|
if (!noscroll && article && article.offsetTop < ctr.scrollTop) {
|
||||||
Article.scroll(-ctr.offsetHeight / 3);
|
Article.scroll(-ctr.offsetHeight / 3, event);
|
||||||
} else if (!noscroll && prev_article &&
|
} else if (!noscroll && prev_article &&
|
||||||
prev_article.offsetTop < ctr.scrollTop) {
|
prev_article.offsetTop < ctr.scrollTop) {
|
||||||
Article.scroll(-ctr.offsetHeight / 4);
|
Article.scroll(-ctr.offsetHeight / 4, event);
|
||||||
} else if (prev_id) {
|
} else if (prev_id) {
|
||||||
Article.setActive(prev_id);
|
Article.setActive(prev_id);
|
||||||
Article.cdmScrollToId(prev_id, noscroll);
|
Article.cdmScrollToId(prev_id, noscroll);
|
||||||
|
@ -1387,7 +1393,7 @@ define(["dojo/_base/declare"], function (declare) {
|
||||||
scrollByPages: function (offset, event) {
|
scrollByPages: function (offset, event) {
|
||||||
const elem = $("headlines-frame");
|
const elem = $("headlines-frame");
|
||||||
|
|
||||||
if (event.repeat) {
|
if (event && event.repeat) {
|
||||||
elem.addClassName("forbid-smooth-scroll");
|
elem.addClassName("forbid-smooth-scroll");
|
||||||
window.clearTimeout(this._scroll_reset_timeout);
|
window.clearTimeout(this._scroll_reset_timeout);
|
||||||
|
|
||||||
|
|
24
js/tt-rss.js
24
js/tt-rss.js
|
@ -277,23 +277,23 @@ require(["dojo/_base/kernel",
|
||||||
|
|
||||||
if (rv) Feeds.open({feed: rv[0], is_cat: rv[1], delayed: true})
|
if (rv) Feeds.open({feed: rv[0], is_cat: rv[1], delayed: true})
|
||||||
};
|
};
|
||||||
this.hotkey_actions["next_article"] = function () {
|
this.hotkey_actions["next_article"] = function (event) {
|
||||||
Headlines.move('next');
|
Headlines.move('next', {event: event});
|
||||||
};
|
};
|
||||||
this.hotkey_actions["prev_article"] = function () {
|
this.hotkey_actions["prev_article"] = function (event) {
|
||||||
Headlines.move('prev');
|
Headlines.move('prev', {event: event});
|
||||||
};
|
};
|
||||||
this.hotkey_actions["next_article_noscroll"] = function () {
|
this.hotkey_actions["next_article_noscroll"] = function (event) {
|
||||||
Headlines.move('next', true);
|
Headlines.move('next', {noscroll: true, event: event});
|
||||||
};
|
};
|
||||||
this.hotkey_actions["prev_article_noscroll"] = function () {
|
this.hotkey_actions["prev_article_noscroll"] = function (event) {
|
||||||
Headlines.move('prev', true);
|
Headlines.move('prev', {noscroll: true, event: event});
|
||||||
};
|
};
|
||||||
this.hotkey_actions["next_article_noexpand"] = function () {
|
this.hotkey_actions["next_article_noexpand"] = function (event) {
|
||||||
Headlines.move('next', true, true);
|
Headlines.move('next', {noscroll: true, noexpand: true, event: event});
|
||||||
};
|
};
|
||||||
this.hotkey_actions["prev_article_noexpand"] = function () {
|
this.hotkey_actions["prev_article_noexpand"] = function (event) {
|
||||||
Headlines.move('prev', true, true);
|
Headlines.move('prev', {noscroll: true, noexpand: true, event: event});
|
||||||
};
|
};
|
||||||
this.hotkey_actions["search_dialog"] = function () {
|
this.hotkey_actions["search_dialog"] = function () {
|
||||||
Feeds.search();
|
Feeds.search();
|
||||||
|
|
Loading…
Reference in New Issue