From 9c99281f20f938701f8645aad1d25412ca6538a7 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Tue, 16 Nov 2010 12:23:06 +0300 Subject: [PATCH] code cleanup --- backend.php | 3 +- feedlist.js | 82 +++----- functions.php | 393 ++++++++------------------------------- modules/popup-dialog.php | 4 +- tt-rss.css | 22 +-- tt-rss.js | 63 +++---- tt-rss.php | 12 +- viewfeed.js | 46 +---- 8 files changed, 144 insertions(+), 481 deletions(-) diff --git a/backend.php b/backend.php index c69a8ff5..9a1a4d71 100644 --- a/backend.php +++ b/backend.php @@ -162,7 +162,6 @@ case "feeds": $print_exec_time = true; - $tags = $_REQUEST["tags"]; $subop = $_REQUEST["subop"]; @@ -207,7 +206,7 @@ } - print json_encode(outputFeedList($link, $tags)); + print json_encode(outputFeedList($link)); break; // feeds diff --git a/feedlist.js b/feedlist.js index edf14c34..071887a1 100644 --- a/feedlist.js +++ b/feedlist.js @@ -224,61 +224,13 @@ function viewfeed(feed, subop, is_cat, offset) { } else { -// if (!page_offset) { - var feedr; - - if (is_cat) { - feedr = $('FCAP-' + feed); - } else { - feedr = $('FEEDR-' + feed); - } - - if (feedr && !$('FLL-' + feed)) { - - var img = $('FIMG-' + feed); - - if (!is_cat && img) { - - var cat_list = feedr.parentNode; - - if (!cat_list || Element.visible(cat_list)) { - if (!img.src.match("indicator_white")) { - img.alt = img.src; - img.src = getInitParam("sign_progress"); - } - } else if (cat_list) { - feed_cat_id = cat_list.id.replace("FCATLIST-", ""); - - if (!$('FLL-' + feed_cat_id)) { - - var ll = document.createElement('img'); - - ll.src = getInitParam("sign_progress_tiny"); - ll.className = 'hlLoading'; - ll.id = 'FLL-' + feed; - - $("FCAP-" + feed_cat_id).appendChild(ll); - } - } - - } else { - - if (!$('FLL-' + feed)) { - var ll = document.createElement('img'); - - ll.src = getInitParam("sign_progress_tiny"); - ll.className = 'hlLoading'; - ll.id = 'FLL-' + feed; - - feedr.appendChild(ll); - } - } - } -// } + if (!is_cat) + setFeedExpandoIcon(feed, is_cat, 'images/indicator_white.gif'); new Ajax.Request("backend.php", { parameters: query, onComplete: function(transport) { + setFeedExpandoIcon(feed, is_cat, 'images/blank_icon.gif'); headlines_callback2(transport, page_offset); } }); } @@ -406,11 +358,7 @@ function request_counters_real() { var query = "?op=rpc&subop=getAllCounters&seq=" + next_seq(); - if (tagsAreDisplayed()) { - query = query + "&omode=tl"; - } else { - query = query + "&omode=flc"; - } + query = query + "&omode=flc"; new Ajax.Request("backend.php", { parameters: query, @@ -892,6 +840,7 @@ function setFeedUnread(feed, is_cat, unread) { function setFeedValue(feed, is_cat, key, value) { try { if (!value) value = ''; + if (!treeModel) return; if (is_cat) treeItem = treeModel.store._itemsByIdentity['CAT:' + feed]; @@ -952,3 +901,24 @@ function setFeedIcon(feed, is_cat, src) { exception_error("setFeedIcon", e); } } + +function setFeedExpandoIcon(feed, is_cat, src) { + try { + var tree = dijit.byId("feedTree"); + + if (!tree) return; + + if (is_cat) + treeNode = tree._itemNodesMap['CAT:' + feed]; + else + treeNode = tree._itemNodesMap['FEED:' + feed]; + + if (treeNode) { + treeNode = treeNode[0]; + treeNode.expandoNode.src = src; + } + + } catch (e) { + exception_error("setFeedIcon", e); + } +} diff --git a/functions.php b/functions.php index 82f06e71..d56ed295 100644 --- a/functions.php +++ b/functions.php @@ -1672,82 +1672,6 @@ } } - function printFeedEntry($feed_id, $class, $feed_title, $unread, $icon_file, $link, - $rtl_content = false, $last_updated = false, $last_error = false, - $fg_content = false, $bg_content = false) { - - if (!$feed_title) $feed_title = getFeedTitle($link, $feed_id, false); - if (!$unread) $unread = getFeedUnread($link, $feed_id); - - if ($unread > 0) $class .= " Unread"; - - if (!$icon_file) $icon_file = getFeedIcon($feed_id); - - if (strpos($icon_file, "images") !== false) { - $icon_file = theme_image($link, $icon_file); - } - - if (file_exists($icon_file) && filesize($icon_file) > 0) { - $feed_icon = ""; - } else { - $feed_icon = ""; - } - - if ($rtl_content) { - $rtl_tag = "dir=\"rtl\""; - } else { - $rtl_tag = "dir=\"ltr\""; - } - - $error_notify_msg = ""; - - if ($last_error) { - $link_title = "Error: $last_error ($last_updated)"; - $error_notify_msg = "(Error)"; - } else if ($last_updated) { - $link_title = "Updated: $last_updated"; - } - - $feed_title = truncate_string($feed_title, 30); - - $feed = "$feed_title"; - -/* if ($feed_id < -10) { - $bg_color = "#00ccff"; - $fg_color = "white"; - } - - if ($fg_color || $bg_color) { - $color_str = "
l
"; - } - - print $color_str; */ - - print "
  • "; - print "$feed_icon"; - print "$feed"; - - if ($unread != 0) { - $fctr_class = "class=\"feedCtr Unread\""; - } else { - $fctr_class = "class=\"feedCtr\""; - } - - print " - ($unread)"; - - if (get_pref($link, "EXTENDED_FEEDLIST")) { - $total = getFeedArticles($link, $feed_id); - print "
    - $last_updated ($total total) $error_notify_msg
    "; - } - - print "
  • "; - - } - function getmicrotime() { list($usec, $sec) = explode(" ",microtime()); return ((float)$usec + (float)$sec); @@ -4147,47 +4071,6 @@ print " "; -/* print "". - __("Actions...") . "   - "; - - print ""; */ - print "