]> git.wh0rd.org Git - tt-rss.git/commitdiff
implement classic next/prev article movement behavior, bind to ctrl-arrows
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Wed, 27 Feb 2013 18:48:43 +0000 (22:48 +0400)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Wed, 27 Feb 2013 18:48:43 +0000 (22:48 +0400)
include/functions.php
js/tt-rss.js
js/viewfeed.js

index 979a287616f99cd4d6dbbe8731fcaca0da45a877..8db72f56de3ec1bac5c1d22bae2248599ded507d 100644 (file)
                                "prev_feed" => __("Open previous feed"),
                                "next_article" => __("Open next 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")),
                        __("Article") => array(
                                "toggle_mark" => __("Toggle starred"),
                                "p" => "prev_article",
                                "(38)|up" => "prev_article",
                                "(40)|down" => "next_article",
+                               "^(38)|Ctrl-up" => "prev_article_noscroll",
+                               "^(40)|Ctrl-down" => "next_article_noscroll",
                                "(191)|/" => "search_dialog",
 //                     "article" => array(
                                "s" => "toggle_mark",
index 530cb293139d4c02ffaed5fdac7df24db5e9a693..7462d933de3f1ee531a3b92a9a9dcf9d107314ec 100644 (file)
@@ -604,6 +604,12 @@ function hotkey_handler(e) {
                case "prev_article":
                        moveToPost('prev');
                        return false;
+               case "next_article_noscroll":
+                       moveToPost('next', true);
+                       return false;
+               case "prev_article_noscroll":
+                       moveToPost('prev', true);
+                       return false;
                case "search_dialog":
                        search();
                        return ;
index 6f88f7eac045a962ffa56e50ef100e8d8039d793..20a3e2b161c5e3b6d836e0485dd7152fa040f7b1 100644 (file)
@@ -514,7 +514,7 @@ function togglePub(id, client_only, no_effects, note) {
        }
 }
 
-function moveToPost(mode) {
+function moveToPost(mode, noscroll) {
 
        try {
 
@@ -555,7 +555,7 @@ function moveToPost(mode) {
                                        var article = $("RROW-" + active_post_id);
                                        var ctr = $("headlines-frame");
 
-                                       if (article && article.offsetTop + article.offsetHeight >
+                                       if (!noscroll && article && article.offsetTop + article.offsetHeight >
                                                        ctr.scrollTop + ctr.offsetHeight) {
 
                                                scrollArticle(ctr.offsetHeight/2);
@@ -580,9 +580,10 @@ function moveToPost(mode) {
                                        var prev_article = $("RROW-" + prev_id);
                                        var ctr = $("headlines-frame");
 
-                                       if (article && article.offsetTop < ctr.scrollTop) {
+                                       if (!noscroll && article && article.offsetTop < ctr.scrollTop) {
                                                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);
                                                scrollArticle(-ctr.offsetHeight/2);
                                        } else if (prev_id) {