remove _active_article_id; use selector instead

This commit is contained in:
Andrew Dolgov 2018-12-10 20:56:09 +03:00
parent d9bf0f17c6
commit c97c755195
1 changed files with 7 additions and 5 deletions

View File

@ -2,7 +2,6 @@
/* global __, ngettext */ /* global __, ngettext */
define(["dojo/_base/declare"], function (declare) { define(["dojo/_base/declare"], function (declare) {
Article = { Article = {
_active_article_id: 0,
selectionSetScore: function () { selectionSetScore: function () {
const ids = Headlines.getSelected(); const ids = Headlines.getSelected();
@ -290,8 +289,6 @@ define(["dojo/_base/declare"], function (declare) {
} }
}); });
this._active_article_id = id;
const row = $("RROW-" + id); const row = $("RROW-" + id);
if (row) { if (row) {
@ -308,13 +305,18 @@ define(["dojo/_base/declare"], function (declare) {
if (cb) cb.attr("checked", true); if (cb) cb.attr("checked", true);
} }
PluginHost.run(PluginHost.HOOK_ARTICLE_SET_ACTIVE, this._active_article_id); PluginHost.run(PluginHost.HOOK_ARTICLE_SET_ACTIVE, row.getAttribute("data-article-id"));
} }
//Headlines.updateSelectedPrompt(); //Headlines.updateSelectedPrompt();
}, },
getActive: function () { getActive: function () {
return this._active_article_id; const row = document.querySelector("#headlines-frame > div[id*=RROW][class*=active]");
if (row)
return row.getAttribute("data-article-id");
else
return 0;
}, },
scroll: function (offset) { scroll: function (offset) {
if (!App.isCombinedMode()) { if (!App.isCombinedMode()) {