prettify main.js
This commit is contained in:
parent
5728b12383
commit
de07384b8e
1 changed files with 30 additions and 15 deletions
|
@ -52,10 +52,14 @@ document.addEventListener('beforeunload', () => {
|
|||
});
|
||||
|
||||
window.addEventListener('hashchange', handleLocationHash);
|
||||
window.addEventListener('load', function onLoad() {
|
||||
window.removeEventListener('load', onLoad, false);
|
||||
handleLocationHash();
|
||||
}, false);
|
||||
window.addEventListener(
|
||||
'load',
|
||||
function onLoad() {
|
||||
window.removeEventListener('load', onLoad, false);
|
||||
handleLocationHash();
|
||||
},
|
||||
false,
|
||||
);
|
||||
|
||||
gl.lazyLoader = new LazyLoader({
|
||||
scrollContainer: window,
|
||||
|
@ -89,9 +93,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||
if (bootstrapBreakpoint === 'xs') {
|
||||
const $rightSidebar = $('aside.right-sidebar, .layout-page');
|
||||
|
||||
$rightSidebar
|
||||
.removeClass('right-sidebar-expanded')
|
||||
.addClass('right-sidebar-collapsed');
|
||||
$rightSidebar.removeClass('right-sidebar-expanded').addClass('right-sidebar-collapsed');
|
||||
}
|
||||
|
||||
// prevent default action for disabled buttons
|
||||
|
@ -108,7 +110,8 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||
addSelectOnFocusBehaviour('.js-select-on-focus');
|
||||
|
||||
$('.remove-row').on('ajax:success', function removeRowAjaxSuccessCallback() {
|
||||
$(this).tooltip('destroy')
|
||||
$(this)
|
||||
.tooltip('destroy')
|
||||
.closest('li')
|
||||
.fadeOut();
|
||||
});
|
||||
|
@ -118,7 +121,9 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||
});
|
||||
|
||||
$('.js-remove-tr').on('ajax:success', function removeTRAjaxSuccessCallback() {
|
||||
$(this).closest('tr').fadeOut();
|
||||
$(this)
|
||||
.closest('tr')
|
||||
.fadeOut();
|
||||
});
|
||||
|
||||
// Initialize select2 selects
|
||||
|
@ -155,7 +160,9 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||
|
||||
// Form submitter
|
||||
$('.trigger-submit').on('change', function triggerSubmitCallback() {
|
||||
$(this).parents('form').submit();
|
||||
$(this)
|
||||
.parents('form')
|
||||
.submit();
|
||||
});
|
||||
|
||||
localTimeAgo($('abbr.timeago, .js-timeago'), true);
|
||||
|
@ -204,9 +211,15 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||
$this.toggleClass('active');
|
||||
|
||||
if ($this.hasClass('active')) {
|
||||
notesHolders.show().find('.hide, .content').show();
|
||||
notesHolders
|
||||
.show()
|
||||
.find('.hide, .content')
|
||||
.show();
|
||||
} else {
|
||||
notesHolders.hide().find('.content').hide();
|
||||
notesHolders
|
||||
.hide()
|
||||
.find('.content')
|
||||
.hide();
|
||||
}
|
||||
|
||||
$(document).trigger('toggle.comments');
|
||||
|
@ -247,9 +260,11 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||
const flashContainer = document.querySelector('.flash-container');
|
||||
|
||||
if (flashContainer && flashContainer.children.length) {
|
||||
flashContainer.querySelectorAll('.flash-alert, .flash-notice, .flash-success').forEach((flashEl) => {
|
||||
removeFlashClickListener(flashEl);
|
||||
});
|
||||
flashContainer
|
||||
.querySelectorAll('.flash-alert, .flash-notice, .flash-success')
|
||||
.forEach(flashEl => {
|
||||
removeFlashClickListener(flashEl);
|
||||
});
|
||||
}
|
||||
|
||||
initDispatcher();
|
||||
|
|
Loading…
Reference in a new issue