Idhae
Active member
Hello, I've been working on it for a while, but I think it's done now.
For those who are interested and for those who hopefully have some suggestions for improvements.
Create the JS file:
TMS the "node_list_forum" template
Search:
Replace:
Inspired by:
https://xenforo.com/community/resources/double-click-forum-icons-to-mark-forum-as-read.2298/
For those who are interested and for those who hopefully have some suggestions for improvements.
Create the JS file:
JavaScript:
var PREFIX = window.PREFIX || {};
!function($, window, document, _undefined)
{
PREFIX.MarkForumRead = XF.Element.newHandler({
eventNameSpace: 'MarkForumRead',
init: function() {
this.$target.on('dblclick', function() {
var $this = $(this);
$this.removeClass('node--unread');
$this.addClass('node--read');
XF.ajax(
'POST',
$this.data('markreadlink')
);
});
}
});
XF.Element.register('mark-forum-read', 'PREFIX.MarkForumRead');
}
(jQuery, window, document);
TMS the "node_list_forum" template
Search:
PHP:
<div class="node node--id{$node.node_id} node--depth{$depth} node--forum {{ $extras.hasNew ? 'node--unread' : 'node--read' }}">
Replace:
PHP:
<xf:js src="prefix/markforumread.js" addon="ADDON/DIR"/>
<div <xf:if is="$extras.hasNew && $xf.visitor.user_id">
data-xf-init="mark-forum-read" data-markreadlink="{{ link('forums/mark-read', $node, {'date': $date}) }}"
</xf:if>
class="node node--id{$node.node_id} node--depth{$depth} node--forum {{ $extras.hasNew ? 'node--unread' : 'node--read' }}">
Inspired by:
https://xenforo.com/community/resources/double-click-forum-icons-to-mark-forum-as-read.2298/
Last edited: