mirror of
https://git.tt-rss.org/git/tt-rss.git
synced 2025-12-13 22:15:56 +00:00
implement classic next/prev article movement behavior, bind to ctrl-arrows
This commit is contained in:
@@ -1859,6 +1859,8 @@
|
|||||||
"prev_feed" => __("Open previous feed"),
|
"prev_feed" => __("Open previous feed"),
|
||||||
"next_article" => __("Open next article"),
|
"next_article" => __("Open next article"),
|
||||||
"prev_article" => __("Open previous article"),
|
"prev_article" => __("Open previous article"),
|
||||||
|
"next_article_noscroll" => __("Open next article (don't scroll long articles)"),
|
||||||
|
"prev_article_noscroll" => __("Open previous article (don't scroll long articles)"),
|
||||||
"search_dialog" => __("Show search dialog")),
|
"search_dialog" => __("Show search dialog")),
|
||||||
__("Article") => array(
|
__("Article") => array(
|
||||||
"toggle_mark" => __("Toggle starred"),
|
"toggle_mark" => __("Toggle starred"),
|
||||||
@@ -1919,6 +1921,8 @@
|
|||||||
"p" => "prev_article",
|
"p" => "prev_article",
|
||||||
"(38)|up" => "prev_article",
|
"(38)|up" => "prev_article",
|
||||||
"(40)|down" => "next_article",
|
"(40)|down" => "next_article",
|
||||||
|
"^(38)|Ctrl-up" => "prev_article_noscroll",
|
||||||
|
"^(40)|Ctrl-down" => "next_article_noscroll",
|
||||||
"(191)|/" => "search_dialog",
|
"(191)|/" => "search_dialog",
|
||||||
// "article" => array(
|
// "article" => array(
|
||||||
"s" => "toggle_mark",
|
"s" => "toggle_mark",
|
||||||
|
|||||||
@@ -604,6 +604,12 @@ function hotkey_handler(e) {
|
|||||||
case "prev_article":
|
case "prev_article":
|
||||||
moveToPost('prev');
|
moveToPost('prev');
|
||||||
return false;
|
return false;
|
||||||
|
case "next_article_noscroll":
|
||||||
|
moveToPost('next', true);
|
||||||
|
return false;
|
||||||
|
case "prev_article_noscroll":
|
||||||
|
moveToPost('prev', true);
|
||||||
|
return false;
|
||||||
case "search_dialog":
|
case "search_dialog":
|
||||||
search();
|
search();
|
||||||
return ;
|
return ;
|
||||||
|
|||||||
@@ -514,7 +514,7 @@ function togglePub(id, client_only, no_effects, note) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function moveToPost(mode) {
|
function moveToPost(mode, noscroll) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
@@ -555,7 +555,7 @@ function moveToPost(mode) {
|
|||||||
var article = $("RROW-" + active_post_id);
|
var article = $("RROW-" + active_post_id);
|
||||||
var ctr = $("headlines-frame");
|
var ctr = $("headlines-frame");
|
||||||
|
|
||||||
if (article && article.offsetTop + article.offsetHeight >
|
if (!noscroll && article && article.offsetTop + article.offsetHeight >
|
||||||
ctr.scrollTop + ctr.offsetHeight) {
|
ctr.scrollTop + ctr.offsetHeight) {
|
||||||
|
|
||||||
scrollArticle(ctr.offsetHeight/2);
|
scrollArticle(ctr.offsetHeight/2);
|
||||||
@@ -580,9 +580,10 @@ function moveToPost(mode) {
|
|||||||
var prev_article = $("RROW-" + prev_id);
|
var prev_article = $("RROW-" + prev_id);
|
||||||
var ctr = $("headlines-frame");
|
var ctr = $("headlines-frame");
|
||||||
|
|
||||||
if (article && article.offsetTop < ctr.scrollTop) {
|
if (!noscroll && article && article.offsetTop < ctr.scrollTop) {
|
||||||
scrollArticle(-ctr.offsetHeight/2);
|
scrollArticle(-ctr.offsetHeight/2);
|
||||||
} else if (prev_article && prev_article.offsetTop < ctr.scrollTop) {
|
} else if (!noscroll && prev_article &&
|
||||||
|
prev_article.offsetTop < ctr.scrollTop) {
|
||||||
cdmExpandArticle(prev_id);
|
cdmExpandArticle(prev_id);
|
||||||
scrollArticle(-ctr.offsetHeight/2);
|
scrollArticle(-ctr.offsetHeight/2);
|
||||||
} else if (prev_id) {
|
} else if (prev_id) {
|
||||||
|
|||||||
Reference in New Issue
Block a user