headlines onLoaded: make sure a few more things respect append instead of offset == 0

This commit is contained in:
Andrew Dolgov 2018-12-18 07:51:00 +03:00
parent 59d1fd481d
commit dee210e546
1 changed files with 18 additions and 19 deletions

View File

@ -539,9 +539,6 @@ define(["dojo/_base/declare"], function (declare) {
if (reply) { if (reply) {
if (offset == 0)
Article.setActive(0);
is_cat = reply['headlines']['is_cat']; is_cat = reply['headlines']['is_cat'];
feed_id = reply['headlines']['id']; feed_id = reply['headlines']['id'];
Feeds.last_search_query = reply['headlines']['search_query']; Feeds.last_search_query = reply['headlines']['search_query'];
@ -549,22 +546,6 @@ define(["dojo/_base/declare"], function (declare) {
if (feed_id != -7 && (feed_id != Feeds.getActive() || is_cat != Feeds.activeIsCat())) if (feed_id != -7 && (feed_id != Feeds.getActive() || is_cat != Feeds.activeIsCat()))
return; return;
try {
if (offset == 0) {
$("headlines-frame").scrollTop = 0;
Element.hide("floatingTitle");
$("floatingTitle").setAttribute("data-article-id", 0);
$("floatingTitle").innerHTML = "";
}
} catch (e) {
}
$("headlines-frame").removeClassName("cdm");
$("headlines-frame").removeClassName("normal");
$("headlines-frame").addClassName(App.isCombinedMode() ? "cdm" : "normal");
const headlines_count = reply['headlines-info']['count']; const headlines_count = reply['headlines-info']['count'];
Feeds.infscroll_disabled = parseInt(headlines_count) != 30; Feeds.infscroll_disabled = parseInt(headlines_count) != 30;
@ -574,6 +555,24 @@ define(["dojo/_base/declare"], function (declare) {
this.current_first_id = reply['headlines']['first_id']; this.current_first_id = reply['headlines']['first_id'];
if (!append) { if (!append) {
$("headlines-frame").removeClassName("cdm");
$("headlines-frame").removeClassName("normal");
$("headlines-frame").addClassName(App.isCombinedMode() ? "cdm" : "normal");
Article.setActive(0);
try {
$("headlines-frame").scrollTop = 0;
Element.hide("floatingTitle");
$("floatingTitle").setAttribute("data-article-id", 0);
$("floatingTitle").innerHTML = "";
} catch (e) {
console.warn(e);
}
//this.headlines = []; //this.headlines = [];
this.vgroup_last_feed = undefined; this.vgroup_last_feed = undefined;