Items can be bookmarked only if they have the status read or unread
This commit is contained in:
parent
c868db1c1e
commit
400b4272b0
38
assets/js/all.min.js
vendored
38
assets/js/all.min.js
vendored
@ -1,24 +1,24 @@
|
|||||||
var Miniflux={};
|
var Miniflux={};
|
||||||
Miniflux.App=function(){return{BlinkIcon:function(){var d=document.querySelectorAll(".loading-icon");[].forEach.call(d,function(c){c.classList.toggle("loading-icon-blink")})},Run:function(){Miniflux.Event.ListenKeyboardEvents();Miniflux.Event.ListenMouseEvents()},MozillaAuth:function(d){navigator.id.watch({onlogin:function(c){var a=new XMLHttpRequest;a.open("POST","?action="+d+"&token="+c,!0);a.setRequestHeader("Connection","close");a.onload=function(){window.location.href=this.responseText};a.send("token="+
|
Miniflux.App=function(){return{BlinkIcon:function(){var e=document.querySelectorAll(".loading-icon");[].forEach.call(e,function(c){c.classList.toggle("loading-icon-blink")})},Run:function(){Miniflux.Event.ListenKeyboardEvents();Miniflux.Event.ListenMouseEvents()},MozillaAuth:function(e){navigator.id.watch({onlogin:function(c){var a=new XMLHttpRequest;a.open("POST","?action="+e+"&token="+c,!0);a.setRequestHeader("Connection","close");a.onload=function(){window.location.href=this.responseText};a.send("token="+
|
||||||
c)},onlogout:function(){}});navigator.id.request()}}}();
|
c)},onlogout:function(){}});navigator.id.request()}}}();
|
||||||
Miniflux.Feed=function(){function d(a){if(a=document.getElementById("loading-feed-"+a))a.appendChild(document.createTextNode("\u2600")),a.classList.add("loading-icon-blink");f||(f=setInterval(Miniflux.App.BlinkIcon,500))}function c(){for(var c=document.getElementsByTagName("a"),e=0,b=c.length;e<b;e++){var g=c[e].getAttribute("data-feed-id");g&&a.push(parseInt(g))}}var a=[],e=[],f;return{Update:function(a,c){d(a);var b=new XMLHttpRequest;b.onload=function(){var b=document.getElementById("loading-feed-"+
|
Miniflux.Feed=function(){function e(a){if(a=document.getElementById("loading-feed-"+a))a.appendChild(document.createTextNode("\u2600")),a.classList.add("loading-icon-blink");f||(f=setInterval(Miniflux.App.BlinkIcon,500))}function c(){for(var c=document.getElementsByTagName("a"),d=0,b=c.length;d<b;d++){var g=c[d].getAttribute("data-feed-id");g&&a.push(parseInt(g))}}var a=[],d=[],f;return{Update:function(a,c){e(a);var b=new XMLHttpRequest;b.onload=function(){var b=document.getElementById("loading-feed-"+
|
||||||
a);b&&(b.innerHTML="");if(b=document.getElementById("last-checked-feed-"+a))b.innerHTML=b.getAttribute("data-after-update");try{var k=JSON.parse(this.responseText);if(k.result){var e=k.items_count,d=document.getElementById("items-count-"+a);d&&(d.innerHTML="("+e.items_unread+"/"+e.items_total+")")}c&&c(k)}catch(f){}};b.open("POST","?action=refresh-feed&feed_id="+a,!0);b.send()},UpdateAll:function(){c();var d=setInterval(function(){for(;0<a.length&&5>e.length;){var c=a.shift();e.push(c);Miniflux.Feed.Update(c,
|
a);b&&(b.innerHTML="");if(b=document.getElementById("last-checked-feed-"+a))b.innerHTML=b.getAttribute("data-after-update");try{var k=JSON.parse(this.responseText);if(k.result){var d=k.items_count,e=document.getElementById("items-count-"+a);e&&(e.innerHTML="("+d.items_unread+"/"+d.items_total+")")}c&&c(k)}catch(f){}};b.open("POST","?action=refresh-feed&feed_id="+a,!0);b.send()},UpdateAll:function(){c();var e=setInterval(function(){for(;0<a.length&&5>d.length;){var c=a.shift();d.push(c);Miniflux.Feed.Update(c,
|
||||||
function(b){b=e.indexOf(b.feed_id);0<=b&&e.splice(b,1);0==a.length&&0==e.length&&(clearInterval(d),clearInterval(f),window.location.href="?action=unread")})}},100)}}}();
|
function(b){b=d.indexOf(b.feed_id);0<=b&&d.splice(b,1);0==a.length&&0==d.length&&(clearInterval(e),clearInterval(f),window.location.href="?action=unread")})}},100)}}}();
|
||||||
Miniflux.Item=function(){function d(b){var a=document.getElementById("item-"+b);a||(a=document.getElementById("current-item"),a.getAttribute("data-item-id")!=b&&(a=!1));return a}function c(b){if((b=document.getElementById("bookmark-"+b))&&b.getAttribute("data-reverse-label")){var a=b.innerHTML;b.innerHTML=b.getAttribute("data-reverse-label");b.setAttribute("data-reverse-label",a)}}function a(b){if(b=document.getElementById("status-"+b)){var a=b.innerHTML;b.innerHTML=b.getAttribute("data-reverse-label");
|
Miniflux.Item=function(){function e(b){var a=document.getElementById("item-"+b);a||(a=document.getElementById("current-item"),a.getAttribute("data-item-id")!=b&&(a=!1));return a}function c(b){if((b=document.getElementById("bookmark-"+b))&&b.getAttribute("data-reverse-label")){var a=b.innerHTML;b.innerHTML=b.getAttribute("data-reverse-label");b.setAttribute("data-reverse-label",a)}}function a(b){if(b=document.getElementById("status-"+b)){var a=b.innerHTML;b.innerHTML=b.getAttribute("data-reverse-label");
|
||||||
b.setAttribute("data-reverse-label",a)}}function e(b){"mouse"!=Miniflux.Event.lastEventType&&Miniflux.Nav.SelectNextItem();b.parentNode.removeChild(b);if(b=document.getElementById("page-counter"))counter=parseInt(b.textContent.trim(),10)-1,0==counter?window.location="?action=unread":(b.textContent=counter+" ",document.title="miniflux ("+counter+")",document.getElementById("nav-counter").textContent="("+counter+")")}function f(b){var c=new XMLHttpRequest;c.onload=function(){if(Miniflux.Nav.IsListing()){var c=
|
b.setAttribute("data-reverse-label",a)}}function d(b){"mouse"!=Miniflux.Event.lastEventType&&Miniflux.Nav.SelectNextItem();b.parentNode.removeChild(b);if(b=document.getElementById("page-counter"))counter=parseInt(b.textContent.trim(),10)-1,0==counter?window.location="?action=unread":(b.textContent=counter+" ",document.title="miniflux ("+counter+")",document.getElementById("nav-counter").textContent="("+counter+")")}function f(b){var c=new XMLHttpRequest;c.onload=function(){if(Miniflux.Nav.IsListing()){var c=
|
||||||
d(b);if(c)if(c.getAttribute("data-hide"))e(c);else{c.setAttribute("data-item-status","read");a(b);if(c=document.getElementById("show-"+b)){c.className="read";var g=document.createElement("span");g.id="read-icon-"+b;g.appendChild(document.createTextNode("\u2714 "));c.parentNode.insertBefore(g,c)}(c=document.getElementById("status-"+b))&&c.setAttribute("data-action","mark-unread")}}};c.open("POST","?action=mark-item-read&id="+b,!0);c.send()}function h(b){var c=new XMLHttpRequest;c.onload=function(){if(Miniflux.Nav.IsListing()){var c=
|
e(b);if(c)if(c.getAttribute("data-hide"))d(c);else{c.setAttribute("data-item-status","read");a(b);if(c=document.getElementById("show-"+b)){c.className="read";var g=document.createElement("span");g.id="read-icon-"+b;g.appendChild(document.createTextNode("\u2714 "));c.parentNode.insertBefore(g,c)}(c=document.getElementById("status-"+b))&&c.setAttribute("data-action","mark-unread")}}};c.open("POST","?action=mark-item-read&id="+b,!0);c.send()}function h(b){var c=new XMLHttpRequest;c.onload=function(){if(Miniflux.Nav.IsListing()){var c=
|
||||||
d(b);if(c)if(c.getAttribute("data-hide"))e(c);else{c.setAttribute("data-item-status","unread");a(b);if(c=document.getElementById("show-"+b))c.className="";(c=document.getElementById("read-icon-"+b))&&c.parentNode.removeChild(c);(c=document.getElementById("status-"+b))&&c.setAttribute("data-action","mark-read")}}};c.open("POST","?action=mark-item-unread&id="+b,!0);c.send()}function l(b,a){var e=b.getAttribute("data-item-id"),d=new XMLHttpRequest;d.onload=function(){b.setAttribute("data-item-bookmark",
|
e(b);if(c)if(c.getAttribute("data-hide"))d(c);else{c.setAttribute("data-item-status","unread");a(b);if(c=document.getElementById("show-"+b))c.className="";(c=document.getElementById("read-icon-"+b))&&c.parentNode.removeChild(c);(c=document.getElementById("status-"+b))&&c.setAttribute("data-action","mark-read")}}};c.open("POST","?action=mark-item-unread&id="+b,!0);c.send()}function m(b,a){var d=b.getAttribute("data-item-id"),e=new XMLHttpRequest;e.onload=function(){try{if(JSON.parse(this.responseText).result)if(b.setAttribute("data-item-bookmark",
|
||||||
a);if(a)if(Miniflux.Nav.IsListing()){if(f=document.getElementById("show-"+e)){var d=document.createElement("span");d.id="bookmark-icon-"+e;d.appendChild(document.createTextNode("\u2605 "));f.parentNode.insertBefore(d,f)}c(e)}else{var f=document.getElementById("bookmark-"+e);f&&(f.innerHTML="\u2605")}else if(Miniflux.Nav.IsListing())(d=document.getElementById("bookmark-icon-"+e))&&d.parentNode.removeChild(d),c(e);else if(d=document.getElementById("bookmark-"+e))d.innerHTML="\u2606"};d.open("POST",
|
a),a)if(Miniflux.Nav.IsListing()){if(f=document.getElementById("show-"+d)){var e=document.createElement("span");e.id="bookmark-icon-"+d;e.appendChild(document.createTextNode("\u2605 "));f.parentNode.insertBefore(e,f)}c(d)}else{var f=document.getElementById("bookmark-"+d);f&&(f.innerHTML="\u2605")}else if(Miniflux.Nav.IsListing()){var l=document.getElementById("bookmark-icon-"+d);l&&l.parentNode.removeChild(l);c(d)}else{var n=document.getElementById("bookmark-"+d);n&&(n.innerHTML="\u2606")}}catch(h){}};
|
||||||
"?action=bookmark&id="+e+"&value="+a,!0);d.send()}return{Get:d,MarkAsRead:f,MarkAsUnread:h,SwitchBookmark:function(b){"1"==b.getAttribute("data-item-bookmark")?l(b,0):l(b,1)},SwitchStatus:function(b){var a=b.getAttribute("data-item-id");b=b.getAttribute("data-item-status");"read"==b?h(a):"unread"==b&&f(a)},ChangeStatus:function(b,a){switch(a){case "read":f(b);break;case "unread":h(b)}},Show:function(b){(b=document.getElementById("show-"+b))&&b.click()},OpenOriginal:function(b){var a=document.getElementById("original-"+
|
e.open("POST","?action=bookmark&id="+d+"&value="+a,!0);e.send()}return{Get:e,MarkAsRead:f,MarkAsUnread:h,SwitchBookmark:function(b){"1"==b.getAttribute("data-item-bookmark")?m(b,0):m(b,1)},SwitchStatus:function(b){var a=b.getAttribute("data-item-id");b=b.getAttribute("data-item-status");"read"==b?h(a):"unread"==b&&f(a)},ChangeStatus:function(b,a){switch(a){case "read":f(b);break;case "unread":h(b)}},Show:function(b){(b=document.getElementById("show-"+b))&&b.click()},OpenOriginal:function(b){var a=
|
||||||
b);a&&("unread"==d(b).getAttribute("data-item-status")&&f(b),a.removeAttribute("data-action"),a.click())},DownloadContent:function(){var b=document.getElementById("download-item");if(b){var a=b.getAttribute("data-item-id"),c=b.getAttribute("data-before-message"),e=document.createElement("span");e.appendChild(document.createTextNode("\u2600"));e.className="loading-icon";b.innerHTML="";b.className="downloading";b.appendChild(e);b.appendChild(document.createTextNode(" "+c));var d=setInterval(Miniflux.App.BlinkIcon,
|
document.getElementById("original-"+b);a&&("unread"==e(b).getAttribute("data-item-status")&&f(b),a.removeAttribute("data-action"),a.click())},DownloadContent:function(){var b=document.getElementById("download-item");if(b){var a=b.getAttribute("data-item-id"),c=b.getAttribute("data-before-message"),d=document.createElement("span");d.appendChild(document.createTextNode("\u2600"));d.className="loading-icon";b.innerHTML="";b.className="downloading";b.appendChild(d);b.appendChild(document.createTextNode(" "+
|
||||||
250),f=new XMLHttpRequest;f.onload=function(){var a=JSON.parse(f.responseText);clearInterval(d);if(a.result){var c=document.getElementById("item-content");c&&(c.innerHTML=a.content);b&&(a=b.getAttribute("data-after-message"),b.innerHTML="",b.appendChild(document.createTextNode(" "+a)))}else b&&(a=b.getAttribute("data-failure-message"),b.innerHTML="",b.appendChild(document.createTextNode(" "+a)))};f.open("POST","?action=download-item&id="+a,!0);f.send()}},MarkListingAsRead:function(a){for(var c=document.getElementsByTagName("article"),
|
c));var e=setInterval(Miniflux.App.BlinkIcon,250),f=new XMLHttpRequest;f.onload=function(){var a=JSON.parse(f.responseText);clearInterval(e);if(a.result){var c=document.getElementById("item-content");c&&(c.innerHTML=a.content);b&&(a=b.getAttribute("data-after-message"),b.innerHTML="",b.appendChild(document.createTextNode(" "+a)))}else b&&(a=b.getAttribute("data-failure-message"),b.innerHTML="",b.appendChild(document.createTextNode(" "+a)))};f.open("POST","?action=download-item&id="+a,!0);f.send()}},
|
||||||
e=[],d=0,f=c.length;d<f;d++)e.push(c[d].getAttribute("data-item-id"));c=new XMLHttpRequest;c.onload=function(){window.location.href=a};c.open("POST","?action=mark-items-as-read",!0);c.send(JSON.stringify(e))}}}();
|
MarkListingAsRead:function(a){for(var c=document.getElementsByTagName("article"),d=[],e=0,f=c.length;e<f;e++)d.push(c[e].getAttribute("data-item-id"));c=new XMLHttpRequest;c.onload=function(){window.location.href=a};c.open("POST","?action=mark-items-as-read",!0);c.send(JSON.stringify(d))}}}();
|
||||||
Miniflux.Event=function(){var d=[];return{lastEventType:"",ListenMouseEvents:function(){document.onclick=function(c){var a=c.target.getAttribute("data-action");if(a)switch(Miniflux.Event.lastEventType="mouse",a){case "refresh-all":c.preventDefault();Miniflux.Feed.UpdateAll();break;case "refresh-feed":c.preventDefault();Miniflux.Feed.Update(c.target.getAttribute("data-feed-id"));break;case "mark-read":c.preventDefault();Miniflux.Item.MarkAsRead(c.target.getAttribute("data-item-id"));break;case "mark-unread":c.preventDefault();
|
Miniflux.Event=function(){var e=[];return{lastEventType:"",ListenMouseEvents:function(){document.onclick=function(c){var a=c.target.getAttribute("data-action");if(a)switch(Miniflux.Event.lastEventType="mouse",a){case "refresh-all":c.preventDefault();Miniflux.Feed.UpdateAll();break;case "refresh-feed":c.preventDefault();Miniflux.Feed.Update(c.target.getAttribute("data-feed-id"));break;case "mark-read":c.preventDefault();Miniflux.Item.MarkAsRead(c.target.getAttribute("data-item-id"));break;case "mark-unread":c.preventDefault();
|
||||||
Miniflux.Item.MarkAsUnread(c.target.getAttribute("data-item-id"));break;case "bookmark":c.preventDefault();Miniflux.Item.SwitchBookmark(Miniflux.Item.Get(c.target.getAttribute("data-item-id")));break;case "download-item":c.preventDefault();Miniflux.Item.DownloadContent();break;case "original-link":Miniflux.Item.OpenOriginal(c.target.getAttribute("data-item-id"));break;case "mark-all-read":c.preventDefault();Miniflux.Item.MarkListingAsRead("?action=unread");break;case "mark-feed-read":c.preventDefault();
|
Miniflux.Item.MarkAsUnread(c.target.getAttribute("data-item-id"));break;case "bookmark":c.preventDefault();Miniflux.Item.SwitchBookmark(Miniflux.Item.Get(c.target.getAttribute("data-item-id")));break;case "download-item":c.preventDefault();Miniflux.Item.DownloadContent();break;case "original-link":Miniflux.Item.OpenOriginal(c.target.getAttribute("data-item-id"));break;case "mark-all-read":c.preventDefault();Miniflux.Item.MarkListingAsRead("?action=unread");break;case "mark-feed-read":c.preventDefault();
|
||||||
Miniflux.Item.MarkListingAsRead("?action=feed-items&feed_id="+c.target.getAttribute("data-feed-id"));break;case "mozilla-login":c.preventDefault();Miniflux.App.MozillaAuth("mozilla-auth");break;case "mozilla-link":c.preventDefault(),Miniflux.App.MozillaAuth("mozilla-link")}}},ListenKeyboardEvents:function(){document.onkeypress=function(c){Miniflux.Event.lastEventType="keyboard";d.push(c.keyCode||c.which);if(103==d[0])switch(d[1]){case void 0:break;case 117:window.location.href="?action=unread";d=
|
Miniflux.Item.MarkListingAsRead("?action=feed-items&feed_id="+c.target.getAttribute("data-feed-id"));break;case "mozilla-login":c.preventDefault();Miniflux.App.MozillaAuth("mozilla-auth");break;case "mozilla-link":c.preventDefault(),Miniflux.App.MozillaAuth("mozilla-link")}}},ListenKeyboardEvents:function(){document.onkeypress=function(c){Miniflux.Event.lastEventType="keyboard";e.push(c.keyCode||c.which);if(103==e[0])switch(e[1]){case void 0:break;case 117:window.location.href="?action=unread";e=
|
||||||
[];break;case 98:window.location.href="?action=bookmarks";d=[];break;case 104:window.location.href="?action=history";d=[];break;case 115:window.location.href="?action=feeds";d=[];break;case 112:window.location.href="?action=config";d=[];break;default:d=[]}else switch(d=[],c.keyCode||c.which){case 100:Miniflux.Item.DownloadContent(Miniflux.Nav.GetCurrentItemId());break;case 112:case 107:Miniflux.Nav.SelectPreviousItem();break;case 110:case 106:Miniflux.Nav.SelectNextItem();break;case 118:Miniflux.Item.OpenOriginal(Miniflux.Nav.GetCurrentItemId());
|
[];break;case 98:window.location.href="?action=bookmarks";e=[];break;case 104:window.location.href="?action=history";e=[];break;case 115:window.location.href="?action=feeds";e=[];break;case 112:window.location.href="?action=config";e=[];break;default:e=[]}else switch(e=[],c.keyCode||c.which){case 100:Miniflux.Item.DownloadContent(Miniflux.Nav.GetCurrentItemId());break;case 112:case 107:Miniflux.Nav.SelectPreviousItem();break;case 110:case 106:Miniflux.Nav.SelectNextItem();break;case 118:Miniflux.Item.OpenOriginal(Miniflux.Nav.GetCurrentItemId());
|
||||||
break;case 111:Miniflux.Item.Show(Miniflux.Nav.GetCurrentItemId());break;case 109:Miniflux.Item.SwitchStatus(Miniflux.Nav.GetCurrentItem());break;case 102:Miniflux.Item.SwitchBookmark(Miniflux.Nav.GetCurrentItem());break;case 104:Miniflux.Nav.OpenPreviousPage();break;case 108:Miniflux.Nav.OpenNextPage();break;case 114:Miniflux.Feed.UpdateAll();break;case 63:Miniflux.Nav.ShowHelp()}}}}}();
|
break;case 111:Miniflux.Item.Show(Miniflux.Nav.GetCurrentItemId());break;case 109:Miniflux.Item.SwitchStatus(Miniflux.Nav.GetCurrentItem());break;case 102:Miniflux.Item.SwitchBookmark(Miniflux.Nav.GetCurrentItem());break;case 104:Miniflux.Nav.OpenPreviousPage();break;case 108:Miniflux.Nav.OpenNextPage();break;case 114:Miniflux.Feed.UpdateAll();break;case 63:Miniflux.Nav.ShowHelp()}}}}}();
|
||||||
Miniflux.Nav=function(){function d(a){var c=pageYOffset+document.documentElement.clientHeight;(0>c-(a.offsetTop+a.offsetHeight)||c-a.offsetTop>document.documentElement.clientHeight)&&window.scrollTo(0,a.offsetTop-10)}function c(){return document.getElementById("listing")?!0:!1}return{GetCurrentItem:function(){return document.getElementById("current-item")},GetCurrentItemId:function(){var a=Miniflux.Nav.GetCurrentItem();return a?a.getAttribute("data-item-id"):null},OpenNextPage:function(){var a=document.getElementById("next-page");
|
Miniflux.Nav=function(){function e(a){var c=pageYOffset+document.documentElement.clientHeight;(0>c-(a.offsetTop+a.offsetHeight)||c-a.offsetTop>document.documentElement.clientHeight)&&window.scrollTo(0,a.offsetTop-10)}function c(){return document.getElementById("listing")?!0:!1}return{GetCurrentItem:function(){return document.getElementById("current-item")},GetCurrentItemId:function(){var a=Miniflux.Nav.GetCurrentItem();return a?a.getAttribute("data-item-id"):null},OpenNextPage:function(){var a=document.getElementById("next-page");
|
||||||
a&&a.click()},OpenPreviousPage:function(){var a=document.getElementById("previous-page");a&&a.click()},SelectNextItem:function(){var a=document.getElementById("next-item");if(a)a.click();else if(c())if(a=document.getElementsByTagName("article"),document.getElementById("current-item"))for(var e=0,f=a.length;e<f;e++){if("current-item"==a[e].id){a[e].id="item-"+a[e].getAttribute("data-item-id");e+1<f&&(a[e+1].id="current-item",d(a[e+1]));break}}else a[0].id="current-item",d(a[0])},SelectPreviousItem:function(){var a=
|
a&&a.click()},OpenPreviousPage:function(){var a=document.getElementById("previous-page");a&&a.click()},SelectNextItem:function(){var a=document.getElementById("next-item");if(a)a.click();else if(c())if(a=document.getElementsByTagName("article"),document.getElementById("current-item"))for(var d=0,f=a.length;d<f;d++){if("current-item"==a[d].id){a[d].id="item-"+a[d].getAttribute("data-item-id");d+1<f&&(a[d+1].id="current-item",e(a[d+1]));break}}else a[0].id="current-item",e(a[0])},SelectPreviousItem:function(){var a=
|
||||||
document.getElementById("previous-item");if(a)a.click();else if(c())if(a=document.getElementsByTagName("article"),document.getElementById("current-item"))for(var e=a.length-1;0<=e;e--){if("current-item"==a[e].id){a[e].id="item-"+a[e].getAttribute("data-item-id");0<=e-1&&(a[e-1].id="current-item",d(a[e-1]));break}}else a[a.length-1].id="current-item",d(a[a.length-1])},ShowHelp:function(){open("?action=show-help","Help","width=320,height=450,location=no,scrollbars=no,status=no,toolbar=no")},IsListing:c}}();
|
document.getElementById("previous-item");if(a)a.click();else if(c())if(a=document.getElementsByTagName("article"),document.getElementById("current-item"))for(var d=a.length-1;0<=d;d--){if("current-item"==a[d].id){a[d].id="item-"+a[d].getAttribute("data-item-id");0<=d-1&&(a[d-1].id="current-item",e(a[d-1]));break}}else a[a.length-1].id="current-item",e(a[a.length-1])},ShowHelp:function(){open("?action=show-help","Help","width=320,height=450,location=no,scrollbars=no,status=no,toolbar=no")},IsListing:c}}();
|
||||||
Miniflux.App.Run();
|
Miniflux.App.Run();
|
||||||
|
@ -182,6 +182,12 @@ Miniflux.Item = (function() {
|
|||||||
|
|
||||||
request.onload = function() {
|
request.onload = function() {
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
var response = JSON.parse(this.responseText);
|
||||||
|
|
||||||
|
if (response.result) {
|
||||||
|
|
||||||
item.setAttribute("data-item-bookmark", value);
|
item.setAttribute("data-item-bookmark", value);
|
||||||
|
|
||||||
if (value) {
|
if (value) {
|
||||||
@ -190,6 +196,9 @@ Miniflux.Item = (function() {
|
|||||||
else {
|
else {
|
||||||
hideItemBookmarked(item_id, item);
|
hideItemBookmarked(item_id, item);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (e) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
request.open("POST", "?action=bookmark&id=" + item_id + "&value=" + value, true);
|
request.open("POST", "?action=bookmark&id=" + item_id + "&value=" + value, true);
|
||||||
|
@ -14,9 +14,11 @@ Router\post_action('bookmark', function() {
|
|||||||
$id = Request\param('id');
|
$id = Request\param('id');
|
||||||
$value = Request\int_param('value');
|
$value = Request\int_param('value');
|
||||||
|
|
||||||
Model\Item\set_bookmark_value($id, $value);
|
Response\json(array(
|
||||||
|
'id' => $id,
|
||||||
Response\json(array('id' => $id, 'value' => $value));
|
'value' => $value,
|
||||||
|
'result' => Model\Item\set_bookmark_value($id, $value),
|
||||||
|
));
|
||||||
});
|
});
|
||||||
|
|
||||||
// Add new bookmark
|
// Add new bookmark
|
||||||
|
@ -298,6 +298,7 @@ function set_bookmark_value($id, $value)
|
|||||||
return Database::get('db')
|
return Database::get('db')
|
||||||
->table('items')
|
->table('items')
|
||||||
->eq('id', $id)
|
->eq('id', $id)
|
||||||
|
->in('status', array('read', 'unread'))
|
||||||
->save(array('bookmark' => $value));
|
->save(array('bookmark' => $value));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user