From: Andrew Dolgov Date: Tue, 16 Nov 2010 06:49:00 +0000 (+0300) Subject: show icons in feedlist X-Git-Tag: 1.5.0~212 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=2ef5c21f61faba21a33ea60058f0aa0d5ebd2620;p=tt-rss.git show icons in feedlist --- diff --git a/feedlist.js b/feedlist.js index f906c37e..c3860da5 100644 --- a/feedlist.js +++ b/feedlist.js @@ -506,6 +506,15 @@ function parse_counters(reply, scheduled_call) { if (kind != "cat") { //setFeedValue(id, false, 'error', error); setFeedValue(id, false, 'updated', updated); + + if (id > 0) { + if (has_img) { + setFeedIcon(id, false, + getInitParam("icons_url") + "/" + id + ".ico"); + } else { + setFeedIcon(id, false, 'images/blank_icon.gif'); + } + } } } @@ -915,3 +924,22 @@ function selectFeed(feed, is_cat) { exception_error("selectFeed", e); } } + +function setFeedIcon(feed, is_cat, src) { + try { + var tree = dijit.byId("feedTree"); + + if (is_cat) + treeNode = tree._itemNodesMap['CAT:' + feed]; + else + treeNode = tree._itemNodesMap['FEED:' + feed]; + + if (treeNode) { + treeNode = treeNode[0]; + treeNode.iconNode.src = src; + } + + } catch (e) { + exception_error("setFeedIcon", e); + } +} diff --git a/functions.php b/functions.php index 94cb9ced..82f06e71 100644 --- a/functions.php +++ b/functions.php @@ -7215,6 +7215,7 @@ $obj['type'] = 'feed'; $obj['error'] = $error; $obj['updated'] = $updated; + $obj['icon'] = getFeedIcon($feed_id); return $obj; } diff --git a/tt-rss.css b/tt-rss.css index 017ce6f6..35d1095d 100644 --- a/tt-rss.css +++ b/tt-rss.css @@ -1514,3 +1514,8 @@ div.fatalError textarea { .dijitTreeRow.Hidden { display : none; } + +img.feedIcon { + max-width : 16px; + max-height : 16px; +} diff --git a/tt-rss.js b/tt-rss.js index 5a7fc3ee..f7beba47 100644 --- a/tt-rss.js +++ b/tt-rss.js @@ -270,9 +270,16 @@ function init() { model: treeModel, _createTreeNode: function(args) { var tnode = new dijit._TreeNode(args); - tnode.labelNode.innerHTML = args.label; + + if (args.item.icon) + tnode.iconNode.src = args.item.icon[0]; + + //tnode.labelNode.innerHTML = args.label; return tnode; }, + getIconClass: function (item, opened) { + return (!item || this.model.mayHaveChildren(item)) ? (opened ? "dijitFolderOpened" : "dijitFolderClosed") : "feedIcon"; + }, getLabelClass: function (item, opened) { return (item.unread == 0) ? "dijitTreeLabel" : "dijitTreeLabel Unread"; },