Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@hundh/contao-list-bundle

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hundh/contao-list-bundle - npm Package Compare versions

Comparing version 1.0.5 to 1.1.0

97

js/contao-list-bundle.js

@@ -7,2 +7,3 @@ class ListBundle {

ListBundle.initEvents();
ListBundle.initModal();
}

@@ -16,2 +17,89 @@

static initModal() {
// only bootstrap is supported at the moment
if ('undefined' === typeof window.jQuery) {
return;
}
const currentUrl = location.href,
lists = document.querySelectorAll('.huh-list .items[data-open-list-items-in-modal="1"]');
if (lists.length < 1) {
return;
}
// modal event listeners for history changing
document.querySelectorAll('.huh-list .items[data-open-list-items-in-modal="1"]').forEach((list) => {
const modalId = 'modal-' + list.parentNode.getAttribute('id');
window.jQuery('#' + modalId).on('hidden.bs.modal', (e) => {
history.pushState({
modalId: modalId
}, '', currentUrl);
});
});
// catch browser back button
addEventListener('popstate', (e) => {
window.jQuery('#' + e.state.modalId).modal('hide');
});
// modal links
utilsBundle.event.addDynamicEventListener('click', '.huh-list .items[data-open-list-items-in-modal="1"] .item .details.modal-link', function(item, event) {
event.preventDefault();
utilsBundle.ajax.get(item.getAttribute('href'), {}, {
onSuccess: (request) => {
const response = document.createElement('div'),
itemsWrapper = item.closest('.items'),
readerType = itemsWrapper.getAttribute('data-list-modal-reader-type'),
readerCssSelector = itemsWrapper.getAttribute('data-list-modal-reader-css-selector'),
readerModule = itemsWrapper.getAttribute('data-list-modal-reader-module'),
modalId = 'modal-' + itemsWrapper.parentNode.getAttribute('id');
let reader = null;
response.innerHTML = request.response.trim();
switch (readerType) {
case 'huh_reader':
reader = response.querySelector('#huh-reader-' + readerModule);
if (null === reader) {
console.log('Reader not found with selector: #huh-reader-' + readerModule);
return;
}
break;
case 'css_selector':
reader = response.querySelector(readerCssSelector);
if (null === reader) {
console.log('Reader not found with selector: ' + readerCssSelector);
return;
}
break;
}
if (null === reader) {
return;
}
document.getElementById(modalId).querySelector('.modal-content .modal-body').innerHTML = reader.outerHTML;
window.jQuery('#' + modalId).modal('show');
history.pushState({
modalId: modalId
}, '', item.getAttribute('href'));
history.pushState({
modalId: modalId
}, '', item.getAttribute('href'));
}
});
});
}
static initPagination() {

@@ -131,2 +219,11 @@ document.querySelectorAll('.huh-list .ajax-pagination').forEach(function(ajaxPagination) {

list.outerHTML = data.list;
document.dispatchEvent(new CustomEvent('huh.list.list_update_complete', {
detail: {
list: list,
listId: id,
filter: target
},
bubbles: true,
cancelable: true
}));
}

@@ -133,0 +230,0 @@ }

2

package.json
{
"name": "@hundh/contao-list-bundle",
"version": "1.0.5",
"version": "1.1.0",
"description": "This package contains the frontend assets of the composer bundle heimrichhannot/contao-list-bundle.",

@@ -5,0 +5,0 @@ "main": "js/contao-list-bundle.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc