Mark as Read on Click/Expand
Another 'hacky' solution - but it works like a charm.
- STEP 1 ----
Added the following line to /selfoss/config.ini. Setting it to 1 will mark items as read on opening/expanding. Setting to 0 will retain the original functionality.
- markasread_openentry=1
- STEP 2 ----
Added the following line to /selfoss/helpers/View.php on line 35, right before $lastSlash = strrpos($_SERVER['SCRIPT_NAME'], '/');. Exactely the same spot as with the fullscreen-hack.
- $this->markasreadopenentry = \F3::get('markasread_openentry');
- STEP 3 ----
Changed the following code in /selfoss/template/home.phtml - replace the following code
- <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; ?>">
with this code
- <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; ?>" <?PHP if ($this->markasreadopenentry=='1'){ echo 'data-markasreadonopenentry="1"'; } ?>>
- STEP 4 ----
Added the following code to /selfoss/public/js/selfoss-events.js on line 317, right before if(selfoss.isSmartphone()==false) {.
- /* MOD --- mark as read hack */
var markOnOpen = $('body').attr('data-markasreadonopenentry');
var entryID = parent.attr('id');
if (markOnOpen == '1') { markAsRead(entryID); }
- STEP 5 ----
Added the following code to /selfoss/public/js/selfoss-events.js on line 391, right before // no source click. (after adding the previous code, otherwise the line-numbers won't match).
- /* MOD --- mark as read hack */
function markAsRead(entryid) {
var ids = new Array();
ids.push( entryid.substr(5) );
$.ajax({
url: $('base').attr('href') + 'mark',
type: 'POST',
data: {
ids: ids
},
success: function() {
$('#'+entryid).removeClass('unread');
var unreadstats = parseInt($('.nav-filter-unread span').html());
$('.nav-filter-unread span').html( (unreadstats - ids.length) );
if(selfoss.isSmartphone())
$('#nav-mobile-settings').click();
},
error: function(jqXHR, textStatus, errorThrown) {
alert('Can not mark visible item: ' + errorThrown);
}
});
}
- STEP 6 ----
Delete the following file: /selfoss/public/all.js - this will be regenerated the next time you visit your selfoss webapp (might take a while on slower servers)
Complete thread:
- Feature Suggestions -
RubenK,
2013-03-15, 08:35
- iOS Fullscreen Webapp Capability -
RubenK,
2013-03-15, 10:26
- iOS Fullscreen Webapp Capability -
nosbig,
2013-03-15, 13:27
- iOS Fullscreen Webapp Capability - RubenK, 2013-03-15, 13:36
- iOS Fullscreen Webapp Capability -
nosbig,
2013-03-15, 13:27
- Mark as Read on Click/Expand -
RubenK,
2013-03-15, 11:27
- Mark as Read on Click/Expand -
baz4096,
2013-03-15, 13:27
- Mark as Read on Click/Expand -
RubenK,
2013-03-15, 13:38
- Mark as Read on Click/Expand -
baz4096,
2013-03-15, 13:55
- Mark as Read on Click/Expand -
RubenK,
2013-03-15, 14:01
- Mark as Read on Click/Expand - sanchomuzax, 2013-04-10, 22:08
- Mark as Read on Click/Expand -
RubenK,
2013-03-15, 14:01
- Mark as Read on Click/Expand -
baz4096,
2013-03-15, 13:55
- Mark as Read on Click/Expand -
RubenK,
2013-03-15, 13:38
- Mark as Read on Click/Expand -
baz4096,
2013-03-15, 13:27
- iOS Fullscreen Webapp Capability -
RubenK,
2013-03-15, 10:26