Add js changes

This commit is contained in:
denfil 2016-03-03 17:51:47 +03:00
parent 4c0d975532
commit caa835030c
6 changed files with 39 additions and 62 deletions

View File

@ -757,16 +757,6 @@ ul.item-infos {
text-align: center; text-align: center;
} }
a.icon {
color: #333;
text-decoration: none;
}
a.icon:focus,
a.icon:hover {
color: #000;
}
#item-content-enclosure { #item-content-enclosure {
border-bottom: 1px dashed #ccc; border-bottom: 1px dashed #ccc;
margin-bottom: 20px; margin-bottom: 20px;

38
assets/js/all.min.js vendored
View File

@ -1,19 +1,19 @@
var h=function(){var b=[],d=5;return{j:function(a,c){var d=a.querySelector("span.items-count");if(d){var b=a.getAttribute("data-feed-id"),q=a.querySelector("h2:first-of-type");q.className="loading-icon";var p=new XMLHttpRequest;p.onload=function(){q.className="";a.removeAttribute("data-feed-error");var b=a.querySelector(".feed-last-checked");b&&(b.innerHTML=b.getAttribute("data-after-update"));b=JSON.parse(this.responseText);b.result?d.innerHTML=b.items_count.items_unread+"/"+b.items_count.items_total: var k=function(){var b=[],d=5;return{j:function(a,c){var d=a.querySelector("span.items-count");if(d){var b=a.getAttribute("data-feed-id"),q=a.querySelector("h2:first-of-type");q.className="loading-icon";var p=new XMLHttpRequest;p.onload=function(){q.className="";a.removeAttribute("data-feed-error");var b=a.querySelector(".feed-last-checked");b&&(b.innerHTML=b.getAttribute("data-after-update"));b=JSON.parse(this.responseText);b.result?d.innerHTML=b.items_count.items_unread+"/"+b.items_count.items_total:
a.setAttribute("data-feed-error","1");c?c(b):f.a()};p.open("POST","?action=refresh-feed&feed_id="+b,!0);p.send()}},l:function(a){var c=Array.prototype.slice.call(document.querySelectorAll("article:not([data-feed-disabled])"));a&&(d=a);var k=setInterval(function(){for(;0<c.length&&b.length<d;){var a=c.shift();b.push(parseInt(a.getAttribute("data-feed-id"),10));h.j(a,function(a){a=b.indexOf(a.feed_id);0<=a&&b.splice(a,1);0===c.length&&0===b.length&&(clearInterval(k),f.a())})}},100)}}}(),f=function(){function b(a){var e= a.setAttribute("data-feed-error","1");c?c(b):f.a()};p.open("POST","?action=refresh-feed&feed_id="+b,!0);p.send()}},l:function(a){var c=Array.prototype.slice.call(document.querySelectorAll("article:not([data-feed-disabled])"));a&&(d=a);var h=setInterval(function(){for(;0<c.length&&b.length<d;){var a=c.shift();b.push(parseInt(a.getAttribute("data-feed-id"),10));k.j(a,function(a){a=b.indexOf(a.feed_id);0<=a&&b.splice(a,1);0===c.length&&0===b.length&&(clearInterval(h),f.a())})}},100)}}}(),f=function(){function b(a){var e=
document.createEvent("MouseEvents");e.initEvent("mousedown",!0,!0);a.dispatchEvent(e);e=document.createEvent("MouseEvents");e.initEvent("mouseup",!0,!0);a.dispatchEvent(e);a.click()}function d(a){return item_id=a.getAttribute("data-item-id")}function a(a){if(a&&a.hasAttribute("data-reverse-label")){var e=a.innerHTML;a.innerHTML=a.getAttribute("data-reverse-label");a.setAttribute("data-reverse-label",e)}}function c(g){"read"!==g.getAttribute("data-item-status")&&(g.getAttribute("data-hide")?k(g):(g.setAttribute("data-item-status", document.createEvent("MouseEvents");e.initEvent("mousedown",!0,!0);a.dispatchEvent(e);e=document.createEvent("MouseEvents");e.initEvent("mouseup",!0,!0);a.dispatchEvent(e);a.click()}function d(a){return item_id=a.getAttribute("data-item-id")}function a(a){if(a&&a.hasAttribute("data-reverse-title")&&a.hasAttribute("title")){var e=a.getAttribute("title");a.setAttribute("title",a.getAttribute("data-reverse-title"));a.setAttribute("data-reverse-title",e)}}function c(g){"read"!==g.getAttribute("data-item-status")&&
"read"),a(g.querySelector("a.mark")),(g=g.querySelector("a.mark"))&&g.setAttribute("data-action","mark-unread")),l--)}function k(a){if("mouse"!==m.c){var e=document.getElementsByTagName("article");"current-item"===e[e.length-1].id?v.g():v.f()}a.parentNode.removeChild(a);r--}function n(){-1<window.location.href.indexOf("nothing_to_read=1")&&0<l?window.location.href="?action=unread":0===r&&window.location.reload();var a=document.getElementById("page-counter");a&&(a.textContent=r||"");document.getElementById("nav-counter").textContent= (g.getAttribute("data-hide")?h(g):(g.setAttribute("data-item-status","read"),a(g.querySelector(".read-icon")),(g=g.querySelector(".read-icon"))&&g.setAttribute("data-action","mark-unread")),l--)}function h(a){if("mouse"!==m.c){var e=document.getElementsByTagName("article");"current-item"===e[e.length-1].id?v.g():v.f()}a.parentNode.removeChild(a);r--}function n(){-1<window.location.href.indexOf("nothing_to_read=1")&&0<l?window.location.href="?action=unread":0===r&&window.location.reload();var a=document.getElementById("page-counter");
l||"";var e=document.querySelector("div.page-header h2:first-of-type");if(e)pageHeading=e.firstChild.nodeValue;else if(e=document.querySelector("article.item h1:first-of-type")){document.title=e.textContent;return}switch(document.querySelector("section.page").getAttribute("data-item-page")){case "unread":document.title="Miniflux ("+l+")";break;case "feed-items":document.title="("+r+") "+pageHeading;break;default:document.title=a?pageHeading+" ("+r+")":pageHeading}}function q(a){var e=d(a),b=new XMLHttpRequest; a&&(a.textContent=r||"");document.getElementById("nav-counter").textContent=l||"";var e=document.querySelector("div.page-header h2:first-of-type");if(e)pageHeading=e.firstChild.nodeValue;else if(e=document.querySelector("article.item h1:first-of-type")){document.title=e.textContent;return}switch(document.querySelector("section.page").getAttribute("data-item-page")){case "unread":document.title="Miniflux ("+l+")";break;case "feed-items":document.title="("+r+") "+pageHeading;break;default:document.title=
b.onload=function(){v.b()&&(c(a),n())};b.open("POST","?action=mark-item-read&id="+e,!0);b.send()}function p(g){var e=d(g),c=new XMLHttpRequest;c.onload=function(){if(v.b()){if("unread"!==g.getAttribute("data-item-status")){if(g.getAttribute("data-hide"))k(g);else{g.setAttribute("data-item-status","unread");a(g.querySelector("a.mark"));var c=g.querySelector("a.mark");c&&c.setAttribute("data-action","mark-read")}l++}n()}};c.open("POST","?action=mark-item-unread&id="+e,!0);c.send()}var u=[],t=!1,l=function(){var a= a?pageHeading+" ("+r+")":pageHeading}}function q(a){var e=d(a),b=new XMLHttpRequest;b.onload=function(){v.b()&&(c(a),n())};b.open("POST","?action=mark-item-read&id="+e,!0);b.send()}function p(g){var e=d(g),c=new XMLHttpRequest;c.onload=function(){if(v.b()){if("unread"!==g.getAttribute("data-item-status")){if(g.getAttribute("data-hide"))h(g);else{g.setAttribute("data-item-status","unread");a(g.querySelector(".read-icon"));var c=g.querySelector(".read-icon");c&&c.setAttribute("data-action","mark-read")}l++}n()}};
document.getElementById("nav-counter");if(a)return counter=parseInt(a.textContent,10)||0}(),r=function(){var a=document.getElementById("page-counter");if(a)return counter=parseInt(a.textContent,10)||0}();return{v:q,A:p,w:function(a){var c=d(a),b=new XMLHttpRequest;b.onload=function(){v.b()&&(k(a),"unread"===a.getAttribute("data-item-status")&&l--,n())};b.open("POST","?action=mark-item-removed&id="+c,!0);b.send()},i:function(c){var e=d(c),b="1"===c.getAttribute("data-item-bookmark")?"0":"1",w=new XMLHttpRequest; c.open("POST","?action=mark-item-unread&id="+e,!0);c.send()}var u=[],t=!1,l=function(){var a=document.getElementById("nav-counter");if(a)return counter=parseInt(a.textContent,10)||0}(),r=function(){var a=document.getElementById("page-counter");if(a)return counter=parseInt(a.textContent,10)||0}();return{v:q,A:p,w:function(a){var c=d(a),b=new XMLHttpRequest;b.onload=function(){v.b()&&(h(a),"unread"===a.getAttribute("data-item-status")&&l--,n())};b.open("POST","?action=mark-item-removed&id="+c,!0);b.send()},
w.onload=function(){var e=document.querySelector("section.page");if(v.b()&&"bookmarks"===e.getAttribute("data-item-page"))k(c),n();else if(c.setAttribute("data-item-bookmark",b),v.b())a(c.querySelector("a.bookmark"));else if((e=c.querySelector("a.bookmark-icon"))&&e.hasAttribute("data-reverse-title")){var d=e.getAttribute("title");e.setAttribute("title",e.getAttribute("data-reverse-title"));e.setAttribute("data-reverse-title",d)}};w.open("POST","?action=bookmark&id="+e+"&value="+b,!0);w.send()},J:function(a){var c= i:function(c){var e=d(c),b="1"===c.getAttribute("data-item-bookmark")?"0":"1",w=new XMLHttpRequest;w.onload=function(){var e=document.querySelector("section.page");v.b()&&"bookmarks"===e.getAttribute("data-item-page")?(h(c),n()):(c.setAttribute("data-item-bookmark",b),a(c.querySelector(".bookmark-icon")))};w.open("POST","?action=bookmark&id="+e+"&value="+b,!0);w.send()},J:function(a){var c=a.getAttribute("data-item-status");"read"===c?p(a):"unread"===c&&q(a)},H:function(a){(a=a.querySelector("a.show"))&&
a.getAttribute("data-item-status");"read"===c?p(a):"unread"===c&&q(a)},H:function(a){(a=a.querySelector("a.show"))&&b(a)},D:function(a){(a=a.querySelector("a.original"))&&b(a)},h:function(a){var c=document.getElementById("download-item");if(c){c.innerHTML=" "+c.getAttribute("data-before-message");c.className="loading-icon";var b=new XMLHttpRequest;b.onload=function(){var a=JSON.parse(b.responseText);c.className="";if(a.result){var d=document.getElementById("item-content");d&&(d.innerHTML=a.content); b(a)},D:function(a){(a=a.querySelector("a.original"))&&b(a)},h:function(a){var c=document.getElementById("download-item");if(c){c.innerHTML=" "+c.getAttribute("data-before-message");c.className="loading-icon";var b=new XMLHttpRequest;b.onload=function(){var a=JSON.parse(b.responseText);c.className="";if(a.result){var d=document.getElementById("item-content");d&&(d.innerHTML=a.content);c.innerHTML=c.getAttribute("data-after-message")}else c.innerHTML=c.getAttribute("data-failure-message")};a=d(a);
c.innerHTML=c.getAttribute("data-after-message")}else c.innerHTML=c.getAttribute("data-failure-message")};a=d(a);b.open("POST","?action=download-item&id="+a,!0);b.send()}},B:function(a){var b=new XMLHttpRequest;b.onload=function(){for(var a=document.getElementsByTagName("article"),b=0,d=a.length;b<d;b++)c(a[b]);l=this.responseText;n()};b.open("POST","?action=mark-feed-as-read&feed_id="+a,!0);b.send()},K:function(){for(var a=["#current-item h1","#item-content","#listing #current-item h2","#listing #current-item .preview", b.open("POST","?action=download-item&id="+a,!0);b.send()}},B:function(a){var b=new XMLHttpRequest;b.onload=function(){for(var a=document.getElementsByTagName("article"),b=0,d=a.length;b<d;b++)c(a[b]);l=this.responseText;n()};b.open("POST","?action=mark-feed-as-read&feed_id="+a,!0);b.send()},K:function(){for(var a=["#current-item h1","#item-content","#listing #current-item h2","#listing #current-item .preview","#listing #current-item .preview-full-content"],c=0;c<a.length;c++){var b=document.querySelector(a[c]);
"#listing #current-item .preview-full-content"],c=0;c<a.length;c++){var b=document.querySelector(a[c]);b&&(b.dir=""==b.dir?"rtl":"")}},L:function(){return t},a:function(){if(!document.hidden||!t){var a=new XMLHttpRequest;a.onload=function(){var a=0===u.length,c=!1,b=JSON.parse(this.responseText),d;for(d in b.feeds){var k=b.feeds[d];if(!u.hasOwnProperty(d)||k.time>u[d])u[d]=k.time,"unread"===k.status&&(c=!0)}document.hidden||b.nbUnread===l&&!t?document.hidden&&!a&&c&&(t=!0,document.title="\u21bb "+ b&&(b.dir=""==b.dir?"rtl":"")}},L:function(){return t},a:function(){if(!document.hidden||!t){var a=new XMLHttpRequest;a.onload=function(){var a=0===u.length,c=!1,b=JSON.parse(this.responseText),d;for(d in b.feeds){var h=b.feeds[d];if(!u.hasOwnProperty(d)||h.time>u[d])u[d]=h.time,"unread"===h.status&&(c=!0)}document.hidden||b.nbUnread===l&&!t?document.hidden&&!a&&c&&(t=!0,document.title="\u21bb "+document.title):(t=!1,l=b.nbUnread,n())};a.open("POST","?action=latest-feeds-items",!0);a.send()}}}}(),
document.title):(t=!1,l=b.nbUnread,n())};a.open("POST","?action=latest-feeds-items",!0);a.send()}}}}(),m=function(){function b(a){if(63!==a.keyCode&&63!==a.which&&(a.ctrlKey||a.shiftKey||a.altKey||a.metaKey))return!0;a=a.target||a.srcElement;return"INPUT"===a.tagName||"TEXTAREA"===a.tagName?!0:!1}var d=[];return{c:"",s:function(){document.onclick=function(a){a.target.hasAttribute("data-action")&&"original"!==a.target.className&&a.preventDefault()};document.onmouseup=function(a){if(2!==a.button)if("INPUT"=== m=function(){function b(a){if(63!==a.keyCode&&63!==a.which&&(a.ctrlKey||a.shiftKey||a.altKey||a.metaKey))return!0;a=a.target||a.srcElement;return"INPUT"===a.tagName||"TEXTAREA"===a.tagName?!0:!1}var d=[];return{c:"",s:function(){document.onclick=function(a){a.target.hasAttribute("data-action")&&"original"!==a.target.className&&a.preventDefault()};document.onmouseup=function(a){if(2!==a.button)if("INPUT"===a.target.nodeName&&"auto-select"===a.target.className)a.target.select();else{var c=a.target.getAttribute("data-action");
a.target.nodeName&&"auto-select"===a.target.className)a.target.select();else{var c=a.target.getAttribute("data-action");if(c){m.c="mouse";var b;a:{for(element=a.target;element&&element.parentNode;)if(element=element.parentNode,element.tagName&&"article"===element.tagName.toLowerCase()){b=element;break a}b=void 0}switch(c){case "refresh-all":h.l(a.target.getAttribute("data-concurrent-requests"));break;case "refresh-feed":b&&h.j(b);break;case "mark-read":b&&f.v(b);break;case "mark-unread":b&&f.A(b); if(c){m.c="mouse";var b;a:{for(element=a.target;element&&element.parentNode;)if(element=element.parentNode,element.tagName&&"article"===element.tagName.toLowerCase()){b=element;break a}b=void 0}switch(c){case "refresh-all":k.l(a.target.getAttribute("data-concurrent-requests"));break;case "refresh-feed":b&&k.j(b);break;case "mark-read":b&&f.v(b);break;case "mark-unread":b&&f.A(b);break;case "mark-removed":b&&f.w(b);break;case "bookmark":b&&f.i(b);break;case "download-item":b&&f.h(b);break;case "mark-feed-read":a=
break;case "mark-removed":b&&f.w(b);break;case "bookmark":b&&f.i(b);break;case "download-item":b&&f.h(b);break;case "mark-feed-read":a=document.getElementById("listing").getAttribute("data-feed-id"),f.B(a)}}}}},o:function(){document.onkeypress=function(a){if(!b(a))if(m.c="keyboard",d.push(a.key||a.which),"g"===d[0]||103===d[0])switch(d[1]){case void 0:break;case "u":case 117:window.location.href="?action=unread";d=[];break;case "b":case 98:window.location.href="?action=bookmarks";d=[];break;case "h":case 104:window.location.href= document.getElementById("listing").getAttribute("data-feed-id"),f.B(a)}}}}},o:function(){document.onkeypress=function(a){if(!b(a))if(m.c="keyboard",d.push(a.key||a.which),"g"===d[0]||103===d[0])switch(d[1]){case void 0:break;case "u":case 117:window.location.href="?action=unread";d=[];break;case "b":case 98:window.location.href="?action=bookmarks";d=[];break;case "h":case 104:window.location.href="?action=history";d=[];break;case "s":case 115:window.location.href="?action=feeds";d=[];break;case "p":case 112:window.location.href=
"?action=history";d=[];break;case "s":case 115:window.location.href="?action=feeds";d=[];break;case "p":case 112:window.location.href="?action=config";d=[];break;default:d=[]}else{d=[];var c=document.getElementById("current-item");switch(a.key||a.which){case "d":case 100:c&&f.h(c);break;case "p":case 112:case "k":case 107:v.g();break;case "n":case 110:case "j":case 106:v.f();break;case "v":case 118:c&&f.D(c);break;case "o":case 111:c&&f.H(c);break;case "m":case 109:c&&f.J(c);break;case "f":case 102:c&& "?action=config";d=[];break;default:d=[]}else{d=[];var c=document.getElementById("current-item");switch(a.key||a.which){case "d":case 100:c&&f.h(c);break;case "p":case 112:case "k":case 107:v.g();break;case "n":case 110:case "j":case 106:v.f();break;case "v":case 118:c&&f.D(c);break;case "o":case 111:c&&f.H(c);break;case "m":case 109:c&&f.J(c);break;case "f":case 102:c&&f.i(c);break;case "h":case 104:v.F();break;case "l":case 108:v.C();break;case "r":case 114:k.l();break;case "?":case 63:v.I();break;
f.i(c);break;case "h":case 104:v.F();break;case "l":case 108:v.C();break;case "r":case 114:h.l();break;case "?":case 63:v.I();break;case "z":case 122:f.K()}}};document.onkeydown=function(a){if(!b(a))switch(m.c="keyboard",a.key||a.which){case "ArrowLeft":case "Left":case 37:v.g();break;case "ArrowRight":case "Right":case 39:v.f()}}},u:function(){document.addEventListener("visibilitychange",function(){!document.hidden&&f.L()&&f.a()})}}}(),v=function(){function b(a){var c=pageYOffset+document.documentElement.clientHeight; case "z":case 122:f.K()}}};document.onkeydown=function(a){if(!b(a))switch(m.c="keyboard",a.key||a.which){case "ArrowLeft":case "Left":case 37:v.g();break;case "ArrowRight":case "Right":case 39:v.f()}}},u:function(){document.addEventListener("visibilitychange",function(){!document.hidden&&f.L()&&f.a()})}}}(),v=function(){function b(a){var b=pageYOffset+document.documentElement.clientHeight;(0>b-(a.offsetTop+a.offsetHeight)||b-a.offsetTop>document.documentElement.clientHeight)&&window.scrollTo(0,a.offsetTop-
(0>c-(a.offsetTop+a.offsetHeight)||c-a.offsetTop>document.documentElement.clientHeight)&&window.scrollTo(0,a.offsetTop-10)}function d(){return document.getElementById("listing")?!0:!1}return{C:function(){var a=document.getElementById("next-page");a&&a.click()},F:function(){var a=document.getElementById("previous-page");a&&a.click()},f:function(){var a=document.getElementById("next-item");if(a)a.click();else if(d())if(a=document.getElementsByTagName("article"),document.getElementById("current-item"))for(var c= 10)}function d(){return document.getElementById("listing")?!0:!1}return{C:function(){var a=document.getElementById("next-page");a&&a.click()},F:function(){var a=document.getElementById("previous-page");a&&a.click()},f:function(){var a=document.getElementById("next-item");if(a)a.click();else if(d())if(a=document.getElementsByTagName("article"),document.getElementById("current-item"))for(var c=0,h=a.length;c<h;c++){if("current-item"===a[c].id){c+1<h&&(a[c].id="item-"+a[c].getAttribute("data-item-id"),
0,k=a.length;c<k;c++){if("current-item"===a[c].id){c+1<k&&(a[c].id="item-"+a[c].getAttribute("data-item-id"),a[c+1].id="current-item",b(a[c+1]));break}}else a[0].id="current-item",b(a[0])},g:function(){var a=document.getElementById("previous-item");if(a)a.click();else if(d())if(a=document.getElementsByTagName("article"),document.getElementById("current-item"))for(var c=a.length-1;0<=c;c--){if("current-item"===a[c].id){0<=c-1&&(a[c].id="item-"+a[c].getAttribute("data-item-id"),a[c-1].id="current-item", a[c+1].id="current-item",b(a[c+1]));break}}else a[0].id="current-item",b(a[0])},g:function(){var a=document.getElementById("previous-item");if(a)a.click();else if(d())if(a=document.getElementsByTagName("article"),document.getElementById("current-item"))for(var c=a.length-1;0<=c;c--){if("current-item"===a[c].id){0<=c-1&&(a[c].id="item-"+a[c].getAttribute("data-item-id"),a[c-1].id="current-item",b(a[c-1]));break}}else a[a.length-1].id="current-item",b(a[a.length-1])},I:function(){open("?action=show-help",
b(a[c-1]));break}}else a[a.length-1].id="current-item",b(a[a.length-1])},I:function(){open("?action=show-help","Help","width=320,height=450,location=no,scrollbars=no,status=no,toolbar=no")},b:d}}();({M:function(){},G:function(){m.o();m.s();m.u();this.m()},m:function(){var b=new XMLHttpRequest;b.onload=function(){var b=JSON.parse(this.responseText);0<b.frontend_updatecheck_interval&&(f.a(),setInterval(function(){f.a()},6E4*b.frontend_updatecheck_interval))};b.open("POST","?action=get-config",!0);b.send(JSON.stringify(["frontend_updatecheck_interval"]))}}).G(); "Help","width=320,height=450,location=no,scrollbars=no,status=no,toolbar=no")},b:d}}();({M:function(){},G:function(){m.o();m.s();m.u();this.m()},m:function(){var b=new XMLHttpRequest;b.onload=function(){var b=JSON.parse(this.responseText);0<b.frontend_updatecheck_interval&&(f.a(),setInterval(function(){f.a()},6E4*b.frontend_updatecheck_interval))};b.open("POST","?action=get-config",!0);b.send(JSON.stringify(["frontend_updatecheck_interval"]))}}).G();

