mirror of
https://git.tt-rss.org/fox/tt-rss.git
synced 2025-10-16 13:31:22 +02:00
migrate tt-rss.js contents to App
This commit is contained in:
parent
ab0fadf60d
commit
cc26be0793
@ -190,7 +190,7 @@ class Dlg extends Handler_Protected {
|
|||||||
print_warning(__("You are using default tt-rss password. Please change it in the Preferences (Personal data / Authentication)."));
|
print_warning(__("You are using default tt-rss password. Please change it in the Preferences (Personal data / Authentication)."));
|
||||||
|
|
||||||
print "<div align='center'>";
|
print "<div align='center'>";
|
||||||
print "<button dojoType=\"dijit.form.Button\" onclick=\"gotoPreferences()\">".
|
print "<button dojoType=\"dijit.form.Button\" onclick=\"document.location.href = 'prefs.php'\">".
|
||||||
__('Open Preferences')."</button> ";
|
__('Open Preferences')."</button> ";
|
||||||
print "<button dojoType=\"dijit.form.Button\"
|
print "<button dojoType=\"dijit.form.Button\"
|
||||||
onclick=\"return closeInfoBox()\">".
|
onclick=\"return closeInfoBox()\">".
|
||||||
|
@ -95,7 +95,7 @@ class Feeds extends Handler_Protected {
|
|||||||
$reply .= "</span> "; */
|
$reply .= "</span> "; */
|
||||||
|
|
||||||
$reply .= "<select dojoType=\"dijit.form.Select\"
|
$reply .= "<select dojoType=\"dijit.form.Select\"
|
||||||
onchange=\"headlineActionsChange(this)\">";
|
onchange=\"Headlines.onActionChanged(this)\">";
|
||||||
|
|
||||||
$reply .= "<option value=\"0\" disabled='1'>".__('Select...')."</option>";
|
$reply .= "<option value=\"0\" disabled='1'>".__('Select...')."</option>";
|
||||||
|
|
||||||
@ -299,7 +299,7 @@ class Feeds extends Handler_Protected {
|
|||||||
$label_cache = $line["label_cache"];
|
$label_cache = $line["label_cache"];
|
||||||
$labels = false;
|
$labels = false;
|
||||||
|
|
||||||
$mouseover_attrs = "onmouseover='postMouseIn(event, $id)' onmouseout='postMouseOut($id)'";
|
$mouseover_attrs = "onmouseover='Article.mouseIn($id)' onmouseout='Article.mouseOut($id)'";
|
||||||
|
|
||||||
if ($label_cache) {
|
if ($label_cache) {
|
||||||
$label_cache = json_decode($label_cache, true);
|
$label_cache = json_decode($label_cache, true);
|
||||||
|
20
index.php
20
index.php
@ -240,18 +240,18 @@
|
|||||||
<div dojoType="dijit.form.DropDownButton">
|
<div dojoType="dijit.form.DropDownButton">
|
||||||
<span><?php echo __('Actions...') ?></span>
|
<span><?php echo __('Actions...') ?></span>
|
||||||
<div dojoType="dijit.Menu" style="display: none">
|
<div dojoType="dijit.Menu" style="display: none">
|
||||||
<div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcPrefs')"><?php echo __('Preferences...') ?></div>
|
<div dojoType="dijit.MenuItem" onclick="App.onActionSelected('qmcPrefs')"><?php echo __('Preferences...') ?></div>
|
||||||
<div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcSearch')"><?php echo __('Search...') ?></div>
|
<div dojoType="dijit.MenuItem" onclick="App.onActionSelected('qmcSearch')"><?php echo __('Search...') ?></div>
|
||||||
<div dojoType="dijit.MenuItem" disabled="1"><?php echo __('Feed actions:') ?></div>
|
<div dojoType="dijit.MenuItem" disabled="1"><?php echo __('Feed actions:') ?></div>
|
||||||
<div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcAddFeed')"><?php echo __('Subscribe to feed...') ?></div>
|
<div dojoType="dijit.MenuItem" onclick="App.onActionSelected('qmcAddFeed')"><?php echo __('Subscribe to feed...') ?></div>
|
||||||
<div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcEditFeed')"><?php echo __('Edit this feed...') ?></div>
|
<div dojoType="dijit.MenuItem" onclick="App.onActionSelected('qmcEditFeed')"><?php echo __('Edit this feed...') ?></div>
|
||||||
<div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcRemoveFeed')"><?php echo __('Unsubscribe') ?></div>
|
<div dojoType="dijit.MenuItem" onclick="App.onActionSelected('qmcRemoveFeed')"><?php echo __('Unsubscribe') ?></div>
|
||||||
<div dojoType="dijit.MenuItem" disabled="1"><?php echo __('All feeds:') ?></div>
|
<div dojoType="dijit.MenuItem" disabled="1"><?php echo __('All feeds:') ?></div>
|
||||||
<div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcCatchupAll')"><?php echo __('Mark as read') ?></div>
|
<div dojoType="dijit.MenuItem" onclick="App.onActionSelected('qmcCatchupAll')"><?php echo __('Mark as read') ?></div>
|
||||||
<div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcShowOnlyUnread')"><?php echo __('(Un)hide read feeds') ?></div>
|
<div dojoType="dijit.MenuItem" onclick="App.onActionSelected('qmcShowOnlyUnread')"><?php echo __('(Un)hide read feeds') ?></div>
|
||||||
<div dojoType="dijit.MenuItem" disabled="1"><?php echo __('Other actions:') ?></div>
|
<div dojoType="dijit.MenuItem" disabled="1"><?php echo __('Other actions:') ?></div>
|
||||||
<div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcToggleWidescreen')"><?php echo __('Toggle widescreen mode') ?></div>
|
<div dojoType="dijit.MenuItem" onclick="App.onActionSelected('qmcToggleWidescreen')"><?php echo __('Toggle widescreen mode') ?></div>
|
||||||
<div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcHKhelp')"><?php echo __('Keyboard shortcuts help') ?></div>
|
<div dojoType="dijit.MenuItem" onclick="App.onActionSelected('qmcHKhelp')"><?php echo __('Keyboard shortcuts help') ?></div>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_ACTION_ITEM) as $p) {
|
foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_ACTION_ITEM) as $p) {
|
||||||
@ -260,7 +260,7 @@
|
|||||||
?>
|
?>
|
||||||
|
|
||||||
<?php if (!$_SESSION["hide_logout"]) { ?>
|
<?php if (!$_SESSION["hide_logout"]) { ?>
|
||||||
<div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcLogout')"><?php echo __('Logout') ?></div>
|
<div dojoType="dijit.MenuItem" onclick="App.onActionSelected('qmcLogout')"><?php echo __('Logout') ?></div>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -6,6 +6,7 @@ const Feeds = {
|
|||||||
infscroll_disabled: 0,
|
infscroll_disabled: 0,
|
||||||
_infscroll_timeout: false,
|
_infscroll_timeout: false,
|
||||||
_search_query: false,
|
_search_query: false,
|
||||||
|
last_search_query: [],
|
||||||
_viewfeed_wait_timeout: false,
|
_viewfeed_wait_timeout: false,
|
||||||
_counters_prev: [],
|
_counters_prev: [],
|
||||||
// NOTE: this implementation is incomplete
|
// NOTE: this implementation is incomplete
|
||||||
@ -206,7 +207,7 @@ const Feeds = {
|
|||||||
|
|
||||||
Utils.setLoadingProgress(50);
|
Utils.setLoadingProgress(50);
|
||||||
|
|
||||||
document.onkeydown = App.hotkeyHandler;
|
document.onkeydown = () => { App.hotkeyHandler(event) };
|
||||||
window.setInterval(() => { hotkeyPrefixTimeout() }, 3 * 1000);
|
window.setInterval(() => { hotkeyPrefixTimeout() }, 3 * 1000);
|
||||||
window.setInterval(() => { Headlines.catchupBatchedArticles() }, 10 * 1000);
|
window.setInterval(() => { Headlines.catchupBatchedArticles() }, 10 * 1000);
|
||||||
|
|
||||||
@ -436,7 +437,7 @@ const Feeds = {
|
|||||||
str = __("Mark %w in %s as read?");
|
str = __("Mark %w in %s as read?");
|
||||||
}
|
}
|
||||||
|
|
||||||
const mark_what = last_search_query && last_search_query[0] ? __("search results") : __("all articles");
|
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.getFeedName(feed, is_cat);
|
||||||
|
|
||||||
str = str.replace("%s", fn)
|
str = str.replace("%s", fn)
|
||||||
@ -448,8 +449,8 @@ const Feeds = {
|
|||||||
|
|
||||||
const catchup_query = {
|
const catchup_query = {
|
||||||
op: 'rpc', method: 'catchupFeed', feed_id: feed,
|
op: 'rpc', method: 'catchupFeed', feed_id: feed,
|
||||||
is_cat: is_cat, mode: mode, search_query: last_search_query[0],
|
is_cat: is_cat, mode: mode, search_query: this.last_search_query[0],
|
||||||
search_lang: last_search_query[1]
|
search_lang: this.last_search_query[1]
|
||||||
};
|
};
|
||||||
|
|
||||||
notify_progress("Loading, please wait...", true);
|
notify_progress("Loading, please wait...", true);
|
||||||
|
@ -1025,7 +1025,7 @@ function uploadIconHandler(rc) {
|
|||||||
switch (rc) {
|
switch (rc) {
|
||||||
case 0:
|
case 0:
|
||||||
notify_info("Upload complete.");
|
notify_info("Upload complete.");
|
||||||
if (inPreferences()) {
|
if (App.isPrefs()) {
|
||||||
Feeds.reload();
|
Feeds.reload();
|
||||||
} else {
|
} else {
|
||||||
setTimeout('Feeds.reload(false, false)', 50);
|
setTimeout('Feeds.reload(false, false)', 50);
|
||||||
@ -1050,7 +1050,7 @@ function removeFeedIcon(id) {
|
|||||||
|
|
||||||
xhrPost("backend.php", query, (transport) => {
|
xhrPost("backend.php", query, (transport) => {
|
||||||
notify_info("Feed icon removed.");
|
notify_info("Feed icon removed.");
|
||||||
if (inPreferences()) {
|
if (App.isPrefs()) {
|
||||||
Feeds.reload();
|
Feeds.reload();
|
||||||
} else {
|
} else {
|
||||||
setTimeout('Feeds.reload(false, false)', 50);
|
setTimeout('Feeds.reload(false, false)', 50);
|
||||||
@ -1090,7 +1090,7 @@ function addLabel(select, callback) {
|
|||||||
xhrPost("backend.php", query, (transport) => {
|
xhrPost("backend.php", query, (transport) => {
|
||||||
if (callback) {
|
if (callback) {
|
||||||
callback(transport);
|
callback(transport);
|
||||||
} else if (inPreferences()) {
|
} else if (App.isPrefs()) {
|
||||||
updateLabelList();
|
updateLabelList();
|
||||||
} else {
|
} else {
|
||||||
Feeds.reload();
|
Feeds.reload();
|
||||||
@ -1317,7 +1317,7 @@ function editFilterTest(query) {
|
|||||||
function quickAddFilter() {
|
function quickAddFilter() {
|
||||||
let query;
|
let query;
|
||||||
|
|
||||||
if (!inPreferences()) {
|
if (!App.isPrefs()) {
|
||||||
query = { op: "pref-filters", method: "newfilter",
|
query = { op: "pref-filters", method: "newfilter",
|
||||||
feed: Feeds.getActiveFeedId(), is_cat: Feeds.activeFeedIsCat() };
|
feed: Feeds.getActiveFeedId(), is_cat: Feeds.activeFeedIsCat() };
|
||||||
} else {
|
} else {
|
||||||
@ -1385,7 +1385,7 @@ function quickAddFilter() {
|
|||||||
const query = dojo.formToQuery("filter_new_form");
|
const query = dojo.formToQuery("filter_new_form");
|
||||||
|
|
||||||
xhrPost("backend.php", query, (transport) => {
|
xhrPost("backend.php", query, (transport) => {
|
||||||
if (inPreferences()) {
|
if (App.isPrefs()) {
|
||||||
updateFilterList();
|
updateFilterList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1395,7 +1395,7 @@ function quickAddFilter() {
|
|||||||
},
|
},
|
||||||
href: "backend.php?" + dojo.objectToQuery(query)});
|
href: "backend.php?" + dojo.objectToQuery(query)});
|
||||||
|
|
||||||
if (!inPreferences()) {
|
if (!App.isPrefs()) {
|
||||||
const selectedText = getSelectionText();
|
const selectedText = getSelectionText();
|
||||||
|
|
||||||
const lh = dojo.connect(dialog, "onLoad", function(){
|
const lh = dojo.connect(dialog, "onLoad", function(){
|
||||||
@ -1453,7 +1453,7 @@ function unsubscribeFeed(feed_id, title) {
|
|||||||
xhrPost("backend.php", query, (transport) => {
|
xhrPost("backend.php", query, (transport) => {
|
||||||
if (dijit.byId("feedEditDlg")) dijit.byId("feedEditDlg").hide();
|
if (dijit.byId("feedEditDlg")) dijit.byId("feedEditDlg").hide();
|
||||||
|
|
||||||
if (inPreferences()) {
|
if (App.isPrefs()) {
|
||||||
Feeds.reload();
|
Feeds.reload();
|
||||||
} else {
|
} else {
|
||||||
if (feed_id == Feeds.getActiveFeedId())
|
if (feed_id == Feeds.getActiveFeedId())
|
||||||
|
11
js/prefs.js
11
js/prefs.js
@ -65,7 +65,7 @@ const App = {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
initSecondStage: function() {
|
initSecondStage: function() {
|
||||||
document.onkeydown = this.hotkeyHandler;
|
document.onkeydown = () => { App.hotkeyHandler(event) };
|
||||||
Utils.setLoadingProgress(50);
|
Utils.setLoadingProgress(50);
|
||||||
notify("");
|
notify("");
|
||||||
|
|
||||||
@ -111,8 +111,11 @@ const App = {
|
|||||||
console.log("unhandled action: " + action_name + "; keycode: " + event.which);
|
console.log("unhandled action: " + action_name + "; keycode: " + event.which);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
isPrefs: function() {
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
function notify_callback2(transport, sticky) {
|
function notify_callback2(transport, sticky) {
|
||||||
notify_info(transport.responseText, sticky);
|
notify_info(transport.responseText, sticky);
|
||||||
@ -909,10 +912,6 @@ function labelColorReset() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function inPreferences() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
function editProfiles() {
|
function editProfiles() {
|
||||||
|
|
||||||
if (dijit.byId("profileEditDlg"))
|
if (dijit.byId("profileEditDlg"))
|
||||||
|
626
js/tt-rss.js
626
js/tt-rss.js
@ -1,10 +1,9 @@
|
|||||||
/* global dijit, __ */
|
/* global dijit, __ */
|
||||||
|
|
||||||
let hotkey_actions = {};
|
|
||||||
|
|
||||||
const App = {
|
const App = {
|
||||||
global_unread: -1,
|
global_unread: -1,
|
||||||
_widescreen_mode: false,
|
_widescreen_mode: false,
|
||||||
|
hotkey_actions: {},
|
||||||
init: function() {
|
init: function() {
|
||||||
|
|
||||||
window.onerror = function (message, filename, lineno, colno, error) {
|
window.onerror = function (message, filename, lineno, colno, error) {
|
||||||
@ -57,7 +56,7 @@ const App = {
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
Utils.setLoadingProgress(30);
|
Utils.setLoadingProgress(30);
|
||||||
init_hotkey_actions();
|
App.initHotkeyActions();
|
||||||
|
|
||||||
const a = document.createElement('audio');
|
const a = document.createElement('audio');
|
||||||
const hasAudio = !!a.canPlayType;
|
const hasAudio = !!a.canPlayType;
|
||||||
@ -179,7 +178,7 @@ const App = {
|
|||||||
const action_name = Utils.keyeventToAction(event);
|
const action_name = Utils.keyeventToAction(event);
|
||||||
|
|
||||||
if (action_name) {
|
if (action_name) {
|
||||||
const action_func = hotkey_actions[action_name];
|
const action_func = this.hotkey_actions[action_name];
|
||||||
|
|
||||||
if (action_func != null) {
|
if (action_func != null) {
|
||||||
action_func();
|
action_func();
|
||||||
@ -233,331 +232,328 @@ const App = {
|
|||||||
|
|
||||||
xhrPost("backend.php", {op: "rpc", method: "setpanelmode", wide: wide ? 1 : 0});
|
xhrPost("backend.php", {op: "rpc", method: "setpanelmode", wide: wide ? 1 : 0});
|
||||||
},
|
},
|
||||||
};
|
initHotkeyActions: function() {
|
||||||
|
this.hotkey_actions["next_feed"] = function () {
|
||||||
|
const rv = dijit.byId("feedTree").getNextFeed(
|
||||||
|
Feeds.getActiveFeedId(), Feeds.activeFeedIsCat());
|
||||||
|
|
||||||
function init_hotkey_actions() {
|
if (rv) Feeds.viewfeed({feed: rv[0], is_cat: rv[1], delayed: true})
|
||||||
hotkey_actions["next_feed"] = function () {
|
};
|
||||||
const rv = dijit.byId("feedTree").getNextFeed(
|
this.hotkey_actions["prev_feed"] = function () {
|
||||||
Feeds.getActiveFeedId(), Feeds.activeFeedIsCat());
|
const rv = dijit.byId("feedTree").getPreviousFeed(
|
||||||
|
Feeds.getActiveFeedId(), Feeds.activeFeedIsCat());
|
||||||
|
|
||||||
if (rv) Feeds.viewfeed({feed: rv[0], is_cat: rv[1], delayed: true})
|
if (rv) Feeds.viewfeed({feed: rv[0], is_cat: rv[1], delayed: true})
|
||||||
};
|
};
|
||||||
hotkey_actions["prev_feed"] = function () {
|
this.hotkey_actions["next_article"] = function () {
|
||||||
const rv = dijit.byId("feedTree").getPreviousFeed(
|
Headlines.moveToPost('next');
|
||||||
Feeds.getActiveFeedId(), Feeds.activeFeedIsCat());
|
};
|
||||||
|
this.hotkey_actions["prev_article"] = function () {
|
||||||
if (rv) Feeds.viewfeed({feed: rv[0], is_cat: rv[1], delayed: true})
|
Headlines.moveToPost('prev');
|
||||||
};
|
};
|
||||||
hotkey_actions["next_article"] = function () {
|
this.hotkey_actions["next_article_noscroll"] = function () {
|
||||||
Headlines.moveToPost('next');
|
Headlines.moveToPost('next', true);
|
||||||
};
|
};
|
||||||
hotkey_actions["prev_article"] = function () {
|
this.hotkey_actions["prev_article_noscroll"] = function () {
|
||||||
Headlines.moveToPost('prev');
|
Headlines.moveToPost('prev', true);
|
||||||
};
|
};
|
||||||
hotkey_actions["next_article_noscroll"] = function () {
|
this.hotkey_actions["next_article_noexpand"] = function () {
|
||||||
Headlines.moveToPost('next', true);
|
Headlines.moveToPost('next', true, true);
|
||||||
};
|
};
|
||||||
hotkey_actions["prev_article_noscroll"] = function () {
|
this.hotkey_actions["prev_article_noexpand"] = function () {
|
||||||
Headlines.moveToPost('prev', true);
|
Headlines.moveToPost('prev', true, true);
|
||||||
};
|
};
|
||||||
hotkey_actions["next_article_noexpand"] = function () {
|
this.hotkey_actions["search_dialog"] = function () {
|
||||||
Headlines.moveToPost('next', true, true);
|
Feeds.search();
|
||||||
};
|
};
|
||||||
hotkey_actions["prev_article_noexpand"] = function () {
|
this.hotkey_actions["toggle_mark"] = function () {
|
||||||
Headlines.moveToPost('prev', true, true);
|
Headlines.selectionToggleMarked();
|
||||||
};
|
};
|
||||||
hotkey_actions["search_dialog"] = function () {
|
this.hotkey_actions["toggle_publ"] = function () {
|
||||||
Feeds.search();
|
Headlines.selectionTogglePublished();
|
||||||
};
|
};
|
||||||
hotkey_actions["toggle_mark"] = function () {
|
this.hotkey_actions["toggle_unread"] = function () {
|
||||||
Headlines.selectionToggleMarked();
|
Headlines.selectionToggleUnread({no_error: 1});
|
||||||
};
|
};
|
||||||
hotkey_actions["toggle_publ"] = function () {
|
this.hotkey_actions["edit_tags"] = function () {
|
||||||
Headlines.selectionTogglePublished();
|
const id = Article.getActiveArticleId();
|
||||||
};
|
if (id) {
|
||||||
hotkey_actions["toggle_unread"] = function () {
|
Article.editArticleTags(id);
|
||||||
Headlines.selectionToggleUnread({no_error: 1});
|
|
||||||
};
|
|
||||||
hotkey_actions["edit_tags"] = function () {
|
|
||||||
const id = Article.getActiveArticleId();
|
|
||||||
if (id) {
|
|
||||||
Article.editArticleTags(id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
hotkey_actions["open_in_new_window"] = function () {
|
|
||||||
if (Article.getActiveArticleId()) {
|
|
||||||
Article.openArticleInNewWindow(Article.getActiveArticleId());
|
|
||||||
}
|
|
||||||
};
|
|
||||||
hotkey_actions["catchup_below"] = function () {
|
|
||||||
catchupRelativeToArticle(1);
|
|
||||||
};
|
|
||||||
hotkey_actions["catchup_above"] = function () {
|
|
||||||
catchupRelativeToArticle(0);
|
|
||||||
};
|
|
||||||
hotkey_actions["article_scroll_down"] = function () {
|
|
||||||
scrollArticle(40);
|
|
||||||
};
|
|
||||||
hotkey_actions["article_scroll_up"] = function () {
|
|
||||||
scrollArticle(-40);
|
|
||||||
};
|
|
||||||
hotkey_actions["close_article"] = function () {
|
|
||||||
if (App.isCombinedMode()) {
|
|
||||||
Article.cdmCollapseActive();
|
|
||||||
} else {
|
|
||||||
Article.closeArticlePanel();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
hotkey_actions["email_article"] = function () {
|
|
||||||
if (typeof emailArticle != "undefined") {
|
|
||||||
emailArticle();
|
|
||||||
} else if (typeof mailtoArticle != "undefined") {
|
|
||||||
mailtoArticle();
|
|
||||||
} else {
|
|
||||||
alert(__("Please enable mail plugin first."));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
hotkey_actions["select_all"] = function () {
|
|
||||||
Headlines.selectArticles('all');
|
|
||||||
};
|
|
||||||
hotkey_actions["select_unread"] = function () {
|
|
||||||
Headlines.selectArticles('unread');
|
|
||||||
};
|
|
||||||
hotkey_actions["select_marked"] = function () {
|
|
||||||
Headlines.selectArticles('marked');
|
|
||||||
};
|
|
||||||
hotkey_actions["select_published"] = function () {
|
|
||||||
Headlines.selectArticles('published');
|
|
||||||
};
|
|
||||||
hotkey_actions["select_invert"] = function () {
|
|
||||||
Headlines.selectArticles('invert');
|
|
||||||
};
|
|
||||||
hotkey_actions["select_none"] = function () {
|
|
||||||
Headlines.selectArticles('none');
|
|
||||||
};
|
|
||||||
hotkey_actions["feed_refresh"] = function () {
|
|
||||||
if (Feeds.getActiveFeedId() != undefined) {
|
|
||||||
Feeds.viewfeed({feed: Feeds.getActiveFeedId(), is_cat: Feeds.activeFeedIsCat()});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
hotkey_actions["feed_unhide_read"] = function () {
|
|
||||||
Feeds.toggleDispRead();
|
|
||||||
};
|
|
||||||
hotkey_actions["feed_subscribe"] = function () {
|
|
||||||
CommonDialogs.quickAddFeed();
|
|
||||||
};
|
|
||||||
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() +
|
|
||||||
"&csrf_token=" + getInitParam("csrf_token"));
|
|
||||||
} else {
|
|
||||||
alert("You can't debug this kind of feed.");
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
hotkey_actions["feed_debug_viewfeed"] = function () {
|
|
||||||
Feeds.viewfeed({feed: Feeds.getActiveFeedId(), is_cat: Feeds.activeFeedIsCat(), viewfeed_debug: true});
|
|
||||||
};
|
|
||||||
|
|
||||||
hotkey_actions["feed_edit"] = function () {
|
|
||||||
if (Feeds.activeFeedIsCat())
|
|
||||||
alert(__("You can't edit this kind of feed."));
|
|
||||||
else
|
|
||||||
editFeed(Feeds.getActiveFeedId());
|
|
||||||
};
|
|
||||||
hotkey_actions["feed_catchup"] = function () {
|
|
||||||
if (Feeds.getActiveFeedId() != undefined) {
|
|
||||||
Feeds.catchupCurrentFeed();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
hotkey_actions["feed_reverse"] = function () {
|
|
||||||
Headlines.reverseHeadlineOrder();
|
|
||||||
};
|
|
||||||
hotkey_actions["feed_toggle_vgroup"] = function () {
|
|
||||||
xhrPost("backend.php", {op: "rpc", method: "togglepref", key: "VFEED_GROUP_BY_FEED"}, () => {
|
|
||||||
Feeds.viewCurrentFeed();
|
|
||||||
})
|
|
||||||
};
|
|
||||||
hotkey_actions["catchup_all"] = function () {
|
|
||||||
Feeds.catchupAllFeeds();
|
|
||||||
};
|
|
||||||
hotkey_actions["cat_toggle_collapse"] = function () {
|
|
||||||
if (Feeds.activeFeedIsCat()) {
|
|
||||||
dijit.byId("feedTree").collapseCat(Feeds.getActiveFeedId());
|
|
||||||
}
|
|
||||||
};
|
|
||||||
hotkey_actions["goto_all"] = function () {
|
|
||||||
Feeds.viewfeed({feed: -4});
|
|
||||||
};
|
|
||||||
hotkey_actions["goto_fresh"] = function () {
|
|
||||||
Feeds.viewfeed({feed: -3});
|
|
||||||
};
|
|
||||||
hotkey_actions["goto_marked"] = function () {
|
|
||||||
Feeds.viewfeed({feed: -1});
|
|
||||||
};
|
|
||||||
hotkey_actions["goto_published"] = function () {
|
|
||||||
Feeds.viewfeed({feed: -2});
|
|
||||||
};
|
|
||||||
hotkey_actions["goto_tagcloud"] = function () {
|
|
||||||
Utils.displayDlg(__("Tag cloud"), "printTagCloud");
|
|
||||||
};
|
|
||||||
hotkey_actions["goto_prefs"] = function () {
|
|
||||||
gotoPreferences();
|
|
||||||
};
|
|
||||||
hotkey_actions["select_article_cursor"] = function () {
|
|
||||||
const id = getArticleUnderPointer();
|
|
||||||
if (id) {
|
|
||||||
const row = $("RROW-" + id);
|
|
||||||
|
|
||||||
if (row) {
|
|
||||||
const cb = dijit.getEnclosingWidget(
|
|
||||||
row.select(".rchk")[0]);
|
|
||||||
|
|
||||||
if (cb) {
|
|
||||||
if (!row.hasClassName("active"))
|
|
||||||
cb.attr("checked", !cb.attr("checked"));
|
|
||||||
|
|
||||||
toggleSelectRowById(cb, "RROW-" + id);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
this.hotkey_actions["open_in_new_window"] = function () {
|
||||||
hotkey_actions["create_label"] = function () {
|
if (Article.getActiveArticleId()) {
|
||||||
addLabel();
|
Article.openArticleInNewWindow(Article.getActiveArticleId());
|
||||||
};
|
}
|
||||||
hotkey_actions["create_filter"] = function () {
|
};
|
||||||
quickAddFilter();
|
this.hotkey_actions["catchup_below"] = function () {
|
||||||
};
|
Headlines.catchupRelativeToArticle(1);
|
||||||
hotkey_actions["collapse_sidebar"] = function () {
|
};
|
||||||
Feeds.viewCurrentFeed();
|
this.hotkey_actions["catchup_above"] = function () {
|
||||||
};
|
Headlines.catchupRelativeToArticle(0);
|
||||||
hotkey_actions["toggle_embed_original"] = function () {
|
};
|
||||||
if (typeof embedOriginalArticle != "undefined") {
|
this.hotkey_actions["article_scroll_down"] = function () {
|
||||||
if (Article.getActiveArticleId())
|
Article.scrollArticle(40);
|
||||||
embedOriginalArticle(Article.getActiveArticleId());
|
};
|
||||||
} else {
|
this.hotkey_actions["article_scroll_up"] = function () {
|
||||||
alert(__("Please enable embed_original plugin first."));
|
Article.scrollArticle(-40);
|
||||||
}
|
};
|
||||||
};
|
this.hotkey_actions["close_article"] = function () {
|
||||||
hotkey_actions["toggle_widescreen"] = function () {
|
if (App.isCombinedMode()) {
|
||||||
if (!App.isCombinedMode()) {
|
Article.cdmCollapseActive();
|
||||||
App._widescreen_mode = !App._widescreen_mode;
|
} else {
|
||||||
|
Article.closeArticlePanel();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
this.hotkey_actions["email_article"] = function () {
|
||||||
|
if (typeof emailArticle != "undefined") {
|
||||||
|
emailArticle();
|
||||||
|
} else if (typeof mailtoArticle != "undefined") {
|
||||||
|
mailtoArticle();
|
||||||
|
} else {
|
||||||
|
alert(__("Please enable mail plugin first."));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
this.hotkey_actions["select_all"] = function () {
|
||||||
|
Headlines.selectArticles('all');
|
||||||
|
};
|
||||||
|
this.hotkey_actions["select_unread"] = function () {
|
||||||
|
Headlines.selectArticles('unread');
|
||||||
|
};
|
||||||
|
this.hotkey_actions["select_marked"] = function () {
|
||||||
|
Headlines.selectArticles('marked');
|
||||||
|
};
|
||||||
|
this.hotkey_actions["select_published"] = function () {
|
||||||
|
Headlines.selectArticles('published');
|
||||||
|
};
|
||||||
|
this.hotkey_actions["select_invert"] = function () {
|
||||||
|
Headlines.selectArticles('invert');
|
||||||
|
};
|
||||||
|
this.hotkey_actions["select_none"] = function () {
|
||||||
|
Headlines.selectArticles('none');
|
||||||
|
};
|
||||||
|
this.hotkey_actions["feed_refresh"] = function () {
|
||||||
|
if (Feeds.getActiveFeedId() != undefined) {
|
||||||
|
Feeds.viewfeed({feed: Feeds.getActiveFeedId(), is_cat: Feeds.activeFeedIsCat()});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
this.hotkey_actions["feed_unhide_read"] = function () {
|
||||||
|
Feeds.toggleDispRead();
|
||||||
|
};
|
||||||
|
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() +
|
||||||
|
"&csrf_token=" + getInitParam("csrf_token"));
|
||||||
|
} else {
|
||||||
|
alert("You can't debug this kind of feed.");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// reset stored sizes because geometry changed
|
this.hotkey_actions["feed_debug_viewfeed"] = function () {
|
||||||
setCookie("ttrss_ci_width", 0);
|
Feeds.viewfeed({feed: Feeds.getActiveFeedId(), is_cat: Feeds.activeFeedIsCat(), viewfeed_debug: true});
|
||||||
setCookie("ttrss_ci_height", 0);
|
};
|
||||||
|
|
||||||
App.switchPanelMode(App._widescreen_mode);
|
this.hotkey_actions["feed_edit"] = function () {
|
||||||
} else {
|
if (Feeds.activeFeedIsCat())
|
||||||
alert(__("Widescreen is not available in combined mode."));
|
alert(__("You can't edit this kind of feed."));
|
||||||
}
|
else
|
||||||
};
|
editFeed(Feeds.getActiveFeedId());
|
||||||
hotkey_actions["help_dialog"] = function () {
|
};
|
||||||
Utils.helpDialog("main");
|
this.hotkey_actions["feed_catchup"] = function () {
|
||||||
};
|
if (Feeds.getActiveFeedId() != undefined) {
|
||||||
hotkey_actions["toggle_combined_mode"] = function () {
|
Feeds.catchupCurrentFeed();
|
||||||
notify_progress("Loading, please wait...");
|
}
|
||||||
|
};
|
||||||
|
this.hotkey_actions["feed_reverse"] = function () {
|
||||||
|
Headlines.reverseHeadlineOrder();
|
||||||
|
};
|
||||||
|
this.hotkey_actions["feed_toggle_vgroup"] = function () {
|
||||||
|
xhrPost("backend.php", {op: "rpc", method: "togglepref", key: "VFEED_GROUP_BY_FEED"}, () => {
|
||||||
|
Feeds.viewCurrentFeed();
|
||||||
|
})
|
||||||
|
};
|
||||||
|
this.hotkey_actions["catchup_all"] = function () {
|
||||||
|
Feeds.catchupAllFeeds();
|
||||||
|
};
|
||||||
|
this.hotkey_actions["cat_toggle_collapse"] = function () {
|
||||||
|
if (Feeds.activeFeedIsCat()) {
|
||||||
|
dijit.byId("feedTree").collapseCat(Feeds.getActiveFeedId());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
this.hotkey_actions["goto_all"] = function () {
|
||||||
|
Feeds.viewfeed({feed: -4});
|
||||||
|
};
|
||||||
|
this.hotkey_actions["goto_fresh"] = function () {
|
||||||
|
Feeds.viewfeed({feed: -3});
|
||||||
|
};
|
||||||
|
this.hotkey_actions["goto_marked"] = function () {
|
||||||
|
Feeds.viewfeed({feed: -1});
|
||||||
|
};
|
||||||
|
this.hotkey_actions["goto_published"] = function () {
|
||||||
|
Feeds.viewfeed({feed: -2});
|
||||||
|
};
|
||||||
|
this.hotkey_actions["goto_tagcloud"] = function () {
|
||||||
|
Utils.displayDlg(__("Tag cloud"), "printTagCloud");
|
||||||
|
};
|
||||||
|
this.hotkey_actions["goto_prefs"] = function () {
|
||||||
|
document.location.href = "prefs.php";
|
||||||
|
};
|
||||||
|
this.hotkey_actions["select_article_cursor"] = function () {
|
||||||
|
const id = Article.getArticleUnderPointer();
|
||||||
|
if (id) {
|
||||||
|
const row = $("RROW-" + id);
|
||||||
|
|
||||||
const value = App.isCombinedMode() ? "false" : "true";
|
if (row) {
|
||||||
|
const cb = dijit.getEnclosingWidget(
|
||||||
|
row.select(".rchk")[0]);
|
||||||
|
|
||||||
xhrPost("backend.php", {op: "rpc", method: "setpref", key: "COMBINED_DISPLAY_MODE", value: value}, () => {
|
if (cb) {
|
||||||
setInitParam("combined_display_mode",
|
if (!row.hasClassName("active"))
|
||||||
!getInitParam("combined_display_mode"));
|
cb.attr("checked", !cb.attr("checked"));
|
||||||
|
|
||||||
Article.closeArticlePanel();
|
toggleSelectRowById(cb, "RROW-" + id);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
this.hotkey_actions["create_label"] = function () {
|
||||||
|
addLabel();
|
||||||
|
};
|
||||||
|
this.hotkey_actions["create_filter"] = function () {
|
||||||
|
quickAddFilter();
|
||||||
|
};
|
||||||
|
this.hotkey_actions["collapse_sidebar"] = function () {
|
||||||
Feeds.viewCurrentFeed();
|
Feeds.viewCurrentFeed();
|
||||||
})
|
};
|
||||||
};
|
this.hotkey_actions["toggle_embed_original"] = function () {
|
||||||
hotkey_actions["toggle_cdm_expanded"] = function () {
|
if (typeof embedOriginalArticle != "undefined") {
|
||||||
notify_progress("Loading, please wait...");
|
if (Article.getActiveArticleId())
|
||||||
|
embedOriginalArticle(Article.getActiveArticleId());
|
||||||
|
} else {
|
||||||
|
alert(__("Please enable embed_original plugin first."));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
this.hotkey_actions["toggle_widescreen"] = function () {
|
||||||
|
if (!App.isCombinedMode()) {
|
||||||
|
App._widescreen_mode = !App._widescreen_mode;
|
||||||
|
|
||||||
const value = getInitParam("cdm_expanded") ? "false" : "true";
|
// reset stored sizes because geometry changed
|
||||||
|
setCookie("ttrss_ci_width", 0);
|
||||||
|
setCookie("ttrss_ci_height", 0);
|
||||||
|
|
||||||
xhrPost("backend.php", {op: "rpc", method: "setpref", key: "CDM_EXPANDED", value: value}, () => {
|
App.switchPanelMode(App._widescreen_mode);
|
||||||
setInitParam("cdm_expanded", !getInitParam("cdm_expanded"));
|
} else {
|
||||||
Feeds.viewCurrentFeed();
|
alert(__("Widescreen is not available in combined mode."));
|
||||||
});
|
}
|
||||||
};
|
};
|
||||||
}
|
this.hotkey_actions["help_dialog"] = function () {
|
||||||
|
Utils.helpDialog("main");
|
||||||
|
};
|
||||||
|
this.hotkey_actions["toggle_combined_mode"] = function () {
|
||||||
|
notify_progress("Loading, please wait...");
|
||||||
|
|
||||||
function quickMenuGo(opid) {
|
const value = App.isCombinedMode() ? "false" : "true";
|
||||||
switch (opid) {
|
|
||||||
case "qmcPrefs":
|
|
||||||
gotoPreferences();
|
|
||||||
break;
|
|
||||||
case "qmcLogout":
|
|
||||||
document.location.href = "backend.php?op=logout";
|
|
||||||
break;
|
|
||||||
case "qmcTagCloud":
|
|
||||||
Utils.displayDlg(__("Tag cloud"), "printTagCloud");
|
|
||||||
break;
|
|
||||||
case "qmcSearch":
|
|
||||||
Feeds.search();
|
|
||||||
break;
|
|
||||||
case "qmcAddFeed":
|
|
||||||
CommonDialogs.quickAddFeed();
|
|
||||||
break;
|
|
||||||
case "qmcDigest":
|
|
||||||
window.location.href = "backend.php?op=digest";
|
|
||||||
break;
|
|
||||||
case "qmcEditFeed":
|
|
||||||
if (Feeds.activeFeedIsCat())
|
|
||||||
alert(__("You can't edit this kind of feed."));
|
|
||||||
else
|
|
||||||
editFeed(Feeds.getActiveFeedId());
|
|
||||||
break;
|
|
||||||
case "qmcRemoveFeed":
|
|
||||||
var actid = Feeds.getActiveFeedId();
|
|
||||||
|
|
||||||
if (Feeds.activeFeedIsCat()) {
|
xhrPost("backend.php", {op: "rpc", method: "setpref", key: "COMBINED_DISPLAY_MODE", value: value}, () => {
|
||||||
alert(__("You can't unsubscribe from the category."));
|
setInitParam("combined_display_mode",
|
||||||
return;
|
!getInitParam("combined_display_mode"));
|
||||||
|
|
||||||
|
Article.closeArticlePanel();
|
||||||
|
Feeds.viewCurrentFeed();
|
||||||
|
})
|
||||||
|
};
|
||||||
|
this.hotkey_actions["toggle_cdm_expanded"] = function () {
|
||||||
|
notify_progress("Loading, please wait...");
|
||||||
|
|
||||||
|
const value = getInitParam("cdm_expanded") ? "false" : "true";
|
||||||
|
|
||||||
|
xhrPost("backend.php", {op: "rpc", method: "setpref", key: "CDM_EXPANDED", value: value}, () => {
|
||||||
|
setInitParam("cdm_expanded", !getInitParam("cdm_expanded"));
|
||||||
|
Feeds.viewCurrentFeed();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
},
|
||||||
|
onActionSelected: function(opid) {
|
||||||
|
switch (opid) {
|
||||||
|
case "qmcPrefs":
|
||||||
|
gotoPreferences();
|
||||||
|
break;
|
||||||
|
case "qmcLogout":
|
||||||
|
document.location.href = "backend.php?op=logout";
|
||||||
|
break;
|
||||||
|
case "qmcTagCloud":
|
||||||
|
Utils.displayDlg(__("Tag cloud"), "printTagCloud");
|
||||||
|
break;
|
||||||
|
case "qmcSearch":
|
||||||
|
Feeds.search();
|
||||||
|
break;
|
||||||
|
case "qmcAddFeed":
|
||||||
|
CommonDialogs.quickAddFeed();
|
||||||
|
break;
|
||||||
|
case "qmcDigest":
|
||||||
|
window.location.href = "backend.php?op=digest";
|
||||||
|
break;
|
||||||
|
case "qmcEditFeed":
|
||||||
|
if (Feeds.activeFeedIsCat())
|
||||||
|
alert(__("You can't edit this kind of feed."));
|
||||||
|
else
|
||||||
|
editFeed(Feeds.getActiveFeedId());
|
||||||
|
break;
|
||||||
|
case "qmcRemoveFeed":
|
||||||
|
var actid = Feeds.getActiveFeedId();
|
||||||
|
|
||||||
|
if (Feeds.activeFeedIsCat()) {
|
||||||
|
alert(__("You can't unsubscribe from the category."));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!actid) {
|
||||||
|
alert(__("Please select some feed first."));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var fn = Feeds.getFeedName(actid);
|
||||||
|
|
||||||
|
var pr = __("Unsubscribe from %s?").replace("%s", fn);
|
||||||
|
|
||||||
|
if (confirm(pr)) {
|
||||||
|
unsubscribeFeed(actid);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "qmcCatchupAll":
|
||||||
|
Feeds.catchupAllFeeds();
|
||||||
|
break;
|
||||||
|
case "qmcShowOnlyUnread":
|
||||||
|
Feeds.toggleDispRead();
|
||||||
|
break;
|
||||||
|
case "qmcToggleWidescreen":
|
||||||
|
if (!App.isCombinedMode()) {
|
||||||
|
App._widescreen_mode = !App._widescreen_mode;
|
||||||
|
|
||||||
|
// reset stored sizes because geometry changed
|
||||||
|
setCookie("ttrss_ci_width", 0);
|
||||||
|
setCookie("ttrss_ci_height", 0);
|
||||||
|
|
||||||
|
App.switchPanelMode(App._widescreen_mode);
|
||||||
|
} else {
|
||||||
|
alert(__("Widescreen is not available in combined mode."));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "qmcHKhelp":
|
||||||
|
Utils.helpDialog("main");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
console.log("quickMenuGo: unknown action: " + opid);
|
||||||
}
|
}
|
||||||
|
},
|
||||||
if (!actid) {
|
isPrefs: function() {
|
||||||
alert(__("Please select some feed first."));
|
return false;
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var fn = Feeds.getFeedName(actid);
|
|
||||||
|
|
||||||
var pr = __("Unsubscribe from %s?").replace("%s", fn);
|
|
||||||
|
|
||||||
if (confirm(pr)) {
|
|
||||||
unsubscribeFeed(actid);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case "qmcCatchupAll":
|
|
||||||
Feeds.catchupAllFeeds();
|
|
||||||
break;
|
|
||||||
case "qmcShowOnlyUnread":
|
|
||||||
Feeds.toggleDispRead();
|
|
||||||
break;
|
|
||||||
case "qmcToggleWidescreen":
|
|
||||||
if (!App.isCombinedMode()) {
|
|
||||||
App._widescreen_mode = !App._widescreen_mode;
|
|
||||||
|
|
||||||
// reset stored sizes because geometry changed
|
|
||||||
setCookie("ttrss_ci_width", 0);
|
|
||||||
setCookie("ttrss_ci_height", 0);
|
|
||||||
|
|
||||||
App.switchPanelMode(App._widescreen_mode);
|
|
||||||
} else {
|
|
||||||
alert(__("Widescreen is not available in combined mode."));
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case "qmcHKhelp":
|
|
||||||
Utils.helpDialog("main");
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
console.log("quickMenuGo: unknown action: " + opid);
|
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
function inPreferences() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
function hash_get(key) {
|
function hash_get(key) {
|
||||||
const kv = window.location.hash.substring(1).toQueryParams();
|
const kv = window.location.hash.substring(1).toQueryParams();
|
||||||
@ -569,7 +565,3 @@ function hash_set(key, value) {
|
|||||||
kv[key] = value;
|
kv[key] = value;
|
||||||
window.location.hash = $H(kv).toQueryString();
|
window.location.hash = $H(kv).toQueryString();
|
||||||
}
|
}
|
||||||
|
|
||||||
function gotoPreferences() {
|
|
||||||
document.location.href = "prefs.php";
|
|
||||||
}
|
|
||||||
|
646
js/viewfeed.js
646
js/viewfeed.js
@ -1,8 +1,5 @@
|
|||||||
/* global dijit, __, ngettext */
|
/* global dijit, __, ngettext */
|
||||||
|
|
||||||
let post_under_pointer = false;
|
|
||||||
let last_search_query;
|
|
||||||
|
|
||||||
const ArticleCache = {
|
const ArticleCache = {
|
||||||
has_storage: 'sessionStorage' in window && window['sessionStorage'] !== null,
|
has_storage: 'sessionStorage' in window && window['sessionStorage'] !== null,
|
||||||
set: function(id, obj) {
|
set: function(id, obj) {
|
||||||
@ -118,7 +115,7 @@ const Article = {
|
|||||||
c.attr('content', article);
|
c.attr('content', article);
|
||||||
PluginHost.run(PluginHost.HOOK_ARTICLE_RENDERED, c.domNode);
|
PluginHost.run(PluginHost.HOOK_ARTICLE_RENDERED, c.domNode);
|
||||||
|
|
||||||
correctHeadlinesOffset(Article.getActiveArticleId());
|
Headlines.correctHeadlinesOffset(Article.getActiveArticleId());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
c.focus();
|
c.focus();
|
||||||
@ -126,7 +123,7 @@ const Article = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
view: function(id, noexpand) {
|
view: function(id, noexpand) {
|
||||||
Article.setActiveArticleId(id);
|
this.setActiveArticleId(id);
|
||||||
|
|
||||||
if (!noexpand) {
|
if (!noexpand) {
|
||||||
console.log("loading article", id);
|
console.log("loading article", id);
|
||||||
@ -135,7 +132,7 @@ const Article = {
|
|||||||
|
|
||||||
/* only request uncached articles */
|
/* only request uncached articles */
|
||||||
|
|
||||||
getRelativePostIds(id).each((n) => {
|
this.getRelativePostIds(id).each((n) => {
|
||||||
if (!ArticleCache.get(n))
|
if (!ArticleCache.get(n))
|
||||||
cids.push(n);
|
cids.push(n);
|
||||||
});
|
});
|
||||||
@ -313,6 +310,49 @@ const Article = {
|
|||||||
},
|
},
|
||||||
getActiveArticleId: function() {
|
getActiveArticleId: function() {
|
||||||
return this._active_article_id;
|
return this._active_article_id;
|
||||||
|
},
|
||||||
|
scrollArticle: function(offset) {
|
||||||
|
if (!App.isCombinedMode()) {
|
||||||
|
const ci = $("content-insert");
|
||||||
|
if (ci) {
|
||||||
|
ci.scrollTop += offset;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
const hi = $("headlines-frame");
|
||||||
|
if (hi) {
|
||||||
|
hi.scrollTop += offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
},
|
||||||
|
getRelativePostIds: function(id, limit) {
|
||||||
|
|
||||||
|
const tmp = [];
|
||||||
|
|
||||||
|
if (!limit) limit = 6; //3
|
||||||
|
|
||||||
|
const ids = Headlines.getLoadedArticleIds();
|
||||||
|
|
||||||
|
for (let i = 0; i < ids.length; i++) {
|
||||||
|
if (ids[i] == id) {
|
||||||
|
for (let k = 1; k <= limit; k++) {
|
||||||
|
//if (i > k-1) tmp.push(ids[i-k]);
|
||||||
|
if (i < ids.length - k) tmp.push(ids[i + k]);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return tmp;
|
||||||
|
},
|
||||||
|
mouseIn: function(id) {
|
||||||
|
this.post_under_pointer = id;
|
||||||
|
},
|
||||||
|
mouseOut: function(id) {
|
||||||
|
this.post_under_pointer = false;
|
||||||
|
},
|
||||||
|
getArticleUnderPointer: function() {
|
||||||
|
return this.post_under_pointer;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -485,7 +525,7 @@ const Headlines = {
|
|||||||
ft.firstChild.innerHTML = "<img class='anchor marked-pic' src='images/page_white_go.png' " +
|
ft.firstChild.innerHTML = "<img class='anchor marked-pic' src='images/page_white_go.png' " +
|
||||||
"onclick=\"Article.cdmScrollToArticleId(" + id + ", true)\">" + ft.firstChild.innerHTML;
|
"onclick=\"Article.cdmScrollToArticleId(" + id + ", true)\">" + ft.firstChild.innerHTML;
|
||||||
|
|
||||||
initFloatingMenu();
|
this.initFloatingMenu();
|
||||||
|
|
||||||
const cb = ft.select(".rchk")[0];
|
const cb = ft.select(".rchk")[0];
|
||||||
|
|
||||||
@ -546,7 +586,7 @@ const Headlines = {
|
|||||||
|
|
||||||
is_cat = reply['headlines']['is_cat'];
|
is_cat = reply['headlines']['is_cat'];
|
||||||
feed_id = reply['headlines']['id'];
|
feed_id = reply['headlines']['id'];
|
||||||
last_search_query = reply['headlines']['search_query'];
|
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.getActiveFeedId() || is_cat != Feeds.activeFeedIsCat()))
|
||||||
return;
|
return;
|
||||||
@ -602,7 +642,7 @@ const Headlines = {
|
|||||||
if (!hsp) hsp = new Element("DIV", {"id": "headlines-spacer"});
|
if (!hsp) hsp = new Element("DIV", {"id": "headlines-spacer"});
|
||||||
dijit.byId('headlines-frame').domNode.appendChild(hsp);
|
dijit.byId('headlines-frame').domNode.appendChild(hsp);
|
||||||
|
|
||||||
initHeadlinesMenu();
|
this.initHeadlinesMenu();
|
||||||
|
|
||||||
if (Feeds.infscroll_disabled)
|
if (Feeds.infscroll_disabled)
|
||||||
hsp.innerHTML = "<a href='#' onclick='Feeds.openNextUnreadFeed()'>" +
|
hsp.innerHTML = "<a href='#' onclick='Feeds.openNextUnreadFeed()'>" +
|
||||||
@ -646,7 +686,7 @@ const Headlines = {
|
|||||||
markHeadline(ids[i]);
|
markHeadline(ids[i]);
|
||||||
} */
|
} */
|
||||||
|
|
||||||
initHeadlinesMenu();
|
this.initHeadlinesMenu();
|
||||||
|
|
||||||
if (Feeds.infscroll_disabled) {
|
if (Feeds.infscroll_disabled) {
|
||||||
hsp.innerHTML = "<a href='#' onclick='Feeds.openNextUnreadFeed()'>" +
|
hsp.innerHTML = "<a href='#' onclick='Feeds.openNextUnreadFeed()'>" +
|
||||||
@ -894,7 +934,7 @@ const Headlines = {
|
|||||||
if (!noscroll && article && article.offsetTop + article.offsetHeight >
|
if (!noscroll && article && article.offsetTop + article.offsetHeight >
|
||||||
ctr.scrollTop + ctr.offsetHeight) {
|
ctr.scrollTop + ctr.offsetHeight) {
|
||||||
|
|
||||||
scrollArticle(ctr.offsetHeight / 4);
|
Article.scrollArticle(ctr.offsetHeight / 4);
|
||||||
|
|
||||||
} else if (next_id) {
|
} else if (next_id) {
|
||||||
Article.setActiveArticleId(next_id);
|
Article.setActiveArticleId(next_id);
|
||||||
@ -902,7 +942,7 @@ const Headlines = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else if (next_id) {
|
} else if (next_id) {
|
||||||
correctHeadlinesOffset(next_id);
|
Headlines.correctHeadlinesOffset(next_id);
|
||||||
Article.view(next_id, noexpand);
|
Article.view(next_id, noexpand);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -917,17 +957,17 @@ const Headlines = {
|
|||||||
const ctr = $("headlines-frame");
|
const ctr = $("headlines-frame");
|
||||||
|
|
||||||
if (!noscroll && article && article.offsetTop < ctr.scrollTop) {
|
if (!noscroll && article && article.offsetTop < ctr.scrollTop) {
|
||||||
scrollArticle(-ctr.offsetHeight / 3);
|
Article.scrollArticle(-ctr.offsetHeight / 3);
|
||||||
} else if (!noscroll && prev_article &&
|
} else if (!noscroll && prev_article &&
|
||||||
prev_article.offsetTop < ctr.scrollTop) {
|
prev_article.offsetTop < ctr.scrollTop) {
|
||||||
scrollArticle(-ctr.offsetHeight / 4);
|
Article.scrollArticle(-ctr.offsetHeight / 4);
|
||||||
} else if (prev_id) {
|
} else if (prev_id) {
|
||||||
Article.setActiveArticleId(prev_id);
|
Article.setActiveArticleId(prev_id);
|
||||||
Article.cdmScrollToArticleId(prev_id, noscroll);
|
Article.cdmScrollToArticleId(prev_id, noscroll);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (prev_id) {
|
} else if (prev_id) {
|
||||||
correctHeadlinesOffset(prev_id);
|
Headlines.correctHeadlinesOffset(prev_id);
|
||||||
Article.view(prev_id, noexpand);
|
Article.view(prev_id, noexpand);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -986,7 +1026,7 @@ const Headlines = {
|
|||||||
|
|
||||||
xhrPost("backend.php", query, (transport) => {
|
xhrPost("backend.php", query, (transport) => {
|
||||||
Utils.handleRpcJson(transport);
|
Utils.handleRpcJson(transport);
|
||||||
updateHeadlineLabels(transport);
|
this.onLabelsUpdated(transport);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
selectionAssignLabel: function(id, ids) {
|
selectionAssignLabel: function(id, ids) {
|
||||||
@ -1004,7 +1044,7 @@ const Headlines = {
|
|||||||
|
|
||||||
xhrPost("backend.php", query, (transport) => {
|
xhrPost("backend.php", query, (transport) => {
|
||||||
Utils.handleRpcJson(transport);
|
Utils.handleRpcJson(transport);
|
||||||
updateHeadlineLabels(transport);
|
this.onLabelsUpdated(transport);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
deleteSelection: function() {
|
deleteSelection: function() {
|
||||||
@ -1212,362 +1252,306 @@ const Headlines = {
|
|||||||
} else {
|
} else {
|
||||||
if (callback) callback();
|
if (callback) callback();
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
};
|
catchupRelativeToArticle: function(below, id) {
|
||||||
|
|
||||||
function postMouseIn(e, id) {
|
if (!id) id = Article.getActiveArticleId();
|
||||||
post_under_pointer = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
function postMouseOut(id) {
|
if (!id) {
|
||||||
post_under_pointer = false;
|
alert(__("No article is selected."));
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
function catchupRelativeToArticle(below, id) {
|
const visible_ids = this.getLoadedArticleIds();
|
||||||
|
|
||||||
if (!id) id = Article.getActiveArticleId();
|
const ids_to_mark = [];
|
||||||
|
|
||||||
if (!id) {
|
if (!below) {
|
||||||
alert(__("No article is selected."));
|
for (let i = 0; i < visible_ids.length; i++) {
|
||||||
return;
|
if (visible_ids[i] != id) {
|
||||||
}
|
const e = $("RROW-" + visible_ids[i]);
|
||||||
|
|
||||||
const visible_ids = Headlines.getLoadedArticleIds();
|
if (e && e.hasClassName("Unread")) {
|
||||||
|
ids_to_mark.push(visible_ids[i]);
|
||||||
const ids_to_mark = [];
|
}
|
||||||
|
} else {
|
||||||
if (!below) {
|
break;
|
||||||
for (let i = 0; i < visible_ids.length; i++) {
|
}
|
||||||
if (visible_ids[i] != id) {
|
}
|
||||||
const e = $("RROW-" + visible_ids[i]);
|
} else {
|
||||||
|
for (let i = visible_ids.length - 1; i >= 0; i--) {
|
||||||
if (e && e.hasClassName("Unread")) {
|
if (visible_ids[i] != id) {
|
||||||
ids_to_mark.push(visible_ids[i]);
|
const e = $("RROW-" + visible_ids[i]);
|
||||||
|
|
||||||
|
if (e && e.hasClassName("Unread")) {
|
||||||
|
ids_to_mark.push(visible_ids[i]);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
for (let i = visible_ids.length - 1; i >= 0; i--) {
|
|
||||||
if (visible_ids[i] != id) {
|
|
||||||
const e = $("RROW-" + visible_ids[i]);
|
|
||||||
|
|
||||||
if (e && e.hasClassName("Unread")) {
|
if (ids_to_mark.length == 0) {
|
||||||
ids_to_mark.push(visible_ids[i]);
|
alert(__("No articles found to mark"));
|
||||||
|
} else {
|
||||||
|
const msg = ngettext("Mark %d article as read?", "Mark %d articles as read?", ids_to_mark.length).replace("%d", ids_to_mark.length);
|
||||||
|
|
||||||
|
if (getInitParam("confirm_feed_catchup") != 1 || confirm(msg)) {
|
||||||
|
|
||||||
|
for (var i = 0; i < ids_to_mark.length; i++) {
|
||||||
|
var e = $("RROW-" + ids_to_mark[i]);
|
||||||
|
e.removeClassName("Unread");
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
break;
|
const query = {
|
||||||
|
op: "rpc", method: "catchupSelected",
|
||||||
|
cmode: 0, ids: ids_to_mark.toString()
|
||||||
|
};
|
||||||
|
|
||||||
|
xhrPost("backend.php", query, (transport) => {
|
||||||
|
Utils.handleRpcJson(transport);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
onLabelsUpdated: function(transport) {
|
||||||
|
const data = JSON.parse(transport.responseText);
|
||||||
|
|
||||||
if (ids_to_mark.length == 0) {
|
if (data) {
|
||||||
alert(__("No articles found to mark"));
|
data['info-for-headlines'].each(function (elem) {
|
||||||
} else {
|
$$(".HLLCTR-" + elem.id).each(function (ctr) {
|
||||||
const msg = ngettext("Mark %d article as read?", "Mark %d articles as read?", ids_to_mark.length).replace("%d", ids_to_mark.length);
|
ctr.innerHTML = elem.labels;
|
||||||
|
});
|
||||||
if (getInitParam("confirm_feed_catchup") != 1 || confirm(msg)) {
|
|
||||||
|
|
||||||
for (var i = 0; i < ids_to_mark.length; i++) {
|
|
||||||
var e = $("RROW-" + ids_to_mark[i]);
|
|
||||||
e.removeClassName("Unread");
|
|
||||||
}
|
|
||||||
|
|
||||||
const query = { op: "rpc", method: "catchupSelected",
|
|
||||||
cmode: 0, ids: ids_to_mark.toString() };
|
|
||||||
|
|
||||||
xhrPost("backend.php", query, (transport) => {
|
|
||||||
Utils.handleRpcJson(transport);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
}
|
onActionChanged: function(elem) {
|
||||||
|
eval(elem.value);
|
||||||
|
elem.attr('value', 'false');
|
||||||
|
},
|
||||||
|
correctHeadlinesOffset: function(id) {
|
||||||
|
const container = $("headlines-frame");
|
||||||
|
const row = $("RROW-" + id);
|
||||||
|
|
||||||
function getArticleUnderPointer() {
|
if (!container || !row) return;
|
||||||
return post_under_pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
function scrollArticle(offset) {
|
const viewport = container.offsetHeight;
|
||||||
if (!App.isCombinedMode()) {
|
|
||||||
const ci = $("content-insert");
|
const rel_offset_top = row.offsetTop - container.scrollTop;
|
||||||
if (ci) {
|
const rel_offset_bottom = row.offsetTop + row.offsetHeight - container.scrollTop;
|
||||||
ci.scrollTop += offset;
|
|
||||||
}
|
//console.log("Rtop: " + rel_offset_top + " Rbtm: " + rel_offset_bottom);
|
||||||
} else {
|
//console.log("Vport: " + viewport);
|
||||||
const hi = $("headlines-frame");
|
|
||||||
if (hi) {
|
if (rel_offset_top <= 0 || rel_offset_top > viewport) {
|
||||||
hi.scrollTop += offset;
|
container.scrollTop = row.offsetTop;
|
||||||
|
} else if (rel_offset_bottom > viewport) {
|
||||||
|
container.scrollTop = row.offsetTop + row.offsetHeight - viewport;
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
initFloatingMenu: function() {
|
||||||
|
if (!dijit.byId("floatingMenu")) {
|
||||||
|
|
||||||
}
|
const menu = new dijit.Menu({
|
||||||
}
|
id: "floatingMenu",
|
||||||
|
targetNodeIds: ["floatingTitle"]
|
||||||
function updateHeadlineLabels(transport) {
|
|
||||||
const data = JSON.parse(transport.responseText);
|
|
||||||
|
|
||||||
if (data) {
|
|
||||||
data['info-for-headlines'].each(function (elem) {
|
|
||||||
$$(".HLLCTR-" + elem.id).each(function (ctr) {
|
|
||||||
ctr.innerHTML = elem.labels;
|
|
||||||
});
|
});
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function getRelativePostIds(id, limit) {
|
this.headlinesMenuCommon(menu);
|
||||||
|
|
||||||
const tmp = [];
|
menu.startup();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
headlinesMenuCommon: function(menu) {
|
||||||
|
|
||||||
if (!limit) limit = 6; //3
|
menu.addChild(new dijit.MenuItem({
|
||||||
|
label: __("Open original article"),
|
||||||
const ids = Headlines.getLoadedArticleIds();
|
onClick: function (event) {
|
||||||
|
Article.openArticleInNewWindow(this.getParent().currentTarget.getAttribute("data-article-id"));
|
||||||
for (let i = 0; i < ids.length; i++) {
|
|
||||||
if (ids[i] == id) {
|
|
||||||
for (let k = 1; k <= limit; k++) {
|
|
||||||
//if (i > k-1) tmp.push(ids[i-k]);
|
|
||||||
if (i < ids.length - k) tmp.push(ids[i + k]);
|
|
||||||
}
|
}
|
||||||
break;
|
}));
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return tmp;
|
menu.addChild(new dijit.MenuItem({
|
||||||
}
|
label: __("Display article URL"),
|
||||||
|
onClick: function (event) {
|
||||||
function correctHeadlinesOffset(id) {
|
Article.displayArticleUrl(this.getParent().currentTarget.getAttribute("data-article-id"));
|
||||||
const container = $("headlines-frame");
|
}
|
||||||
const row = $("RROW-" + id);
|
}));
|
||||||
|
|
||||||
if (!container || !row) return;
|
|
||||||
|
|
||||||
const viewport = container.offsetHeight;
|
|
||||||
|
|
||||||
const rel_offset_top = row.offsetTop - container.scrollTop;
|
|
||||||
const rel_offset_bottom = row.offsetTop + row.offsetHeight - container.scrollTop;
|
|
||||||
|
|
||||||
//console.log("Rtop: " + rel_offset_top + " Rbtm: " + rel_offset_bottom);
|
|
||||||
//console.log("Vport: " + viewport);
|
|
||||||
|
|
||||||
if (rel_offset_top <= 0 || rel_offset_top > viewport) {
|
|
||||||
container.scrollTop = row.offsetTop;
|
|
||||||
} else if (rel_offset_bottom > viewport) {
|
|
||||||
container.scrollTop = row.offsetTop + row.offsetHeight - viewport;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function headlineActionsChange(elem) {
|
|
||||||
eval(elem.value);
|
|
||||||
elem.attr('value', 'false');
|
|
||||||
}
|
|
||||||
|
|
||||||
function initFloatingMenu() {
|
|
||||||
if (!dijit.byId("floatingMenu")) {
|
|
||||||
|
|
||||||
const menu = new dijit.Menu({
|
|
||||||
id: "floatingMenu",
|
|
||||||
targetNodeIds: ["floatingTitle"]
|
|
||||||
});
|
|
||||||
|
|
||||||
headlinesMenuCommon(menu);
|
|
||||||
|
|
||||||
menu.startup();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function headlinesMenuCommon(menu) {
|
|
||||||
|
|
||||||
menu.addChild(new dijit.MenuItem({
|
|
||||||
label: __("Open original article"),
|
|
||||||
onClick: function (event) {
|
|
||||||
Article.openArticleInNewWindow(this.getParent().currentTarget.getAttribute("data-article-id"));
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
|
|
||||||
menu.addChild(new dijit.MenuItem({
|
|
||||||
label: __("Display article URL"),
|
|
||||||
onClick: function (event) {
|
|
||||||
Article.displayArticleUrl(this.getParent().currentTarget.getAttribute("data-article-id"));
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
|
|
||||||
menu.addChild(new dijit.MenuSeparator());
|
|
||||||
|
|
||||||
menu.addChild(new dijit.MenuItem({
|
|
||||||
label: __("Toggle unread"),
|
|
||||||
onClick: function () {
|
|
||||||
|
|
||||||
let ids = Headlines.getSelectedArticleIds2();
|
|
||||||
// cast to string
|
|
||||||
const id = (this.getParent().currentTarget.getAttribute("data-article-id")) + "";
|
|
||||||
ids = ids.length != 0 && ids.indexOf(id) != -1 ? ids : [id];
|
|
||||||
|
|
||||||
Headlines.selectionToggleUnread({ids: ids, no_error: 1});
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
|
|
||||||
menu.addChild(new dijit.MenuItem({
|
|
||||||
label: __("Toggle starred"),
|
|
||||||
onClick: function () {
|
|
||||||
let ids = Headlines.getSelectedArticleIds2();
|
|
||||||
// cast to string
|
|
||||||
const id = (this.getParent().currentTarget.getAttribute("data-article-id")) + "";
|
|
||||||
ids = ids.length != 0 && ids.indexOf(id) != -1 ? ids : [id];
|
|
||||||
|
|
||||||
Headlines.selectionToggleMarked(ids);
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
|
|
||||||
menu.addChild(new dijit.MenuItem({
|
|
||||||
label: __("Toggle published"),
|
|
||||||
onClick: function () {
|
|
||||||
let ids = Headlines.getSelectedArticleIds2();
|
|
||||||
// cast to string
|
|
||||||
const id = (this.getParent().currentTarget.getAttribute("data-article-id")) + "";
|
|
||||||
ids = ids.length != 0 && ids.indexOf(id) != -1 ? ids : [id];
|
|
||||||
|
|
||||||
Headlines.selectionTogglePublished(ids);
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
|
|
||||||
menu.addChild(new dijit.MenuSeparator());
|
|
||||||
|
|
||||||
menu.addChild(new dijit.MenuItem({
|
|
||||||
label: __("Mark above as read"),
|
|
||||||
onClick: function () {
|
|
||||||
catchupRelativeToArticle(0, this.getParent().currentTarget.getAttribute("data-article-id"));
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
|
|
||||||
menu.addChild(new dijit.MenuItem({
|
|
||||||
label: __("Mark below as read"),
|
|
||||||
onClick: function () {
|
|
||||||
catchupRelativeToArticle(1, this.getParent().currentTarget.getAttribute("data-article-id"));
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
|
|
||||||
|
|
||||||
const labels = getInitParam("labels");
|
|
||||||
|
|
||||||
if (labels && labels.length) {
|
|
||||||
|
|
||||||
menu.addChild(new dijit.MenuSeparator());
|
menu.addChild(new dijit.MenuSeparator());
|
||||||
|
|
||||||
const labelAddMenu = new dijit.Menu({ownerMenu: menu});
|
menu.addChild(new dijit.MenuItem({
|
||||||
const labelDelMenu = new dijit.Menu({ownerMenu: menu});
|
label: __("Toggle unread"),
|
||||||
|
onClick: function () {
|
||||||
|
|
||||||
labels.each(function (label) {
|
let ids = Headlines.getSelectedArticleIds2();
|
||||||
const bare_id = label.id;
|
// cast to string
|
||||||
const name = label.caption;
|
const id = (this.getParent().currentTarget.getAttribute("data-article-id")) + "";
|
||||||
|
ids = ids.length != 0 && ids.indexOf(id) != -1 ? ids : [id];
|
||||||
|
|
||||||
labelAddMenu.addChild(new dijit.MenuItem({
|
Headlines.selectionToggleUnread({ids: ids, no_error: 1});
|
||||||
label: name,
|
}
|
||||||
labelId: bare_id,
|
}));
|
||||||
onClick: function () {
|
|
||||||
|
|
||||||
let ids = Headlines.getSelectedArticleIds2();
|
menu.addChild(new dijit.MenuItem({
|
||||||
// cast to string
|
label: __("Toggle starred"),
|
||||||
const id = (this.getParent().ownerMenu.currentTarget.getAttribute("data-article-id")) + "";
|
onClick: function () {
|
||||||
|
let ids = Headlines.getSelectedArticleIds2();
|
||||||
|
// cast to string
|
||||||
|
const id = (this.getParent().currentTarget.getAttribute("data-article-id")) + "";
|
||||||
|
ids = ids.length != 0 && ids.indexOf(id) != -1 ? ids : [id];
|
||||||
|
|
||||||
ids = ids.length != 0 && ids.indexOf(id) != -1 ? ids : [id];
|
Headlines.selectionToggleMarked(ids);
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
|
||||||
|
menu.addChild(new dijit.MenuItem({
|
||||||
|
label: __("Toggle published"),
|
||||||
|
onClick: function () {
|
||||||
|
let ids = Headlines.getSelectedArticleIds2();
|
||||||
|
// cast to string
|
||||||
|
const id = (this.getParent().currentTarget.getAttribute("data-article-id")) + "";
|
||||||
|
ids = ids.length != 0 && ids.indexOf(id) != -1 ? ids : [id];
|
||||||
|
|
||||||
|
Headlines.selectionTogglePublished(ids);
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
|
||||||
|
menu.addChild(new dijit.MenuSeparator());
|
||||||
|
|
||||||
|
menu.addChild(new dijit.MenuItem({
|
||||||
|
label: __("Mark above as read"),
|
||||||
|
onClick: function () {
|
||||||
|
Headlines.catchupRelativeToArticle(0, this.getParent().currentTarget.getAttribute("data-article-id"));
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
|
||||||
|
menu.addChild(new dijit.MenuItem({
|
||||||
|
label: __("Mark below as read"),
|
||||||
|
onClick: function () {
|
||||||
|
Headlines.catchupRelativeToArticle(1, this.getParent().currentTarget.getAttribute("data-article-id"));
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
|
||||||
|
|
||||||
|
const labels = getInitParam("labels");
|
||||||
|
|
||||||
|
if (labels && labels.length) {
|
||||||
|
|
||||||
|
menu.addChild(new dijit.MenuSeparator());
|
||||||
|
|
||||||
|
const labelAddMenu = new dijit.Menu({ownerMenu: menu});
|
||||||
|
const labelDelMenu = new dijit.Menu({ownerMenu: menu});
|
||||||
|
|
||||||
|
labels.each(function (label) {
|
||||||
|
const bare_id = label.id;
|
||||||
|
const name = label.caption;
|
||||||
|
|
||||||
|
labelAddMenu.addChild(new dijit.MenuItem({
|
||||||
|
label: name,
|
||||||
|
labelId: bare_id,
|
||||||
|
onClick: function () {
|
||||||
|
|
||||||
|
let ids = Headlines.getSelectedArticleIds2();
|
||||||
|
// cast to string
|
||||||
|
const id = (this.getParent().ownerMenu.currentTarget.getAttribute("data-article-id")) + "";
|
||||||
|
|
||||||
|
ids = ids.length != 0 && ids.indexOf(id) != -1 ? ids : [id];
|
||||||
|
|
||||||
|
Headlines.selectionAssignLabel(this.labelId, ids);
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
|
||||||
|
labelDelMenu.addChild(new dijit.MenuItem({
|
||||||
|
label: name,
|
||||||
|
labelId: bare_id,
|
||||||
|
onClick: function () {
|
||||||
|
let ids = Headlines.getSelectedArticleIds2();
|
||||||
|
// cast to string
|
||||||
|
const id = (this.getParent().ownerMenu.currentTarget.getAttribute("data-article-id")) + "";
|
||||||
|
|
||||||
|
ids = ids.length != 0 && ids.indexOf(id) != -1 ? ids : [id];
|
||||||
|
|
||||||
|
Headlines.selectionRemoveLabel(this.labelId, ids);
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
menu.addChild(new dijit.PopupMenuItem({
|
||||||
|
label: __("Assign label"),
|
||||||
|
popup: labelAddMenu
|
||||||
|
}));
|
||||||
|
|
||||||
|
menu.addChild(new dijit.PopupMenuItem({
|
||||||
|
label: __("Remove label"),
|
||||||
|
popup: labelDelMenu
|
||||||
|
}));
|
||||||
|
|
||||||
|
}
|
||||||
|
},
|
||||||
|
initHeadlinesMenu: function() {
|
||||||
|
if (!dijit.byId("headlinesMenu")) {
|
||||||
|
|
||||||
|
const menu = new dijit.Menu({
|
||||||
|
id: "headlinesMenu",
|
||||||
|
targetNodeIds: ["headlines-frame"],
|
||||||
|
selector: ".hlMenuAttach"
|
||||||
|
});
|
||||||
|
|
||||||
|
this.headlinesMenuCommon(menu);
|
||||||
|
|
||||||
|
menu.startup();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* vgroup feed title menu */
|
||||||
|
|
||||||
|
if (!dijit.byId("headlinesFeedTitleMenu")) {
|
||||||
|
|
||||||
|
const menu = new dijit.Menu({
|
||||||
|
id: "headlinesFeedTitleMenu",
|
||||||
|
targetNodeIds: ["headlines-frame"],
|
||||||
|
selector: "div.cdmFeedTitle"
|
||||||
|
});
|
||||||
|
|
||||||
|
menu.addChild(new dijit.MenuItem({
|
||||||
|
label: __("Select articles in group"),
|
||||||
|
onClick: function (event) {
|
||||||
|
Headlines.selectArticles("all",
|
||||||
|
"#headlines-frame > div[id*=RROW]" +
|
||||||
|
"[data-orig-feed-id='" + this.getParent().currentTarget.getAttribute("data-feed-id") + "']");
|
||||||
|
|
||||||
Headlines.selectionAssignLabel(this.labelId, ids);
|
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
labelDelMenu.addChild(new dijit.MenuItem({
|
menu.addChild(new dijit.MenuItem({
|
||||||
label: name,
|
label: __("Mark group as read"),
|
||||||
labelId: bare_id,
|
|
||||||
onClick: function () {
|
onClick: function () {
|
||||||
let ids = Headlines.getSelectedArticleIds2();
|
Headlines.selectArticles("none");
|
||||||
// cast to string
|
Headlines.selectArticles("all",
|
||||||
const id = (this.getParent().ownerMenu.currentTarget.getAttribute("data-article-id")) + "";
|
"#headlines-frame > div[id*=RROW]" +
|
||||||
|
"[data-orig-feed-id='" + this.getParent().currentTarget.getAttribute("data-feed-id") + "']");
|
||||||
|
|
||||||
ids = ids.length != 0 && ids.indexOf(id) != -1 ? ids : [id];
|
Headlines.catchupSelection();
|
||||||
|
|
||||||
Headlines.selectionRemoveLabel(this.labelId, ids);
|
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
});
|
menu.addChild(new dijit.MenuItem({
|
||||||
|
label: __("Mark feed as read"),
|
||||||
|
onClick: function () {
|
||||||
|
Feeds.catchupFeedInGroup(this.getParent().currentTarget.getAttribute("data-feed-id"));
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
|
||||||
menu.addChild(new dijit.PopupMenuItem({
|
menu.addChild(new dijit.MenuItem({
|
||||||
label: __("Assign label"),
|
label: __("Edit feed"),
|
||||||
popup: labelAddMenu
|
onClick: function () {
|
||||||
}));
|
editFeed(this.getParent().currentTarget.getAttribute("data-feed-id"));
|
||||||
|
}
|
||||||
menu.addChild(new dijit.PopupMenuItem({
|
}));
|
||||||
label: __("Remove label"),
|
|
||||||
popup: labelDelMenu
|
|
||||||
}));
|
|
||||||
|
|
||||||
|
menu.startup();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
function initHeadlinesMenu() {
|
|
||||||
if (!dijit.byId("headlinesMenu")) {
|
|
||||||
|
|
||||||
const menu = new dijit.Menu({
|
|
||||||
id: "headlinesMenu",
|
|
||||||
targetNodeIds: ["headlines-frame"],
|
|
||||||
selector: ".hlMenuAttach"
|
|
||||||
});
|
|
||||||
|
|
||||||
headlinesMenuCommon(menu);
|
|
||||||
|
|
||||||
menu.startup();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* vgroup feed title menu */
|
|
||||||
|
|
||||||
if (!dijit.byId("headlinesFeedTitleMenu")) {
|
|
||||||
|
|
||||||
const menu = new dijit.Menu({
|
|
||||||
id: "headlinesFeedTitleMenu",
|
|
||||||
targetNodeIds: ["headlines-frame"],
|
|
||||||
selector: "div.cdmFeedTitle"
|
|
||||||
});
|
|
||||||
|
|
||||||
menu.addChild(new dijit.MenuItem({
|
|
||||||
label: __("Select articles in group"),
|
|
||||||
onClick: function (event) {
|
|
||||||
Headlines.selectArticles("all",
|
|
||||||
"#headlines-frame > div[id*=RROW]" +
|
|
||||||
"[data-orig-feed-id='" + this.getParent().currentTarget.getAttribute("data-feed-id") + "']");
|
|
||||||
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
|
|
||||||
menu.addChild(new dijit.MenuItem({
|
|
||||||
label: __("Mark group as read"),
|
|
||||||
onClick: function () {
|
|
||||||
Headlines.selectArticles("none");
|
|
||||||
Headlines.selectArticles("all",
|
|
||||||
"#headlines-frame > div[id*=RROW]" +
|
|
||||||
"[data-orig-feed-id='" + this.getParent().currentTarget.getAttribute("data-feed-id") + "']");
|
|
||||||
|
|
||||||
Headlines.catchupSelection();
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
|
|
||||||
menu.addChild(new dijit.MenuItem({
|
|
||||||
label: __("Mark feed as read"),
|
|
||||||
onClick: function () {
|
|
||||||
Feeds.catchupFeedInGroup(this.getParent().currentTarget.getAttribute("data-feed-id"));
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
|
|
||||||
menu.addChild(new dijit.MenuItem({
|
|
||||||
label: __("Edit feed"),
|
|
||||||
onClick: function () {
|
|
||||||
editFeed(this.getParent().currentTarget.getAttribute("data-feed-id"));
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
|
|
||||||
menu.startup();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user