Add links to mark as read/unread and change some functions names
This commit is contained in:
parent
078c13da2b
commit
038e58dfd6
@ -23,7 +23,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
request.open("POST", "?action=status&id=" + item_id, true);
|
||||
request.open("POST", "?action=change-item-status&id=" + item_id, true);
|
||||
request.send();
|
||||
}
|
||||
|
||||
@ -37,7 +37,7 @@
|
||||
remove_item(item_id);
|
||||
};
|
||||
|
||||
request.open("POST", "?action=read&id=" + item_id, true);
|
||||
request.open("POST", "?action=mark-item-read&id=" + item_id, true);
|
||||
request.send();
|
||||
}
|
||||
|
||||
@ -46,7 +46,7 @@
|
||||
{
|
||||
var request = new XMLHttpRequest();
|
||||
|
||||
request.open("POST", "?action=unread&id=" + item_id, true);
|
||||
request.open("POST", "?action=mark-item-unread&id=" + item_id, true);
|
||||
request.send();
|
||||
}
|
||||
|
||||
@ -87,28 +87,31 @@
|
||||
|
||||
var request = new XMLHttpRequest();
|
||||
|
||||
request.onload = function() {
|
||||
request.onreadystatechange = function() {
|
||||
|
||||
hide_refresh_icon(feed_id);
|
||||
if (request.readyState === 4) {
|
||||
|
||||
try {
|
||||
hide_refresh_icon(feed_id);
|
||||
|
||||
var response = JSON.parse(this.responseText);
|
||||
try {
|
||||
|
||||
if (callback) {
|
||||
var response = JSON.parse(this.responseText);
|
||||
|
||||
callback(response);
|
||||
}
|
||||
|
||||
if (! response.result) {
|
||||
|
||||
//window.alert('Unable to refresh this feed: ' + feed_id);
|
||||
if (callback) {
|
||||
|
||||
callback(response);
|
||||
}
|
||||
|
||||
if (! response.result) {
|
||||
|
||||
//window.alert('Unable to refresh this feed: ' + feed_id);
|
||||
}
|
||||
}
|
||||
catch (e) {}
|
||||
}
|
||||
catch (e) {}
|
||||
};
|
||||
|
||||
request.open("GET", "?action=ajax-refresh-feed&feed_id=" + feed_id, true);
|
||||
request.open("POST", "?action=refresh-feed&feed_id=" + feed_id, true);
|
||||
request.send();
|
||||
|
||||
return true;
|
||||
|
@ -98,27 +98,39 @@ Router\get_action('read', function() {
|
||||
});
|
||||
|
||||
|
||||
Router\post_action('read', function() {
|
||||
Router\get_action('mark-item-read', function() {
|
||||
|
||||
$id = Request\param('id');
|
||||
|
||||
Model\set_item_read($id);
|
||||
|
||||
Response\json(array('Ok'));
|
||||
Response\Redirect('?action=default');
|
||||
});
|
||||
|
||||
|
||||
Router\post_action('unread', function() {
|
||||
Router\get_action('mark-item-unread', function() {
|
||||
|
||||
$id = Request\param('id');
|
||||
|
||||
Model\set_item_unread($id);
|
||||
Response\Redirect('?action=history');
|
||||
});
|
||||
|
||||
|
||||
Router\post_action('mark-item-read', function() {
|
||||
|
||||
$id = Request\param('id');
|
||||
Model\set_item_read($id);
|
||||
Response\json(array('Ok'));
|
||||
});
|
||||
|
||||
|
||||
Router\post_action('status', function() {
|
||||
Router\post_action('mark-item-unread', function() {
|
||||
|
||||
$id = Request\param('id');
|
||||
Model\set_item_unread($id);
|
||||
Response\json(array('Ok'));
|
||||
});
|
||||
|
||||
|
||||
Router\post_action('change-item-status', function() {
|
||||
|
||||
$id = Request\param('id');
|
||||
|
||||
@ -179,7 +191,7 @@ Router\get_action('refresh-feed', function() {
|
||||
});
|
||||
|
||||
|
||||
Router\get_action('ajax-refresh-feed', function() {
|
||||
Router\post_action('refresh-feed', function() {
|
||||
|
||||
$id = Request\int_param('feed_id');
|
||||
|
||||
@ -243,7 +255,7 @@ Router\post_action('add', function() {
|
||||
}
|
||||
else {
|
||||
|
||||
Session\flash_error('Unable to find a subscription.');
|
||||
Session\flash_error('Unable to find a subscription or parsing error.');
|
||||
}
|
||||
|
||||
Response\html(Template\layout('add', array(
|
||||
|
@ -25,6 +25,7 @@
|
||||
<p>
|
||||
<?= Helper\get_host_from_url($item['url']) ?> |
|
||||
<?= date('l, j F Y H:i', $item['updated']) ?> |
|
||||
<a href="?action=mark-item-unread&id=<?= urlencode($item['id']) ?>">mark as unread</a> |
|
||||
<a
|
||||
href="<?= $item['url'] ?>"
|
||||
id="original-<?= urlencode($item['id']) ?>"
|
||||
|
@ -27,6 +27,7 @@
|
||||
</p>
|
||||
<p>
|
||||
<?= Helper\get_host_from_url($item['url']) ?> |
|
||||
<a href="?action=mark-item-read&id=<?= urlencode($item['id']) ?>">mark as read</a> |
|
||||
<a
|
||||
href="<?= $item['url'] ?>"
|
||||
id="original-<?= urlencode($item['id']) ?>"
|
||||
|
Loading…
Reference in New Issue
Block a user