mirror of
https://bitbucket.org/skobkin/chrome_point_plus.git
synced 2024-11-12 22:03:06 +00:00
#98 fixed. Adding new comments with 'unread' class.
This commit is contained in:
parent
06682d3222
commit
eecd3133b8
|
@ -22,6 +22,9 @@ function PointPlus(ppVersion) {
|
|||
console.group('point-plus');
|
||||
console.info('Point+ %s', ppVersion);
|
||||
|
||||
// Getting username
|
||||
var point_username = $('#name h1').text();
|
||||
|
||||
// Проверяем, загрузились ли мы
|
||||
var point_plus_debug = $('#point-plus-debug');
|
||||
if (point_plus_debug.length > 0) {
|
||||
|
@ -397,7 +400,7 @@ function PointPlus(ppVersion) {
|
|||
console.groupEnd();
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// Generating comment from websocket message
|
||||
create_comment_elements({
|
||||
id: (wsMessage.a === 'ok') ? wsMessage.rcid : wsMessage.comment_id,
|
||||
|
@ -406,7 +409,8 @@ function PointPlus(ppVersion) {
|
|||
author: wsMessage.author,
|
||||
text: wsMessage.text,
|
||||
fadeOut: options.is('option_ws_comments_color_fadeout'),
|
||||
isRec: (wsMessage.a === 'ok') ? true : false
|
||||
isRec: (wsMessage.a === 'ok') ? true : false,
|
||||
unread: (point_username && point_username !== wsMessage.author) ? true : false,
|
||||
}, function($comment) {
|
||||
// It's time to DOM
|
||||
console.info('Inserting comment');
|
||||
|
@ -584,6 +588,7 @@ var months = [
|
|||
* @param {string} commentData.text Text of the comment
|
||||
* @param {boolean} commentData.fadeOut Is fadeout enabled or not
|
||||
* @param {boolean|null} commentData.isRec Is comment also a recommendation
|
||||
* @param {boolean} commentData.unread Is comment unread
|
||||
* @param {function} onCommentCreated Callback which is called when comment is ready
|
||||
*
|
||||
*/
|
||||
|
@ -592,7 +597,7 @@ function create_comment_elements(commentData, onCommentCreated) {
|
|||
|
||||
// Initializing comment element
|
||||
var $commentTemplate = $('<div>').attr({
|
||||
'class': 'post',
|
||||
'class': 'post' + (commentData.unread ? ' unread' : ''),
|
||||
'data-id': commentData.postId,
|
||||
'data-comment-id': commentData.id,
|
||||
'data-to-comment-id': commentData.id || ''
|
||||
|
|
Loading…
Reference in a new issue