1
0
Fork 0
mirror of https://github.com/Oreolek/ifhub.club.git synced 2024-07-04 23:44:25 +03:00
ifhub.club/application/frontend/common/js/activity.js

69 lines
1.5 KiB
JavaScript
Raw Normal View History

/**
* Активность
*
* @module ls/activity
*
* @license GNU General Public License, version 2
* @copyright 2013 OOO "ЛС-СОФТ" {@link http://livestreetcms.com}
* @author Denis Shakhov <denis.shakhov@gmail.com>
*/
2014-07-18 18:45:16 +03:00
(function($) {
"use strict";
2014-07-18 18:45:16 +03:00
$.widget( "livestreet.lsActivity", {
/**
* Дефолтные опции
*/
options: {
// Ссылки
urls: {
// Подгрузка событий
more: null
},
// Селекторы
selectors: {
// Список событий
list: '.js-activity-event-list',
2014-07-18 18:45:16 +03:00
// Событие
event: '.js-activity-event',
// Кнопка подгрузки событий
more: '.js-activity-more'
}
},
2014-07-18 18:45:16 +03:00
/**
* Конструктор
*
* @constructor
* @private
*/
_create: function () {
var _this = this;
2014-07-18 18:45:16 +03:00
this.elements = {
list: this.element.find( this.option( 'selectors.list' ) ),
more: this.element.find( this.option( 'selectors.more' ) )
};
2014-07-18 18:45:16 +03:00
// Подгрузка событий
this.elements.more.more({
url: this.option( 'urls.more' ),
target: this.elements.list,
beforeload: function (e, context) {
2014-07-18 18:45:16 +03:00
context.options.params.date_last = _this.getDateLast();
}
});
2014-07-18 18:45:16 +03:00
},
2014-07-18 18:45:16 +03:00
/**
* Получает дату последнего подгруженного события
*/
getDateLast: function() {
return this.elements.list.find( this.option( 'selectors.event' ) ).last().find( 'time' ).attr( 'datetime' );
}
});
})(jQuery);