1
0
Fork 0
mirror of https://github.com/Oreolek/ifhub.club.git synced 2024-07-02 22:45:02 +03:00
ifhub.club/application/frontend/common/js/activity.js
2014-07-18 22:45:16 +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>
*/
(function($) {
"use strict";
$.widget( "livestreet.lsActivity", {
/**
* Дефолтные опции
*/
options: {
// Ссылки
urls: {
// Подгрузка событий
more: null
},
// Селекторы
selectors: {
// Список событий
list: '.js-activity-event-list',
// Событие
event: '.js-activity-event',
// Кнопка подгрузки событий
more: '.js-activity-more'
}
},
/**
* Конструктор
*
* @constructor
* @private
*/
_create: function () {
var _this = this;
this.elements = {
list: this.element.find( this.option( 'selectors.list' ) ),
more: this.element.find( this.option( 'selectors.more' ) )
};
// Подгрузка событий
this.elements.more.more({
url: this.option( 'urls.more' ),
target: this.elements.list,
beforeload: function (e, context) {
context.options.params.date_last = _this.getDateLast();
}
});
},
/**
* Получает дату последнего подгруженного события
*/
getDateLast: function() {
return this.elements.list.find( this.option( 'selectors.event' ) ).last().find( 'time' ).attr( 'datetime' );
}
});
})(jQuery);