1
0
Fork 0
mirror of https://github.com/Oreolek/ifhub.club.git synced 2024-07-08 01:14:24 +03:00
ifhub.club/application/frontend/components/feed/js/feed-blogs.js
2015-10-27 16:02:57 +07:00

54 lines
1.3 KiB
JavaScript

/**
* Управление блогами в ленте
*
* @module ls/feed/blogs
*
* @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.lsFeedBlogs", $.livestreet.lsComponent, {
/**
* Дефолтные опции
*/
options: {
// Ссылки
urls: {
subscribe: null,
unsubscribe: null
},
// Селекторы
selectors: {
checkbox: '.js-feed-blogs-subscribe'
},
params: {}
},
/**
* Конструктор
*
* @constructor
* @private
*/
_create: function () {
this._super();
this._on( this.getElement( 'checkbox' ), { change: this.toggleSubscribe } );
},
/**
* Сохранение настроек
*/
toggleSubscribe: function( event ) {
var checkbox = $( event.target );
this._load( checkbox.is(':checked') ? 'subscribe' : 'unsubscribe', { type: 'blogs', id: checkbox.data( 'id' ) } );
}
});
})(jQuery);