Add keyboard shortcuts to the bookmarks page
This commit is contained in:
parent
a89d8c0005
commit
a5e9d41561
@ -5,7 +5,7 @@
|
|||||||
var queue_length = 5;
|
var queue_length = 5;
|
||||||
|
|
||||||
|
|
||||||
function switch_status(item_id)
|
function switch_status(item_id, hide)
|
||||||
{
|
{
|
||||||
var request = new XMLHttpRequest();
|
var request = new XMLHttpRequest();
|
||||||
|
|
||||||
@ -18,7 +18,7 @@
|
|||||||
if (response.status == "read" || response.status == "unread") {
|
if (response.status == "read" || response.status == "unread") {
|
||||||
|
|
||||||
find_next_item();
|
find_next_item();
|
||||||
remove_item(response.item_id);
|
if (hide) remove_item(response.item_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -193,23 +193,27 @@
|
|||||||
function remove_item(item_id)
|
function remove_item(item_id)
|
||||||
{
|
{
|
||||||
var item = document.getElementById("item-" + item_id);
|
var item = document.getElementById("item-" + item_id);
|
||||||
if (item) item.parentNode.removeChild(item);
|
|
||||||
|
|
||||||
var container = document.getElementById("page-counter");
|
if (item) {
|
||||||
|
|
||||||
if (container) {
|
item.parentNode.removeChild(item);
|
||||||
|
|
||||||
counter = parseInt(container.textContent.trim(), 10) - 1;
|
var container = document.getElementById("page-counter");
|
||||||
|
|
||||||
if (counter == 0) {
|
if (container) {
|
||||||
|
|
||||||
window.location = "?action=feeds¬hing_to_read=1";
|
counter = parseInt(container.textContent.trim(), 10) - 1;
|
||||||
}
|
|
||||||
else {
|
|
||||||
|
|
||||||
container.textContent = counter + " ";
|
if (counter == 0) {
|
||||||
document.title = "miniflux (" + counter + ")";
|
|
||||||
document.getElementById("nav-counter").textContent = "(" + counter + ")";
|
window.location = "?action=feeds¬hing_to_read=1";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
container.textContent = counter + " ";
|
||||||
|
document.title = "miniflux (" + counter + ")";
|
||||||
|
document.getElementById("nav-counter").textContent = "(" + counter + ")";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -221,7 +225,10 @@
|
|||||||
|
|
||||||
if (link) {
|
if (link) {
|
||||||
|
|
||||||
if (is_listing()) mark_as_read(link.getAttribute("data-item-id"));
|
if (is_listing() && link.getAttribute("data-hide")) {
|
||||||
|
mark_as_read(link.getAttribute("data-item-id"));
|
||||||
|
}
|
||||||
|
|
||||||
link.removeAttribute("data-action");
|
link.removeAttribute("data-action");
|
||||||
link.click();
|
link.click();
|
||||||
}
|
}
|
||||||
@ -268,11 +275,14 @@
|
|||||||
function change_item_status()
|
function change_item_status()
|
||||||
{
|
{
|
||||||
if (is_listing() && ! document.getElementById("current-item")) {
|
if (is_listing() && ! document.getElementById("current-item")) {
|
||||||
document.querySelector("article").id = "current-item";
|
find_next_item();
|
||||||
}
|
}
|
||||||
|
|
||||||
var item = document.getElementById("current-item");
|
var item = document.getElementById("current-item");
|
||||||
if (item) switch_status(item.getAttribute("data-item-id"));
|
|
||||||
|
if (item) {
|
||||||
|
switch_status(item.getAttribute("data-item-id"), item.getAttribute("data-hide"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -8,13 +8,14 @@
|
|||||||
<h2><?= t('Bookmarks') ?> (<?= $nb_items ?>)</h2>
|
<h2><?= t('Bookmarks') ?> (<?= $nb_items ?>)</h2>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<section class="items">
|
<section class="items" id="listing">
|
||||||
<?php foreach ($items as $item): ?>
|
<?php foreach ($items as $item): ?>
|
||||||
<?php $item_id = Model\encode_item_id($item['id']) ?>
|
<?php $item_id = Model\encode_item_id($item['id']) ?>
|
||||||
<article id="item-<?= $item_id ?>" data-item-id="<?= $item_id ?>">
|
<article id="item-<?= $item_id ?>" data-item-id="<?= $item_id ?>">
|
||||||
<h2>
|
<h2>
|
||||||
<a
|
<a
|
||||||
href="?action=show&id=<?= $item_id ?>"
|
href="?action=show&id=<?= $item_id ?>"
|
||||||
|
data-item-id="<?= $item_id ?>"
|
||||||
id="open-<?= $item_id ?>"
|
id="open-<?= $item_id ?>"
|
||||||
>
|
>
|
||||||
<?= Helper\escape($item['title']) ?>
|
<?= Helper\escape($item['title']) ?>
|
||||||
|
@ -12,11 +12,12 @@
|
|||||||
<section class="items" id="listing">
|
<section class="items" id="listing">
|
||||||
<?php foreach ($items as $item): ?>
|
<?php foreach ($items as $item): ?>
|
||||||
<?php $item_id = Model\encode_item_id($item['id']) ?>
|
<?php $item_id = Model\encode_item_id($item['id']) ?>
|
||||||
<article id="item-<?= $item_id ?>" data-item-id="<?= $item_id ?>" data-item-page="<?= $menu ?>">
|
<article id="item-<?= $item_id ?>" data-item-id="<?= $item_id ?>" data-item-page="<?= $menu ?>" data-hide="true">
|
||||||
<h2>
|
<h2>
|
||||||
<?= $item['bookmark'] ? '★ ' : '' ?>
|
<?= $item['bookmark'] ? '★ ' : '' ?>
|
||||||
<a
|
<a
|
||||||
href="?action=show&id=<?= $item_id ?>"
|
href="?action=show&id=<?= $item_id ?>"
|
||||||
|
data-item-id="<?= $item_id ?>"
|
||||||
id="open-<?= $item_id ?>"
|
id="open-<?= $item_id ?>"
|
||||||
>
|
>
|
||||||
<?= Helper\escape($item['title']) ?>
|
<?= Helper\escape($item['title']) ?>
|
||||||
@ -28,7 +29,7 @@
|
|||||||
<a href="?action=mark-item-unread&id=<?= $item_id ?>&offset=<?= $offset ?>"><?= t('mark as unread') ?></a> |
|
<a href="?action=mark-item-unread&id=<?= $item_id ?>&offset=<?= $offset ?>"><?= t('mark as unread') ?></a> |
|
||||||
|
|
||||||
<?php if (! $item['bookmark']): ?>
|
<?php if (! $item['bookmark']): ?>
|
||||||
<a href="?action=bookmark&value=1&id=<?= $item_id ?>&redirect=history&offset=<?= $offset ?>"><?= t('bookmark') ?></a> |
|
<a id="bookmark-<?= $item_id ?>" href="?action=bookmark&value=1&id=<?= $item_id ?>&redirect=history&offset=<?= $offset ?>"><?= t('bookmark') ?></a> |
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
|
||||||
<a href="?action=mark-item-removed&id=<?= $item_id ?>&offset=<?= $offset ?>"><?= t('remove') ?></a> |
|
<a href="?action=mark-item-removed&id=<?= $item_id ?>&offset=<?= $offset ?>"><?= t('remove') ?></a> |
|
||||||
|
@ -14,11 +14,12 @@
|
|||||||
<section class="items" id="listing">
|
<section class="items" id="listing">
|
||||||
<?php foreach ($items as $item): ?>
|
<?php foreach ($items as $item): ?>
|
||||||
<?php $item_id = Model\encode_item_id($item['id']) ?>
|
<?php $item_id = Model\encode_item_id($item['id']) ?>
|
||||||
<article id="item-<?= $item_id ?>" data-item-id="<?= $item_id ?>" data-item-page="<?= $menu ?>">
|
<article id="item-<?= $item_id ?>" data-item-id="<?= $item_id ?>" data-item-page="<?= $menu ?>" data-hide="true">
|
||||||
<h2>
|
<h2>
|
||||||
<?= $item['bookmark'] ? '★ ' : '' ?>
|
<?= $item['bookmark'] ? '★ ' : '' ?>
|
||||||
<a
|
<a
|
||||||
href="?action=read&id=<?= $item_id ?>"
|
href="?action=read&id=<?= $item_id ?>"
|
||||||
|
data-item-id="<?= $item_id ?>"
|
||||||
id="open-<?= $item_id ?>"
|
id="open-<?= $item_id ?>"
|
||||||
>
|
>
|
||||||
<?= Helper\escape($item['title']) ?>
|
<?= Helper\escape($item['title']) ?>
|
||||||
@ -45,6 +46,7 @@
|
|||||||
target="_blank"
|
target="_blank"
|
||||||
data-item-id="<?= $item_id ?>"
|
data-item-id="<?= $item_id ?>"
|
||||||
data-action="mark-read"
|
data-action="mark-read"
|
||||||
|
data-hide="true"
|
||||||
>
|
>
|
||||||
<?= t('original link') ?>
|
<?= t('original link') ?>
|
||||||
</a>
|
</a>
|
||||||
|
Loading…
Reference in New Issue
Block a user