1
0
Fork 0
mirror of https://github.com/Oreolek/ifhub.club.git synced 2024-07-05 07:54:24 +03:00
ifhub.club/application/frontend/common/js/activity.js
2014-03-07 23:14:34 +07:00

69 lines
1.5 KiB
JavaScript

/**
* Активность
*
* @module ls/activity
*
* @license GNU General Public License, version 2
* @copyright 2013 OOO "ЛС-СОФТ" {@link http://livestreetcms.com}
* @author Denis Shakhov <denis.shakhov@gmail.com>
*/
var ls = ls || {};
ls.activity = (function ($) {
"use strict";
/**
* Дефолтные опции
*
* @private
*/
var _defaults = {
};
/**
* Инициализация
*
* @param {Object} options Опции
*/
this.init = function(options) {
var _this = this;
this.options = $.extend({}, _defaults, options);
// Настройки
$('.js-activity-settings-toggle').on('click', function () {
_this.toggleEvent($(this).data('type'));
});
// Подгрузка контента
$.each([ 'all', 'user', 'custom' ], function (iIndex, sValue) {
$('.js-more-activity-' + sValue).more({
url: aRouter['stream'] + 'get_more_' + sValue,
target: '#activity-event-list',
beforeload: function (e, context) {
context.options.params.sDateLast=$('.js-activity-event-item').last().data('dateLast');
}
});
});
};
/**
*
*/
this.toggleEvent = function (sType) {
var sUrl = aRouter['stream'] + 'switchEventType/',
oParams = {'type': sType};
ls.hook.marker('switchEventTypeBefore');
ls.ajax.load(sUrl, oParams, function(oResponse) {
if ( ! oResponse.bStateError) {
ls.msg.notice(oResponse.sMsgTitle, oResponse.sMsg);
ls.hook.run('ls_stream_switch_event_type_after',[oParams, oResponse]);
}
});
};
return this;
}).call(ls.activity || {}, jQuery);