Repository URL to install this package:
|
Version:
1.0.3 ▾
|
'use strict';
var dds = dds || {};
dds.backend_node = dds.backend_node || new function () {
this.init = function (Drupal, drupalSettings) {
const button = document.querySelector('.js-trigger-advanced');
const body = document.querySelector('body');
const advanced_sidebar = document.querySelector('.advanced-sidebar');
const footer_region = document.querySelector('.layout-region-node-footer');
const close_advanced = document.querySelector('.advanced-sidebar h3 .close-button');
const sidebar_state = drupalSettings.better_backend.advanced_sidebar.state;
if (advanced_sidebar) {
const style = window.getComputedStyle(footer_region);
const advanced_sidebar_style = window.getComputedStyle(advanced_sidebar);
advanced_sidebar.style.marginBottom = style.height;
if (sidebar_state) {
if (sidebar_state === 'open') {
advanced_sidebar.style.display = null;
body.classList.add('node-additional-settings-visible');
} else {
advanced_sidebar.style.display = "none";
body.classList.remove('node-additional-settings-visible');
}
} else {
// If the secondary sidebar is visible, add class to body
// to push content out from under it.
if (advanced_sidebar_style.display === 'block') {
advanced_sidebar.style.display = null;
body.classList.add('node-additional-settings-visible');
}
}
if (button) {
button.addEventListener('click', function (event) {
if (advanced_sidebar_style.display === 'block') {
advanced_sidebar.style.display = "none";
body.classList.remove('node-additional-settings-visible');
} else {
advanced_sidebar.style.display = null;
body.classList.add('node-additional-settings-visible');
}
event.preventDefault();
return false;
});
}
if (close_advanced) {
close_advanced.addEventListener('click', function (event) {
advanced_sidebar.style.display = "none";
body.classList.remove('node-additional-settings-visible');
});
}
}
};
}();
(function (Drupal, drupalSettings) {
dds.backend_node.init(Drupal, drupalSettings);
})(Drupal, drupalSettings);