1
0
Fork 0
mirror of https://github.com/Oreolek/ifhub.club.git synced 2024-06-26 03:30:48 +03:00

Наследование jquery-виджета lsComponent другими компонентами

This commit is contained in:
Denis Shakhov 2015-02-18 22:35:12 +07:00
parent d41d588700
commit 3e72059946
13 changed files with 126 additions and 450 deletions

View file

@ -25,7 +25,9 @@
// Селекторы
selectors: {
checkbox: '.js-feed-blogs-subscribe'
}
},
params: {}
},
/**
@ -44,21 +46,9 @@
* Сохранение настроек
*/
toggleSubscribe: function( event ) {
var checkbox = $( event.target ),
id = checkbox.data( 'id' );
var checkbox = $( event.target );
ls.ajax.load(
this.option( 'urls.' + ( checkbox.is(':checked') ? 'subscribe' : 'unsubscribe' ) ),
{
type: 'blogs',
id: id
},
function( response ) {
if ( ! response.bStateError ) {
ls.msg.notice( response.sMsgTitle, response.sMsg );
}
}
);
this._load( checkbox.is(':checked') ? 'subscribe' : 'unsubscribe', { type: 'blogs', id: checkbox.data( 'id' ) } );
}
});
})(jQuery);

View file

@ -11,7 +11,7 @@
(function($) {
"use strict";
$.widget( "livestreet.lsNote", {
$.widget( "livestreet.lsNote", $.livestreet.lsComponent, {
/**
* Дефолтные опции
*/
@ -34,7 +34,9 @@
form: '.js-user-note-form',
form_text: '.js-user-note-form-text',
form_cancel: '.js-user-note-form-cancel'
}
},
params: {}
},
/**
@ -44,60 +46,42 @@
* @private
*/
_create: function () {
var _this = this;
this.options = $.extend({}, this.options, ls.utils.getDataOptions(this.element, 'note'));
// Получаем аякс параметры
this.params = ls.utils.getDataOptions(this.element, 'param');
// Получаем элементы
this.elements = {};
this.elements.container = this.element;
this.elements.body = this.elements.container.find(this.options.selectors.body);
this.elements.text = this.elements.body.find(this.options.selectors.text);
this.elements.add = this.elements.body.find(this.options.selectors.add);
this.elements.actions = this.elements.body.find(this.options.selectors.actions);
this.elements.actions_edit = this.elements.actions.find(this.options.selectors.actions_edit);
this.elements.actions_remove = this.elements.actions.find(this.options.selectors.actions_remove);
this.elements.form = this.elements.container.find(this.options.selectors.form);
this.elements.form_text = this.elements.form.find(this.options.selectors.form_text);
this.elements.form_cancel = this.elements.form.find(this.options.selectors.form_cancel);
this._super();
// Добавление
this.elements.add.on('click', function (e) {
_this.showForm();
e.preventDefault();
});
this._on( this.elements.add, { click: 'onShowFormClick' } );
// Редактирование
this.elements.actions_edit.on('click', function (e) {
_this.showForm();
e.preventDefault();
});
this._on( this.elements.actions_edit, { click: 'onShowFormClick' } );
// Отмена редактирования
this.elements.form_cancel.on('click', this.hideForm.bind(this));
this._on( this.elements.form_cancel, { click: 'hideForm' } );
// Удаление
this.elements.actions_remove.on('click', function (e) {
_this.remove();
this.elements.actions_remove.on('click' + this.eventNamespace, function (e) {
this.remove();
e.preventDefault();
});
}.bind( this ));
// Сохранение
this.elements.form.on('submit', function (e) {
_this.save();
this.elements.form.on('submit' + this.eventNamespace, function (e) {
this.save();
e.preventDefault();
});
}.bind( this ));
},
/**
* Добавление/Редактирование
*/
onShowFormClick: function( event ) {
event.preventDefault();
this.showForm();
},
/**
* Показывает форму редактирования
*/
showForm: function() {
showForm: function( event ) {
this.elements.body.hide();
this.elements.form.show();
this.elements.form_text.val( $.trim(this.elements.text.html()) ).select();
@ -115,41 +99,25 @@
* Сохраняет заметку
*/
save: function() {
var oParams = {
text: this.elements.form_text.val()
};
this._setParam( 'text', this.elements.form_text.val() );
oParams = $.extend({}, oParams, this.params);
ls.utils.formLock(this.elements.form);
ls.ajax.load(this.options.urls.save, oParams, function (oResponse) {
ls.utils.formUnlock(this.elements.form);
if (oResponse.bStateError) {
ls.msg.error(null, oResponse.sMsg);
} else {
this.elements.text.html(oResponse.sText).show();
this.elements.add.hide();
this.elements.actions.show();
this.hideForm();
}
}.bind(this));
this._submit( 'save', this.elements.form, function ( response ) {
this.elements.text.html(response.sText).show();
this.elements.add.hide();
this.elements.actions.show();
this.hideForm();
});
},
/**
* Удаление заметки
*/
remove: function() {
ls.ajax.load(this.options.urls.remove, this.params, function (oResponse) {
if (oResponse.bStateError) {
ls.msg.error(null, oResponse.sMsg);
} else {
this.elements.text.empty().hide();
this.elements.add.show();
this.elements.actions.hide();
}
}.bind(this));
this._load( 'remove', function () {
this.elements.text.empty().hide();
this.elements.add.show();
this.elements.actions.hide();
});
}
});
})(jQuery);

View file

@ -11,7 +11,7 @@
(function($) {
"use strict";
$.widget( "livestreet.lsPhoto", {
$.widget( "livestreet.lsPhoto", $.livestreet.lsComponent, {
/**
* Дефолтные опции
*/
@ -40,13 +40,11 @@
// Селекторы
selectors: {
image: '.js-photo-image',
actions: {
upload: '.js-photo-actions-upload',
upload_label: '.js-photo-actions-upload-label',
upload_input: '.js-photo-actions-upload-input',
crop_avatar: '.js-photo-actions-crop-avatar',
remove: '.js-photo-actions-remove',
},
action_upload: '.js-photo-actions-upload',
action_upload_label: '.js-photo-actions-upload-label',
action_upload_input: '.js-photo-actions-upload-input',
action_crop_avatar: '.js-photo-actions-crop-avatar',
action_remove: '.js-photo-actions-remove'
},
// Классы
classes: {
@ -66,29 +64,22 @@
* @private
*/
_create: function () {
this._super();
var _this = this;
this.option( 'params.target_id', this.element.data( 'target-id' ) );
this.elements = {
image: this.element.find( this.option( 'selectors.image' ) ),
actions: {
upload: this.element.find( this.option( 'selectors.actions.upload' ) ),
upload_label: this.element.find( this.option( 'selectors.actions.upload_label' ) ),
upload_input: this.element.find( this.option( 'selectors.actions.upload_input' ) ),
crop_avatar: this.element.find( this.option( 'selectors.actions.crop_avatar' ) ),
remove: this.element.find( this.option( 'selectors.actions.remove' ) ),
}
};
this.elements.actions.upload_input.on( 'change' + this.eventNamespace, function () {
this.elements.action_upload_input.on( 'change' + this.eventNamespace, function () {
_this.upload( $( this ) );
});
this.elements.actions.remove.on( 'click' + this.eventNamespace, this.remove.bind( this ) );
// Удаление
this._on( this.elements.action_remove, { click: 'remove' } );
// Изменение аватара
if ( this.option( 'use_avatar' ) ) {
this.elements.actions.crop_avatar.on( 'click' + this.eventNamespace, this.cropAvatar.bind( this ) );
this._on( this.elements.action_crop_avatar, { click: 'cropAvatar' } );
}
},
@ -96,19 +87,15 @@
* Удаление фото
*/
remove: function() {
ls.ajax.load( this.option( 'urls.remove' ), this.option( 'params' ), function( response ) {
if ( response.bStateError ) {
ls.msg.error( null, response.sMsg );
} else {
this.element.addClass( this.option( 'classes.nophoto' ) );
this.elements.image.attr( 'src', response.photo );
this.elements.actions.upload_label.text( response.upload_text );
this._load( 'remove', function( response ) {
this._addClass( 'nophoto' );
this.elements.image.attr( 'src', response.photo );
this.elements.action_upload_label.text( response.upload_text );
if ( this.option( 'use_avatar' ) ) {
this._trigger( 'changeavatar', null, [ this, response.avatars ] );
}
if ( this.option( 'use_avatar' ) ) {
this._trigger( 'changeavatar', null, [ this, response.avatars ] );
}
}.bind( this ));
});
},
/**
@ -120,15 +107,12 @@
input.appendTo( form );
$( '<input type="hidden" name="target_id" value="' + this.option( 'params.target_id' ) + '" >').appendTo( form );
ls.ajax.submit( this.option( 'urls.upload' ), form, function ( response ) {
if ( response.bStateError ) {
ls.msg.error( response.sMsgTitle, response.sMsg );
} else {
this.cropPhoto( response );
}
this._submit( 'upload', form, function ( response ) {
this.cropPhoto( response );
form.remove();
}.bind( this ));
}, {
lock: false
});
},
/**
@ -143,9 +127,9 @@
params: $.extend( {}, this.option( 'params' ), image, { usePreview: this.option( 'crop_photo.usePreview' ) } ),
crop_options: this.option( 'crop_photo' ),
aftersave: function( response, modal, image ) {
this.element.removeClass( this.option( 'classes.nophoto' ) );
this._removeClass( 'nophoto' );
this.elements.image.attr( 'src', response.photo + '?' + Math.random() );
this.elements.actions.upload_label.text( response.upload_text );
this.elements.action_upload_label.text( response.upload_text );
if ( this.option( 'use_avatar' ) ) {
// TODO: Временный хак (модальное не показывается сразу после закрытия предыдущего окна)
@ -153,7 +137,7 @@
}
}.bind( this ),
afterhide: function( event, modal ) {
ls.ajax.load( this.option( 'urls.cancel_photo' ), this.option( 'params' ) );
this._load( 'cancel_photo' );
}.bind( this )
});
},

View file

@ -248,13 +248,9 @@
*/
remove: function( button ) {
ls.ajax.load( this.option( 'urls.remove' ), { id: button.data('poll-id'), tmp: button.data('poll-target-tmp') }, function ( response ) {
if (response.bStateError) {
ls.msg.error(null, response.sMsg);
} else {
button.closest( this.option( 'selectors.item' ) ).fadeOut('slow', function() {
$(this).remove();
});
}
button.closest( this.option( 'selectors.item' ) ).fadeOut('slow', function() {
$(this).remove();
});
}.bind(this));
},
});

View file

@ -11,7 +11,7 @@
(function($) {
"use strict";
$.widget( "livestreet.lsSearchAjax", {
$.widget( "livestreet.lsSearchAjax", $.livestreet.lsComponent, {
/**
* Дефолтные опции
*/
@ -40,11 +40,9 @@
* @private
*/
_create: function () {
var _this = this;
this._super();
this.elements = {
more: this.element.find( this.option( 'selectors.more' ) )
};
var _this = this;
// Иниц-ия фильтров
$.each( this.option( 'filters' ), function ( index, value ) {
@ -173,9 +171,9 @@
* Обновление поиска
*/
update: function() {
ls.ajax.load( this.option( 'urls.search' ), this.option( 'params' ), function ( response ) {
this._load( 'search', function ( response ) {
this.element.html( $.trim( response.html ) );
}.bind( this ));
});
},
/**

View file

@ -1,8 +1,8 @@
/**
* Подписка
*
*
* @module ls/subscribe
*
*
* @license GNU General Public License, version 2
* @copyright 2013 OOO "ЛС-СОФТ" {@link http://livestreetcms.com}
* @author Denis Shakhov <denis.shakhov@gmail.com>
@ -15,20 +15,18 @@ ls.subscribe = (function ($) {
/**
* Подписка/отписка
*/
this.toggle = function(sTargetType, iTargetId, sMail, iValue) {
this.toggle = function(targetType, targetId, mail, value) {
var url = aRouter['subscribe']+'ajax-subscribe-toggle/';
var params = {target_type: sTargetType, target_id: iTargetId, mail: sMail, value: iValue};
var params = { target_type: targetType, target_id: targetId, mail: mail, value: value };
ls.hook.marker('toggleBefore');
ls.ajax.load(url, params, function(result) {
if (result.bStateError) {
ls.msg.error(null, result.sMsg);
} else {
ls.msg.notice(null, result.sMsg);
ls.hook.run('ls_subscribe_toggle_after',[sTargetType, iTargetId, sMail, iValue, result]);
}
ls.ajax.load( url, params, function( response ) {
ls.hook.run('ls_subscribe_toggle_after',[targetType, targetId, mail, value, response ]);
});
return false;
}
return this;
}).call(ls.subscribe || {},jQuery);
}).call(ls.subscribe || {}, jQuery);

View file

@ -7,6 +7,7 @@
"comment": "*",
"button": "*",
"field": "*",
"photo": "*",
"alert": "*"
},
"templates": {
@ -46,7 +47,6 @@
"fields": "js/user-fields.js",
"follow": "js/user-follow.js",
"friend": "js/user-friend.js",
"photo": "js/user-photo.js",
"user": "js/user.js"
},
"styles": {

View file

@ -33,7 +33,9 @@
selectors: {
form: '.js-user-friend-form',
text: '.js-user-friend-text'
}
},
params: {}
},
/**
@ -111,19 +113,12 @@
ls.utils.formLock( form );
ls.ajax.load( _this.option( 'urls.add' ), {
idUser: _this.target,
userText: text
}, function( response ) {
ls.utils.formUnlock( form );
if ( response.bStateError ) {
ls.msg.error( null, response.sMsg );
} else {
ls.msg.notice( null, response.sMsg );
modal.hide();
_this.setStatus( 'sent' );
_this._load( 'add', { idUser: _this.target, userText: text }, function( response ) {
modal.hide();
_this.setStatus( 'sent' );
}, {
onResponse: function () {
ls.utils.formUnlock( form );
}
});

View file

@ -1,226 +0,0 @@
/**
* User photo
*
* @module ls/user/photo
*
* @license GNU General Public License, version 2
* @copyright 2013 OOO "ЛС-СОФТ" {@link http://livestreetcms.com}
* @author Denis Shakhov <denis.shakhov@gmail.com>
*
* TODO: Вынести опции кропа для фото и аватары в общие опции
*/
(function($) {
"use strict";
$.widget( "livestreet.lsUserPhoto", {
/**
* Дефолтные опции
*/
options: {
// Ссылки
urls: {
upload: null,
remove: null,
crop_photo: null,
crop_avatar: null,
save_photo: null,
save_avatar: null,
cancel_photo: null,
},
// Селекторы
selectors: {
image: '.js-user-photo-image',
actions: {
upload: '.js-user-photo-actions-upload',
upload_label: '.js-user-photo-actions-upload-label',
upload_input: '.js-user-photo-actions-upload-input',
crop_avatar: '.js-user-photo-actions-crop-avatar',
remove: '.js-user-photo-actions-remove',
},
},
// Классы
classes: {
nophoto: 'user-photo--nophoto'
},
// Параметры передаваемые в аякс запросах
params: {}
// Изменение аватара
// changeavatar: function() {}
},
/**
* Конструктор
*
* @constructor
* @private
*/
_create: function () {
var _this = this;
this.option( 'params.user_id', this.element.data( 'user-id' ) );
this.elements = {
image: this.element.find( this.option( 'selectors.image' ) ),
actions: {
upload: this.element.find( this.option( 'selectors.actions.upload' ) ),
upload_label: this.element.find( this.option( 'selectors.actions.upload_label' ) ),
upload_input: this.element.find( this.option( 'selectors.actions.upload_input' ) ),
crop_avatar: this.element.find( this.option( 'selectors.actions.crop_avatar' ) ),
remove: this.element.find( this.option( 'selectors.actions.remove' ) ),
}
};
this.elements.actions.upload_input.on( 'change' + this.eventNamespace, function () {
_this.upload( $( this ) );
});
this.elements.actions.crop_avatar.on( 'click' + this.eventNamespace, this.cropAvatar.bind( this ) );
this.elements.actions.remove.on( 'click' + this.eventNamespace, this.remove.bind( this ) );
},
/**
* Удаление фото
*/
remove: function() {
ls.ajax.load( this.option( 'urls.remove' ), this.option( 'params' ), function( response ) {
if ( response.bStateError ) {
ls.msg.error( null, response.sMsg );
} else {
this.element.addClass( this.option( 'classes.nophoto' ) );
this.elements.image.attr( 'src', response.photo );
this.elements.actions.upload_label.text( response.upload_text );
this.elements.actions.remove.hide();
this.elements.actions.crop_avatar.hide();
this._trigger( 'changeavatar', null, [ this, response.avatars ] );
}
}.bind( this ));
},
/**
* Загрузка фото
*/
upload: function( input ) {
var form = $( '<form method="post" enctype="multipart/form-data"></form>' ).hide().appendTo( 'body' );
input.clone( true ).insertAfter( input );
input.appendTo( form );
$( '<input type="hidden" name="user_id" value="' + this.option( 'params.user_id' ) + '" >').appendTo( form );
ls.ajax.submit( this.option( 'urls.upload' ), form, function ( response ) {
if ( response.bStateError ) {
ls.msg.error( response.sMsgTitle, response.sMsg );
} else {
this.cropPhoto( response );
}
form.remove();
}.bind( this ));
},
/**
* Показывает модальное кропа фото
*/
cropPhoto: function( image ) {
this.showModal( image, false, {
crop_params : {
minSize: [ 370, 370 ]
},
save_params : this.option( 'params' ),
crop_url : this.option( 'urls.crop_photo' ),
save_url : this.option( 'urls.save_photo' ),
save_callback : function( response, modal, image ) {
this.element.removeClass( this.option( 'classes.nophoto' ) );
this.elements.image.attr( 'src', response.photo );
this.elements.actions.upload_label.text( response.upload_text );
this.elements.actions.remove.show();
this.elements.actions.crop_avatar.show();
// TODO: Временный хак (модальное не показывается сразу после закрытия предыдущего окна)
setTimeout( this.cropAvatar.bind( this ), 300);
},
modal_close_callback : function( event, modal ) {
ls.ajax.load( this.option( 'urls.cancel_photo' ), this.option( 'params' ) );
}
});
},
/**
* Показывает модальное кропа аватара
*/
cropAvatar: function() {
var photo = $('.js-user-photo-image');
var image = {
path: photo.attr( 'src' ),
// TODO: IE8 naturalWidth naturalHeight
original_width: photo[0].naturalWidth,
original_height: photo[0].naturalHeight,
width: photo[0].naturalWidth,
height: photo[0].naturalHeight
};
this.showModal( image, true, {
crop_params : {
minSize: [ 100, 100 ],
aspectRatio: 1
},
save_callback : function( response, modal, image ) {
this._trigger( 'changeavatar', null, [ this, response.avatars ] );
},
save_params : this.option( 'params' ),
crop_url : this.option( 'urls.crop_avatar' ),
save_url : this.option( 'urls.save_avatar' )
});
},
/**
* Показывает модальное кропа
*
* TODO: Перенести в компонент crop
*/
showModal: function( image, usePreview, params ) {
var _this = this;
ls.modal.load( params.crop_url, {
original_width: image.original_width,
original_height: image.original_height,
width: image.width,
height: image.height,
image_src: image.path,
use_preview: usePreview
}, {
aftershow: function( e, modal ) {
var crop = modal.element.find('.js-crop').lsCrop( params.crop_params );
var submit = modal.element.find('.js-crop-submit');
var image = crop.lsCrop( 'getImage' );
submit.on( 'click', function() {
var paramsRequest = $.extend({}, {
size: crop.lsCrop( 'getSelection' ),
canvas_width: image.innerWidth()
}, params.save_params || {});
ls.ajax.load( params.save_url, paramsRequest, function( response ) {
if ( response.bStateError ) {
ls.msg.error( null, response.sMsg );
} else {
modal.hide();
if ( $.isFunction( params.save_callback ) ) {
params.save_callback.call( _this, response, modal, image );
}
}
});
});
},
afterhide: function( event, modal ) {
if ( $.isFunction( params.modal_close_callback ) ) {
params.modal_close_callback.call( _this, event, modal );
}
},
center: false
});
}
});
})(jQuery);

View file

@ -11,7 +11,7 @@
(function($) {
"use strict";
$.widget( "livestreet.lsWallEntry", {
$.widget( "livestreet.lsWallEntry", $.livestreet.lsComponent, {
/**
* Дефолтные опции
*/
@ -28,7 +28,9 @@
wrapper: '.js-wall-entry-container',
remove: '.js-comment-remove',
reply: '.js-comment-reply',
}
},
params: {}
},
/**
@ -38,12 +40,7 @@
* @private
*/
_create: function () {
var _this = this;
this.elements = {
remove: this.element.find( this.option( 'selectors.remove' ) ),
reply: this.element.find( this.option( 'selectors.reply' ) )
};
this._super();
// ID поста
this.id = this.element.data( 'id' );
@ -82,15 +79,6 @@
this.form.lsWallForm( 'toggle' );
},
/**
* Возвращает элементы записи
*
* @return {Array} Элементы записи
*/
getElements: function() {
return this.elements;
},
/**
* Возвращает тип записи (комментарий/пост)
*
@ -104,7 +92,7 @@
* Удаление
*/
remove: function() {
ls.ajax.load( this.option( 'urls.remove' ), { user_id: this.option( 'wall' ).lsWall( 'getUserId' ), id: this.id }, this.onRemove.bind( this ) );
this._load( 'remove', { user_id: this.option( 'wall' ).lsWall( 'getUserId' ), id: this.id }, 'onRemove' );
},
/**

View file

@ -49,7 +49,7 @@
this.id = this.element.data( 'id' );
// Кнопка "Ответить" в посте
this.reply = this.option( 'wall' ).lsWall( 'getEntryById', this.id ).lsWallEntry( 'getElements' ).reply;
this.reply = this.option( 'wall' ).lsWall( 'getEntryById', this.id ).lsWallEntry( 'getElement', 'reply' );
// Отправка формы
this._on({ submit: this.submit });

View file

@ -11,7 +11,7 @@
(function($) {
"use strict";
$.widget( "livestreet.lsWall", {
$.widget( "livestreet.lsWall", $.livestreet.lsComponent, {
/**
* Дефолтные опции
*/
@ -26,11 +26,7 @@
// Селекторы
selectors: {
entry: {
self: '.js-wall-entry',
remove: '.js-comment-remove',
reply: '.js-comment-reply'
},
entry: '.js-wall-entry',
comment: '.js-wall-comment',
post: '.js-wall-post',
form: '.js-wall-form',
@ -39,7 +35,9 @@
comment_wrapper: '.js-wall-comment-wrapper',
container: '.js-wall-entry-container',
empty: '.js-wall-alert-empty'
}
},
params: {}
},
/**
@ -49,16 +47,9 @@
* @private
*/
_create: function () {
var _this = this;
this._super();
this.elements = {
empty: this.element.find( this.option( 'selectors.empty' ) ),
more: this.element.find( this.option( 'selectors.more' ) ),
more_comments: this.element.find( this.option( 'selectors.more_comments' ) ),
entries: this.element.find( this.option( 'selectors.entry.self' ) ),
forms: this.element.find( this.option( 'selectors.form' ) ),
container: this.element.find( this.option( 'selectors.container' ) )
};
var _this = this;
this.userId = this.getUserId();
@ -88,7 +79,7 @@
});
// Записи
this.elements.entries.livequery( function () {
this.elements.entry.livequery( function () {
$( this ).lsWallEntry({
wall: _this.element,
urls: {
@ -103,7 +94,7 @@
});
// Формы
this.elements.forms.livequery( function () {
this.elements.form.livequery( function () {
$( this ).lsWallForm({
wall: _this.element
});
@ -118,18 +109,16 @@
add: function( pid, text ) {
var form = this.getFormById( pid );
ls.ajax.load( this.option( 'urls.add' ), { user_id: this.getUserId(), pid: pid, text: text }, function( response ) {
if ( response.bStateError ) {
ls.msg.error(null, response.sMsg);
} else {
if ( pid === 0 ) this.elements.empty.hide();
this._load( 'add', { user_id: this.getUserId(), pid: pid, text: text }, function( response ) {
if ( pid === 0 ) this.elements.empty.hide();
this.load( pid );
form.lsWallForm( 'close' );
this.load( pid );
form.lsWallForm( 'close' );
}, {
onResponse: function () {
ls.utils.formUnlock( form );
}
ls.utils.formUnlock( form );
}.bind(this));
});
},
/**
@ -139,18 +128,14 @@
*/
load: function( pid ) {
var container = this.element.find( this.options.selectors.container + '[data-id=' + pid + ']' ),
firstId = container.find( '>' + this.option( 'selectors.entry.self' ) + ':' + ( pid === 0 ? 'first' : 'last' ) ).data( 'id' ) || -1,
firstId = container.find( '>' + this.option( 'selectors.entry' ) + ':' + ( pid === 0 ? 'first' : 'last' ) ).data( 'id' ) || -1,
params = { user_id: this.getUserId(), first_id: firstId, target_id: pid };
ls.ajax.load( this.option( pid === 0 ? 'urls.load' : 'urls.load_comments' ), params, function( response ) {
if (response.bStateError) {
ls.msg.error(null, response.sMsg);
} else {
if ( response.count_loaded ) {
container[ pid === 0 ? 'prepend' : 'append' ]( response.html );
}
this._load( pid === 0 ? 'load' : 'load_comments', params, function( response ) {
if ( response.count_loaded ) {
container[ pid === 0 ? 'prepend' : 'append' ]( response.html );
}
}.bind(this));
});
},
/**

@ -1 +1 @@
Subproject commit ed7c209f3ef42c774040ad57936c09412688addd
Subproject commit dae4ad3c41abfd9224c44ad9fcc8134815c70ec5