|
@@ -323,9 +323,7 @@ function send_mark_queue_tick(callback) {
|
|
|
const delayedFunction = send_mark_queue_tick;
|
|
const delayedFunction = send_mark_queue_tick;
|
|
|
|
|
|
|
|
function delayedClick(a) {
|
|
function delayedClick(a) {
|
|
|
- if (a) {
|
|
|
|
|
- delayedFunction(function () { a.click(); });
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ delayedFunction(function () { a.click(); });
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function mark_read(div, only_not_read, asBatch) {
|
|
function mark_read(div, only_not_read, asBatch) {
|
|
@@ -612,7 +610,7 @@ function next_unread_entry(skipping) {
|
|
|
toggleContent(new_active, old_active, skipping);
|
|
toggleContent(new_active, old_active, skipping);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-function prev_feed(jump_to_unread) {
|
|
|
|
|
|
|
+function prev_feed() {
|
|
|
let found = false;
|
|
let found = false;
|
|
|
let adjacent = null;
|
|
let adjacent = null;
|
|
|
const feeds = document.querySelectorAll('#aside_feed .feed');
|
|
const feeds = document.querySelectorAll('#aside_feed .feed');
|
|
@@ -628,16 +626,14 @@ function prev_feed(jump_to_unread) {
|
|
|
if (getComputedStyle(feed).display === 'none') {
|
|
if (getComputedStyle(feed).display === 'none') {
|
|
|
continue;
|
|
continue;
|
|
|
}
|
|
}
|
|
|
- if (jump_to_unread && feed.dataset.unread != 0) {
|
|
|
|
|
- delayedClick(feed.querySelector('a.item-title'));
|
|
|
|
|
- return;
|
|
|
|
|
- } else if (adjacent === null) {
|
|
|
|
|
|
|
+ if (adjacent === null) {
|
|
|
adjacent = feed;
|
|
adjacent = feed;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
if (found && adjacent) {
|
|
if (found && adjacent) {
|
|
|
delayedClick(adjacent.querySelector('a.item-title'));
|
|
delayedClick(adjacent.querySelector('a.item-title'));
|
|
|
} else {
|
|
} else {
|
|
|
|
|
+ // if the current active item is a category, goes to the last feed of the category above
|
|
|
last_feed();
|
|
last_feed();
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -668,25 +664,58 @@ function next_feed(jump_to_unread) {
|
|
|
if (found && adjacent) {
|
|
if (found && adjacent) {
|
|
|
delayedClick(adjacent.querySelector('a.item-title'));
|
|
delayedClick(adjacent.querySelector('a.item-title'));
|
|
|
} else {
|
|
} else {
|
|
|
- first_feed();
|
|
|
|
|
|
|
+ // if the current active feed is the last of the entire feed list, doesn't do anything
|
|
|
|
|
+ first_feed(jump_to_unread);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-function first_feed() {
|
|
|
|
|
- const a = document.querySelector('#aside_feed .category.active .feed:not([data-unread="0"]) a.item-title');
|
|
|
|
|
- delayedClick(a);
|
|
|
|
|
|
|
+function first_feed(jump_to_unread, skip_if_last = true) {
|
|
|
|
|
+ let feed;
|
|
|
|
|
+ if (jump_to_unread) {
|
|
|
|
|
+ feed = document.querySelector('#aside_feed .category.active .feed:not([data-unread="0"])');
|
|
|
|
|
+ } else {
|
|
|
|
|
+ feed = document.querySelector('#aside_feed .category.active .feed');
|
|
|
|
|
+ }
|
|
|
|
|
+ while (getComputedStyle(feed).display === 'none') {
|
|
|
|
|
+ feed = feed.nextElementSibling;
|
|
|
|
|
+ if (!feed) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ const categoryItems = feed.parentElement;
|
|
|
|
|
+ if (skip_if_last && categoryItems.querySelector('.feed.active') === categoryItems.lastElementChild) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ const link = feed.querySelector('a.item-title');
|
|
|
|
|
+ delayedClick(link);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function last_feed() {
|
|
function last_feed() {
|
|
|
- const links = document.querySelectorAll('#aside_feed .category.active .feed:not([data-unread="0"]) a.item-title');
|
|
|
|
|
- if (links && links.length > 0) {
|
|
|
|
|
- delayedClick(links[links.length - 1]);
|
|
|
|
|
|
|
+ let feed = document.querySelector('#aside_feed .category.active .feed:last-child');
|
|
|
|
|
+ if (feed.classList.contains('active')) {
|
|
|
|
|
+ const category = feed.closest('.category').previousElementSibling;
|
|
|
|
|
+ if (category) {
|
|
|
|
|
+ delayedClick(category);
|
|
|
|
|
+ }
|
|
|
|
|
+ return;
|
|
|
}
|
|
}
|
|
|
|
|
+ while (getComputedStyle(feed).display === 'none') {
|
|
|
|
|
+ feed = feed.previousElementSibling;
|
|
|
|
|
+ if (!feed) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ const link = feed.querySelector('a.item-title');
|
|
|
|
|
+ delayedClick(link);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function prev_category() {
|
|
function prev_category() {
|
|
|
const active_cat = document.querySelector('#aside_feed .category.active');
|
|
const active_cat = document.querySelector('#aside_feed .category.active');
|
|
|
if (active_cat) {
|
|
if (active_cat) {
|
|
|
|
|
+ if (active_cat.querySelector('.feed.active')) {
|
|
|
|
|
+ delayedClick(active_cat.querySelector('a.tree-folder-title'));
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
let cat = active_cat;
|
|
let cat = active_cat;
|
|
|
do cat = cat.previousElementSibling;
|
|
do cat = cat.previousElementSibling;
|
|
|
while (cat && getComputedStyle(cat).display === 'none');
|
|
while (cat && getComputedStyle(cat).display === 'none');
|
|
@@ -720,6 +749,8 @@ function next_unread_category() {
|
|
|
while (cat && cat.getAttribute('data-unread') <= 0);
|
|
while (cat && cat.getAttribute('data-unread') <= 0);
|
|
|
if (cat) {
|
|
if (cat) {
|
|
|
delayedClick(cat.querySelector('a.tree-folder-title'));
|
|
delayedClick(cat.querySelector('a.tree-folder-title'));
|
|
|
|
|
+ } else if (active_cat.nextElementSibling) {
|
|
|
|
|
+ delayedClick(active_cat.nextElementSibling.querySelector('a.tree-folder-title'));
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
first_category();
|
|
first_category();
|
|
@@ -727,15 +758,20 @@ function next_unread_category() {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function first_category() {
|
|
function first_category() {
|
|
|
- const a = document.querySelector('#aside_feed .category:not([data-unread="0"]) a.tree-folder-title');
|
|
|
|
|
|
|
+ // goes to main stream which is always visible
|
|
|
|
|
+ const a = document.querySelector('#aside_feed .category a.tree-folder-title');
|
|
|
delayedClick(a);
|
|
delayedClick(a);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function last_category() {
|
|
function last_category() {
|
|
|
- const links = document.querySelectorAll('#aside_feed .category:not([data-unread="0"]) a.tree-folder-title');
|
|
|
|
|
- if (links && links.length > 0) {
|
|
|
|
|
- delayedClick(links[links.length - 1]);
|
|
|
|
|
|
|
+ let category = document.querySelector('#sidebar > :nth-last-child(2)');
|
|
|
|
|
+ while (getComputedStyle(category).display === 'none') {
|
|
|
|
|
+ category = category.previousElementSibling;
|
|
|
|
|
+ if (!category) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
+ delayedClick(category.querySelector('a.tree-folder-title'));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function collapse_entry() {
|
|
function collapse_entry() {
|
|
@@ -1271,7 +1307,7 @@ function init_shortcuts() {
|
|
|
if (ev.altKey) {
|
|
if (ev.altKey) {
|
|
|
prev_category();
|
|
prev_category();
|
|
|
} else if (ev.shiftKey) {
|
|
} else if (ev.shiftKey) {
|
|
|
- prev_feed(false);
|
|
|
|
|
|
|
+ prev_feed();
|
|
|
} else {
|
|
} else {
|
|
|
prev_entry(false);
|
|
prev_entry(false);
|
|
|
}
|
|
}
|
|
@@ -1293,7 +1329,7 @@ function init_shortcuts() {
|
|
|
if (ev.altKey) {
|
|
if (ev.altKey) {
|
|
|
first_category();
|
|
first_category();
|
|
|
} else if (ev.shiftKey) {
|
|
} else if (ev.shiftKey) {
|
|
|
- first_feed();
|
|
|
|
|
|
|
+ first_feed(false, false);
|
|
|
} else {
|
|
} else {
|
|
|
const old_active = document.querySelector('.flux.current');
|
|
const old_active = document.querySelector('.flux.current');
|
|
|
const first = document.querySelector('.flux');
|
|
const first = document.querySelector('.flux');
|