Add keyboard shortcuts to the bookmarks page
This commit is contained in:
parent
a89d8c0005
commit
a5e9d41561
@ -5,7 +5,7 @@
|
||||
var queue_length = 5;
|
||||
|
||||
|
||||
function switch_status(item_id)
|
||||
function switch_status(item_id, hide)
|
||||
{
|
||||
var request = new XMLHttpRequest();
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
if (response.status == "read" || response.status == "unread") {
|
||||
|
||||
find_next_item();
|
||||
remove_item(response.item_id);
|
||||
if (hide) remove_item(response.item_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -193,7 +193,10 @@
|
||||
function remove_item(item_id)
|
||||
{
|
||||
var item = document.getElementById("item-" + item_id);
|
||||
if (item) item.parentNode.removeChild(item);
|
||||
|
||||
if (item) {
|
||||
|
||||
item.parentNode.removeChild(item);
|
||||
|
||||
var container = document.getElementById("page-counter");
|
||||
|
||||
@ -213,6 +216,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function open_original_item()
|
||||
@ -221,7 +225,10 @@
|
||||
|
||||
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.click();
|
||||
}
|
||||
@ -268,11 +275,14 @@
|
||||
function change_item_status()
|
||||
{
|
||||
if (is_listing() && ! document.getElementById("current-item")) {
|
||||
document.querySelector("article").id = "current-item";
|
||||
find_next_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>
|
||||
</div>
|
||||
|
||||
<section class="items">
|
||||
<section class="items" id="listing">
|
||||
<?php foreach ($items as $item): ?>
|
||||
<?php $item_id = Model\encode_item_id($item['id']) ?>
|
||||
<article id="item-<?= $item_id ?>" data-item-id="<?= $item_id ?>">
|
||||
<h2>
|
||||
<a
|
||||
href="?action=show&id=<?= $item_id ?>"
|
||||
data-item-id="<?= $item_id ?>"
|
||||
id="open-<?= $item_id ?>"
|
||||
>
|
||||
<?= Helper\escape($item['title']) ?>
|
||||
|
@ -12,11 +12,12 @@
|
||||
<section class="items" id="listing">
|
||||
<?php foreach ($items as $item): ?>
|
||||
<?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>
|
||||
<?= $item['bookmark'] ? '★ ' : '' ?>
|
||||
<a
|
||||
href="?action=show&id=<?= $item_id ?>"
|
||||
data-item-id="<?= $item_id ?>"
|
||||
id="open-<?= $item_id ?>"
|
||||
>
|
||||
<?= Helper\escape($item['title']) ?>
|
||||
@ -28,7 +29,7 @@
|
||||
<a href="?action=mark-item-unread&id=<?= $item_id ?>&offset=<?= $offset ?>"><?= t('mark as unread') ?></a> |
|
||||
|
||||
<?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 ?>
|
||||
|
||||
<a href="?action=mark-item-removed&id=<?= $item_id ?>&offset=<?= $offset ?>"><?= t('remove') ?></a> |
|
||||
|
@ -14,11 +14,12 @@
|
||||
<section class="items" id="listing">
|
||||
<?php foreach ($items as $item): ?>
|
||||
<?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>
|
||||
<?= $item['bookmark'] ? '★ ' : '' ?>
|
||||
<a
|
||||
href="?action=read&id=<?= $item_id ?>"
|
||||
data-item-id="<?= $item_id ?>"
|
||||
id="open-<?= $item_id ?>"
|
||||
>
|
||||
<?= Helper\escape($item['title']) ?>
|
||||
@ -45,6 +46,7 @@
|
||||
target="_blank"
|
||||
data-item-id="<?= $item_id ?>"
|
||||
data-action="mark-read"
|
||||
data-hide="true"
|
||||
>
|
||||
<?= t('original link') ?>
|
||||
</a>
|
||||
|
Loading…
Reference in New Issue
Block a user