Added functionality for navigation without opening articles and toggling expansion of headlines
This commit is contained in:
parent
b87bd8ed56
commit
8b35d17172
|
@ -1912,6 +1912,8 @@
|
||||||
"prev_article" => __("Open previous article"),
|
"prev_article" => __("Open previous article"),
|
||||||
"next_article_noscroll" => __("Open next article (don't scroll long articles)"),
|
"next_article_noscroll" => __("Open next article (don't scroll long articles)"),
|
||||||
"prev_article_noscroll" => __("Open previous article (don't scroll long articles)"),
|
"prev_article_noscroll" => __("Open previous article (don't scroll long articles)"),
|
||||||
|
"next_article_noexpand" => __("Move to next article (don't expand or mark read)"),
|
||||||
|
"prev_article_noexpand" => __("Move to previous article (don't expand or mark read)"),
|
||||||
"search_dialog" => __("Show search dialog")),
|
"search_dialog" => __("Show search dialog")),
|
||||||
__("Article") => array(
|
__("Article") => array(
|
||||||
"toggle_mark" => __("Toggle starred"),
|
"toggle_mark" => __("Toggle starred"),
|
||||||
|
@ -1928,6 +1930,7 @@
|
||||||
"select_article_cursor" => __("Select article under cursor"),
|
"select_article_cursor" => __("Select article under cursor"),
|
||||||
"email_article" => __("Email article"),
|
"email_article" => __("Email article"),
|
||||||
"close_article" => __("Close/collapse article"),
|
"close_article" => __("Close/collapse article"),
|
||||||
|
"toggle_expand" => __("Toggle article expansion (combined mode)"),
|
||||||
"toggle_widescreen" => __("Toggle widescreen mode"),
|
"toggle_widescreen" => __("Toggle widescreen mode"),
|
||||||
"toggle_embed_original" => __("Toggle embed original")),
|
"toggle_embed_original" => __("Toggle embed original")),
|
||||||
__("Article selection") => array(
|
__("Article selection") => array(
|
||||||
|
|
16
js/tt-rss.js
16
js/tt-rss.js
|
@ -282,6 +282,12 @@ function init() {
|
||||||
hotkey_actions["prev_article_noscroll"] = function() {
|
hotkey_actions["prev_article_noscroll"] = function() {
|
||||||
moveToPost('prev', true);
|
moveToPost('prev', true);
|
||||||
};
|
};
|
||||||
|
hotkey_actions["next_article_noexpand"] = function() {
|
||||||
|
moveToPost('next', true, true);
|
||||||
|
};
|
||||||
|
hotkey_actions["prev_article_noexpand"] = function() {
|
||||||
|
moveToPost('prev', true, true);
|
||||||
|
};
|
||||||
hotkey_actions["collapse_article"] = function() {
|
hotkey_actions["collapse_article"] = function() {
|
||||||
var id = getActiveArticleId();
|
var id = getActiveArticleId();
|
||||||
var elem = $("CICD-"+id);
|
var elem = $("CICD-"+id);
|
||||||
|
@ -292,6 +298,16 @@ function init() {
|
||||||
cdmExpandArticle(id);
|
cdmExpandArticle(id);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
hotkey_actions["toggle_expand"] = function() {
|
||||||
|
var id = getActiveArticleId();
|
||||||
|
var elem = $("CICD-"+id);
|
||||||
|
if(elem.visible()) {
|
||||||
|
cdmUnexpandArticle(null, id);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
cdmExpandArticle(id);
|
||||||
|
}
|
||||||
|
};
|
||||||
hotkey_actions["search_dialog"] = function() {
|
hotkey_actions["search_dialog"] = function() {
|
||||||
search();
|
search();
|
||||||
};
|
};
|
||||||
|
|
|
@ -241,7 +241,7 @@ function render_article(article) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function showArticleInHeadlines(id) {
|
function showArticleInHeadlines(id, noexpand) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
selectArticles("none");
|
selectArticles("none");
|
||||||
|
@ -252,6 +252,7 @@ function showArticleInHeadlines(id) {
|
||||||
|
|
||||||
var article_is_unread = crow.hasClassName("Unread");
|
var article_is_unread = crow.hasClassName("Unread");
|
||||||
|
|
||||||
|
if (!noexpand)
|
||||||
crow.removeClassName("Unread");
|
crow.removeClassName("Unread");
|
||||||
crow.addClassName("active");
|
crow.addClassName("active");
|
||||||
|
|
||||||
|
@ -268,7 +269,7 @@ function showArticleInHeadlines(id) {
|
||||||
|
|
||||||
markHeadline(id);
|
markHeadline(id);
|
||||||
|
|
||||||
if (article_is_unread)
|
if (article_is_unread && !noexpand)
|
||||||
_force_scheduled_update = true;
|
_force_scheduled_update = true;
|
||||||
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -336,7 +337,7 @@ function article_callback2(transport, id) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function view(id) {
|
function view(id, activefeed, noexpand) {
|
||||||
try {
|
try {
|
||||||
var oldrow = $("RROW-" + getActiveArticleId());
|
var oldrow = $("RROW-" + getActiveArticleId());
|
||||||
if (oldrow) oldrow.removeClassName("active");
|
if (oldrow) oldrow.removeClassName("active");
|
||||||
|
@ -344,6 +345,11 @@ function view(id) {
|
||||||
var crow = $("RROW-" + id);
|
var crow = $("RROW-" + id);
|
||||||
|
|
||||||
if (!crow) return;
|
if (!crow) return;
|
||||||
|
if (noexpand) {
|
||||||
|
setActiveArticleId(id);
|
||||||
|
showArticleInHeadlines(id, noexpand);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
console.log("loading article: " + id);
|
console.log("loading article: " + id);
|
||||||
|
|
||||||
|
@ -499,7 +505,7 @@ function togglePub(id, client_only, no_effects, note) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function moveToPost(mode, noscroll) {
|
function moveToPost(mode, noscroll, noexpand) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
@ -546,13 +552,13 @@ function moveToPost(mode, noscroll) {
|
||||||
scrollArticle(ctr.offsetHeight/4);
|
scrollArticle(ctr.offsetHeight/4);
|
||||||
|
|
||||||
} else if (next_id) {
|
} else if (next_id) {
|
||||||
cdmExpandArticle(next_id);
|
cdmExpandArticle(next_id, noexpand);
|
||||||
cdmScrollToArticleId(next_id, true);
|
cdmScrollToArticleId(next_id, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (next_id) {
|
} else if (next_id) {
|
||||||
correctHeadlinesOffset(next_id);
|
correctHeadlinesOffset(next_id);
|
||||||
view(next_id, getActiveFeedId());
|
view(next_id, getActiveFeedId(), noexpand);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -570,7 +576,7 @@ function moveToPost(mode, noscroll) {
|
||||||
if (!noscroll && article.offsetTop < ctr.scrollTop) {
|
if (!noscroll && article.offsetTop < ctr.scrollTop) {
|
||||||
scrollArticle(-ctr.offsetHeight/4);
|
scrollArticle(-ctr.offsetHeight/4);
|
||||||
} else {
|
} else {
|
||||||
cdmExpandArticle(prev_id);
|
cdmExpandArticle(prev_id, noexpand);
|
||||||
cdmScrollToArticleId(prev_id, true);
|
cdmScrollToArticleId(prev_id, true);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -579,17 +585,17 @@ function moveToPost(mode, noscroll) {
|
||||||
scrollArticle(-ctr.offsetHeight/3);
|
scrollArticle(-ctr.offsetHeight/3);
|
||||||
} else if (!noscroll && prev_article &&
|
} else if (!noscroll && prev_article &&
|
||||||
prev_article.offsetTop < ctr.scrollTop) {
|
prev_article.offsetTop < ctr.scrollTop) {
|
||||||
cdmExpandArticle(prev_id);
|
cdmExpandArticle(prev_id, noexpand);
|
||||||
scrollArticle(-ctr.offsetHeight/4);
|
scrollArticle(-ctr.offsetHeight/4);
|
||||||
} else if (prev_id) {
|
} else if (prev_id) {
|
||||||
cdmExpandArticle(prev_id);
|
cdmExpandArticle(prev_id, noexpand);
|
||||||
cdmScrollToArticleId(prev_id, noscroll);
|
cdmScrollToArticleId(prev_id, noscroll);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (prev_id) {
|
} else if (prev_id) {
|
||||||
correctHeadlinesOffset(prev_id);
|
correctHeadlinesOffset(prev_id);
|
||||||
view(prev_id, getActiveFeedId());
|
view(prev_id, getActiveFeedId(), noexpand);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1375,7 +1381,28 @@ function cdmCollapseArticle(event, id) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function cdmExpandArticle(id) {
|
function cdmUnexpandArticle(event, id) {
|
||||||
|
try {
|
||||||
|
var row = $("RROW-" + id);
|
||||||
|
var elem = $("CICD-" + id);
|
||||||
|
|
||||||
|
if (elem && row) {
|
||||||
|
var collapse = $$("div#RROW-" + id +
|
||||||
|
" span[class='collapseBtn']")[0];
|
||||||
|
|
||||||
|
Element.hide(elem);
|
||||||
|
Element.show("CEXC-" + id);
|
||||||
|
Element.hide(collapse);
|
||||||
|
|
||||||
|
if (event) Event.stop(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (e) {
|
||||||
|
exception_error("cdmUnexpandArticle", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function cdmExpandArticle(id, noexpand) {
|
||||||
try {
|
try {
|
||||||
console.log("cdmExpandArticle " + id);
|
console.log("cdmExpandArticle " + id);
|
||||||
|
|
||||||
|
@ -1412,7 +1439,7 @@ function cdmExpandArticle(id) {
|
||||||
|
|
||||||
var cencw = $("CENCW-" + id);
|
var cencw = $("CENCW-" + id);
|
||||||
|
|
||||||
if (!Element.visible(elem)) {
|
if (!Element.visible(elem) && !noexpand) {
|
||||||
if (cencw) {
|
if (cencw) {
|
||||||
cencw.innerHTML = htmlspecialchars_decode(cencw.innerHTML);
|
cencw.innerHTML = htmlspecialchars_decode(cencw.innerHTML);
|
||||||
cencw.setAttribute('id', '');
|
cencw.setAttribute('id', '');
|
||||||
|
@ -1429,6 +1456,7 @@ function cdmExpandArticle(id) {
|
||||||
if (old_offset > new_offset)
|
if (old_offset > new_offset)
|
||||||
$("headlines-frame").scrollTop -= (old_offset-new_offset);
|
$("headlines-frame").scrollTop -= (old_offset-new_offset);
|
||||||
|
|
||||||
|
if (!noexpand)
|
||||||
toggleUnread(id, 0, true);
|
toggleUnread(id, 0, true);
|
||||||
toggleSelected(id);
|
toggleSelected(id);
|
||||||
$("RROW-" + id).addClassName("active");
|
$("RROW-" + id).addClassName("active");
|
||||||
|
|
Loading…
Reference in New Issue