ref: master
plugins/mark_comment_as_read/public/mark_comment_as_read.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
function mark_comments_as_read(comments) { jQuery(document).ready(function($) { for(var i=0; i<comments.length; i++) { $comment = jQuery('#comment-'+comments[i]); $comment.find('.comment-content').first().addClass('comment-mark-read'); } }); } function toggle_comment_read(button, url, mark) { var $ = jQuery; var $button = $(button); $button.addClass('comment-button-loading'); $.post(url, function(data) { if (data.ok) { var $comment = $button.closest('.article-comment'); var $content = $comment.find('.comment-content').first(); if(mark) $content.addClass('comment-mark-read'); else $content.removeClass('comment-mark-read'); $button.hide(); $button.removeClass('comment-button-loading'); return; } }); } |