diff options
Diffstat (limited to 'js')
-rw-r--r-- | js/FeedTree.js | 70 | ||||
-rw-r--r-- | js/feedlist.js | 6 | ||||
-rw-r--r-- | js/prefs.js | 15 | ||||
-rw-r--r-- | js/tt-rss.js | 38 | ||||
-rw-r--r-- | js/viewfeed.js | 58 |
5 files changed, 131 insertions, 56 deletions
diff --git a/js/FeedTree.js b/js/FeedTree.js index fbddb708f..e35417daf 100644 --- a/js/FeedTree.js +++ b/js/FeedTree.js @@ -184,10 +184,60 @@ dojo.declare("fox.FeedTree", dijit.Tree, { tnode._menu = menu; } + ctr = dojo.doc.createElement('span'); + ctr.className = 'counterNode'; + ctr.innerHTML = args.item.unread > 0 ? args.item.unread : args.item.auxcounter; + + //args.item.unread > 0 ? ctr.addClassName("unread") : ctr.removeClassName("unread"); + + args.item.unread > 0 || args.item.auxcounter > 0 ? Element.show(ctr) : Element.hide(ctr); + + args.item.unread == 0 && args.item.auxcounter > 0 ? ctr.addClassName("aux") : ctr.removeClassName("aux"); + + dojo.place(ctr, tnode.rowNode, 'first'); + tnode.counterNode = ctr; //tnode.labelNode.innerHTML = args.label; return tnode; }, + postCreate: function() { + this.connect(this.model, "onChange", "updateCounter"); + this.connect(this, "_expandNode", function() { + this.hideRead(getInitParam("hide_read_feeds"), getInitParam("hide_read_shows_special")); + }); + + this.inherited(arguments); + }, + updateCounter: function (item) { + var tree = this; + + //console.log("updateCounter: " + item.id[0] + " " + item.unread + " " + tree); + + var node = tree._itemNodesMap[item.id]; + + if (node) { + node = node[0]; + + if (node.counterNode) { + ctr = node.counterNode; + ctr.innerHTML = item.unread > 0 ? item.unread : item.auxcounter; + item.unread > 0 || item.auxcounter > 0 ? + Effect.Appear(ctr, {duration : 0.3, + queue: { position: 'end', scope: 'CAPPEAR-' + item.id, limit: 1 }}) : + Element.hide(ctr); + + item.unread == 0 && item.auxcounter > 0 ? ctr.addClassName("aux") : ctr.removeClassName("aux"); + + } + } + + }, + getTooltip: function (item) { + if (item.updated) + return item.updated; + else + return ""; + }, getIconClass: function (item, opened) { return (!item || this.model.mayHaveChildren(item)) ? (opened ? "dijitFolderOpened" : "dijitFolderClosed") : "feedIcon"; }, @@ -195,8 +245,12 @@ dojo.declare("fox.FeedTree", dijit.Tree, { return (item.unread == 0) ? "dijitTreeLabel" : "dijitTreeLabel Unread"; }, getRowClass: function (item, opened) { - return (!item.error || item.error == '') ? "dijitTreeRow" : + var rc = (!item.error || item.error == '') ? "dijitTreeRow" : "dijitTreeRow Error"; + + if (item.unread > 0) rc += " Unread"; + + return rc; }, getLabel: function(item) { var name = String(item.name); @@ -208,15 +262,15 @@ dojo.declare("fox.FeedTree", dijit.Tree, { name = name.replace(/</g, "<"); name = name.replace(/>/g, ">"); - var label; + /* var label; if (item.unread > 0) { label = name + " (" + item.unread + ")"; } else { label = name; - } + } */ - return label; + return name; }, expandParentNodes: function(feed, is_cat, list) { try { @@ -307,11 +361,9 @@ dojo.declare("fox.FeedTree", dijit.Tree, { if (treeNode) { treeNode = treeNode[0]; - if (is_cat) { - if (treeNode.loadingNode) { - treeNode.loadingNode.src = src; - return true; - } + if (treeNode.loadingNode) { + treeNode.loadingNode.src = src; + return true; } else { treeNode.expandoNode.src = src; return true; diff --git a/js/feedlist.js b/js/feedlist.js index 2c1acc310..84b561227 100644 --- a/js/feedlist.js +++ b/js/feedlist.js @@ -151,6 +151,8 @@ function feedlist_init() { try { console.log("in feedlist init"); + loading_set_progress(50); + document.onkeydown = hotkey_handler; setTimeout("hotkey_prefix_timeout()", 5*1000); @@ -217,6 +219,7 @@ function parse_counters(elems, scheduled_call) { var error = elems[l].error; var has_img = elems[l].has_img; var updated = elems[l].updated; + var auxctr = parseInt(elems[l].auxcounter); if (id == "global-unread") { global_unread = ctr; @@ -234,6 +237,7 @@ function parse_counters(elems, scheduled_call) { } setFeedUnread(id, (kind == "cat"), ctr); + setFeedValue(id, (kind == "cat"), 'auxcounter', auxctr); if (kind != "cat") { setFeedValue(id, false, 'error', error); @@ -416,7 +420,7 @@ function catchupFeed(feed, is_cat, mode) { case "1week": str = __("Mark all articles in %s older than 1 week as read?"); break; - case "2weeks": + case "2week": str = __("Mark all articles in %s older than 2 weeks as read?"); break; default: diff --git a/js/prefs.js b/js/prefs.js index 4346054ef..e226459fc 100644 --- a/js/prefs.js +++ b/js/prefs.js @@ -1610,21 +1610,6 @@ function resetCatOrder() { } } -function toggleHiddenFeedCats() { - try { - notify_progress("Loading, please wait..."); - - new Ajax.Request("backend.php", { - parameters: "?op=pref-feeds&method=togglehiddenfeedcats", - onComplete: function(transport) { - updateFeedList(); - } }); - - } catch (e) { - exception_error("toggleHiddenFeedCats"); - } -} - function editCat(id, item, event) { try { var new_name = prompt(__('Rename category to:'), item.name); diff --git a/js/tt-rss.js b/js/tt-rss.js index c6c0c13dd..e3731c0cb 100644 --- a/js/tt-rss.js +++ b/js/tt-rss.js @@ -116,6 +116,7 @@ function updateFeedList() { tree.startup(); + } catch (e) { exception_error("updateFeedList", e); } @@ -249,7 +250,7 @@ function init() { if (!genericSanityCheck()) return false; - loading_set_progress(20); + loading_set_progress(30); var a = document.createElement('audio'); @@ -547,11 +548,37 @@ function init_second_stage() { closeArticlePanel(); _widescreen_mode = getInitParam("widescreen"); + switchPanelMode(_widescreen_mode); - if (_widescreen_mode) { - switchPanelMode(_widescreen_mode); + if (parseInt(getCookie("ttrss_fh_width")) > 0) { + dijit.byId("feeds-holder").domNode.setStyle( + {width: getCookie("ttrss_fh_width") + "px" }); } + if (parseInt(getCookie("ttrss_ci_width")) > 0) { + if (_widescreen_mode) { + dijit.byId("content-insert").domNode.setStyle( + {width: getCookie("ttrss_ci_width") + "px" }); + + } else { + dijit.byId("content-insert").domNode.setStyle( + {height: getCookie("ttrss_ci_height") + "px" }); + } + } + + dijit.byId("main").resize(); + + var tmph = dojo.connect(dijit.byId('feeds-holder'), 'resize', + function (args) { + setCookie("ttrss_fh_width", args.w, getInitParam("cookie_lifetime")); + }); + + var tmph = dojo.connect(dijit.byId('content-insert'), 'resize', + function (args) { + setCookie("ttrss_ci_width", args.w, getInitParam("cookie_lifetime")); + setCookie("ttrss_ci_height", args.h, getInitParam("cookie_lifetime")); + }); + }); delCookie("ttrss_test"); @@ -573,7 +600,7 @@ function init_second_stage() { setActiveFeedId(hash_feed_id, hash_feed_is_cat); } - loading_set_progress(30); + loading_set_progress(50); // can't use cache_clear() here because viewfeed might not have initialized yet if ('sessionStorage' in window && window['sessionStorage'] !== null) @@ -1033,6 +1060,7 @@ function switchPanelMode(wide) { borderTopWidth: '0px' }); $("headlines-toolbar").setStyle({ borderBottomWidth: '0px' }); + $("headlines-frame").setStyle({ borderBottomWidth: '0px' }); } else { @@ -1044,6 +1072,8 @@ function switchPanelMode(wide) { borderTopWidth: '1px'}); $("headlines-toolbar").setStyle({ borderBottomWidth: '1px' }); + + $("headlines-frame").setStyle({ borderBottomWidth: '1px' }); } closeArticlePanel(); diff --git a/js/viewfeed.js b/js/viewfeed.js index ada225cbf..095bfab22 100644 --- a/js/viewfeed.js +++ b/js/viewfeed.js @@ -20,8 +20,6 @@ function headlines_callback2(transport, offset, background, infscroll_req) { try { handle_rpc_json(transport); - loading_set_progress(25); - console.log("headlines_callback2 [offset=" + offset + "] B:" + background + " I:" + infscroll_req); var is_cat = false; @@ -60,6 +58,11 @@ function headlines_callback2(transport, offset, background, infscroll_req) { } } catch (e) { }; + $("headlines-frame").removeClassName("cdm"); + $("headlines-frame").removeClassName("normal"); + + $("headlines-frame").addClassName(isCdmMode() ? "cdm" : "normal"); + var headlines_count = reply['headlines-info']['count']; vgroup_last_feed = reply['headlines-info']['vgroup_last_feed']; @@ -136,8 +139,6 @@ function headlines_callback2(transport, offset, background, infscroll_req) { if (!hsp) hsp = new Element("DIV", {"id": "headlines-spacer"}); - fixHeadlinesOrder(getLoadedArticleIds()); - if (getInitParam("cdm_auto_catchup") == 1) { c.domNode.appendChild(hsp); } @@ -1239,6 +1240,29 @@ function headlines_scroll_handler(e) { unpackVisibleHeadlines(); + // set topmost child in the buffer as active + if (getInitParam("cdm_auto_catchup") == 1) { + var rows = $$("#headlines-frame > div[id*=RROW]"); + + for (var i = 0; i < rows.length; i++) { + var child = rows[i]; + + if ($("headlines-frame").scrollTop < child.offsetTop && + child.offsetTop - $("headlines-frame").scrollTop < 100) { + + if (_active_article_id) { + var row = $("RROW-" + _active_article_id); + if (row) row.removeClassName("active"); + } + + _active_article_id = child.id.replace("RROW-", ""); + showArticleInHeadlines(_active_article_id, true); + updateSelectedPrompt(); + break; + } + } + } + if (!_infscroll_disable) { if ((hsp && e.scrollTop + e.offsetHeight >= hsp.offsetTop - hsp.offsetHeight) || (e.scrollHeight != 0 && @@ -1274,6 +1298,7 @@ function headlines_scroll_handler(e) { //console.log("auto_catchup_batch: " + catchup_id_batch.toString()); } + }); if (catchup_id_batch.length > 0) { @@ -1418,6 +1443,8 @@ function cdmCollapseArticle(event, id, unmark) { if (id == getActiveArticleId()) { setActiveArticleId(0); } + + updateSelectedPrompt(); } if (event) Event.stop(event); @@ -1498,26 +1525,6 @@ function cdmExpandArticle(id, noexpand) { return false; } -function fixHeadlinesOrder(ids) { - try { - for (var i = 0; i < ids.length; i++) { - var e = $("RROW-" + ids[i]); - - if (e) { - if (i % 2 == 0) { - e.removeClassName("even"); - e.addClassName("odd"); - } else { - e.removeClassName("odd"); - e.addClassName("even"); - } - } - } - } catch (e) { - exception_error("fixHeadlinesOrder", e); - } -} - function getArticleUnderPointer() { return post_under_pointer; } @@ -1598,7 +1605,6 @@ function dismissSelectedArticles() { if (sel.length > 0) selectionToggleUnread(false); - fixHeadlinesOrder(tmp); } catch (e) { exception_error("dismissSelectedArticles", e); @@ -1623,8 +1629,6 @@ function dismissReadArticles() { } } - fixHeadlinesOrder(tmp); - } catch (e) { exception_error("dismissSelectedArticles", e); } |