diff options
| author | 2018-11-18 19:31:36 +0100 | |
|---|---|---|
| committer | 2018-11-18 19:31:36 +0100 | |
| commit | e20c7ef1b020df492923ca9a445fb8fa172a11dd (patch) | |
| tree | 9ff4516fe9c6269f0eca404c338dca27e8730e6a /p/scripts | |
| parent | f3a88614ef4a2541ee29054124d62c0cdc78f485 (diff) | |
[fix] Finishing touches for next/previous without focus (#2140)
* [fix] Finishing touches for next/previous without focus
Cf. #1767.
* Avoid single quote
Alternative: use `’`
* Minor whitespace
* Minor whitespace
* be explicit about skipping
* add todos
* overshot by one
Diffstat (limited to 'p/scripts')
| -rw-r--r-- | p/scripts/main.js | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/p/scripts/main.js b/p/scripts/main.js index 43753417c..3f1fdf20e 100644 --- a/p/scripts/main.js +++ b/p/scripts/main.js @@ -237,7 +237,7 @@ function mark_favorite(active) { }); } -function toggleContent(new_active, old_active, skipping = false) { +function toggleContent(new_active, old_active, skipping) { // If skipping, move current without activating or marking as read if (new_active.length === 0) { return; @@ -252,7 +252,7 @@ function toggleContent(new_active, old_active, skipping = false) { } if (old_active[0] !== new_active[0]) { - if (isCollapsed && !skipping) { // BUG?: isCollapsed can only ever be true + if (isCollapsed && !skipping) { // BUG?: isCollapsed can only ever be true new_active.addClass("active"); } old_active.removeClass("active current"); @@ -260,7 +260,7 @@ function toggleContent(new_active, old_active, skipping = false) { if (context.auto_remove_article && !old_active.hasClass('not_read') && !skipping) { auto_remove(old_active); } - } else { // collapse_entry calls toggleContent(flux_current, flux_current) + } else { // collapse_entry calls toggleContent(flux_current, flux_current, false) new_active.toggleClass('active'); } @@ -279,9 +279,9 @@ function toggleContent(new_active, old_active, skipping = false) { } } - if (skipping){ + if (skipping) { // when skipping, this feels more natural if it's not so near the top - new_pos -= $(window).height()/4 + new_pos -= $(window).height() / 4; } if (context.hide_posts) { if (relative_move) { @@ -423,7 +423,7 @@ function last_category() { function collapse_entry() { var flux_current = $(".flux.current"); - toggleContent(flux_current, flux_current); + toggleContent(flux_current, flux_current, false); } function user_filter(key) { @@ -666,7 +666,7 @@ function init_shortcuts() { first = $(".flux:first"); if (first.hasClass("flux")) { - toggleContent(first, old_active); + toggleContent(first, old_active, false); } }, { 'disable_in_input': true @@ -682,7 +682,7 @@ function init_shortcuts() { last = $(".flux:last"); if (last.hasClass("flux")) { - toggleContent(last, old_active); + toggleContent(last, old_active, false); } }, { 'disable_in_input': true @@ -795,7 +795,7 @@ function init_stream(divStream) { } return true; } - toggleContent(new_active, old_active); + toggleContent(new_active, old_active, false); }); divStream.on('click', '.flux a.read', function () { |
