mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-28 01:56:01 -05:00
BUGFIX: j/k now goes to the suggested topic list correctly.
This commit is contained in:
parent
5adc486cef
commit
bb887964b1
2 changed files with 13 additions and 5 deletions
|
@ -31,7 +31,7 @@ Discourse.KeyboardShortcuts = Ember.Object.createWithMixins({
|
|||
'm t': 'div.notification-options li[data-id="2"] a', // mark topic as tracking
|
||||
'm w': 'div.notification-options li[data-id="3"] a', // mark topic as watching
|
||||
'n': '#user-notifications', // open notifictions menu
|
||||
'o,enter': '#topic-list tr.topic-list-item.selected a.title', // open selected topic
|
||||
'o,enter': '#topic-list tr.selected a.title', // open selected topic
|
||||
'shift+r': '#topic-footer-buttons button.create', // reply to topic
|
||||
'r': '.topic-post.selected button.create', // reply to selected post
|
||||
'shift+s': '#topic-footer-buttons button.share', // share topic
|
||||
|
@ -141,17 +141,25 @@ Discourse.KeyboardShortcuts = Ember.Object.createWithMixins({
|
|||
|
||||
var rgx = new RegExp("post-cloak-(\\d+)").exec($article.parent()[0].id);
|
||||
if (rgx === null || typeof rgx[1] === 'undefined') {
|
||||
this._scrollList($article);
|
||||
this._scrollList($article, direction);
|
||||
} else {
|
||||
Discourse.TopicView.jumpToPost(rgx[1]);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
_scrollList: function($article) {
|
||||
_scrollList: function($article, direction) {
|
||||
var $body = $('body'),
|
||||
distToElement = $article.position().top + $article.height() - $(window).height() - $body.scrollTop();
|
||||
|
||||
// cut some bottom slack
|
||||
distToElement += 40;
|
||||
|
||||
// don't scroll backwards, its silly
|
||||
if((direction > 0 && distToElement < 0) || (direction < 0 && distToElement > 0)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$('html, body').scrollTop($body.scrollTop() + distToElement);
|
||||
},
|
||||
|
||||
|
@ -160,7 +168,7 @@ Discourse.KeyboardShortcuts = Ember.Object.createWithMixins({
|
|||
$topicArea = $('.posts-wrapper');
|
||||
|
||||
if ($topicArea.size() > 0) {
|
||||
return $topicArea.find('.topic-post');
|
||||
return $('.posts-wrapper .topic-post, #topic-list tbody tr');
|
||||
}
|
||||
else if ($topicList.size() > 0) {
|
||||
return $topicList.find('.topic-list-item');
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
border-left: 1px solid transparent;
|
||||
}
|
||||
|
||||
.topic-list-item.selected td:first-child, .topic-post.selected {
|
||||
#topic-list tr.selected td:first-child, .topic-list-item.selected td:first-child, .topic-post.selected {
|
||||
border-left: 1px solid $danger;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue