Skip to content

Commit

Permalink
new option for automatically mark items as read
Browse files Browse the repository at this point in the history
  • Loading branch information
SSilence committed Mar 24, 2013
1 parent acdcb4d commit b3636b8
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 25 deletions.
44 changes: 23 additions & 21 deletions _docs/website/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -109,36 +109,34 @@ <h2>Installation</h2>
For further questions or on any problem use our <a href="forum">support forum</a>.
</div>

<h2>Configuration</h2>
<div class="documentation-entry">
<p>Configuration is optional. Any settings in config.ini will override the settings in defaults.ini. To customize settings follow these instructions:</p>
<ol>
<li>Copy defaults.ini to config.ini.</li>
<li>Edit config.ini and delete any lines you do not wish to override.</li>
<li>Do not delete the <code>[globals]</code> line.</li>
</ol>
<p>Sample config.ini file which provides password protection:</p>
<pre>
<code>
<h2>Configuration</h2>
<div class="documentation-entry">
<p>Configuration is optional. Any settings in config.ini will override the settings in defaults.ini. To customize settings follow these instructions:</p>
<ol>
<li>Copy defaults.ini to config.ini.</li>
<li>Edit config.ini and delete any lines you do not wish to override.</li>
<li>Do not delete the <code>[globals]</code> line.</li>
</ol>
<p>Sample config.ini file which provides password protection:</p>
<pre>
<code>
[globals]
username=secretagent
password=5d95c032abce4865d49ee225d28a8a939ea39a924a158f0056ebb1880d9
salt=1291929@9394$95%939201098*61234324(@#$(!*@#981923123
</code>
</pre>
<p>Sample config.ini file with a MySQL database connection:</p>
<pre>
<code>
salt=1291929@9394$95%939201098*61234324(@#$(!*@#981923123</code>
</pre>
<p>Sample config.ini file with a MySQL database connection:</p>
<pre>
<code>
[globals]
db_type=mysql
db_host=localhost
db_database=selfoss
db_username=secretagent
db_password=life0fD4ng3r
db_port=3306
</code>
</pre>
</div>
db_port=3306</code>
</pre>
</div>

<h2>Update</h2>
<div class="documentation-entry">
Expand Down Expand Up @@ -247,6 +245,10 @@ <h2>Configuration</h2>
<td class="documentation-first-column">homepage</td>
<td>set here your prefered homepage. Choose between newest, unread and starred. Default = newest.</td>
</tr>
<tr>
<td class="documentation-first-column">auto_mark_as_read</td>
<td>set this to 1 for autmatically marking items as read after open/read them.</td>
</tr>
</table>
</div>

Expand Down
3 changes: 2 additions & 1 deletion defaults.ini
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ public=
rss_title=selfoss feed
rss_max_items=300
rss_mark_as_read=0
homepage=newest
homepage=newest
auto_mark_as_read=0
14 changes: 13 additions & 1 deletion public/js/selfoss-events-entries.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ selfoss.events.entries = function(e) {
// show/hide entry
var target = selfoss.isMobile() ? '.entry' : '.entry-title';
$(target).unbind('click').click(function() {
var parent = target == '.entry' ? $(this) : $(this).parent();
var parent = ((target == '.entry') ? $(this) : $(this).parent());

if(selfoss.isSmartphone()==false) {
$('.entry.selected').removeClass('selected');
Expand All @@ -17,6 +17,8 @@ selfoss.events.entries = function(e) {
if(parent.hasClass('fullscreen'))
return;

var autoMarkAsRead = $('body').hasClass('auto_mark_as_read') && parent.hasClass('unread');

// show entry in popup
if(selfoss.isSmartphone()) {
location.hash = "show";
Expand Down Expand Up @@ -57,10 +59,15 @@ selfoss.events.entries = function(e) {
fullscreen.hide();
});

// automark as read
if(autoMarkAsRead) {
fullscreen.find('.entry-unread').click();
}
// open entry content
} else {
var content = parent.find('.entry-content');

// show/hide (with toolbar)
if(content.is(':visible')) {
parent.find('.entry-toolbar').hide();
content.hide();
Expand All @@ -74,6 +81,11 @@ selfoss.events.entries = function(e) {
if(selfoss.isMobile()==false) {
content.lazyLoadImages();
}

// automark as read
if(autoMarkAsRead) {
parent.find('.entry-unread').click();
}
}
});

Expand Down
5 changes: 4 additions & 1 deletion public/js/selfoss-shortcuts.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,17 @@ selfoss.shortcuts = {
current.click().removeClass('selected').prev().addClass('selected');

// open?
if(open && current.find('.entry-thumbnail').length==0) {
if(open) {
var content = current.find('.entry-content');
// load images not on mobile devices
if(selfoss.isMobile()==false)
content.lazyLoadImages();
content.show();
current.find('.entry-toolbar').show();
selfoss.events.entriesToolbar(current);
// automark as read
if($('body').hasClass('auto_mark_as_read') && current.hasClass('unread'))
current.find('.entry-unread').click();
}

// scroll to element
Expand Down
7 changes: 6 additions & 1 deletion templates/home.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,12 @@
<link rel="stylesheet" href="all.css">

</head>
<body class="<?PHP if($this->publicMode===true) : ?>publicmode<?PHP endif; ?> <?PHP echo $this->loggedin ? "loggedin" : "notloggedin"; ?> <?PHP if(\F3::get('initial_open')==1) : ?>initial_open<?PHP endif; ?>">
<body class="
<?PHP echo $this->publicMode===true ? "publicmode" : ""; ?>
<?PHP echo $this->loggedin===true ? "loggedin" : "notloggedin"; ?>
<?PHP echo \F3::get('initial_open')==1 ? "initial_open" : ""; ?>
<?PHP echo \F3::get('auto_mark_as_read')==1 ? "auto_mark_as_read" : ""; ?>
">

<!-- menue open for smartphone -->
<div id="nav-mobile">
Expand Down

0 comments on commit b3636b8

Please sign in to comment.