mirror of
https://bitbucket.org/skobkin/chrome_point_plus.git
synced 2024-12-27 17:04:21 +00:00
#96 and some other fixed. Now inserting new comments as HTML (new WebSocket message format).
This commit is contained in:
parent
75bc6636b2
commit
f91dfc4ba7
|
@ -362,11 +362,23 @@ function PointPlus(ppVersion) {
|
|||
if (evt.data === 'ping') {
|
||||
console.info('ws-ping');
|
||||
} else {
|
||||
/**
|
||||
* @namespace
|
||||
* @property {string} a Message type ("comment" or "post")
|
||||
* @property {string} author
|
||||
* @property {number} comment_id
|
||||
* @property {?Array} files
|
||||
* @property {?string} html
|
||||
* @property {string} post_id
|
||||
* @property {?string} text
|
||||
* @property {?number} to_comment_id
|
||||
* @property {?string} to_text
|
||||
*/
|
||||
var wsMessage = JSON.parse(evt.data);
|
||||
|
||||
if (wsMessage.hasOwnProperty('a') && wsMessage.a !== '') {
|
||||
console.log(wsMessage);
|
||||
|
||||
|
||||
switch (wsMessage.a) {
|
||||
// Recommendation comment
|
||||
case 'ok':
|
||||
|
@ -407,7 +419,7 @@ function PointPlus(ppVersion) {
|
|||
toId: wsMessage.to_comment_id,
|
||||
postId: wsMessage.post_id,
|
||||
author: wsMessage.author,
|
||||
text: wsMessage.text,
|
||||
html: wsMessage.html,
|
||||
fadeOut: options.is('option_ws_comments_color_fadeout'),
|
||||
isRec: (wsMessage.a === 'ok') ? true : false,
|
||||
unread: (point_username && point_username !== wsMessage.author) ? true : false,
|
||||
|
@ -585,7 +597,7 @@ var months = [
|
|||
* @param {string|number} commentData.toId ID of the comment replying to
|
||||
* @param {string} commentData.postId ID of the post
|
||||
* @param {string} commentData.author Author of the comment
|
||||
* @param {string} commentData.text Text of the comment
|
||||
* @param {string} commentData.html HTML of the comment text
|
||||
* @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
|
||||
|
@ -629,7 +641,7 @@ function create_comment_elements(commentData, onCommentCreated) {
|
|||
///Crutchy fix
|
||||
.append($('<span>').html(date.getHours() + ':' + ((date.getMinutes().toString().length < 2) ? ('0' + date.getMinutes().toString()) : (date.getMinutes().toString()))));
|
||||
// Comment text
|
||||
$commentTemplate.find('.text').append($('<p>').text(commentData.text));
|
||||
$commentTemplate.find('.text').html(commentData.html);
|
||||
// Author
|
||||
$commentTemplate.find('.author a.user').attr('href', userLink).text(commentData.author);
|
||||
// Avatar and link
|
||||
|
|
Loading…
Reference in a new issue