diff --git a/assets/js/all.min.js b/assets/js/all.min.js index b0c18dd..ce7de56 100644 --- a/assets/js/all.min.js +++ b/assets/js/all.min.js @@ -1,19 +1,19 @@ -var k=function(){var e=[];return{j:function(d,a){var b=d.querySelector("span.items-count");if(b){var c=d.getAttribute("data-feed-id"),e=d.querySelector("h2:first-of-type");e.className="loading-icon";var l=new XMLHttpRequest;l.onload=function(){e.className="";d.removeAttribute("data-feed-error");var c=d.querySelector(".feed-last-checked");c&&(c.innerHTML=c.getAttribute("data-after-update"));c=JSON.parse(this.responseText);c.result?b.innerHTML=c.items_count.items_unread+"/"+c.items_count.items_total: -d.setAttribute("data-feed-error","1");a?a(c):g.a()};l.open("POST","?action=refresh-feed&feed_id="+c,!0);l.send()}},k:function(){var d=Array.prototype.slice.call(document.querySelectorAll("article:not([data-feed-disabled])")),a=setInterval(function(){for(;0e.length;){var b=d.shift();e.push(parseInt(b.getAttribute("data-feed-id"),10));k.j(b,function(b){b=e.indexOf(b.feed_id);0<=b&&e.splice(b,1);0===d.length&&0===e.length&&(clearInterval(a),g.a())})}},100)}}}(),g=function(){function e(a){return item_id= -a.getAttribute("data-item-id")}function d(a){if(a&&a.hasAttribute("data-reverse-label")){var b=a.innerHTML;a.innerHTML=a.getAttribute("data-reverse-label");a.setAttribute("data-reverse-label",b)}}function a(a){"mouse"!==m.c&&t.d();a.parentNode.removeChild(a);r--}function b(){-1l[e])l[e]=f.time,"unread"===f.status&&(c=!0)}document.hidden||d.nbUnread===n&&!q?document.hidden&&!a&&c&&(q=!0,document.title="\u21bb "+document.title):(q=!1,n=d.nbUnread,b())};a.open("POST","?action=latest-feeds-items",!0);a.send()}}}}(),m=function(){function e(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:"",n:function(){document.onclick=function(a){var b=a.target.getAttribute("data-action");b&&"original-link"!==b&&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 b=a.target.getAttribute("data-action");if(b){m.c="mouse";var c;a:{for(element=a.target;element&&element.parentNode;)if(element=element.parentNode,element.tagName&&"article"=== -element.tagName.toLowerCase()){c=element;break a}c=void 0}switch(b){case "refresh-all":k.k();break;case "refresh-feed":c&&k.j(c);break;case "mark-read":c&&g.p(c);break;case "mark-unread":c&&g.r(c);break;case "mark-removed":c&&g.q(c);break;case "bookmark":c&&g.i(c);break;case "download-item":c&&g.e(c);break;case "original-link":c&&g.g(c);break;case "mark-all-read":g.f("?action=unread");break;case "mark-feed-read":g.f("?action=feed-items&feed_id="+a.target.getAttribute("data-feed-id"))}}}}},m:function(){document.onkeypress= -function(a){if(!e(a))if(m.c="keyboard",d.push(a.keyCode||a.which),103===d[0])switch(d[1]){case void 0:break;case 117:window.location.href="?action=unread";d=[];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{d=[];var b=document.getElementById("current-item");switch(a.keyCode||a.which){case 100:b&& -g.e(b);break;case 112:case 107:t.h();break;case 110:case 106:t.d();break;case 118:b&&g.g(b);break;case 111:b&&g.v(b);break;case 109:b&&g.A(b);break;case 102:b&&g.i(b);break;case 104:t.t();break;case 108:t.s();break;case 114:k.k();break;case 63:t.w();break;case 122:g.B()}}};document.onkeydown=function(a){if(!e(a))switch(m.c="keyboard",a.keyCode||a.which){case 37:t.h();break;case 39:t.d()}}},o:function(){document.addEventListener("visibilitychange",function(){!document.hidden&&g.C()&&g.a()})}}}(),t= -function(){function e(a){var b=pageYOffset+document.documentElement.clientHeight;(0>b-(a.offsetTop+a.offsetHeight)||b-a.offsetTop>document.documentElement.clientHeight)&&window.scrollTo(0,a.offsetTop-10)}function d(){return document.getElementById("listing")?!0:!1}return{s:function(){var a=document.getElementById("next-page");a&&a.click()},t:function(){var a=document.getElementById("previous-page");a&&a.click()},d: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 b=0,c=a.length;bd.length;){var b=c.shift();d.push(parseInt(b.getAttribute("data-feed-id"),10));k.i(b,function(b){b=d.indexOf(b.feed_id);0<=b&&d.splice(b,1);0===c.length&&0===d.length&&(clearInterval(a),g.a())})}},100)}}}(),g=function(){function d(a){var b= +document.createEvent("MouseEvents");b.initEvent("mousedown",!0,!0);a.dispatchEvent(b);b=document.createEvent("MouseEvents");b.initEvent("mouseup",!0,!0);a.dispatchEvent(b);a.click()}function c(a){return item_id=a.getAttribute("data-item-id")}function a(a){if(a&&a.hasAttribute("data-reverse-label")){var b=a.innerHTML;a.innerHTML=a.getAttribute("data-reverse-label");a.setAttribute("data-reverse-label",b)}}function b(a){"mouse"!==n.c&&u.d();a.parentNode.removeChild(a);q--}function e(){-1t[d])t[d]=f.time,"unread"===f.status&&(b=!0)}document.hidden||c.nbUnread===l&&!r?document.hidden&&!a&&b&&(r=!0,document.title="\u21bb "+document.title):(r=!1,l=c.nbUnread,e())};a.open("POST","?action=latest-feeds-items", +!0);a.send()}}}}(),n=function(){function d(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 c=[];return{c:"",m: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 b= +a.target.getAttribute("data-action");if(b){n.c="mouse";var c;a:{for(element=a.target;element&&element.parentNode;)if(element=element.parentNode,element.tagName&&"article"===element.tagName.toLowerCase()){c=element;break a}c=void 0}switch(b){case "refresh-all":k.j();break;case "refresh-feed":c&&k.i(c);break;case "mark-read":c&&g.o(c);break;case "mark-unread":c&&g.q(c);break;case "mark-removed":c&&g.p(c);break;case "bookmark":c&&g.h(c);break;case "download-item":c&&g.e(c);break;case "mark-all-read":g.f("?action=unread"); +break;case "mark-feed-read":g.f("?action=feed-items&feed_id="+a.target.getAttribute("data-feed-id"))}}}}},l:function(){document.onkeypress=function(a){if(!d(a))if(n.c="keyboard",c.push(a.keyCode||a.which),103===c[0])switch(c[1]){case void 0:break;case 117:window.location.href="?action=unread";c=[];break;case 98:window.location.href="?action=bookmarks";c=[];break;case 104:window.location.href="?action=history";c=[];break;case 115:window.location.href="?action=feeds";c=[];break;case 112:window.location.href= +"?action=config";c=[];break;default:c=[]}else{c=[];var b=document.getElementById("current-item");switch(a.keyCode||a.which){case 100:b&&g.e(b);break;case 112:case 107:u.g();break;case 110:case 106:u.d();break;case 118:b&&g.s(b);break;case 111:b&&g.v(b);break;case 109:b&&g.A(b);break;case 102:b&&g.h(b);break;case 104:u.t();break;case 108:u.r();break;case 114:k.j();break;case 63:u.w();break;case 122:g.B()}}};document.onkeydown=function(a){if(!d(a))switch(n.c="keyboard",a.keyCode||a.which){case 37:u.g(); +break;case 39:u.d()}}},n:function(){document.addEventListener("visibilitychange",function(){!document.hidden&&g.C()&&g.a()})}}}(),u=function(){function d(a){var b=pageYOffset+document.documentElement.clientHeight;(0>b-(a.offsetTop+a.offsetHeight)||b-a.offsetTop>document.documentElement.clientHeight)&&window.scrollTo(0,a.offsetTop-10)}function c(){return document.getElementById("listing")?!0:!1}return{r:function(){var a=document.getElementById("next-page");a&&a.click()},t:function(){var a=document.getElementById("previous-page"); +a&&a.click()},d: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 b=0,e=a.length;b Model\Feed\get_item_favicons($items), + 'original_marks_read' => Model\Config\get('original_marks_read'), 'order' => '', 'direction' => '', 'display_mode' => Model\Config\get('items_display_mode'), diff --git a/controllers/config.php b/controllers/config.php index 2fb8572..fe3e5b2 100644 --- a/controllers/config.php +++ b/controllers/config.php @@ -138,7 +138,7 @@ Router\get_action('config', function() { // Update preferences Router\post_action('config', function() { - $values = Request\values() + array('nocontent' => 0, 'image_proxy' => 0, 'favicons' => 0, 'debug_mode' => 0); + $values = Request\values() + array('nocontent' => 0, 'image_proxy' => 0, 'favicons' => 0, 'debug_mode' => 0, 'original_marks_read' => 0); Model\Config\check_csrf_values($values); list($valid, $errors) = Model\Config\validate_modification($values); @@ -175,7 +175,7 @@ Router\post_action('config', function() { Router\post_action('get-config', function() { $return = array(); $options = Request\values(); - + if (empty($options)) { $return = Model\Config\get_all(); } @@ -184,7 +184,7 @@ Router\post_action('get-config', function() { $return[$name] = Model\Config\get($name); } } - + Response\json($return); }); diff --git a/controllers/history.php b/controllers/history.php index 7031118..7febdf4 100644 --- a/controllers/history.php +++ b/controllers/history.php @@ -21,6 +21,7 @@ Router\get_action('history', function() { Response\html(Template\layout('history', array( 'favicons' => Model\Feed\get_item_favicons($items), + 'original_marks_read' => Model\Config\get('original_marks_read'), 'items' => $items, 'order' => '', 'direction' => '', diff --git a/controllers/item.php b/controllers/item.php index 4722eeb..d77e07b 100644 --- a/controllers/item.php +++ b/controllers/item.php @@ -26,6 +26,7 @@ Router\get_action('unread', function() { Response\html(Template\layout('unread_items', array( 'favicons' => Model\Feed\get_item_favicons($items), + 'original_marks_read' => Model\Config\get('original_marks_read'), 'order' => $order, 'direction' => $direction, 'display_mode' => Model\Config\get('items_display_mode'), @@ -89,6 +90,7 @@ Router\get_action('feed-items', function() { Response\html(Template\layout('feed_items', array( 'favicons' => Model\Feed\get_favicons(array($feed['id'])), + 'original_marks_read' => Model\Config\get('original_marks_read'), 'order' => $order, 'direction' => $direction, 'display_mode' => Model\Config\get('items_display_mode'), @@ -204,7 +206,7 @@ Router\get_action('mark-item-removed', function() { Router\post_action('latest-feeds-items', function() { $items = Model\Item\get_latest_feeds_items(); $nb_unread_items = Model\Item\count_by_status('unread'); - + $feeds = array_reduce($items, function ($result, $item) { $result[$item['id']] = array( 'time' => $item['updated'] ?: 0, @@ -212,7 +214,7 @@ Router\post_action('latest-feeds-items', function() { ); return $result; }, array()); - + Response\json(array( 'feeds' => $feeds, 'nbUnread' => $nb_unread_items diff --git a/locales/cs_CZ/translations.php b/locales/cs_CZ/translations.php index 407d0e7..eb7e743 100644 --- a/locales/cs_CZ/translations.php +++ b/locales/cs_CZ/translations.php @@ -234,4 +234,5 @@ return array( // 'Refresh interval in minutes for unread counter' => '', // 'Nothing to show. Enable the debug mode to see log messages.' => '', // 'Enable debug mode' => '', + // 'Original link marks article as read' => '', ); diff --git a/locales/de_DE/translations.php b/locales/de_DE/translations.php index b48979b..870b7fd 100644 --- a/locales/de_DE/translations.php +++ b/locales/de_DE/translations.php @@ -234,4 +234,5 @@ return array( // 'Refresh interval in minutes for unread counter' => '', // 'Nothing to show. Enable the debug mode to see log messages.' => '', // 'Enable debug mode' => '', + // 'Original link marks article as read' => '', ); diff --git a/locales/es_ES/translations.php b/locales/es_ES/translations.php index 6e998f5..5551e71 100644 --- a/locales/es_ES/translations.php +++ b/locales/es_ES/translations.php @@ -234,4 +234,5 @@ return array( // 'Refresh interval in minutes for unread counter' => '', // 'Nothing to show. Enable the debug mode to see log messages.' => '', // 'Enable debug mode' => '', + // 'Original link marks article as read' => '', ); diff --git a/locales/fr_FR/translations.php b/locales/fr_FR/translations.php index 9efc017..109ed92 100644 --- a/locales/fr_FR/translations.php +++ b/locales/fr_FR/translations.php @@ -234,4 +234,5 @@ return array( 'Refresh interval in minutes for unread counter' => 'Fréquence d\'actualisation en minute du compteur de non lus', 'Nothing to show. Enable the debug mode to see log messages.' => 'Rien à montrer. Activez le mode debug pour voir les messages de log.', 'Enable debug mode' => 'Activer le mode debug', + 'Original link marks article as read' => 'Original link marks article as read', ); diff --git a/locales/it_IT/translations.php b/locales/it_IT/translations.php index 4dfe7a2..690c59a 100644 --- a/locales/it_IT/translations.php +++ b/locales/it_IT/translations.php @@ -234,4 +234,5 @@ return array( // 'Refresh interval in minutes for unread counter' => '', // 'Nothing to show. Enable the debug mode to see log messages.' => '', // 'Enable debug mode' => '', + // 'Original link marks article as read' => '', ); diff --git a/locales/pt_BR/translations.php b/locales/pt_BR/translations.php index 40f06b1..229ec57 100644 --- a/locales/pt_BR/translations.php +++ b/locales/pt_BR/translations.php @@ -234,4 +234,5 @@ return array( // 'Refresh interval in minutes for unread counter' => '', // 'Nothing to show. Enable the debug mode to see log messages.' => '', // 'Enable debug mode' => '', + // 'Original link marks article as read' => '', ); diff --git a/locales/zh_CN/translations.php b/locales/zh_CN/translations.php index d5a9d8e..c6c004d 100644 --- a/locales/zh_CN/translations.php +++ b/locales/zh_CN/translations.php @@ -234,4 +234,5 @@ return array( // 'Refresh interval in minutes for unread counter' => '', // 'Nothing to show. Enable the debug mode to see log messages.' => '', // 'Enable debug mode' => '', + // 'Original link marks article as read' => '', ); diff --git a/models/config.php b/models/config.php index c37dd39..002c4d6 100644 --- a/models/config.php +++ b/models/config.php @@ -288,6 +288,9 @@ function validate_modification(array $values) new Validators\Required('theme', t('Value required')), new Validators\Integer('frontend_updatecheck_interval', t('Must be an integer')), new Validators\Integer('debug_mode', t('Must be an integer')), + new Validators\Integer('nocontent', t('Must be an integer')), + new Validators\Integer('favicons', t('Must be an integer')), + new Validators\Integer('original_marks_read', t('Must be an integer')), ); if (ENABLE_AUTO_UPDATE) { diff --git a/models/schema.php b/models/schema.php index e5223d4..fd0e731 100644 --- a/models/schema.php +++ b/models/schema.php @@ -5,7 +5,12 @@ namespace Schema; use PDO; use Model\Config; -const VERSION = 37; +const VERSION = 38; + +function version_38($pdo) +{ + $pdo->exec('INSERT INTO settings ("key", "value") VALUES ("original_marks_read", 1)'); +} function version_37($pdo) { diff --git a/templates/bookmarks.php b/templates/bookmarks.php index dbf58d1..380ad8f 100644 --- a/templates/bookmarks.php +++ b/templates/bookmarks.php @@ -19,6 +19,7 @@ 'hide' => false, 'display_mode' => $display_mode, 'favicons' => $favicons, + 'original_marks_read' => $original_marks_read, )) ?> diff --git a/templates/config.php b/templates/config.php index 6744b26..a5b54d4 100644 --- a/templates/config.php +++ b/templates/config.php @@ -72,6 +72,7 @@
+


diff --git a/templates/feed_items.php b/templates/feed_items.php index 23412c1..dab2ad0 100644 --- a/templates/feed_items.php +++ b/templates/feed_items.php @@ -35,6 +35,7 @@ 'hide' => false, 'display_mode' => $display_mode, 'favicons' => $favicons, + 'original_marks_read' => $original_marks_read, )) ?> diff --git a/templates/history.php b/templates/history.php index 85e687a..dc8de46 100644 --- a/templates/history.php +++ b/templates/history.php @@ -22,6 +22,7 @@ 'hide' => true, 'display_mode' => $display_mode, 'favicons' => $favicons, + 'original_marks_read' => $original_marks_read, )) ?> diff --git a/templates/item.php b/templates/item.php index 8b17d74..30c1b8c 100644 --- a/templates/item.php +++ b/templates/item.php @@ -36,7 +36,7 @@
  • - + >
  • diff --git a/templates/unread_items.php b/templates/unread_items.php index 9f3e299..4c6299c 100644 --- a/templates/unread_items.php +++ b/templates/unread_items.php @@ -23,6 +23,7 @@ 'hide' => true, 'display_mode' => $display_mode, 'favicons' => $favicons, + 'original_marks_read' => $original_marks_read, )) ?>