Initial commit
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* Saves accordion open/closed state on toggle. The initial state restoration is
|
||||
* handled by an inline script in the view that runs synchronously before Bootstrap
|
||||
* initializes, preventing any visible flash.
|
||||
*
|
||||
* Key format: pcl_catalog_acc_{collapseId} → "1" (open) or "0" (closed)
|
||||
*/
|
||||
(function () {
|
||||
const PREFIX = 'pcl_catalog_acc_';
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
document.querySelectorAll('.catalog-tree .collapse').forEach(function (el) {
|
||||
el.addEventListener('show.bs.collapse', function () {
|
||||
localStorage.setItem(PREFIX + el.id, '1');
|
||||
});
|
||||
el.addEventListener('hide.bs.collapse', function () {
|
||||
localStorage.setItem(PREFIX + el.id, '0');
|
||||
});
|
||||
});
|
||||
});
|
||||
}());
|
||||
Reference in New Issue
Block a user