From c97c755195c1d58a550078500fc0427905e5d71c Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Mon, 10 Dec 2018 20:56:09 +0300 Subject: [PATCH] remove _active_article_id; use selector instead --- js/Article.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/js/Article.js b/js/Article.js index 9aea53b35..0af8a0d55 100644 --- a/js/Article.js +++ b/js/Article.js @@ -2,7 +2,6 @@ /* global __, ngettext */ define(["dojo/_base/declare"], function (declare) { Article = { - _active_article_id: 0, selectionSetScore: function () { const ids = Headlines.getSelected(); @@ -290,8 +289,6 @@ define(["dojo/_base/declare"], function (declare) { } }); - this._active_article_id = id; - const row = $("RROW-" + id); if (row) { @@ -308,13 +305,18 @@ define(["dojo/_base/declare"], function (declare) { 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(); }, 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) { if (!App.isCombinedMode()) {