1
0
Fork 0
mirror of https://github.com/Oreolek/ifhub.club.git synced 2024-07-08 17:34:26 +03:00
ifhub.club/application/frontend/skin/developer/assets/js/init.js

404 lines
7.2 KiB
JavaScript
Raw Normal View History

/**
* Инициализации модулей
*
* @license GNU General Public License, version 2
* @copyright 2013 OOO "ЛС-СОФТ" {@link http://livestreetcms.com}
* @author Denis Shakhov <denis.shakhov@gmail.com>
*/
2013-04-09 01:30:54 +03:00
jQuery(document).ready(function($){
// Хук начала инициализации javascript-составляющих шаблона
ls.hook.run('ls_template_init_start',[],window);
/**
* Иниц-ия модулей ядра
2013-04-09 01:30:54 +03:00
*/
ls.init({
production: false
});
ls.dev.init();
2013-04-09 01:30:54 +03:00
/**
* Actionbar
*/
$('.js-user-list-modal-actionbar').livequery(function () {
$( this ).lsActionbarItemSelect({
selectors: {
target_item: '.js-user-list-select .js-user-list-small-item'
}
});
});
2013-04-09 01:30:54 +03:00
/**
* Modals
*/
$('.js-modal-default').lsModal();
2013-04-09 01:30:54 +03:00
2014-10-25 10:15:11 +03:00
/**
* Accordion
*/
$('.js-accordion-default').accordion({
collapsible: true
});
2013-04-09 01:30:54 +03:00
/**
* Dropdowns
*/
$('.js-dropdown-default').livequery(function () {
$(this).lsDropdown();
});
2013-04-09 01:30:54 +03:00
/**
* Tabs
*/
$( '.js-tabs-auth, .js-tabs-block' ).lsTabs();
/**
* Fields
*/
ls.geo.initSelect();
$('.js-date-picker').datepicker();
$('[data-type=captcha]').livequery(function () {
$(this).captcha();
});
/**
* Alerts
*/
$('.js-alert').lsAlert();
2013-04-09 01:30:54 +03:00
/**
* Tooltips
*/
$('.js-tooltip').tooltip();
2013-04-09 01:30:54 +03:00
$('.js-popover-default').tooltip({
useAttrTitle: false,
trigger: 'click',
classes: 'tooltip-light'
2013-04-09 01:30:54 +03:00
});
if (ls.registry.get('block_stream_show_tip')) {
$('.js-title-comment, .js-title-topic').livequery(function () {
$(this).tooltip({
position: {
my: "right center",
at: "left left"
},
show: {
delay: 1500
}
});
2013-04-09 01:30:54 +03:00
});
}
/**
* Autocomplete
*/
$( '.autocomplete-tags' ).lsAutocomplete({
multiple: false,
urls: {
load: aRouter.ajax + 'autocompleter/tag/'
}
});
$( '.autocomplete-tags-sep' ).lsAutocomplete({
multiple: true,
urls: {
load: aRouter.ajax + 'autocompleter/tag/'
}
});
$( '.autocomplete-users' ).lsAutocomplete({
multiple: false,
urls: {
load: aRouter.ajax + 'autocompleter/user/'
}
});
$( '.autocomplete-users-sep' ).lsAutocomplete({
multiple: true,
urls: {
load: aRouter.ajax + 'autocompleter/user/'
}
});
2013-04-09 01:30:54 +03:00
/**
* Code highlight
*/
prettyPrint();
/**
* Blocks
*/
$( '.js-block-default' ).lsBlock();
2013-04-09 01:30:54 +03:00
/**
2014-07-19 19:50:52 +03:00
* Активность
2013-04-09 01:30:54 +03:00
*/
2014-07-18 18:45:16 +03:00
$('.js-activity--all').lsActivity({ urls: { more: aRouter.stream + 'get_more_all' } });
$('.js-activity--user').lsActivity({ urls: { more: aRouter.stream + 'get_more_user' } });
$('.js-activity--personal').lsActivity({
urls: {
more: aRouter.stream + 'get_more_personal'
},
create: function() {
// Настройки активности
$('.js-activity-settings').lsActivitySettings({
urls: {
toggle_type: aRouter.stream + 'switchEventType'
}
});
// Добавление пользователей в персональную активность
$('.js-activity-users').user_list_add({
urls: {
add: aRouter.stream + 'ajaxadduser',
remove: aRouter.stream + 'ajaxremoveuser'
}
});
}
});
2013-04-09 01:30:54 +03:00
2013-05-04 17:10:22 +03:00
/**
2014-07-19 19:50:52 +03:00
* Лента
2013-05-04 17:10:22 +03:00
*/
2014-07-19 19:50:52 +03:00
$('.js-feed').lsFeed({
urls: {
more: aRouter.feed + 'get_more'
},
create: function() {
// Блоги
$('.js-feed-blogs').lsFeedBlogs({
urls: {
subscribe: aRouter.feed + 'subscribe',
unsubscribe: aRouter.feed + 'unsubscribe'
}
});
// Добавление пользователей в свою ленту
$('.js-feed-users').user_list_add({
urls: {
add: aRouter.feed + 'ajaxadduser',
remove: aRouter.feed + 'unsubscribe'
}
});
}
});
2013-04-09 01:30:54 +03:00
/**
* Toolbar
*/
$('.js-toolbar').toolbar({
target: '.grid-role-wrapper',
offsetX: 20
});
2014-06-17 12:54:39 +03:00
$('.js-toolbar-scrollup').lsToolbarScrollUp();
$('.js-toolbar-comments').lsToolbarComments();
2014-06-17 12:54:39 +03:00
$('.js-toolbar-topics').lsToolbarTopics();
2013-04-09 01:30:54 +03:00
/**
* User
*/
ls.user.init();
// Голосование за пользователя
$('.js-vote-user').vote({
urls: {
vote: aRouter['ajax'] + 'vote/user/'
}
});
2013-05-04 17:10:22 +03:00
/**
* Talk
2013-04-09 01:30:54 +03:00
*/
2013-07-02 05:58:58 +03:00
ls.talk.init();
2014-10-25 10:15:11 +03:00
// Форма поиска
$('.js-talk-search-form').accordion({
collapsible: true,
active: false
});
// Добавление диалога в избранное
$('.js-favourite-talk').lsFavourite({
urls: {
toggle: aRouter['ajax'] + 'favourite/talk/'
}
});
// Комментарии
$('.js-comments-talk').lsComments({
urls: {
add: aRouter['talk'] + 'ajaxaddcomment/',
load: aRouter['talk'] + 'ajaxresponsecomment/'
}
});
// Экшнбар
$('.js-talk-actionbar-select').lsActionbarItemSelect({
selectors: {
target_item: '.js-message-list-item'
}
});
// Добавление участников личного сообщения
$('.js-message-users').message_users();
// Черный список
$('.js-user-list-add-blacklist').user_list_add({
urls: {
add: aRouter['talk'] + 'ajaxaddtoblacklist/',
remove: aRouter['talk'] + 'ajaxdeletefromblacklist/'
}
});
/**
* Poll
*/
2014-06-23 15:51:40 +03:00
$('.js-poll').lsPoll();
$('.js-poll-manage').lsPollManage();
/**
* User Note
*/
$('.js-user-note').livequery(function () {
$(this).lsNote({
urls: {
save: aRouter['profile'] + 'ajax-note-save/',
remove: aRouter['profile'] + 'ajax-note-remove/'
}
});
});
2013-07-09 08:09:06 +03:00
/**
* Editor
*/
$( '.js-editor-default' ).lsEditor();
2013-07-09 08:09:06 +03:00
2014-01-25 14:39:19 +02:00
/**
* Blog
*/
ls.blog.init();
// Голосование за блог
$('.js-vote-blog').vote({
urls: {
vote: aRouter['ajax'] + 'vote/blog/'
}
});
// Приглашение пользователей в блог
$('.js-user-list-add-blog-invite').lsBlogInvites();
2013-07-09 11:40:06 +03:00
/**
* Topic
*/
$( '.js-topic' ).lsTopic();
ls.topic.init();
ls.content.init();
// Пагинация
2014-05-04 06:52:24 +03:00
$('.js-pagination-topics').lsPagination({
hash: {
2014-06-17 12:54:39 +03:00
next: 'goTopic=first',
2014-05-04 06:52:24 +03:00
prev: 'goTopic=last'
}
});
$('.js-comments-topic').lsComments({
urls: {
add: aRouter['blog'] + 'ajaxaddcomment/',
load: aRouter['blog'] + 'ajaxresponsecomment/'
}
});
2014-01-02 07:58:44 +02:00
/**
* Теги
*/
ls.tags.init();
2014-10-25 10:15:11 +03:00
// Облако тегов избранного
$('.js-tags-favourite-accordion').accordion({
collapsible: true,
active: false
});
2014-01-02 07:58:44 +02:00
/**
* Form validate
*/
$('.js-form-validate').parsley({
validators: {
rangetags: function (val, arrayRange) {
2013-08-05 08:24:15 +03:00
var tag_count = val.replace(/ /g, "").match(/[^\s,]+(,|)/gi);
return tag_count && tag_count.length >= arrayRange[0] && tag_count.length <= arrayRange[1];
}
},
// TODO: Вынести в лок-ию
messages: {
rangetags: "Кол-во тегов должно быть от %s до %s"
}
});
2014-01-13 08:33:20 +02:00
/**
* Стена
*/
2014-07-07 13:50:14 +03:00
$('.js-wall-default').lsWall({
urls: {
add: aRouter.ajax + 'wall/add/',
remove: aRouter.ajax + 'wall/remove/',
load: aRouter.ajax + 'wall/load/',
load_comments: aRouter.ajax + 'wall/load-comments/'
2014-07-07 13:50:14 +03:00
}
});
/**
* Лайтбокс
*/
$('a.js-lbx').colorbox({ width:"100%", height:"100%" });
2014-01-13 08:33:20 +02:00
/**
* Поиск
*/
ls.search.init();
/**
* Fotorama
*/
$( '.fotorama' ).livequery(function() {
$( this ).fotorama();
});
2013-04-09 01:30:54 +03:00
// Хук конца инициализации javascript-составляющих шаблона
ls.hook.run('ls_template_init_end',[],window);
2012-04-22 21:14:29 +03:00
});