Feeds: shorten some method names
finally rename "view as rss"
This commit is contained in:
parent
6e625555c9
commit
0a18d0b1ed
|
@ -877,7 +877,7 @@ class Article extends Handler_Protected {
|
|||
$tags_str = "";
|
||||
|
||||
for ($i = 0; $i < $maxtags; $i++) {
|
||||
$tags_str .= "<a class=\"tag\" href=\"#\" onclick=\"Feeds.viewfeed({feed:'".$tags[$i]."'})\">" . $tags[$i] . "</a>, ";
|
||||
$tags_str .= "<a class=\"tag\" href=\"#\" onclick=\"Feeds.open({feed:'".$tags[$i]."'})\">" . $tags[$i] . "</a>, ";
|
||||
}
|
||||
|
||||
$tags_str = mb_substr($tags_str, 0, mb_strlen($tags_str)-2);
|
||||
|
|
|
@ -139,7 +139,7 @@ class Dlg extends Handler_Protected {
|
|||
|
||||
$key_escaped = str_replace("'", "\\'", $key);
|
||||
|
||||
echo "<a href=\"#\" onclick=\"Feeds.viewfeed({feed:'$key_escaped'}) \" style=\"font-size: " .
|
||||
echo "<a href=\"#\" onclick=\"Feeds.open({feed:'$key_escaped'}) \" style=\"font-size: " .
|
||||
$size . "px\" title=\"$value articles tagged with " .
|
||||
$key . '">' . $key . '</a> ';
|
||||
}
|
||||
|
|
|
@ -50,8 +50,8 @@ class Feeds extends Handler_Protected {
|
|||
|
||||
$reply .= "<span class='r'>
|
||||
<a href=\"#\"
|
||||
title=\"".__("View as RSS feed")."\"
|
||||
onclick=\"Utils.displayDlg('".__("View as RSS")."','generatedFeed', '$feed_id:$is_cat:$rss_link')\">
|
||||
title=\"".__("Show as feed")."\"
|
||||
onclick=\"Utils.displayDlg('".__("Show as feed")."','generatedFeed', '$feed_id:$is_cat:$rss_link')\">
|
||||
<img class=\"noborder\" src=\"images/pub_set.png\"></a>";
|
||||
|
||||
|
||||
|
@ -137,7 +137,8 @@ class Feeds extends Handler_Protected {
|
|||
|
||||
//$reply .= "<option value=\"catchupPage()\">".__('Mark as read')."</option>";
|
||||
|
||||
$reply .= "<option value=\"Utils.displayDlg('".__("View as RSS")."','generatedFeed', '$feed_id:$is_cat:$rss_link')\">".__('View as RSS')."</option>";
|
||||
$reply .= "<option value=\"Utils.displayDlg('".__("Show as feed")."','generatedFeed', '$feed_id:$is_cat:$rss_link')\">".
|
||||
__('Show as feed')."</option>";
|
||||
|
||||
$reply .= "</select>";
|
||||
|
||||
|
@ -392,7 +393,7 @@ class Feeds extends Handler_Protected {
|
|||
|
||||
$reply['content'] .= "<div data-feed-id='$feed_id' class='feed-title'>".
|
||||
"<div style='float : right'>$feed_icon_img</div>".
|
||||
"<a class='title' href=\"#\" onclick=\"Feeds.viewfeed({feed:$feed_id})\">".
|
||||
"<a class='title' href=\"#\" onclick=\"Feeds.open({feed:$feed_id})\">".
|
||||
$line["feed_title"]."</a>
|
||||
$vf_catchup_link</div>";
|
||||
|
||||
|
@ -434,7 +435,7 @@ class Feeds extends Handler_Protected {
|
|||
if (@$line["feed_title"]) {
|
||||
$rgba = @$rgba_cache[$feed_id];
|
||||
|
||||
$reply['content'] .= "<span class=\"feed\"><a style=\"background : rgba($rgba, 0.3)\" href=\"#\" onclick=\"Feeds.viewfeed({feed:$feed_id})\">".
|
||||
$reply['content'] .= "<span class=\"feed\"><a style=\"background : rgba($rgba, 0.3)\" href=\"#\" onclick=\"Feeds.open({feed:$feed_id})\">".
|
||||
truncate_string($line["feed_title"],30)."</a></span>";
|
||||
}
|
||||
}
|
||||
|
@ -451,7 +452,7 @@ class Feeds extends Handler_Protected {
|
|||
|
||||
if ($line["feed_title"] && !$vfeed_group_enabled) {
|
||||
|
||||
$reply['content'] .= "<span onclick=\"Feeds.viewfeed({feed:$feed_id})\"
|
||||
$reply['content'] .= "<span onclick=\"Feeds.open({feed:$feed_id})\"
|
||||
style=\"cursor : pointer\"
|
||||
title=\"".htmlspecialchars($line['feed_title'])."\">
|
||||
$feed_icon_img</span>";
|
||||
|
@ -488,7 +489,7 @@ class Feeds extends Handler_Protected {
|
|||
|
||||
$reply['content'] .= "<div data-feed-id='$feed_id' class='feed-title'>".
|
||||
"<div style=\"float : right\">$feed_icon_img</div>".
|
||||
"<a href=\"#\" class='title' onclick=\"Feeds.viewfeed({feed:$feed_id})\">".
|
||||
"<a href=\"#\" class='title' onclick=\"Feeds.open({feed:$feed_id})\">".
|
||||
$line["feed_title"]."</a> $vf_catchup_link</div>";
|
||||
|
||||
}
|
||||
|
@ -547,7 +548,7 @@ class Feeds extends Handler_Protected {
|
|||
|
||||
$tmp_content .= "<div class=\"feed\">
|
||||
<a href=\"#\" style=\"background-color: rgba($rgba,0.3)\"
|
||||
onclick=\"Feeds.viewfeed({feed:$feed_id})\">".
|
||||
onclick=\"Feeds.open({feed:$feed_id})\">".
|
||||
truncate_string($line["feed_title"],30)."</a>
|
||||
</div>";
|
||||
}
|
||||
|
@ -561,7 +562,7 @@ class Feeds extends Handler_Protected {
|
|||
if (!get_pref("VFEED_GROUP_BY_FEED") && $line["feed_title"]) {
|
||||
$tmp_content .= "<span style=\"cursor : pointer\"
|
||||
title=\"".htmlspecialchars($line["feed_title"])."\"
|
||||
onclick=\"Feeds.viewfeed({feed:$feed_id})\">$feed_icon_img</span>";
|
||||
onclick=\"Feeds.open({feed:$feed_id})\">$feed_icon_img</span>";
|
||||
}
|
||||
$tmp_content .= "</div>"; //score wrapper2
|
||||
|
||||
|
|
|
@ -1323,7 +1323,7 @@ class Pref_Feeds extends Handler_Protected {
|
|||
|
||||
print "<p>";
|
||||
|
||||
print "<button dojoType=\"dijit.form.Button\" onclick=\"return Utils.displayDlg('".__("View as RSS")."','generatedFeed', '$rss_url')\">".
|
||||
print "<button dojoType=\"dijit.form.Button\" onclick=\"return Utils.displayDlg('".__("Show as feed")."','generatedFeed', '$rss_url')\">".
|
||||
__('Display URL')."</button> ";
|
||||
|
||||
print "<button class=\"warning\" dojoType=\"dijit.form.Button\" onclick=\"return clearFeedAccessKeys()\">".
|
||||
|
|
|
@ -207,16 +207,16 @@
|
|||
<option value="title"><?php echo __('Title') ?></option>
|
||||
</select>
|
||||
|
||||
<div dojoType="dijit.form.ComboButton" onclick="Feeds.catchupCurrentFeed()">
|
||||
<div dojoType="dijit.form.ComboButton" onclick="Feeds.catchupCurrent()">
|
||||
<span><?php echo __('Mark as read') ?></span>
|
||||
<div dojoType="dijit.DropDownMenu">
|
||||
<div dojoType="dijit.MenuItem" onclick="Feeds.catchupCurrentFeed('1day')">
|
||||
<div dojoType="dijit.MenuItem" onclick="Feeds.catchupCurrent('1day')">
|
||||
<?php echo __('Older than one day') ?>
|
||||
</div>
|
||||
<div dojoType="dijit.MenuItem" onclick="Feeds.catchupCurrentFeed('1week')">
|
||||
<div dojoType="dijit.MenuItem" onclick="Feeds.catchupCurrent('1week')">
|
||||
<?php echo __('Older than one week') ?>
|
||||
</div>
|
||||
<div dojoType="dijit.MenuItem" onclick="Feeds.catchupCurrentFeed('2week')">
|
||||
<div dojoType="dijit.MenuItem" onclick="Feeds.catchupCurrent('2week')">
|
||||
<?php echo __('Older than two weeks') ?>
|
||||
</div>
|
||||
</div>
|
||||
|
|
122
js/feedlist.js
122
js/feedlist.js
|
@ -68,23 +68,23 @@ const Feeds = {
|
|||
continue;
|
||||
}
|
||||
|
||||
/*if (this.getFeedUnread(id, (kind == "cat")) != ctr ||
|
||||
/*if (this.getUnread(id, (kind == "cat")) != ctr ||
|
||||
(kind == "cat")) {
|
||||
}*/
|
||||
|
||||
this.setFeedUnread(id, (kind == "cat"), ctr);
|
||||
this.setFeedValue(id, (kind == "cat"), 'auxcounter', auxctr);
|
||||
this.setUnread(id, (kind == "cat"), ctr);
|
||||
this.setValue(id, (kind == "cat"), 'auxcounter', auxctr);
|
||||
|
||||
if (kind != "cat") {
|
||||
this.setFeedValue(id, false, 'error', error);
|
||||
this.setFeedValue(id, false, 'updated', updated);
|
||||
this.setValue(id, false, 'error', error);
|
||||
this.setValue(id, false, 'updated', updated);
|
||||
|
||||
if (id > 0) {
|
||||
if (has_img) {
|
||||
this.setFeedIcon(id, false,
|
||||
this.setIcon(id, false,
|
||||
getInitParam("icons_url") + "/" + id + ".ico?" + has_img);
|
||||
} else {
|
||||
this.setFeedIcon(id, false, 'images/blank_icon.gif');
|
||||
this.setIcon(id, false, 'images/blank_icon.gif');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -93,20 +93,20 @@ const Feeds = {
|
|||
this.hideOrShowFeeds(getInitParam("hide_read_feeds") == 1);
|
||||
this._counters_prev = elems;
|
||||
},
|
||||
viewCurrentFeed: function(method) {
|
||||
console.log("viewCurrentFeed: " + method);
|
||||
reloadCurrent: function(method) {
|
||||
console.log("reloadCurrent: " + method);
|
||||
|
||||
if (this.getActiveFeedId() != undefined) {
|
||||
this.viewfeed({feed: this.getActiveFeedId(), is_cat: this.activeFeedIsCat(), method: method});
|
||||
if (this.getActive() != undefined) {
|
||||
this.open({feed: this.getActive(), is_cat: this.activeIsCat(), method: method});
|
||||
}
|
||||
return false; // block unneeded form submits
|
||||
},
|
||||
openNextUnreadFeed: function() {
|
||||
const is_cat = this.activeFeedIsCat();
|
||||
const nuf = this.getNextUnreadFeed(this.getActiveFeedId(), is_cat);
|
||||
if (nuf) this.viewfeed({feed: nuf, is_cat: is_cat});
|
||||
openNextUnread: function() {
|
||||
const is_cat = this.activeIsCat();
|
||||
const nuf = this.getNextUnread(this.getActive(), is_cat);
|
||||
if (nuf) this.open({feed: nuf, is_cat: is_cat});
|
||||
},
|
||||
collapseFeedlist: function() {
|
||||
toggle: function() {
|
||||
Element.toggle("feeds-holder");
|
||||
|
||||
const splitter = $("feeds-holder_splitter");
|
||||
|
@ -117,7 +117,7 @@ const Feeds = {
|
|||
},
|
||||
cancelSearch: function() {
|
||||
this._search_query = "";
|
||||
this.viewCurrentFeed();
|
||||
this.reloadCurrent();
|
||||
},
|
||||
requestCounters: function(force) {
|
||||
const date = new Date();
|
||||
|
@ -173,7 +173,7 @@ const Feeds = {
|
|||
const id = String(item.id);
|
||||
const is_cat = id.match("^CAT:");
|
||||
const feed = id.substr(id.indexOf(":") + 1);
|
||||
Feeds.viewfeed({feed: feed, is_cat: is_cat});
|
||||
Feeds.open({feed: feed, is_cat: is_cat});
|
||||
return false;
|
||||
},
|
||||
openOnClick: false,
|
||||
|
@ -214,10 +214,10 @@ const Feeds = {
|
|||
document.onkeydown = () => { App.hotkeyHandler(event) };
|
||||
window.setInterval(() => { Headlines.catchupBatched() }, 10 * 1000);
|
||||
|
||||
if (!this.getActiveFeedId()) {
|
||||
this.viewfeed({feed: -3});
|
||||
if (!this.getActive()) {
|
||||
this.open({feed: -3});
|
||||
} else {
|
||||
this.viewfeed({feed: this.getActiveFeedId(), is_cat: this.activeFeedIsCat()});
|
||||
this.open({feed: this.getActive(), is_cat: this.activeIsCat()});
|
||||
}
|
||||
|
||||
this.hideOrShowFeeds(getInitParam("hide_read_feeds") == 1);
|
||||
|
@ -254,13 +254,13 @@ const Feeds = {
|
|||
}, 250);
|
||||
}
|
||||
},
|
||||
activeFeedIsCat: function() {
|
||||
activeIsCat: function() {
|
||||
return !!this._active_feed_is_cat;
|
||||
},
|
||||
getActiveFeedId: function() {
|
||||
getActive: function() {
|
||||
return this._active_feed_id;
|
||||
},
|
||||
setActiveFeedId: function(id, is_cat) {
|
||||
setActive: function(id, is_cat) {
|
||||
hash_set('f', id);
|
||||
hash_set('c', is_cat ? 1 : 0);
|
||||
|
||||
|
@ -270,16 +270,16 @@ const Feeds = {
|
|||
$("headlines-frame").setAttribute("feed-id", id);
|
||||
$("headlines-frame").setAttribute("is-cat", is_cat ? 1 : 0);
|
||||
|
||||
this.selectFeed(id, is_cat);
|
||||
this.select(id, is_cat);
|
||||
|
||||
PluginHost.run(PluginHost.HOOK_FEED_SET_ACTIVE, [this._active_feed_id, this._active_feed_is_cat]);
|
||||
},
|
||||
selectFeed: function(feed, is_cat) {
|
||||
select: function(feed, is_cat) {
|
||||
const tree = dijit.byId("feedTree");
|
||||
|
||||
if (tree) return tree.selectFeed(feed, is_cat);
|
||||
},
|
||||
toggleDispRead: function() {
|
||||
toggleUnread: function() {
|
||||
const hide = !(getInitParam("hide_read_feeds") == "1");
|
||||
|
||||
xhrPost("backend.php", {op: "rpc", method: "setpref", key: "HIDE_READ_FEEDS", value: hide}, () => {
|
||||
|
@ -293,7 +293,7 @@ const Feeds = {
|
|||
if (tree)
|
||||
return tree.hideRead(hide, getInitParam("hide_read_shows_special"));
|
||||
},
|
||||
viewfeed: function(params) {
|
||||
open: function(params) {
|
||||
const feed = params.feed;
|
||||
const is_cat = !!params.is_cat || false;
|
||||
const offset = params.offset || 0;
|
||||
|
@ -302,7 +302,7 @@ const Feeds = {
|
|||
// this is used to quickly switch between feeds, sets active but xhr is on a timeout
|
||||
const delayed = params.delayed || false;
|
||||
|
||||
if (feed != this.getActiveFeedId() || this.activeFeedIsCat() != is_cat) {
|
||||
if (feed != this.getActive() || this.activeIsCat() != is_cat) {
|
||||
this._search_query = false;
|
||||
Article.setActive(0);
|
||||
}
|
||||
|
@ -347,20 +347,20 @@ const Feeds = {
|
|||
if (Headlines.vgroup_last_feed != undefined) {
|
||||
query.vgrlf = Headlines.vgroup_last_feed;
|
||||
}
|
||||
} else if (!is_cat && feed == this.getActiveFeedId() && !params.method) {
|
||||
} else if (!is_cat && feed == this.getActive() && !params.method) {
|
||||
query.m = "ForceUpdate";
|
||||
}
|
||||
|
||||
Form.enable("main_toolbar_form");
|
||||
|
||||
if (!delayed)
|
||||
if (!this.setFeedExpandoIcon(feed, is_cat,
|
||||
if (!this.setExpando(feed, is_cat,
|
||||
(is_cat) ? 'images/indicator_tiny.gif' : 'images/indicator_white.gif'))
|
||||
notify_progress("Loading, please wait...", true);
|
||||
|
||||
query.cat = is_cat;
|
||||
|
||||
this.setActiveFeedId(feed, is_cat);
|
||||
this.setActive(feed, is_cat);
|
||||
|
||||
if (viewfeed_debug) {
|
||||
window.open("backend.php?" +
|
||||
|
@ -375,7 +375,7 @@ const Feeds = {
|
|||
xhrPost("backend.php", query, (transport) => {
|
||||
try {
|
||||
window.clearTimeout(this._infscroll_timeout);
|
||||
this.setFeedExpandoIcon(feed, is_cat, 'images/blank_icon.gif');
|
||||
this.setExpando(feed, is_cat, 'images/blank_icon.gif');
|
||||
Headlines.onLoaded(transport, offset);
|
||||
PluginHost.run(PluginHost.HOOK_FEED_LOADED, [feed, is_cat]);
|
||||
} catch (e) {
|
||||
|
@ -385,7 +385,7 @@ const Feeds = {
|
|||
});
|
||||
}, delayed ? 250 : 0);
|
||||
},
|
||||
catchupAllFeeds: function() {
|
||||
catchupAll: function() {
|
||||
const str = __("Mark all articles as read?");
|
||||
|
||||
if (getInitParam("confirm_feed_catchup") != 1 || confirm(str)) {
|
||||
|
@ -394,7 +394,7 @@ const Feeds = {
|
|||
|
||||
xhrPost("backend.php", {op: "feeds", method: "catchupAll"}, () => {
|
||||
this.requestCounters(true);
|
||||
this.viewCurrentFeed();
|
||||
this.reloadCurrent();
|
||||
});
|
||||
|
||||
App.global_unread = 0;
|
||||
|
@ -402,21 +402,21 @@ const Feeds = {
|
|||
}
|
||||
},
|
||||
decrementFeedCounter: function(feed, is_cat) {
|
||||
let ctr = this.getFeedUnread(feed, is_cat);
|
||||
let ctr = this.getUnread(feed, is_cat);
|
||||
|
||||
if (ctr > 0) {
|
||||
this.setFeedUnread(feed, is_cat, ctr - 1);
|
||||
this.setUnread(feed, is_cat, ctr - 1);
|
||||
App.global_unread -= 1;
|
||||
App.updateTitle();
|
||||
|
||||
if (!is_cat) {
|
||||
const cat = parseInt(this.getFeedCategory(feed));
|
||||
const cat = parseInt(this.getCategory(feed));
|
||||
|
||||
if (!isNaN(cat)) {
|
||||
ctr = this.getFeedUnread(cat, true);
|
||||
ctr = this.getUnread(cat, true);
|
||||
|
||||
if (ctr > 0) {
|
||||
this.setFeedUnread(cat, true, ctr - 1);
|
||||
this.setUnread(cat, true, ctr - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -442,7 +442,7 @@ const Feeds = {
|
|||
}
|
||||
|
||||
const mark_what = this.last_search_query && this.last_search_query[0] ? __("search results") : __("all articles");
|
||||
const fn = this.getFeedName(feed, is_cat);
|
||||
const fn = this.getName(feed, is_cat);
|
||||
|
||||
str = str.replace("%s", fn)
|
||||
.replace("%w", mark_what);
|
||||
|
@ -465,23 +465,23 @@ const Feeds = {
|
|||
const show_next_feed = getInitParam("on_catchup_show_next_feed") == "1";
|
||||
|
||||
if (show_next_feed) {
|
||||
const nuf = this.getNextUnreadFeed(feed, is_cat);
|
||||
const nuf = this.getNextUnread(feed, is_cat);
|
||||
|
||||
if (nuf) {
|
||||
this.viewfeed({feed: nuf, is_cat: is_cat});
|
||||
this.open({feed: nuf, is_cat: is_cat});
|
||||
}
|
||||
} else if (feed == this.getActiveFeedId() && is_cat == this.activeFeedIsCat()) {
|
||||
this.viewCurrentFeed();
|
||||
} else if (feed == this.getActive() && is_cat == this.activeIsCat()) {
|
||||
this.reloadCurrent();
|
||||
}
|
||||
|
||||
notify("");
|
||||
});
|
||||
},
|
||||
catchupCurrentFeed: function(mode) {
|
||||
this.catchupFeed(this.getActiveFeedId(), this.activeFeedIsCat(), mode);
|
||||
catchupCurrent: function(mode) {
|
||||
this.catchupFeed(this.getActive(), this.activeIsCat(), mode);
|
||||
},
|
||||
catchupFeedInGroup: function(id) {
|
||||
const title = this.getFeedName(id);
|
||||
const title = this.getName(id);
|
||||
|
||||
const str = __("Mark all articles in %s as read?").replace("%s", title);
|
||||
|
||||
|
@ -523,7 +523,7 @@ const Feeds = {
|
|||
});
|
||||
}
|
||||
},
|
||||
getFeedUnread: function(feed, is_cat) {
|
||||
getUnread: function(feed, is_cat) {
|
||||
try {
|
||||
const tree = dijit.byId("feedTree");
|
||||
|
||||
|
@ -536,7 +536,7 @@ const Feeds = {
|
|||
|
||||
return -1;
|
||||
},
|
||||
getFeedCategory: function(feed) {
|
||||
getCategory: function(feed) {
|
||||
try {
|
||||
const tree = dijit.byId("feedTree");
|
||||
|
||||
|
@ -549,7 +549,7 @@ const Feeds = {
|
|||
|
||||
return false;
|
||||
},
|
||||
getFeedName: function(feed, is_cat) {
|
||||
getName: function(feed, is_cat) {
|
||||
if (isNaN(feed)) return feed; // it's a tag
|
||||
|
||||
const tree = dijit.byId("feedTree");
|
||||
|
@ -557,13 +557,13 @@ const Feeds = {
|
|||
if (tree && tree.model)
|
||||
return tree.model.getFeedValue(feed, is_cat, 'name');
|
||||
},
|
||||
setFeedUnread: function(feed, is_cat, unread) {
|
||||
setUnread: function(feed, is_cat, unread) {
|
||||
const tree = dijit.byId("feedTree");
|
||||
|
||||
if (tree && tree.model)
|
||||
return tree.model.setFeedUnread(feed, is_cat, unread);
|
||||
},
|
||||
setFeedValue: function(feed, is_cat, key, value) {
|
||||
setValue: function(feed, is_cat, key, value) {
|
||||
try {
|
||||
const tree = dijit.byId("feedTree");
|
||||
|
||||
|
@ -574,7 +574,7 @@ const Feeds = {
|
|||
//
|
||||
}
|
||||
},
|
||||
getFeedValue: function(feed, is_cat, key) {
|
||||
getValue: function(feed, is_cat, key) {
|
||||
try {
|
||||
const tree = dijit.byId("feedTree");
|
||||
|
||||
|
@ -586,19 +586,19 @@ const Feeds = {
|
|||
}
|
||||
return '';
|
||||
},
|
||||
setFeedIcon: function(feed, is_cat, src) {
|
||||
setIcon: function(feed, is_cat, src) {
|
||||
const tree = dijit.byId("feedTree");
|
||||
|
||||
if (tree) return tree.setFeedIcon(feed, is_cat, src);
|
||||
},
|
||||
setFeedExpandoIcon: function(feed, is_cat, src) {
|
||||
setExpando: function(feed, is_cat, src) {
|
||||
const tree = dijit.byId("feedTree");
|
||||
|
||||
if (tree) return tree.setFeedExpandoIcon(feed, is_cat, src);
|
||||
|
||||
return false;
|
||||
},
|
||||
getNextUnreadFeed: function(feed, is_cat) {
|
||||
getNextUnread: function(feed, is_cat) {
|
||||
const tree = dijit.byId("feedTree");
|
||||
const nuf = tree.model.getNextUnreadFeed(feed, is_cat);
|
||||
|
||||
|
@ -607,7 +607,7 @@ const Feeds = {
|
|||
},
|
||||
search: function() {
|
||||
const query = "backend.php?op=feeds&method=search¶m=" +
|
||||
param_escape(Feeds.getActiveFeedId() + ":" + Feeds.activeFeedIsCat());
|
||||
param_escape(Feeds.getActive() + ":" + Feeds.activeIsCat());
|
||||
|
||||
if (dijit.byId("searchDlg"))
|
||||
dijit.byId("searchDlg").destroyRecursive();
|
||||
|
@ -620,7 +620,7 @@ const Feeds = {
|
|||
if (this.validate()) {
|
||||
Feeds._search_query = this.attr('value');
|
||||
this.hide();
|
||||
Feeds.viewCurrentFeed();
|
||||
Feeds.reloadCurrent();
|
||||
}
|
||||
},
|
||||
href: query
|
||||
|
@ -628,10 +628,10 @@ const Feeds = {
|
|||
|
||||
dialog.show();
|
||||
},
|
||||
updateRandomFeed: function() {
|
||||
updateRandom: function() {
|
||||
console.log("in update_random_feed");
|
||||
|
||||
xhrPost("backend.php", {op: "rpc", method: "updateRandomFeed"}, (transport) => {
|
||||
xhrPost("backend.php", {op: "rpc", method: "updateRandom"}, (transport) => {
|
||||
Utils.handleRpcJson(transport, true);
|
||||
});
|
||||
},
|
||||
|
|
|
@ -699,9 +699,9 @@ const CommonDialogs = {
|
|||
if (App.isPrefs()) {
|
||||
Feeds.reload();
|
||||
} else {
|
||||
if (feed_id == Feeds.getActiveFeedId())
|
||||
if (feed_id == Feeds.getActive())
|
||||
setTimeout(() => {
|
||||
Feeds.viewfeed({feed: -5})
|
||||
Feeds.open({feed: -5})
|
||||
},
|
||||
100);
|
||||
|
||||
|
@ -1351,7 +1351,7 @@ const Filters = {
|
|||
if (!App.isPrefs()) {
|
||||
query = {
|
||||
op: "pref-filters", method: "newfilter",
|
||||
feed: Feeds.getActiveFeedId(), is_cat: Feeds.activeFeedIsCat()
|
||||
feed: Feeds.getActive(), is_cat: Feeds.activeIsCat()
|
||||
};
|
||||
} else {
|
||||
query = {op: "pref-filters", method: "newfilter"};
|
||||
|
@ -1445,8 +1445,8 @@ const Filters = {
|
|||
|
||||
if (selectedText != "") {
|
||||
|
||||
const feed_id = Feeds.activeFeedIsCat() ? 'CAT:' + parseInt(Feeds.getActiveFeedId()) :
|
||||
Feeds.getActiveFeedId();
|
||||
const feed_id = Feeds.activeIsCat() ? 'CAT:' + parseInt(Feeds.getActive()) :
|
||||
Feeds.getActive();
|
||||
|
||||
const rule = {reg_exp: selectedText, feed_id: [feed_id], filter_type: 1};
|
||||
|
||||
|
@ -1463,12 +1463,12 @@ const Filters = {
|
|||
|
||||
if (reply && reply.title) title = reply.title;
|
||||
|
||||
if (title || Feeds.getActiveFeedId() || Feeds.activeFeedIsCat()) {
|
||||
if (title || Feeds.getActive() || Feeds.activeIsCat()) {
|
||||
|
||||
console.log(title + " " + Feeds.getActiveFeedId());
|
||||
console.log(title + " " + Feeds.getActive());
|
||||
|
||||
const feed_id = Feeds.activeFeedIsCat() ? 'CAT:' + parseInt(Feeds.getActiveFeedId()) :
|
||||
Feeds.getActiveFeedId();
|
||||
const feed_id = Feeds.activeIsCat() ? 'CAT:' + parseInt(Feeds.getActive()) :
|
||||
Feeds.getActive();
|
||||
|
||||
const rule = {reg_exp: title, feed_id: [feed_id], filter_type: 1};
|
||||
|
||||
|
|
70
js/tt-rss.js
70
js/tt-rss.js
|
@ -128,7 +128,7 @@ const App = {
|
|||
const hash_feed_is_cat = hash_get('c') == "1";
|
||||
|
||||
if (hash_feed_id != undefined) {
|
||||
Feeds.setActiveFeedId(hash_feed_id, hash_feed_is_cat);
|
||||
Feeds.setActive(hash_feed_id, hash_feed_is_cat);
|
||||
}
|
||||
|
||||
Utils.setLoadingProgress(50);
|
||||
|
@ -142,7 +142,7 @@ const App = {
|
|||
|
||||
if (getInitParam("simple_update")) {
|
||||
console.log("scheduling simple feed updater...");
|
||||
window.setInterval(() => { Feeds.updateRandomFeed() }, 30 * 1000);
|
||||
window.setInterval(() => { Feeds.updateRandom() }, 30 * 1000);
|
||||
}
|
||||
|
||||
console.log("second stage ok");
|
||||
|
@ -167,7 +167,7 @@ const App = {
|
|||
},
|
||||
onViewModeChanged: function() {
|
||||
ArticleCache.clear();
|
||||
return Feeds.viewCurrentFeed('');
|
||||
return Feeds.reloadCurrent('');
|
||||
},
|
||||
isCombinedMode: function() {
|
||||
return getInitParam("combined_display_mode");
|
||||
|
@ -235,15 +235,15 @@ const App = {
|
|||
initHotkeyActions: function() {
|
||||
this.hotkey_actions["next_feed"] = function () {
|
||||
const rv = dijit.byId("feedTree").getNextFeed(
|
||||
Feeds.getActiveFeedId(), Feeds.activeFeedIsCat());
|
||||
Feeds.getActive(), Feeds.activeIsCat());
|
||||
|
||||
if (rv) Feeds.viewfeed({feed: rv[0], is_cat: rv[1], delayed: true})
|
||||
if (rv) Feeds.open({feed: rv[0], is_cat: rv[1], delayed: true})
|
||||
};
|
||||
this.hotkey_actions["prev_feed"] = function () {
|
||||
const rv = dijit.byId("feedTree").getPreviousFeed(
|
||||
Feeds.getActiveFeedId(), Feeds.activeFeedIsCat());
|
||||
Feeds.getActive(), Feeds.activeIsCat());
|
||||
|
||||
if (rv) Feeds.viewfeed({feed: rv[0], is_cat: rv[1], delayed: true})
|
||||
if (rv) Feeds.open({feed: rv[0], is_cat: rv[1], delayed: true})
|
||||
};
|
||||
this.hotkey_actions["next_article"] = function () {
|
||||
Headlines.move('next');
|
||||
|
@ -333,19 +333,19 @@ const App = {
|
|||
Headlines.select('none');
|
||||
};
|
||||
this.hotkey_actions["feed_refresh"] = function () {
|
||||
if (Feeds.getActiveFeedId() != undefined) {
|
||||
Feeds.viewfeed({feed: Feeds.getActiveFeedId(), is_cat: Feeds.activeFeedIsCat()});
|
||||
if (Feeds.getActive() != undefined) {
|
||||
Feeds.open({feed: Feeds.getActive(), is_cat: Feeds.activeIsCat()});
|
||||
}
|
||||
};
|
||||
this.hotkey_actions["feed_unhide_read"] = function () {
|
||||
Feeds.toggleDispRead();
|
||||
Feeds.toggleUnread();
|
||||
};
|
||||
this.hotkey_actions["feed_subscribe"] = function () {
|
||||
CommonDialogs.quickAddFeed();
|
||||
};
|
||||
this.hotkey_actions["feed_debug_update"] = function () {
|
||||
if (!Feeds.activeFeedIsCat() && parseInt(Feeds.getActiveFeedId()) > 0) {
|
||||
window.open("backend.php?op=feeds&method=update_debugger&feed_id=" + Feeds.getActiveFeedId() +
|
||||
if (!Feeds.activeIsCat() && parseInt(Feeds.getActive()) > 0) {
|
||||
window.open("backend.php?op=feeds&method=update_debugger&feed_id=" + Feeds.getActive() +
|
||||
"&csrf_token=" + getInitParam("csrf_token"));
|
||||
} else {
|
||||
alert("You can't debug this kind of feed.");
|
||||
|
@ -353,18 +353,18 @@ const App = {
|
|||
};
|
||||
|
||||
this.hotkey_actions["feed_debug_viewfeed"] = function () {
|
||||
Feeds.viewfeed({feed: Feeds.getActiveFeedId(), is_cat: Feeds.activeFeedIsCat(), viewfeed_debug: true});
|
||||
Feeds.open({feed: Feeds.getActive(), is_cat: Feeds.activeIsCat(), viewfeed_debug: true});
|
||||
};
|
||||
|
||||
this.hotkey_actions["feed_edit"] = function () {
|
||||
if (Feeds.activeFeedIsCat())
|
||||
if (Feeds.activeIsCat())
|
||||
alert(__("You can't edit this kind of feed."));
|
||||
else
|
||||
CommonDialogs.editFeed(Feeds.getActiveFeedId());
|
||||
CommonDialogs.editFeed(Feeds.getActive());
|
||||
};
|
||||
this.hotkey_actions["feed_catchup"] = function () {
|
||||
if (Feeds.getActiveFeedId() != undefined) {
|
||||
Feeds.catchupCurrentFeed();
|
||||
if (Feeds.getActive() != undefined) {
|
||||
Feeds.catchupCurrent();
|
||||
}
|
||||
};
|
||||
this.hotkey_actions["feed_reverse"] = function () {
|
||||
|
@ -372,28 +372,28 @@ const App = {
|
|||
};
|
||||
this.hotkey_actions["feed_toggle_vgroup"] = function () {
|
||||
xhrPost("backend.php", {op: "rpc", method: "togglepref", key: "VFEED_GROUP_BY_FEED"}, () => {
|
||||
Feeds.viewCurrentFeed();
|
||||
Feeds.reloadCurrent();
|
||||
})
|
||||
};
|
||||
this.hotkey_actions["catchup_all"] = function () {
|
||||
Feeds.catchupAllFeeds();
|
||||
Feeds.catchupAll();
|
||||
};
|
||||
this.hotkey_actions["cat_toggle_collapse"] = function () {
|
||||
if (Feeds.activeFeedIsCat()) {
|
||||
dijit.byId("feedTree").collapseCat(Feeds.getActiveFeedId());
|
||||
if (Feeds.activeIsCat()) {
|
||||
dijit.byId("feedTree").collapseCat(Feeds.getActive());
|
||||
}
|
||||
};
|
||||
this.hotkey_actions["goto_all"] = function () {
|
||||
Feeds.viewfeed({feed: -4});
|
||||
Feeds.open({feed: -4});
|
||||
};
|
||||
this.hotkey_actions["goto_fresh"] = function () {
|
||||
Feeds.viewfeed({feed: -3});
|
||||
Feeds.open({feed: -3});
|
||||
};
|
||||
this.hotkey_actions["goto_marked"] = function () {
|
||||
Feeds.viewfeed({feed: -1});
|
||||
Feeds.open({feed: -1});
|
||||
};
|
||||
this.hotkey_actions["goto_published"] = function () {
|
||||
Feeds.viewfeed({feed: -2});
|
||||
Feeds.open({feed: -2});
|
||||
};
|
||||
this.hotkey_actions["goto_tagcloud"] = function () {
|
||||
Utils.displayDlg(__("Tag cloud"), "printTagCloud");
|
||||
|
@ -427,7 +427,7 @@ const App = {
|
|||
Filters.quickAddFilter();
|
||||
};
|
||||
this.hotkey_actions["collapse_sidebar"] = function () {
|
||||
Feeds.viewCurrentFeed();
|
||||
Feeds.reloadCurrent();
|
||||
};
|
||||
this.hotkey_actions["toggle_embed_original"] = function () {
|
||||
if (typeof embedOriginalArticle != "undefined") {
|
||||
|
@ -463,7 +463,7 @@ const App = {
|
|||
!getInitParam("combined_display_mode"));
|
||||
|
||||
Article.close();
|
||||
Feeds.viewCurrentFeed();
|
||||
Feeds.reloadCurrent();
|
||||
})
|
||||
};
|
||||
this.hotkey_actions["toggle_cdm_expanded"] = function () {
|
||||
|
@ -473,7 +473,7 @@ const App = {
|
|||
|
||||
xhrPost("backend.php", {op: "rpc", method: "setpref", key: "CDM_EXPANDED", value: value}, () => {
|
||||
setInitParam("cdm_expanded", !getInitParam("cdm_expanded"));
|
||||
Feeds.viewCurrentFeed();
|
||||
Feeds.reloadCurrent();
|
||||
});
|
||||
};
|
||||
},
|
||||
|
@ -498,35 +498,35 @@ const App = {
|
|||
window.location.href = "backend.php?op=digest";
|
||||
break;
|
||||
case "qmcEditFeed":
|
||||
if (Feeds.activeFeedIsCat())
|
||||
if (Feeds.activeIsCat())
|
||||
alert(__("You can't edit this kind of feed."));
|
||||
else
|
||||
CommonDialogs.editFeed(Feeds.getActiveFeedId());
|
||||
CommonDialogs.editFeed(Feeds.getActive());
|
||||
break;
|
||||
case "qmcRemoveFeed":
|
||||
const actid = Feeds.getActiveFeedId();
|
||||
const actid = Feeds.getActive();
|
||||
|
||||
if (!actid) {
|
||||
alert(__("Please select some feed first."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (Feeds.activeFeedIsCat()) {
|
||||
if (Feeds.activeIsCat()) {
|
||||
alert(__("You can't unsubscribe from the category."));
|
||||
return;
|
||||
}
|
||||
|
||||
const fn = Feeds.getFeedName(actid);
|
||||
const fn = Feeds.getName(actid);
|
||||
|
||||
if (confirm(__("Unsubscribe from %s?").replace("%s", fn))) {
|
||||
CommonDialogs.unsubscribeFeed(actid);
|
||||
}
|
||||
break;
|
||||
case "qmcCatchupAll":
|
||||
Feeds.catchupAllFeeds();
|
||||
Feeds.catchupAll();
|
||||
break;
|
||||
case "qmcShowOnlyUnread":
|
||||
Feeds.toggleDispRead();
|
||||
Feeds.toggleUnread();
|
||||
break;
|
||||
case "qmcToggleWidescreen":
|
||||
if (!App.isCombinedMode()) {
|
||||
|
|
|
@ -291,7 +291,7 @@ const Article = {
|
|||
if (row.hasClassName("Unread")) {
|
||||
|
||||
Headlines.catchupBatched(() => {
|
||||
Feeds.decrementFeedCounter(Feeds.getActiveFeedId(), Feeds.activeFeedIsCat());
|
||||
Feeds.decrementFeedCounter(Feeds.getActive(), Feeds.activeIsCat());
|
||||
Headlines.toggleUnread(id, 0);
|
||||
Headlines.updateFloatingTitle(true);
|
||||
});
|
||||
|
@ -404,7 +404,7 @@ const Headlines = {
|
|||
const view_mode = document.forms["main_toolbar_form"].view_mode.value;
|
||||
const unread_in_buffer = $$("#headlines-frame > div[id*=RROW][class*=Unread]").length;
|
||||
const num_all = $$("#headlines-frame > div[id*=RROW]").length;
|
||||
const num_unread = Feeds.getFeedUnread(Feeds.getActiveFeedId(), Feeds.activeFeedIsCat());
|
||||
const num_unread = Feeds.getUnread(Feeds.getActive(), Feeds.activeIsCat());
|
||||
|
||||
// TODO implement marked & published
|
||||
|
||||
|
@ -419,14 +419,14 @@ const Headlines = {
|
|||
offset = unread_in_buffer;
|
||||
break;
|
||||
case "adaptive":
|
||||
if (!(Feeds.getActiveFeedId() == -1 && !Feeds.activeFeedIsCat()))
|
||||
if (!(Feeds.getActive() == -1 && !Feeds.activeIsCat()))
|
||||
offset = num_unread > 0 ? unread_in_buffer : num_all;
|
||||
break;
|
||||
}
|
||||
|
||||
console.log("loadMore, offset=", offset);
|
||||
|
||||
Feeds.viewfeed({feed: Feeds.getActiveFeedId(), is_cat: Feeds.activeFeedIsCat(), offset: offset});
|
||||
Feeds.open({feed: Feeds.getActive(), is_cat: Feeds.activeIsCat(), offset: offset});
|
||||
},
|
||||
scrollHandler: function() {
|
||||
try {
|
||||
|
@ -497,7 +497,7 @@ const Headlines = {
|
|||
console.log("we seem to be at an end");
|
||||
|
||||
if (getInitParam("on_catchup_show_next_feed") == "1") {
|
||||
Feeds.openNextUnreadFeed();
|
||||
Feeds.openNextUnread();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -592,7 +592,7 @@ const Headlines = {
|
|||
feed_id = reply['headlines']['id'];
|
||||
Feeds.last_search_query = reply['headlines']['search_query'];
|
||||
|
||||
if (feed_id != -7 && (feed_id != Feeds.getActiveFeedId() || is_cat != Feeds.activeFeedIsCat()))
|
||||
if (feed_id != -7 && (feed_id != Feeds.getActive() || is_cat != Feeds.activeIsCat()))
|
||||
return;
|
||||
|
||||
try {
|
||||
|
@ -654,7 +654,7 @@ const Headlines = {
|
|||
this.initHeadlinesMenu();
|
||||
|
||||
if (Feeds.infscroll_disabled)
|
||||
hsp.innerHTML = "<a href='#' onclick='Feeds.openNextUnreadFeed()'>" +
|
||||
hsp.innerHTML = "<a href='#' onclick='Feeds.openNextUnread()'>" +
|
||||
__("Click to open next unread feed.") + "</a>";
|
||||
|
||||
if (Feeds._search_query) {
|
||||
|
@ -663,7 +663,7 @@ const Headlines = {
|
|||
"</span>";
|
||||
}
|
||||
|
||||
} else if (headlines_count > 0 && feed_id == Feeds.getActiveFeedId() && is_cat == Feeds.activeFeedIsCat()) {
|
||||
} else if (headlines_count > 0 && feed_id == Feeds.getActive() && is_cat == Feeds.activeIsCat()) {
|
||||
const c = dijit.byId("headlines-frame");
|
||||
//const ids = Headlines.getSelected();
|
||||
|
||||
|
@ -702,7 +702,7 @@ const Headlines = {
|
|||
this.initHeadlinesMenu();
|
||||
|
||||
if (Feeds.infscroll_disabled) {
|
||||
hsp.innerHTML = "<a href='#' onclick='Feeds.openNextUnreadFeed()'>" +
|
||||
hsp.innerHTML = "<a href='#' onclick='Feeds.openNextUnread()'>" +
|
||||
__("Click to open next unread feed.") + "</a>";
|
||||
}
|
||||
|
||||
|
@ -716,10 +716,10 @@ const Headlines = {
|
|||
|
||||
if (hsp) {
|
||||
if (first_id_changed) {
|
||||
hsp.innerHTML = "<a href='#' onclick='Feeds.viewCurrentFeed()'>" +
|
||||
hsp.innerHTML = "<a href='#' onclick='Feeds.reloadCurrent()'>" +
|
||||
__("New articles found, reload feed to continue.") + "</a>";
|
||||
} else {
|
||||
hsp.innerHTML = "<a href='#' onclick='Feeds.openNextUnreadFeed()'>" +
|
||||
hsp.innerHTML = "<a href='#' onclick='Feeds.openNextUnread()'>" +
|
||||
__("Click to open next unread feed.") + "</a>";
|
||||
}
|
||||
}
|
||||
|
@ -753,7 +753,7 @@ const Headlines = {
|
|||
|
||||
order_by.attr('value', value);
|
||||
|
||||
Feeds.viewCurrentFeed();
|
||||
Feeds.reloadCurrent();
|
||||
},
|
||||
selectionToggleUnread: function(params) {
|
||||
params = params || {};
|
||||
|
@ -1059,10 +1059,10 @@ const Headlines = {
|
|||
return;
|
||||
}
|
||||
|
||||
const fn = Feeds.getFeedName(Feeds.getActiveFeedId(), Feeds.activeFeedIsCat());
|
||||
const fn = Feeds.getName(Feeds.getActive(), Feeds.activeIsCat());
|
||||
let str;
|
||||
|
||||
if (Feeds.getActiveFeedId() != 0) {
|
||||
if (Feeds.getActive() != 0) {
|
||||
str = ngettext("Delete %d selected article in %s?", "Delete %d selected articles in %s?", rows.length);
|
||||
} else {
|
||||
str = ngettext("Delete %d selected article?", "Delete %d selected articles?", rows.length);
|
||||
|
@ -1079,7 +1079,7 @@ const Headlines = {
|
|||
|
||||
xhrPost("backend.php", query, (transport) => {
|
||||
Utils.handleRpcJson(transport);
|
||||
Feeds.viewCurrentFeed();
|
||||
Feeds.reloadCurrent();
|
||||
});
|
||||
},
|
||||
getSelected: function() {
|
||||
|
@ -1171,11 +1171,11 @@ const Headlines = {
|
|||
return;
|
||||
}
|
||||
|
||||
const fn = Feeds.getFeedName(Feeds.getActiveFeedId(), Feeds.activeFeedIsCat());
|
||||
const fn = Feeds.getName(Feeds.getActive(), Feeds.activeIsCat());
|
||||
let str;
|
||||
let op;
|
||||
|
||||
if (Feeds.getActiveFeedId() != 0) {
|
||||
if (Feeds.getActive() != 0) {
|
||||
str = ngettext("Archive %d selected article in %s?", "Archive %d selected articles in %s?", rows.length);
|
||||
op = "archive";
|
||||
} else {
|
||||
|
@ -1200,7 +1200,7 @@ const Headlines = {
|
|||
|
||||
xhrPost("backend.php", query, (transport) => {
|
||||
Utils.handleRpcJson(transport);
|
||||
Feeds.viewCurrentFeed();
|
||||
Feeds.reloadCurrent();
|
||||
});
|
||||
},
|
||||
catchupSelection: function() {
|
||||
|
@ -1211,7 +1211,7 @@ const Headlines = {
|
|||
return;
|
||||
}
|
||||
|
||||
const fn = Feeds.getFeedName(Feeds.getActiveFeedId(), Feeds.activeFeedIsCat());
|
||||
const fn = Feeds.getName(Feeds.getActive(), Feeds.activeIsCat());
|
||||
|
||||
let str = ngettext("Mark %d selected article in %s as read?", "Mark %d selected articles in %s as read?", rows.length);
|
||||
|
||||
|
@ -1222,7 +1222,7 @@ const Headlines = {
|
|||
return;
|
||||
}
|
||||
|
||||
Headlines.selectionToggleUnread({callback: Feeds.viewCurrentFeed, no_error: 1});
|
||||
Headlines.selectionToggleUnread({callback: Feeds.reloadCurrent, no_error: 1});
|
||||
},
|
||||
catchupBatched: function(callback) {
|
||||
console.log("catchupBatched, size=", this.catchup_id_batch.length);
|
||||
|
|
|
@ -93,7 +93,7 @@ class Af_Psql_Trgm extends Plugin {
|
|||
print " <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"$article_link\">".
|
||||
$line["title"]."</a>";
|
||||
|
||||
print " (<a href=\"#\" onclick=\"Feeds.viewfeed({feed:".$line["feed_id"]."})\">".
|
||||
print " (<a href=\"#\" onclick=\"Feeds.open({feed:".$line["feed_id"]."})\">".
|
||||
htmlspecialchars($line["feed_title"])."</a>)";
|
||||
|
||||
print " <span class='insensitive'>($sm)</span>";
|
||||
|
|
|
@ -18,7 +18,7 @@ class Toggle_Sidebar extends Plugin {
|
|||
function hook_main_toolbar_button() {
|
||||
?>
|
||||
|
||||
<button dojoType="dijit.form.Button" onclick="Feeds.collapseFeedlist()">
|
||||
<button dojoType="dijit.form.Button" onclick="Feeds.toggle()">
|
||||
<img src="plugins/toggle_sidebar/application_side_list.png"
|
||||
title="<?php echo __('Collapse feedlist') ?>">
|
||||
</button>
|
||||
|
|
Loading…
Reference in New Issue