diff options
Diffstat (limited to 'js')
-rw-r--r-- | js/feedlist.js | 8 | ||||
-rwxr-xr-x[-rw-r--r--] | js/functions.js | 112 | ||||
-rwxr-xr-x[-rw-r--r--] | js/prefs.js | 12 | ||||
-rw-r--r-- | js/tt-rss.js | 6 | ||||
-rwxr-xr-x[-rw-r--r--] | js/viewfeed.js | 29 |
5 files changed, 138 insertions, 29 deletions
diff --git a/js/feedlist.js b/js/feedlist.js index 7a5996a87..d14d3e5ca 100644 --- a/js/feedlist.js +++ b/js/feedlist.js @@ -35,7 +35,8 @@ function loadMoreHeadlines() { offset = unread_in_buffer; } else if (_search_query) { offset = num_all; - } else if (view_mode == "adaptive") { + } else if (view_mode == "adaptive" && !(getActiveFeedId() == -1 && !activeFeedIsCat())) { + // ^ starred feed shows both unread & read articles in adaptive mode offset = num_unread > 0 ? unread_in_buffer : num_all; } else { offset = num_all; @@ -59,6 +60,7 @@ function viewfeed(params) { var infscroll_req = params.infscroll_req; var can_wait = params.can_wait; var viewfeed_debug = params.viewfeed_debug; + var method = params.method; if (is_cat == undefined) is_cat = false; @@ -102,6 +104,8 @@ function viewfeed(params) { var query = "?op=feeds&method=view&feed=" + param_escape(feed) + "&" + toolbar_query; + if (method) query += "&m=" + param_escape(method); + if (offset > 0) { if (current_first_id) { query = query + "&fid=" + param_escape(current_first_id); @@ -123,7 +127,7 @@ function viewfeed(params) { query = query + "&vgrlf=" + param_escape(vgroup_last_feed); } } else { - if (!is_cat && feed == getActiveFeedId()) { + if (!is_cat && feed == getActiveFeedId() && !params.method) { query = query + "&m=ForceUpdate"; } } diff --git a/js/functions.js b/js/functions.js index 8e5694960..24e585847 100644..100755 --- a/js/functions.js +++ b/js/functions.js @@ -1051,6 +1051,100 @@ function addFilterAction(replaceNode, actionStr) { } } +function editFilterTest(query) { + try { + + if (dijit.byId("filterTestDlg")) + dijit.byId("filterTestDlg").destroyRecursive(); + + var test_dlg = new dijit.Dialog({ + id: "filterTestDlg", + title: "Test Filter", + style: "width: 600px", + results: 0, + limit: 100, + max_offset: 10000, + getTestResults: function(query, offset) { + var updquery = query + "&offset=" + offset + "&limit=" + test_dlg.limit; + + console.log("getTestResults:" + offset); + + new Ajax.Request("backend.php", { + parameters: updquery, + onComplete: function (transport) { + try { + var result = JSON.parse(transport.responseText); + + if (result && dijit.byId("filterTestDlg") && dijit.byId("filterTestDlg").open) { + test_dlg.results += result.size(); + + console.log("got results:" + result.size()); + + $("prefFilterProgressMsg").innerHTML = __("Looking for articles (%d processed, %f found)...") + .replace("%f", test_dlg.results) + .replace("%d", offset); + + console.log(offset + " " + test_dlg.max_offset); + + for (var i = 0; i < result.size(); i++) { + var tmp = new Element("table"); + tmp.innerHTML = result[i]; + dojo.parser.parse(tmp); + + $("prefFilterTestResultList").innerHTML += tmp.innerHTML; + } + + if (test_dlg.results < 30 && offset < test_dlg.max_offset) { + + // get the next batch + window.setTimeout(function () { + test_dlg.getTestResults(query, offset + test_dlg.limit); + }, 0); + + } else { + // all done + + Element.hide("prefFilterLoadingIndicator"); + + if (test_dlg.results == 0) { + $("prefFilterTestResultList").innerHTML = "<tr><td align='center'>No recent articles matching this filter have been found.</td></tr>"; + $("prefFilterProgressMsg").innerHTML = "Articles matching this filter:"; + } else { + $("prefFilterProgressMsg").innerHTML = __("Found %d articles matching this filter:") + .replace("%d", test_dlg.results); + } + + } + + } else if (!result) { + console.log("getTestResults: can't parse results object"); + + Element.hide("prefFilterLoadingIndicator"); + + notify_error("Error while trying to get filter test results."); + + } else { + console.log("getTestResults: dialog closed, bailing out."); + } + } catch (e) { + exception_error("editFilterTest/inner", e); + } + + } }); + }, + href: query}); + + dojo.connect(test_dlg, "onLoad", null, function(e) { + test_dlg.getTestResults(query, 0); + }); + + test_dlg.show(); + + } catch (e) { + exception_error("editFilterTest", e); + } +} + function quickAddFilter() { try { var query = ""; @@ -1077,16 +1171,7 @@ function quickAddFilter() { test: function() { var query = "backend.php?" + dojo.formToQuery("filter_new_form") + "&savemode=test"; - if (dijit.byId("filterTestDlg")) - dijit.byId("filterTestDlg").destroyRecursive(); - - var test_dlg = new dijit.Dialog({ - id: "filterTestDlg", - title: "Test Filter", - style: "width: 600px", - href: query}); - - test_dlg.show(); + editFilterTest(query); }, selectRules: function(select) { $$("#filterDlg_Matches input[type=checkbox]").each(function(e) { @@ -1968,3 +2053,10 @@ function getSelectionText() { return text.stripTags(); } + +function openArticlePopup(id) { + window.open("backend.php?op=article&method=view&mode=raw&html=1&zoom=1&id=" + id + + "&csrf_token=" + getInitParam("csrf_token"), + "ttrss_article_popup", + "height=900,width=900,resizable=yes,status=no,location=no,menubar=no,directories=no,scrollbars=yes,toolbar=no"); +}
\ No newline at end of file diff --git a/js/prefs.js b/js/prefs.js index 66288764a..ddcdbe351 100644..100755 --- a/js/prefs.js +++ b/js/prefs.js @@ -146,19 +146,11 @@ function editFilter(id) { id: "filterEditDlg", title: __("Edit Filter"), style: "width: 600px", + test: function() { var query = "backend.php?" + dojo.formToQuery("filter_edit_form") + "&savemode=test"; - if (dijit.byId("filterTestDlg")) - dijit.byId("filterTestDlg").destroyRecursive(); - - var test_dlg = new dijit.Dialog({ - id: "filterTestDlg", - title: "Test Filter", - style: "width: 600px", - href: query}); - - test_dlg.show(); + editFilterTest(query); }, selectRules: function(select) { $$("#filterDlg_Matches input[type=checkbox]").each(function(e) { diff --git a/js/tt-rss.js b/js/tt-rss.js index 2dbf8a3b5..5261485ae 100644 --- a/js/tt-rss.js +++ b/js/tt-rss.js @@ -146,11 +146,11 @@ function catchupAllFeeds() { } } -function viewCurrentFeed() { - console.log("viewCurrentFeed"); +function viewCurrentFeed(method) { + console.log("viewCurrentFeed: " + method); if (getActiveFeedId() != undefined) { - viewfeed({feed: getActiveFeedId(), is_cat: activeFeedIsCat()}); + viewfeed({feed: getActiveFeedId(), is_cat: activeFeedIsCat(), method: method}); } return false; // block unneeded form submits } diff --git a/js/viewfeed.js b/js/viewfeed.js index c079586a2..3b647e080 100644..100755 --- a/js/viewfeed.js +++ b/js/viewfeed.js @@ -92,13 +92,29 @@ function headlines_callback2(transport, offset, background, infscroll_req) { reply['headlines']['toolbar'], {parseContent: true}); - dojo.html.set($("headlines-frame"), + /*dojo.html.set($("headlines-frame"), reply['headlines']['content'], {parseContent: true}); $$("#headlines-frame div[id*='RROW']").each(function(row) { loaded_article_ids.push(row.id); - }); + });*/ + + $("headlines-frame").innerHTML = ''; + + var tmp = new Element("div"); + tmp.innerHTML = reply['headlines']['content']; + dojo.parser.parse(tmp); + + while (tmp.hasChildNodes()) { + var row = tmp.removeChild(tmp.firstChild); + + if (loaded_article_ids.indexOf(row.id) == -1 || row.hasClassName("cdmFeedTitle")) { + dijit.byId("headlines-frame").domNode.appendChild(row); + + loaded_article_ids.push(row.id); + } + } var hsp = $("headlines-spacer"); if (!hsp) hsp = new Element("DIV", {"id": "headlines-spacer"}); @@ -138,8 +154,7 @@ function headlines_callback2(transport, offset, background, infscroll_req) { if (loaded_article_ids.indexOf(row.id) == -1 || row.hasClassName("cdmFeedTitle")) { dijit.byId("headlines-frame").domNode.appendChild(row); - //Element.hide(row); - //new Effect.Appear(row, {duration:0.5}); + loaded_article_ids.push(row.id); } } @@ -2185,6 +2200,12 @@ function initHeadlinesMenu() { catchupFeedInGroup(menu.callerRowId); }})); + menu.addChild(new dijit.MenuItem({ + label: __("Edit feed"), + onClick: function(event) { + editFeed(menu.callerRowId); + }})); + menu.startup(); } |