summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2017-02-13 22:45:30 +0300
committerAndrew Dolgov <[email protected]>2017-02-13 22:45:30 +0300
commit20deb5fc3262a60a28739542152ea84174587586 (patch)
treecba57593cf2b0994309ebe9f8c7db5c21a25d255 /js
parent61570c474b432fde7f092326ef867364c0939ecd (diff)
cdmcollapse/expand: use less convoluted selector queries
Diffstat (limited to 'js')
-rwxr-xr-xjs/viewfeed.js19
1 files changed, 9 insertions, 10 deletions
diff --git a/js/viewfeed.js b/js/viewfeed.js
index dfbf8bced..15cd2e304 100755
--- a/js/viewfeed.js
+++ b/js/viewfeed.js
@@ -1492,8 +1492,7 @@ function cdmCollapseArticle(event, id, unmark) {
var elem = $("CICD-" + id);
if (elem && row) {
- var collapse = $$("div#RROW-" + id +
- " span[class='collapseBtn']")[0];
+ var collapse = row.select("span[class='collapseBtn']")[0];
Element.hide(elem);
Element.show("CEXC-" + id);
@@ -1531,7 +1530,9 @@ function cdmExpandArticle(id, noexpand) {
try {
console.log("cdmExpandArticle " + id);
- if (!$("RROW-" + id)) return false;
+ var row = $("RROW-" + id);
+
+ if (!row) return false;
var oldrow = $("RROW-" + getActiveArticleId());
@@ -1542,11 +1543,10 @@ function cdmExpandArticle(id, noexpand) {
selectArticles("none");
- var old_offset = $("RROW-" + id).offsetTop;
+ var old_offset = row.offsetTop;
if (getActiveArticleId() && elem && !getInitParam("cdm_expanded")) {
- var collapse = $$("div#RROW-" + getActiveArticleId() +
- " span[class='collapseBtn']")[0];
+ var collapse = oldrow.select("span[class='collapseBtn']")[0];
Element.hide(elem);
Element.show("CEXC-" + getActiveArticleId());
@@ -1559,8 +1559,7 @@ function cdmExpandArticle(id, noexpand) {
elem = $("CICD-" + id);
- var collapse = $$("div#RROW-" + id +
- " span[class='collapseBtn']")[0];
+ var collapse = row.select("span[class='collapseBtn']")[0];
var cencw = $("CENCW-" + id);
@@ -1576,7 +1575,7 @@ function cdmExpandArticle(id, noexpand) {
Element.show(collapse);
}
- var new_offset = $("RROW-" + id).offsetTop;
+ var new_offset = row.offsetTop;
if (old_offset > new_offset)
$("headlines-frame").scrollTop -= (old_offset-new_offset);
@@ -1589,7 +1588,7 @@ function cdmExpandArticle(id, noexpand) {
}
toggleSelected(id);
- $("RROW-" + id).addClassName("active");
+ row.addClassName("active");
PluginHost.run(PluginHost.HOOK_ARTICLE_EXPANDED, id);