View File

@ -45,22 +45,22 @@ Miniflux.Item = (function() {
function changeLabel(link) function changeLabel(link)
{ {
if (link && link.hasAttribute("data-reverse-label")) { if (link && link.hasAttribute("data-reverse-title") && link.hasAttribute("title")) {
var content = link.innerHTML; var title = link.getAttribute("title");
link.innerHTML = link.getAttribute("data-reverse-label"); link.setAttribute("title", link.getAttribute("data-reverse-title"));
link.setAttribute("data-reverse-label", content); link.setAttribute("data-reverse-title", title);
} }
} }
function changeBookmarkLabel(item) function changeBookmarkLabel(item)
{ {
var link = item.querySelector("a.bookmark"); var link = item.querySelector(".bookmark-icon");
changeLabel(link); changeLabel(link);
} }
function changeStatusLabel(item) function changeStatusLabel(item)
{ {
var link = item.querySelector("a.mark"); var link = item.querySelector(".read-icon");
changeLabel(link); changeLabel(link);
} }
@ -78,7 +78,7 @@ Miniflux.Item = (function() {
changeStatusLabel(item); changeStatusLabel(item);
// Change action // Change action
var link = item.querySelector("a.mark"); var link = item.querySelector(".read-icon");
if (link) link.setAttribute("data-action", "mark-unread"); if (link) link.setAttribute("data-action", "mark-unread");
} }
@ -99,7 +99,7 @@ Miniflux.Item = (function() {
changeStatusLabel(item); changeStatusLabel(item);
// Change action // Change action
var link = item.querySelector("a.mark"); var link = item.querySelector(".read-icon");
if (link) link.setAttribute("data-action", "mark-read"); if (link) link.setAttribute("data-action", "mark-read");
} }
@ -237,22 +237,9 @@ Miniflux.Item = (function() {
if (Miniflux.Nav.IsListing() && sectionElement.getAttribute("data-item-page") === "bookmarks") { if (Miniflux.Nav.IsListing() && sectionElement.getAttribute("data-item-page") === "bookmarks") {
hideItem(item); hideItem(item);
updateCounters(); updateCounters();
} } else {
else {
item.setAttribute("data-item-bookmark", value); item.setAttribute("data-item-bookmark", value);
changeBookmarkLabel(item);
if (Miniflux.Nav.IsListing()) {
changeBookmarkLabel(item);
}
else {
var link = item.querySelector("a.bookmark-icon");
if (link && link.hasAttribute("data-reverse-title")) {
var title = link.getAttribute("title");
link.setAttribute("title", link.getAttribute("data-reverse-title"));
link.setAttribute("data-reverse-title", title);
}
}
} }
}; };

View File

@ -3,7 +3,7 @@
class="bookmark-icon" class="bookmark-icon"
href="?action=bookmark&amp;value=0&amp;id=<?= $item['id'] ?>&amp;menu=<?= $menu ?>&amp;offset=<?= $offset ?>&amp;source=<?= $source ?>" href="?action=bookmark&amp;value=0&amp;id=<?= $item['id'] ?>&amp;menu=<?= $menu ?>&amp;offset=<?= $offset ?>&amp;source=<?= $source ?>"
data-action="bookmark" data-action="bookmark"
data-reverse-label="<?= t('bookmark') ?>" data-reverse-title="<?= t('bookmark') ?>"
title="<?= t('remove bookmark') ?>" title="<?= t('remove bookmark') ?>"
></span> ></span>
<?php else: ?> <?php else: ?>
@ -11,7 +11,7 @@
class="bookmark-icon" class="bookmark-icon"
href="?action=bookmark&amp;value=1&amp;id=<?= $item['id'] ?>&amp;menu=<?= $menu ?>&amp;offset=<?= $offset ?>&amp;source=<?= $source ?>" href="?action=bookmark&amp;value=1&amp;id=<?= $item['id'] ?>&amp;menu=<?= $menu ?>&amp;offset=<?= $offset ?>&amp;source=<?= $source ?>"
data-action="bookmark" data-action="bookmark"
data-reverse-label="<?= t('remove bookmark') ?>" data-reverse-title="<?= t('remove bookmark') ?>"
title="<?= t('bookmark') ?>" title="<?= t('bookmark') ?>"
></span> ></span>
<?php endif ?> <?php endif ?>

View File

@ -35,13 +35,13 @@
<ul class="item-infos"> <ul class="item-infos">
<li> <li>
<a <span
class="bookmark-icon icon" class="bookmark-icon"
href="?action=bookmark&amp;value=<?= (int)!$item['bookmark'] ?>&amp;id=<?= $item['id'] ?>&amp;source=show&amp;menu=<?= $menu ?>" href="?action=bookmark&amp;value=<?= (int)!$item['bookmark'] ?>&amp;id=<?= $item['id'] ?>&amp;source=show&amp;menu=<?= $menu ?>"
title="<?= ($item['bookmark']) ? t('remove bookmark') : t('bookmark') ?>" title="<?= ($item['bookmark']) ? t('remove bookmark') : t('bookmark') ?>"
data-reverse-title="<?= ($item['bookmark']) ? t('bookmark') :t('remove bookmark') ?>" data-reverse-title="<?= ($item['bookmark']) ? t('bookmark') :t('remove bookmark') ?>"
data-action="bookmark" data-action="bookmark"
></a> ></span>
</li> </li>
<li> <li>
<a href="?action=feed-items&amp;feed_id=<?= $feed['id'] ?>"><?= Helper\escape($feed['title']) ?></a> <a href="?action=feed-items&amp;feed_id=<?= $feed['id'] ?>"><?= Helper\escape($feed['title']) ?></a>

View File

@ -3,7 +3,7 @@
class="read-icon" class="read-icon"
href="?action=mark-item-read&amp;id=<?= $item['id'] ?>&amp;offset=<?= $offset ?>&amp;redirect=<?= $redirect ?>&amp;feed_id=<?= $item['feed_id'] ?>" href="?action=mark-item-read&amp;id=<?= $item['id'] ?>&amp;offset=<?= $offset ?>&amp;redirect=<?= $redirect ?>&amp;feed_id=<?= $item['feed_id'] ?>"
data-action="mark-read" data-action="mark-read"
data-reverse-label="<?= t('mark as unread') ?>" data-reverse-title="<?= t('mark as unread') ?>"
title="<?= t('mark as read') ?>" title="<?= t('mark as read') ?>"
></span> ></span>
<?php else: ?> <?php else: ?>
@ -11,7 +11,7 @@
class="read-icon" class="read-icon"
href="?action=mark-item-unread&amp;id=<?= $item['id'] ?>&amp;offset=<?= $offset ?>&amp;redirect=<?= $redirect ?>&amp;feed_id=<?= $item['feed_id'] ?>" href="?action=mark-item-unread&amp;id=<?= $item['id'] ?>&amp;offset=<?= $offset ?>&amp;redirect=<?= $redirect ?>&amp;feed_id=<?= $item['feed_id'] ?>"
data-action="mark-unread" data-action="mark-unread"
data-reverse-label="<?= t('mark as read') ?>" data-reverse-title="<?= t('mark as read') ?>"
title="<?= t('mark as unread') ?>" title="<?= t('mark as unread') ?>"
></span> ></span>
<?php endif ?> <?php endif ?>