@dreher-media/dm-js-lib 0.4.2 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,165 +1,283 @@
1
1
  # @dreher-media/dm-js-lib
2
2
 
3
- Centralized JavaScript library for Dreher.Media websites with CDN delivery.
3
+ A comprehensive JavaScript library for modern websites. Add powerful functionality to your site with simple HTML attributes - no JavaScript knowledge required!
4
4
 
5
- ## Installation
5
+ ## Quick Start
6
6
 
7
- ```bash
8
- npm install
7
+ Add this script tag to your HTML (before the closing `</body>` tag):
8
+
9
+ ```html
10
+ <script src="https://cdn.jsdelivr.net/npm/@dreher-media/dm-js-lib@latest/dist/dm-js-lib.min.js"></script>
9
11
  ```
10
12
 
11
- ## Development
13
+ That's it! All modules are now available on your page. No configuration needed.
14
+
15
+ ## What This Library Does
16
+
17
+ This library provides 5 built-in modules that add common website functionality. Simply add HTML attributes to your elements, and the library handles the rest automatically.
18
+
19
+ Additionally, there are standalone modules available that can be loaded separately when needed.
20
+
21
+ ## Built-in Modules
12
22
 
13
- ### Build
23
+ ### 🛠️ Utilities
24
+ **A collection of four small utility functions**
14
25
 
15
- ```bash
16
- npm run build
26
+ Combines four simple utilities that work automatically:
27
+ - **Active Link** - Automatically highlights active navigation links
28
+ - **File Download** - Enables file downloads from any element
29
+ - **Separators** - Automatically inserts separators between elements
30
+ - **Webflow Init** - Webflow-specific initialization (copyright year)
31
+
32
+ **Perfect for:** Common website tasks that need minimal setup
33
+
34
+ **Examples:**
35
+ ```html
36
+ <!-- Active Link (automatic) -->
37
+ <nav>
38
+ <a href="/">Home</a>
39
+ <a href="/about">About</a>
40
+ </nav>
41
+
42
+ <!-- File Download -->
43
+ <button data-download-href="/files/document.pdf">Download</button>
44
+
45
+ <!-- Separators -->
46
+ <div data-separator=", ">
47
+ <span>Tag 1</span>
48
+ <span>Tag 2</span>
49
+ </div>
50
+
51
+ <!-- Webflow Copyright Year -->
52
+ <p>&copy; <span class="copyright-year">2024</span> Company</p>
17
53
  ```
18
54
 
19
- This will compile TypeScript and create `dist/dm-js-lib.min.js`.
55
+ [📖 Full Documentation →](./src/modules/utilities/README.md)
56
+
57
+ ---
20
58
 
21
- ### Format Code
59
+ ### 🍪 Cookie Consent
60
+ **Shows or hides content based on cookie preferences**
22
61
 
23
- ```bash
24
- npm run format
62
+ Integrates with Finsweet Cookie Consent to automatically show/hide content based on user consent choices. Perfect for GDPR compliance.
63
+
64
+ **Perfect for:** Analytics scripts, marketing embeds, tracking pixels
65
+
66
+ **Example:**
67
+ ```html
68
+ <div fs-cc="analytics">
69
+ <!-- Shown when analytics consent is given -->
70
+ <script>/* Google Analytics */</script>
71
+ </div>
25
72
  ```
26
73
 
27
- Check formatting:
74
+ [📖 Full Documentation →](./src/modules/cookieConsent/README.md)
28
75
 
29
- ```bash
30
- npm run format:check
76
+ ---
77
+
78
+ ### 🌍 Language
79
+ **Multi-language content switching**
80
+
81
+ Create multi-language pages with automatic browser language detection. Users can switch languages, and their preference is remembered.
82
+
83
+ **Perfect for:** International websites, bilingual content, localized pages
84
+
85
+ **Example:**
86
+ ```html
87
+ <button data-lang-link="en">English</button>
88
+ <button data-lang-link="de">Deutsch</button>
89
+
90
+ <div data-lang-content="en">English content</div>
91
+ <div data-lang-content="de">Deutsche Inhalte</div>
31
92
  ```
32
93
 
33
- ## Release Workflow
94
+ [📖 Full Documentation →](./src/modules/lang/README.md)
95
+
96
+ ---
34
97
 
35
- ### Standard Release
98
+ ### 📑 Tabs
99
+ **Interactive tab interfaces**
36
100
 
37
- ```bash
38
- npm run release:patch # 1.0.0 -> 1.0.1 (builds, versions, publishes, and pushes tags)
39
- npm run release:minor # 1.0.0 -> 1.1.0 (builds, versions, publishes, and pushes tags)
40
- npm run release:major # 1.0.0 -> 2.0.0 (builds, versions, publishes, and pushes tags)
101
+ Create tabbed content sections with support for multiple tab groups, URL control, and automatic activation.
102
+
103
+ **Perfect for:** Product details, FAQ sections, feature comparisons, content organization
104
+
105
+ **Example:**
106
+ ```html
107
+ <div class="tabs">
108
+ <button class="tab-link" data-tab-target="tab1">Tab 1</button>
109
+ <button class="tab-link" data-tab-target="tab2">Tab 2</button>
110
+ </div>
111
+
112
+ <div data-tab-content="tab1">Content 1</div>
113
+ <div data-tab-content="tab2">Content 2</div>
41
114
  ```
42
115
 
43
- The release script will:
116
+ [📖 Full Documentation →](./src/modules/tabs/README.md)
44
117
 
45
- 1. Update the version in `package.json`
46
- 2. Create a git commit with the version change
47
- 3. **Create a git tag** (e.g., `v1.2.3`) - automatically done by `npm version`
48
- 4. Build the project (via `prepublishOnly` hook)
49
- 5. Publish to npm
50
- 6. Push commits and tags to remote
118
+ ---
51
119
 
52
- ### Patching an Old Version
120
+ ### 🎥 Video Players
121
+ **Unified video player management**
53
122
 
54
- To create a patch for an older version (e.g., patch v1.2.0 while main is at v1.5.0):
123
+ Supports YouTube, Vimeo, Dailymotion, and HTML5 videos (Plyr). Automatically pauses other videos when one plays. Integrates with Swiper carousels. **Also automatically upgrades YouTube thumbnail quality** for crisp, clear thumbnails.
55
124
 
56
- ```bash
57
- # 1. Checkout the old version tag
58
- git checkout v1.2.0
125
+ **Perfect for:** Video galleries, product demos, tutorial pages, media libraries
126
+
127
+ **Example:**
128
+ ```html
129
+ <div class="youtube"
130
+ data-type="youtube"
131
+ data-video-id="dQw4w9WgXcQ"
132
+ data-id="player1">
133
+ <img src="thumbnail.jpg" alt="Video">
134
+ </div>
135
+ ```
59
136
 
60
- # 2. Create a branch for the patch
61
- git checkout -b patch-1.2.1
137
+ YouTube thumbnails are automatically upgraded to the highest available quality - no setup needed!
62
138
 
63
- # 3. Make your fixes, then release
64
- npm version patch
65
- npm publish
66
- git push origin patch-1.2.1 --follow-tags
139
+ [📖 Full Documentation →](./src/modules/videoPlayers/README.md)
67
140
 
68
- # 4. Switch back to main
69
- git checkout main
141
+
142
+ ---
143
+
144
+ ## Standalone Modules
145
+
146
+ These modules are not included in the main bundle and must be loaded separately when needed. They're perfect for when you only need specific functionality.
147
+
148
+ ### 🔍 Filter
149
+ **Powerful filtering system for lists and collections**
150
+
151
+ Create advanced filter interfaces with checkboxes, search boxes, dropdowns, and more. Supports multiple filter types, URL persistence, and localStorage.
152
+
153
+ **Perfect for:** Product catalogs, portfolio galleries, blog archives, directory listings
154
+
155
+ **Installation:**
156
+ ```html
157
+ <script src="https://cdn.jsdelivr.net/npm/@dreher-media/dm-js-lib@latest/dist/standalone/filter.min.js"></script>
70
158
  ```
71
159
 
72
- See `RELEASE_WORKFLOW.md` for detailed workflow documentation.
160
+ The filter module auto-initializes on page load. Manual initialization is optional (useful for dynamic content):
161
+
162
+ ```html
163
+ <script>
164
+ // Optional: Manually initialize if needed
165
+ Filter.initFilter();
166
+ </script>
167
+ ```
168
+
169
+ **Example:**
170
+ ```html
171
+ <!-- Filter controls -->
172
+ <input type="checkbox" data-filter-field="category" value="design"> Design
173
+ <input type="text" data-filter-field="search" placeholder="Search...">
174
+
175
+ <!-- Filterable list -->
176
+ <ul data-filter-list>
177
+ <li data-filter-value="design">Design Project</li>
178
+ <li data-filter-value="development">Dev Project</li>
179
+ </ul>
180
+ ```
73
181
 
74
- ## CDN Usage
182
+ [📖 Full Documentation →](./src/standalone/filter/README.md)
75
183
 
76
- jsDelivr automatically serves from npm with full semantic versioning support:
184
+ ---
77
185
 
78
- ### Pinned Version (Frozen)
186
+ ### 🔄 Preview Detail Switcher
187
+ **Switch between preview and detail views**
79
188
 
189
+ Create interactive interfaces where clicking preview elements shows corresponding detail views. Only one detail view is visible at a time.
190
+
191
+ **Perfect for:** Product galleries, portfolio showcases, content switchers
192
+
193
+ **Installation:**
80
194
  ```html
81
- <script src="https://cdn.jsdelivr.net/npm/@dreher-media/dm-js-lib@1.2.3/dist/dm-js-lib.min.js"></script>
195
+ <script src="https://cdn.jsdelivr.net/npm/@dreher-media/dm-js-lib@latest/dist/standalone/previewDetailSwitcher.min.js"></script>
196
+ <script>
197
+ // Initialize
198
+ PreviewDetailSwitcher.initPreviewDetailSwitcher({
199
+ container: '.my-container'
200
+ });
201
+ </script>
82
202
  ```
83
203
 
84
- ### Patch-Only Auto-Update
204
+ **Example:**
205
+ ```html
206
+ <div class="gallery">
207
+ <button data-preview-id="item1">Preview 1</button>
208
+ <button data-preview-id="item2">Preview 2</button>
209
+
210
+ <div data-detail-item data-detail-id="item1">Detail 1</div>
211
+ <div data-detail-item data-detail-id="item2">Detail 2</div>
212
+ </div>
213
+ ```
214
+
215
+ [📖 Full Documentation →](./src/standalone/previewDetailSwitcher/README.md)
216
+
217
+ ---
218
+
219
+ ## CDN Installation
220
+
221
+ ### Recommended: Auto-update on patches
85
222
 
86
223
  ```html
87
224
  <script src="https://cdn.jsdelivr.net/npm/@dreher-media/dm-js-lib@1.2.x/dist/dm-js-lib.min.js"></script>
88
225
  ```
89
226
 
90
- Automatically updates only on patch versions (e.g., `1.2.0 1.2.1`), never on minor or major versions.
227
+ Automatically receives bug fixes and patches, but won't break on major updates.
91
228
 
92
- ### Version Range
229
+ ### Pin to specific version
93
230
 
94
231
  ```html
95
- <script src="https://cdn.jsdelivr.net/npm/@dreher-media/dm-js-lib@^1.2.0/dist/dm-js-lib.min.js"></script>
232
+ <script src="https://cdn.jsdelivr.net/npm/@dreher-media/dm-js-lib@1.2.3/dist/dm-js-lib.min.js"></script>
96
233
  ```
97
234
 
98
- Updates to any compatible version (patches and minor versions, but not major).
235
+ Frozen at this version - no automatic updates.
99
236
 
100
- ### Latest (Staging)
237
+ ### Always latest
101
238
 
102
239
  ```html
103
240
  <script src="https://cdn.jsdelivr.net/npm/@dreher-media/dm-js-lib@latest/dist/dm-js-lib.min.js"></script>
104
241
  ```
105
242
 
106
- Always points to the newest published version.
243
+ Always uses the newest version (use with caution in production).
107
244
 
108
- ## Versioning Strategy
245
+ ## How It Works
109
246
 
110
- - All versions follow **semantic versioning (semver)**
111
- - Published versions are **immutable** - once published to npm, never changed
112
- - Version ranges (`@1.2.x`, `@^1.2.0`) automatically resolve to compatible versions
113
- - `@latest` always points to the newest published version
114
- - Multiple minor version lines can receive security patches independently
247
+ 1. **Add the script** - Include the library via CDN
248
+ 2. **Add attributes** - Use data attributes on your HTML elements
249
+ 3. **It works!** - The library automatically initializes everything
115
250
 
116
- ## Project Structure
117
-
118
- ```
119
- dm-js-lib/
120
- src/
121
- types/
122
- global.d.ts
123
- modules/
124
- [module files]
125
- index.ts
126
- dist/
127
- dm-js-lib.min.js
128
- package.json
129
- tsconfig.json
130
- rollup.config.mjs
131
- ```
251
+ No JavaScript coding required. Everything works through HTML attributes.
132
252
 
133
- ## Dependencies
253
+ ## Browser Support
134
254
 
135
- - **rollup** - Build tool
136
- - **@rollup/plugin-typescript** - TypeScript support
137
- - **rollup-plugin-terser** - Minification
138
- - **typescript** - TypeScript compiler
139
- - **prettier** - Code formatter
255
+ Works in all modern browsers:
256
+ - Chrome (latest)
257
+ - Firefox (latest)
258
+ - Safari (latest)
259
+ - Edge (latest)
140
260
 
141
- ## Publishing to npm
261
+ ## Requirements
142
262
 
143
- Before publishing, ensure you have:
263
+ Most modules work standalone. Some modules have optional dependencies:
144
264
 
145
- 1. An npm account
146
- 2. Access to the `@dreher-media` organization (or change the package name)
147
- 3. Logged in: `npm login`
265
+ - **Cookie Consent** - Requires [Finsweet Cookie Consent](https://www.finsweet.com/cookie-consent)
266
+ - **Video Players** - Automatically loads required APIs (YouTube, Vimeo, etc.)
267
+ - **Webflow Init** - Requires Webflow to be loaded
148
268
 
149
- Then use the release scripts which handle building and publishing automatically.
269
+ ## Getting Help
150
270
 
151
- ## External Dependencies (Runtime)
271
+ Each module has detailed documentation with examples. Click on any module name above to see:
272
+ - Complete usage examples
273
+ - All available options
274
+ - Styling tips
275
+ - Common use cases
152
276
 
153
- The library integrates with these external services (loaded separately):
277
+ ## For Developers
154
278
 
155
- - **FsCC (Finsweet Cookie Consent)** - Cookie consent management
156
- - **Webflow** - Webflow CMS and interactions
157
- - **Plyr** - Video player library
158
- - **YouTube IFrame API** - YouTube player
159
- - **Vimeo Player API** - Vimeo player
160
- - **Dailymotion Player Library** - Dailymotion player
161
- - **Swiper** - Carousel/slider library (optional, for video swipers)
279
+ If you're contributing to this library or need technical details about the codebase, architecture, build system, or release process, see the [Developer Documentation](./src/README.md).
162
280
 
163
281
  ## License
164
282
 
165
- MIT
283
+ MIT License - Use freely in personal and commercial projects.
@@ -1,2 +1,2 @@
1
- /*! dm-js-lib v0.4.2 */
2
- !function(){"use strict";function t(t){const e=t.dataset.langLink;if(e)return e;const a=t.textContent?.trim().toLowerCase();return a||null}function e(e){sessionStorage.setItem("selected_lang",e),document.querySelectorAll("[data-lang-content]").forEach(t=>{const a=t;a.dataset.langContent===e?(a.style.display="",a.classList.add("lang-active")):(a.style.display="none",a.classList.remove("lang-active"))}),document.querySelectorAll(`.biography-text:not([data-lang-content]):not(.${e})`).forEach(t=>{t.style.display="none"}),document.querySelectorAll(`.biography-text:not([data-lang-content]).${e}`).forEach(t=>{t.style.display="block"}),document.querySelectorAll("[data-lang-link]").forEach(a=>{const n=a;t(n)===e?n.classList.add("active"):n.classList.remove("active")}),document.querySelectorAll(`.biography-lang-links .tab-link[data-lang]:not([data-lang-link]):not([data-lang="${e}"])`).forEach(t=>{t.classList.remove("active")}),document.querySelectorAll(`.biography-lang-links .tab-link[data-lang]:not([data-lang-link])[data-lang="${e}"]`).forEach(t=>{t.classList.add("active")})}function a(t){const e=t.match(/^([a-z]{2})(?:-|$)/i);return e?e[1].toLowerCase():null}function n(t){if(document.querySelector(`[data-lang-link="${t}"]`))return!0;if(document.querySelector(`[data-lang-content="${t}"]`))return!0;if(document.querySelector(`.biography-lang-links .tab-link[data-lang]:not([data-lang-link])[data-lang="${t}"]`))return!0;return!!document.querySelector(`.biography-text.${t}`)}function o(){let t=sessionStorage.getItem("selected_lang");if(!t){const e=function(){if(navigator.languages&&navigator.languages.length>0)for(const t of navigator.languages){const e=a(t);if(e)return e}return navigator.language?a(navigator.language):null}();if(e&&n(e))t=e;else{if(!n("en"))return;t="en"}}if(t){const a=document.querySelector(`[data-lang-link="${t}"]`);if(a)return void a.click();const n=document.querySelector(`.biography-lang-links .tab-link[data-lang]:not([data-lang-link])[data-lang="${t}"]`);if(n)return void n.click();e(t)}}function r(t,e="script"){return new Promise((a,n)=>{const o="script"===e?`script[src="${t}"]`:`link[rel="stylesheet"][href="${t}"]`;if(document.querySelector(o))a();else if("script"===e){const e=document.createElement("script");e.src=t,e.async=!0,e.onload=()=>a(),e.onerror=()=>n(new Error(`Failed to load script: ${t}`)),document.head.appendChild(e)}else if("stylesheet"===e){const e=document.createElement("link");e.rel="stylesheet",e.href=t,e.onload=()=>a(),e.onerror=()=>n(new Error(`Failed to load stylesheet: ${t}`)),document.head.appendChild(e)}else n(new Error(`Unsupported resource type: ${e}`))})}function l(t){return r(t,"script")}"undefined"!=typeof window&&void 0===window.videoSwipers&&(window.videoSwipers=[]);const i=()=>"undefined"!=typeof window?window.videoSwipers:void 0;function d(t){const e=document.querySelectorAll(".youtube");return Array.from(e).some(e=>e.dataset.type===t)}!function(){let t=!1;const e=()=>{window.FsCC?(t||(window.FsCC.consentController.on("updateconsents",()=>{e()}),t=!0),document.querySelectorAll("[fs-cc-reject]").forEach(t=>{const e=t.getAttribute("fs-cc-reject");if(!e)return;const a=window.FsCC?.store.consents[e]??!1,n=document.querySelector(`[fs-cc="${e}"]`);a?(t.style.display="none",n&&(n.style.display="block")):(t.style.display="block",n&&(n.style.display="none"))})):setTimeout(e,200)};document.addEventListener("DOMContentLoaded",e)}(),void 0!==window.Webflow&&window.Webflow.push(()=>{document.querySelectorAll(".copyright-year").forEach(t=>{t.textContent=(new Date).getFullYear().toString()})}),function(){const t=t=>{const e=(t||"").replace(/\/+$/,"").replace(/\.html?$/i,"");return""===e?"/":e};window.addEventListener("load",()=>{const e=t(window.location.pathname);document.querySelectorAll("a[href]").forEach(a=>{const n=a.getAttribute("href");if(!n)return;if(n.startsWith("#")||n.toLowerCase().startsWith("javascript:"))return;let o;try{o=new URL(n,window.location.href)}catch{return}if(o.origin!==window.location.origin)return;t(o.pathname)===e&&a.classList.add("w--current")})})}(),document.addEventListener("DOMContentLoaded",()=>{document.querySelectorAll("[data-separator]").forEach(t=>{const e=t.getAttribute("data-separator");if(!e)return;const a=Array.from(t.children);a.forEach((t,n)=>{if(n<a.length-1){const a=document.createElement("span");a.innerHTML=`&nbsp;${e}&nbsp;`,t.insertAdjacentElement("afterend",a)}})})}),document.addEventListener("DOMContentLoaded",()=>{const t=t=>{const e=t.dataset.tabTarget;if(e)return e;const a=t.dataset.tabLink;if(a)return a;const n=t.getAttribute("href");return n?.startsWith("#")?n.slice(1):null},e=t=>Array.from(document.querySelectorAll(`[data-tab-content="${t}"]`)),a=e=>{const a=[];return document.querySelectorAll(`.tab-link[data-tab-group="${e}"]:not([data-lang-link]):not([data-lang]), [data-tab-link][data-tab-group="${e}"]`).forEach(e=>{const n=t(e);n&&a.push(n)}),a},n=e=>{const a=[];return e.querySelectorAll(".tab-link:not([data-lang-link]):not([data-lang]), [data-tab-link]").forEach(e=>{const n=t(e);n&&a.push(n)}),a},o=o=>{const r=o.dataset.tabGroup,l=t(o),i=l?e(l):[];if(r)document.querySelectorAll(`.tab-link[data-tab-group="${r}"]:not([data-lang-link]):not([data-lang]), [data-tab-link][data-tab-group="${r}"]`).forEach(t=>{t.classList.remove("active")}),a(r).forEach(t=>{e(t).forEach(t=>{t.style.display="none",t.classList.remove("active")})});else{const t=o.parentNode;t&&(t.querySelectorAll(".tab-link:not([data-lang-link]):not([data-lang]), [data-tab-link]").forEach(t=>{t.classList.remove("active")}),n(t).forEach(t=>{e(t).forEach(t=>{t.style.display="none",t.classList.remove("active")})}))}o.classList.add("active"),i.forEach(t=>{t.style.display="block",t.classList.add("active")})},r=new URLSearchParams(window.location.search),l=r.get("tab"),i=r.get("tabGroup");if(l){let n=null;i?(document.querySelectorAll(`.tab-link[data-tab-group="${i}"]:not([data-lang-link]):not([data-lang]), [data-tab-link][data-tab-group="${i}"]`).forEach(e=>{t(e)===l&&(n=e)}),document.querySelectorAll(`.tab-link[data-tab-group="${i}"]:not([data-lang-link]):not([data-lang]), [data-tab-link][data-tab-group="${i}"]`).forEach(t=>{t.classList.remove("active")}),a(i).forEach(t=>{e(t).forEach(t=>{t.style.display="none",t.classList.remove("active")})})):document.querySelectorAll(".tab-link:not([data-lang-link]):not([data-lang]), [data-tab-link]").forEach(e=>{t(e)===l&&(n=e)}),n&&o(n)}if(document.querySelectorAll(".tab-link:not([data-lang-link]):not([data-lang]), [data-tab-link]").forEach(t=>{t.addEventListener("click",t=>{t.preventDefault();const e=t.currentTarget;o(e)})}),l||document.querySelectorAll(".tab-link.active:not([data-lang-link]):not([data-lang]), [data-tab-link].active").forEach(o=>{const r=o,l=r.dataset.tabGroup,i=t(r),d=i?e(i):[];if(d.length>0){if(l)a(l).forEach(t=>{e(t).forEach(t=>{d.includes(t)||(t.style.display="none",t.classList.remove("active"))})});else{const t=r.parentNode;t&&n(t).forEach(t=>{e(t).forEach(t=>{d.includes(t)||(t.style.display="none",t.classList.remove("active"))})})}d.forEach(t=>{t.style.display="block",t.classList.add("active")})}}),!l){const t=new Set;document.querySelectorAll(".tab-link[data-tab-first-active]:not([data-lang-link]):not([data-lang]), [data-tab-link][data-tab-first-active]").forEach(e=>{const a=e,n=a.dataset.tabGroup;if(!(i&&n===i||a.classList.contains("active")))if(n){if(t.has(n))return;if(null!==document.querySelector(`.tab-link.active[data-tab-group="${n}"]:not([data-lang-link]):not([data-lang]), [data-tab-link].active[data-tab-group="${n}"]`))return void t.add(n);t.add(n);const e=document.querySelector(`.tab-link[data-tab-group="${n}"]:not([data-lang-link]):not([data-lang]), [data-tab-link][data-tab-group="${n}"]`);e&&o(e)}else{const t=a.parentNode;t&&null!==t.querySelector(".tab-link.active:not([data-lang-link]):not([data-lang]), [data-tab-link].active")||o(a)}}),document.querySelectorAll("[data-tab-first-active][data-tab-group]").forEach(e=>{const a=e.dataset.tabGroup;if(!a)return;if(i&&a===i)return;if(t.has(a))return;if(null!==document.querySelector(`.tab-link.active[data-tab-group="${a}"]:not([data-lang-link]):not([data-lang]), [data-tab-link].active[data-tab-group="${a}"]`))return void t.add(a);t.add(a);const n=document.querySelector(`.tab-link[data-tab-group="${a}"]:not([data-lang-link]):not([data-lang]), [data-tab-link][data-tab-group="${a}"]`);n&&o(n)})}}),document.addEventListener("DOMContentLoaded",()=>{document.querySelectorAll("[data-lang-link]").forEach(a=>{a.addEventListener("click",a=>{a.preventDefault();const n=t(a.currentTarget);n&&e(n)})}),document.querySelectorAll(".biography-lang-links .tab-link[data-lang]:not([data-lang-link])[data-lang]").forEach(t=>{t.addEventListener("click",t=>{t.preventDefault();const a=t.currentTarget,n=a.dataset?.lang;n&&e(n)})}),o()}),"interactive"!==document.readyState&&"complete"!==document.readyState||o(),document.addEventListener("DOMContentLoaded",()=>{let t=[];const e=document.querySelectorAll(".youtube"),a={};let n=!1;const o=document.querySelectorAll("._init-plyr").length>0,c=d("youtube"),s=d("vimeo"),u=d("dailymotion"),y=()=>{void 0!==window.Plyr&&(t=window.Plyr.setup("._init-plyr"),t.forEach(t=>{t.on("play",()=>{p();const t=i();t&&t.forEach(t=>{t.autoplay.stop()})}),t.on("pause",()=>{const t=i();t&&t.forEach(t=>{t.autoplay.start()})})}))},p=(e=null)=>{t.forEach(t=>{t.pause()});for(const[t,n]of Object.entries(a))e!==t&&("youtube"===n.type?n.player.pauseVideo():("vimeo"===n.type||"dailymotion"===n.type)&&n.player.pause())},f=t=>{p(t);const e=i();e&&e.forEach(t=>{t.autoplay.stop()})},g=t=>{const e=i();e&&e.forEach(t=>{t.autoplay.start()})},m=()=>{n||(n=!0,e.forEach(t=>{t.addEventListener("click",()=>{const e=t.querySelector("[data-custom-embed]");e&&(t.innerHTML=e.innerHTML);const n=t,o=`player_${n.dataset.id}`,r=n.dataset.type,l=n.dataset.videoId,i=parseInt(n.dataset.time||"0",10);if(l&&r)if(f(o),"youtube"===r&&window.YT){const t=new window.YT.Player(o,{videoId:l,playerVars:{start:i},events:{onReady:t=>{t.target.playVideo()},onStateChange:t=>{t.data===window.YT.PlayerState.PLAYING?f(o):t.data!==window.YT.PlayerState.PAUSED&&t.data!==window.YT.PlayerState.ENDED||g()}}});a[o]={type:r,player:t}}else if("vimeo"===r&&window.Vimeo){const t=document.getElementById(o);t&&(t.innerHTML="");const e=new window.Vimeo.Player(o,{id:l,autoplay:!0,start:i});e.on("play",()=>f(o)),e.on("pause",()=>g()),a[o]={type:r,player:e}}else"dailymotion"===r&&window.dailymotion&&window.dailymotion.createPlayer(o,{video:l,params:{autoplay:1,start:i,mute:!1}}).then(t=>{t.on("play",()=>f(o)),t.on("pause",()=>g()),t.on("ended",()=>g()),a[o]={type:"dailymotion",player:t}}).catch(t=>{console.error("Error initializing Dailymotion player:",t)})})}))};c&&(window.onYouTubeIframeAPIReady=()=>{m()});const h=[];var w;o&&h.push(window.Plyr&&"function"==typeof window.Plyr.setup?Promise.resolve():Promise.all([(w="https://cdn.plyr.io/3.7.8/plyr.css",r(w,"stylesheet")),l("https://cdn.plyr.io/3.7.8/plyr.polyfilled.js")]).then(()=>{}).catch(t=>{throw console.error("Failed to load Plyr resources:",t),t})),c&&h.push(window.YT&&"function"==typeof window.YT.Player?Promise.resolve():l("https://www.youtube.com/iframe_api").catch(t=>{console.error("Failed to load YouTube API:",t)})),s&&h.push(window.Vimeo&&"function"==typeof window.Vimeo.Player?Promise.resolve():l("https://player.vimeo.com/api/player.js").catch(t=>{console.error("Failed to load Vimeo API:",t)})),u&&h.push(window.dailymotion&&"function"==typeof window.dailymotion.createPlayer?Promise.resolve():l("https://api.dmcdn.net/all.js").catch(t=>{console.error("Failed to load Dailymotion API:",t)})),h.length>0?Promise.all(h).then(()=>{o&&y(),c?setTimeout(()=>{n||m()},1e3):setTimeout(()=>{m()},100)}).catch(t=>{console.error("Error loading video player APIs:",t),o&&void 0!==window.Plyr&&y(),setTimeout(()=>{m()},500)}):(o&&void 0!==window.Plyr&&y(),m());const b=i();b&&b.forEach(t=>{t.on("slideChange",()=>{p()})})}),document.addEventListener("DOMContentLoaded",()=>{const t=["maxresdefault","sddefault","hqdefault","mqdefault","default"],e=(a,n=0)=>{if(a.naturalWidth>120)return;if(n>=t.length)return;const o=t[n],r=a.src,l=new Image;l.onload=()=>{l.naturalWidth>120?a.src=l.src:e(a,n+1)},l.onerror=()=>{e(a,n+1)},l.src=r.replace(/maxresdefault/,o)};document.querySelectorAll(".youtube img").forEach(t=>{e(t)})}),document.addEventListener("DOMContentLoaded",()=>{document.querySelectorAll("[data-download-href]").forEach(t=>{t.addEventListener("click",e=>{e.preventDefault(),e.stopPropagation();const a=t.getAttribute("data-download-href"),n=t.getAttribute("data-download-filename");a&&((t,e)=>{const a=document.createElement("a");a.href=t,a.download=e||t.split("/").pop()||"download",document.body.appendChild(a),a.click(),document.body.removeChild(a)})(a,n)})})})}();
1
+ /*! dm-js-lib v0.5.0 */
2
+ !function(){"use strict";function t(){document.addEventListener("DOMContentLoaded",()=>{document.querySelectorAll("[data-download-href]").forEach(t=>{t.addEventListener("click",e=>{e.preventDefault(),e.stopPropagation();const a=t.getAttribute("data-download-href"),n=t.getAttribute("data-download-filename");a&&((t,e)=>{const a=document.createElement("a");a.href=t,a.download=e||t.split("/").pop()||"download",document.body.appendChild(a),a.click(),document.body.removeChild(a)})(a,n)})})})}function e(t){const e=t.dataset.tabTarget;if(e)return e;const a=t.dataset.tabLink;if(a)return a;const n=t.getAttribute("href");return n?.startsWith("#")?n.slice(1):null}function a(t){return Array.from(document.querySelectorAll(`[data-tab-content="${t}"]`))}function n(t){const a=[];return document.querySelectorAll(`.tab-link[data-tab-group="${t}"]:not([data-lang-link]):not([data-lang]), [data-tab-link][data-tab-group="${t}"]`).forEach(t=>{const n=e(t);n&&a.push(n)}),a}function o(t){const a=[];return t.querySelectorAll(".tab-link:not([data-lang-link]):not([data-lang]), [data-tab-link]").forEach(t=>{const n=e(t);n&&a.push(n)}),a}function l(t){const l=t.dataset.tabGroup,r=e(t),i=r?a(r):[];if(l){document.querySelectorAll(`.tab-link[data-tab-group="${l}"]:not([data-lang-link]):not([data-lang]), [data-tab-link][data-tab-group="${l}"]`).forEach(t=>{t.classList.remove("active")}),document.querySelectorAll(`[data-tab-content][data-tab-group="${l}"]`).forEach(t=>{t.style.display="none",t.classList.remove("active")});n(l).forEach(t=>{a(t).forEach(t=>{t.style.display="none",t.classList.remove("active")})})}else{const e=t.parentNode;if(e){e.querySelectorAll(".tab-link:not([data-lang-link]):not([data-lang]), [data-tab-link]").forEach(t=>{t.classList.remove("active")});o(e).forEach(t=>{a(t).forEach(t=>{t.style.display="none",t.classList.remove("active")})})}}t.classList.add("active"),i.forEach(t=>{t.style.display="block",t.classList.add("active")})}function r(t){const e=t.dataset.langLink;if(e)return e;const a=t.textContent?.trim().toLowerCase();return a||null}function i(t){const e=t.match(/^([a-z]{2})(?:-|$)/i);return e?e[1].toLowerCase():null}function c(t){if(document.querySelector(`[data-lang-link="${t}"]`))return!0;if(document.querySelector(`[data-lang-content="${t}"]`))return!0;if(document.querySelector(`.biography-lang-links .tab-link[data-lang]:not([data-lang-link])[data-lang="${t}"]`))return!0;return!!document.querySelector(`.biography-text.${t}`)}function d(t){sessionStorage.setItem("selected_lang",t),document.querySelectorAll("[data-lang-content]").forEach(e=>{const a=e;a.dataset.langContent===t?(a.style.display="",a.classList.add("lang-active")):(a.style.display="none",a.classList.remove("lang-active"))}),document.querySelectorAll(`.biography-text:not([data-lang-content]):not(.${t})`).forEach(t=>{t.style.display="none"}),document.querySelectorAll(`.biography-text:not([data-lang-content]).${t}`).forEach(t=>{t.style.display="block"}),document.querySelectorAll("[data-lang-link]").forEach(e=>{const a=e;r(a)===t?a.classList.add("active"):a.classList.remove("active")}),document.querySelectorAll(`.biography-lang-links .tab-link[data-lang]:not([data-lang-link]):not([data-lang="${t}"])`).forEach(t=>{t.classList.remove("active")}),document.querySelectorAll(`.biography-lang-links .tab-link[data-lang]:not([data-lang-link])[data-lang="${t}"]`).forEach(t=>{t.classList.add("active")})}function s(){let t=sessionStorage.getItem("selected_lang");if(!t){const e=function(){if(navigator.languages&&navigator.languages.length>0)for(const t of navigator.languages){const e=i(t);if(e)return e}return navigator.language?i(navigator.language):null}();if(e&&c(e))t=e;else{if(!c("en"))return;t="en"}}if(t){const e=document.querySelector(`[data-lang-link="${t}"]`);if(e)return void e.click();const a=document.querySelector(`.biography-lang-links .tab-link[data-lang]:not([data-lang-link])[data-lang="${t}"]`);if(a)return void a.click();d(t)}}function u(t,e="script"){return new Promise((a,n)=>{const o="script"===e?`script[src="${t}"]`:`link[rel="stylesheet"][href="${t}"]`;if(document.querySelector(o))a();else if("script"===e){const e=document.createElement("script");e.src=t,e.async=!0,e.onload=()=>a(),e.onerror=()=>n(new Error(`Failed to load script: ${t}`)),document.head.appendChild(e)}else if("stylesheet"===e){const e=document.createElement("link");e.rel="stylesheet",e.href=t,e.onload=()=>a(),e.onerror=()=>n(new Error(`Failed to load stylesheet: ${t}`)),document.head.appendChild(e)}else n(new Error(`Unsupported resource type: ${e}`))})}function y(t){return u(t,"script")}function f(t){const e=document.querySelectorAll(".youtube");return Array.from(e).some(e=>e.dataset.type===t)}"undefined"!=typeof window&&void 0===window.videoSwipers&&(window.videoSwipers=[]);const p=()=>"undefined"!=typeof window?window.videoSwipers:void 0;function g(t){if(void 0!==window.Plyr){const e=window.Plyr.setup("._init-plyr");t.push(...e),e.forEach(e=>{e.on("play",()=>{m(null,t,{});const e=p();e&&e.forEach(t=>{t.autoplay.stop()})}),e.on("pause",()=>{const t=p();t&&t.forEach(t=>{t.autoplay.start()})})})}}function m(t=null,e,a){e.forEach(t=>{t.pause()});for(const[e,n]of Object.entries(a))if(t!==e)if("youtube"===n.type){n.player.pauseVideo()}else if("vimeo"===n.type){n.player.pause()}else if("dailymotion"===n.type){n.player.pause()}}function h(t,e,a){m(t,e,a);const n=p();n&&n.forEach(t=>{t.autoplay.stop()})}function w(t){const e=p();e&&e.forEach(t=>{t.autoplay.start()})}!function(){let t=!1;const e=()=>{window.FsCC?(t||(window.FsCC.consentController.on("updateconsents",()=>{e()}),t=!0),document.querySelectorAll("[fs-cc-reject]").forEach(t=>{const e=t.getAttribute("fs-cc-reject");if(!e)return;const a=window.FsCC?.store.consents[e]??!1,n=document.querySelector(`[fs-cc="${e}"]`);a?(t.style.display="none",n&&(n.style.display="block")):(t.style.display="block",n&&(n.style.display="none"))})):setTimeout(e,200)};document.addEventListener("DOMContentLoaded",e)}(),function(){const t=t=>{const e=(t||"").replace(/\/+$/,"").replace(/\.html?$/i,"");return""===e?"/":e};window.addEventListener("load",()=>{const e=t(window.location.pathname);document.querySelectorAll("a[href]").forEach(a=>{const n=a.getAttribute("href");if(!n)return;if(n.startsWith("#")||n.toLowerCase().startsWith("javascript:"))return;let o;try{o=new URL(n,window.location.href)}catch{return}o.origin===window.location.origin&&t(o.pathname)===e&&a.classList.add("w--current")})})}(),t(),document.addEventListener("DOMContentLoaded",()=>{document.querySelectorAll("[data-separator]").forEach(t=>{const e=t.getAttribute("data-separator");if(!e)return;const a=Array.from(t.children);a.forEach((t,n)=>{if(n<a.length-1){const a=document.createElement("span");a.innerHTML=`&nbsp;${e}&nbsp;`,t.insertAdjacentElement("afterend",a)}})})}),void 0!==window.Webflow&&window.Webflow.push(()=>{document.querySelectorAll(".copyright-year").forEach(t=>{t.textContent=(new Date).getFullYear().toString()})}),document.addEventListener("DOMContentLoaded",()=>{const t=new URLSearchParams(window.location.search),r=t.get("tab"),i=t.get("tabGroup");if(r){let t=null;i?(document.querySelectorAll(`.tab-link[data-tab-group="${i}"]:not([data-lang-link]):not([data-lang]), [data-tab-link][data-tab-group="${i}"]`).forEach(a=>{e(a)===r&&(t=a)}),document.querySelectorAll(`.tab-link[data-tab-group="${i}"]:not([data-lang-link]):not([data-lang]), [data-tab-link][data-tab-group="${i}"]`).forEach(t=>{t.classList.remove("active")}),document.querySelectorAll(`[data-tab-content][data-tab-group="${i}"]`).forEach(t=>{t.style.display="none",t.classList.remove("active")}),n(i).forEach(t=>{a(t).forEach(t=>{t.style.display="none",t.classList.remove("active")})})):document.querySelectorAll(".tab-link:not([data-lang-link]):not([data-lang]), [data-tab-link]").forEach(a=>{e(a)===r&&(t=a)}),t&&l(t)}if(document.querySelectorAll(".tab-link:not([data-lang-link]):not([data-lang]), [data-tab-link]").forEach(t=>{t.addEventListener("click",t=>{t.preventDefault(),l(t.currentTarget)})}),r||document.querySelectorAll(".tab-link.active:not([data-lang-link]):not([data-lang]), [data-tab-link].active").forEach(t=>{const l=t,r=l.dataset.tabGroup,i=e(l),c=i?a(i):[];if(c.length>0){if(r)document.querySelectorAll(`[data-tab-content][data-tab-group="${r}"]`).forEach(t=>{c.includes(t)||(t.style.display="none",t.classList.remove("active"))}),n(r).forEach(t=>{a(t).forEach(t=>{c.includes(t)||(t.style.display="none",t.classList.remove("active"))})});else{const t=l.parentNode;t&&o(t).forEach(t=>{a(t).forEach(t=>{c.includes(t)||(t.style.display="none",t.classList.remove("active"))})})}c.forEach(t=>{t.style.display="block",t.classList.add("active")})}}),!r){const t=new Set;document.querySelectorAll(".tab-link[data-tab-first-active]:not([data-lang-link]):not([data-lang]), [data-tab-link][data-tab-first-active]").forEach(e=>{const a=e,n=a.dataset.tabGroup;if(!(i&&n===i||a.classList.contains("active")))if(n){if(t.has(n))return;if(null!==document.querySelector(`.tab-link.active[data-tab-group="${n}"]:not([data-lang-link]):not([data-lang]), [data-tab-link].active[data-tab-group="${n}"]`))return void t.add(n);t.add(n);const e=document.querySelector(`.tab-link[data-tab-group="${n}"]:not([data-lang-link]):not([data-lang]), [data-tab-link][data-tab-group="${n}"]`);e&&l(e)}else{const t=a.parentNode;t&&null!==t.querySelector(".tab-link.active:not([data-lang-link]):not([data-lang]), [data-tab-link].active")||l(a)}}),document.querySelectorAll("[data-tab-first-active][data-tab-group]").forEach(e=>{const a=e.dataset.tabGroup;if(!a)return;if(i&&a===i)return;if(t.has(a))return;if(null!==document.querySelector(`.tab-link.active[data-tab-group="${a}"]:not([data-lang-link]):not([data-lang]), [data-tab-link].active[data-tab-group="${a}"]`))return void t.add(a);t.add(a);const n=document.querySelector(`.tab-link[data-tab-group="${a}"]:not([data-lang-link]):not([data-lang]), [data-tab-link][data-tab-group="${a}"]`);n&&l(n)})}}),document.addEventListener("DOMContentLoaded",()=>{document.querySelectorAll("[data-lang-link]").forEach(t=>{t.addEventListener("click",t=>{t.preventDefault();const e=r(t.currentTarget);e&&d(e)})}),document.querySelectorAll(".biography-lang-links .tab-link[data-lang]:not([data-lang-link])[data-lang]").forEach(t=>{t.addEventListener("click",t=>{t.preventDefault();const e=t.currentTarget,a=e.dataset?.lang;a&&d(a)})}),s()}),"interactive"!==document.readyState&&"complete"!==document.readyState||s(),document.addEventListener("DOMContentLoaded",()=>{const t=["maxresdefault","sddefault","hqdefault","mqdefault","default"],e=(a,n=0)=>{if(a.naturalWidth>120)return;if(n>=t.length)return;const o=t[n],l=a.src,r=new Image;r.onload=()=>{r.naturalWidth>120?a.src=r.src:e(a,n+1)},r.onerror=()=>{e(a,n+1)},r.src=l.replace(/maxresdefault/,o)};document.querySelectorAll(".youtube img").forEach(t=>{e(t)})}),document.addEventListener("DOMContentLoaded",()=>{let t=[];const e=document.querySelectorAll(".youtube"),a={};let n=!1;const o=document.querySelectorAll("._init-plyr").length>0,l=f("youtube"),r=f("vimeo"),i=f("dailymotion"),c=()=>{n||(n=!0,function(t,e,a){t.forEach(t=>{t.addEventListener("click",()=>{const n=t.querySelector("[data-custom-embed]");n&&(t.innerHTML=n.innerHTML);const o=t,l=`player_${o.dataset.id}`,r=o.dataset.type,i=o.dataset.videoId,c=parseInt(o.dataset.time||"0",10);if(i&&r)if(h(l,a,e),"youtube"===r&&window.YT){const t=new window.YT.Player(l,{videoId:i,playerVars:{start:c},events:{onReady:t=>{t.target.playVideo()},onStateChange:t=>{t.data===window.YT.PlayerState.PLAYING?h(l,a,e):t.data!==window.YT.PlayerState.PAUSED&&t.data!==window.YT.PlayerState.ENDED||w()}}});e[l]={type:r,player:t}}else if("vimeo"===r&&window.Vimeo){const t=document.getElementById(l);t&&(t.innerHTML="");const n=new window.Vimeo.Player(l,{id:i,autoplay:!0,start:c});n.on("play",()=>h(l,a,e)),n.on("pause",()=>w()),e[l]={type:r,player:n}}else"dailymotion"===r&&window.dailymotion&&window.dailymotion.createPlayer(l,{video:i,params:{autoplay:1,start:c,mute:!1}}).then(t=>{t.on("play",()=>h(l,a,e)),t.on("pause",()=>w()),t.on("ended",()=>w()),e[l]={type:"dailymotion",player:t}}).catch(t=>{console.error("Error initializing Dailymotion player:",t)})})})}(e,a,t))};l&&(window.onYouTubeIframeAPIReady=()=>{c()});const d=[];var s;o&&d.push(window.Plyr&&"function"==typeof window.Plyr.setup?Promise.resolve():Promise.all([(s="https://cdn.plyr.io/3.7.8/plyr.css",u(s,"stylesheet")),y("https://cdn.plyr.io/3.7.8/plyr.polyfilled.js")]).then(()=>{}).catch(t=>{throw console.error("Failed to load Plyr resources:",t),t})),l&&d.push(window.YT&&"function"==typeof window.YT.Player?Promise.resolve():y("https://www.youtube.com/iframe_api").catch(t=>{console.error("Failed to load YouTube API:",t)})),r&&d.push(window.Vimeo&&"function"==typeof window.Vimeo.Player?Promise.resolve():y("https://player.vimeo.com/api/player.js").catch(t=>{console.error("Failed to load Vimeo API:",t)})),i&&d.push(window.dailymotion&&"function"==typeof window.dailymotion.createPlayer?Promise.resolve():y("https://api.dmcdn.net/all.js").catch(t=>{console.error("Failed to load Dailymotion API:",t)})),d.length>0?Promise.all(d).then(()=>{o&&g(t),l?setTimeout(()=>{n||c()},1e3):setTimeout(()=>{c()},100)}).catch(e=>{console.error("Error loading video player APIs:",e),o&&void 0!==window.Plyr&&g(t),setTimeout(()=>{c()},500)}):(o&&void 0!==window.Plyr&&g(t),c());const p="undefined"!=typeof window?window.videoSwipers:void 0;p&&p.forEach(e=>{e.on("slideChange",()=>{m(null,t,a)})})})}();
@@ -0,0 +1,2 @@
1
+ /*! dm-js-lib/filter v0.5.0 */
2
+ var Filter=function(t){"use strict";function e(t){let e=t;for(;e;){const t=e.dataset.filterInstance;if(t)return t;e=e.parentElement}return null}function a(t,e){const a=`[data-filter-field="${t}"]`,n=e?`[data-filter-instance="${e}"] ${a}, ${a}[data-filter-instance="${e}"]`:`${a}:not([data-filter-instance])`,i=document.querySelector(n);if(!i)return!1;if("input"===i.tagName.toLowerCase()){const t=i.type;return"text"===t||"search"===t}return!1}function n(t){const e={},a={},n="[data-filter-field]",i=t?`[data-filter-instance="${t}"] ${n}, ${n}[data-filter-instance="${t}"]`:`${n}:not([data-filter-instance])`;return document.querySelectorAll(i).forEach(t=>{const n=t,i=n.dataset.filterField;if(i){const t=function(t){const e=t.tagName.toLowerCase();if("input"===e){const e=t.type;return"checkbox"===e||"radio"===e?t.checked?t.value||"true":null:"text"===e||"search"===e?t.value.trim()||null:t.value||null}if("select"===e)return t.value||null;return t.dataset.filterValue||null}(n);if(t){const l=function(t){return t?t.split(",").map(t=>t.trim()).filter(t=>t.length>0):[]}(n.dataset.filterSearch);l.length>0&&(a[i]=l),e[i]||(e[i]=[]),e[i].push(t.toLowerCase())}}}),{filters:e,multifieldSearches:a}}function i(t,e){if(t.dataset.filterField===e){return(t.dataset.filterValue||t.textContent?.trim()||"").split(",").map(t=>t.trim().toLowerCase()).filter(Boolean)}const a=t.querySelector(`[data-filter-field="${e}"]`);if(a){return(a.dataset.filterValue||a.textContent?.trim()||a.getAttribute("value")||"").split(",").map(t=>t.trim().toLowerCase()).filter(Boolean)}const n=t.dataset.filterValue;if(n){return n.split(",").map(t=>t.trim().toLowerCase()).filter(Boolean)}return[]}function l(t){const e=[],a=t.dataset.filterValue;return a&&e.push(...a.split(",").map(t=>t.trim().toLowerCase()).filter(Boolean)),e}const r=new Map;function o(t){return t||"default"}function c(t,e){const a=o(t),n="[data-filter-count], [data-filter-results]",i=t?`[data-filter-instance="${t}"] ${n}, ${n}[data-filter-instance="${t}"]`:`${n}:not([data-filter-instance])`,l=t?`[data-filter-instance="${t}"] [data-filter-empty], [data-filter-empty][data-filter-instance="${t}"]`:"[data-filter-empty]:not([data-filter-instance])",c=t?`[data-filter-instance="${t}"] [data-filter-loading], [data-filter-loading][data-filter-instance="${t}"]`:"[data-filter-loading]:not([data-filter-instance])";let s=[];const d=e.querySelectorAll("[data-filter-item]");if(d.length>0)s=Array.from(d);else if(Array.from(e.children).forEach(t=>{t instanceof HTMLElement&&s.push(t)}),0===s.length){const t=e.querySelectorAll("[data-filter-field]");s=Array.from(t)}const f={listElement:e,items:s,controls:Array.from(document.querySelectorAll(t?`[data-filter-instance="${t}"] [data-filter-field], [data-filter-field][data-filter-instance="${t}"]`:"[data-filter-field]:not([data-filter-instance])")),countElements:Array.from(document.querySelectorAll(i)),emptyElement:document.querySelector(l)||null,loadingElement:document.querySelector(c)||null,lastUpdate:Date.now()};return r.set(a,f),f}function s(t){const s=e(t),{filters:d,multifieldSearches:f}=n(s),u=function(t,e){const a=o(t),n=r.get(a);return n&&n.listElement===e?n:c(t,e)}(s,t),m=u.items;u.loadingElement&&(u.loadingElement.style.display="",u.loadingElement.classList.add("filter-loading-active")),requestAnimationFrame(()=>{let e=0;if(m.forEach(t=>{const n=function(t,e,n,r){if(0===Object.keys(e).length)return!0;for(const[o,c]of Object.entries(e)){if(0===c.length)continue;const e=n[o];if(e&&e.length>0){if(!c.some(a=>{const n=e.some(e=>i(t,e).some(t=>t.includes(a)||a.includes(t)));return n||l(t).some(t=>t.includes(a)||a.includes(t))}))return!1}else{let e=i(t,o);if(0===e.length&&(e=l(t)),0===e.length)return!1;const n=a(o,r);if(!c.some(t=>e.some(e=>n?e.includes(t)||t.includes(e):e===t)))return!1}}return!0}(t,d,f,s);n?(t.style.display="",t.classList.add("filter-active"),t.classList.remove("filter-hidden"),e++):(t.style.display="none",t.classList.add("filter-hidden"),t.classList.remove("filter-active"))}),function(t,e,a,n,i){const l=i?.countElements||[];if(0===l.length){const t="[data-filter-count], [data-filter-results]",e=n?`[data-filter-instance="${n}"] ${t}, ${t}[data-filter-instance="${n}"]`:`${t}:not([data-filter-instance])`;l.push(...Array.from(document.querySelectorAll(e)))}l.forEach(t=>{const n=t;void 0!==n.dataset.filterCount&&(n.textContent=e.toString(),n.setAttribute("aria-label",`Total items: ${e}`)),void 0!==n.dataset.filterResults&&(n.textContent=a.toString(),n.setAttribute("aria-label",`Showing ${a} of ${e} items`))})}(0,m.length,e,s,u),u.emptyElement)if(0===e){u.emptyElement.style.display="",u.emptyElement.classList.add("filter-empty-active");const t=u.emptyElement.dataset.filterEmptyText;if(t){(u.emptyElement.querySelector("[data-filter-empty-text-content]")||u.emptyElement).textContent=t}}else u.emptyElement.style.display="none",u.emptyElement.classList.remove("filter-empty-active");u.loadingElement&&(u.loadingElement.style.display="none",u.loadingElement.classList.remove("filter-loading-active"));const n=new CustomEvent("filter:change",{detail:{instance:s,filters:d,visibleCount:e,total:m.length}});if(t.dispatchEvent(n),0===e){const e=new CustomEvent("filter:empty",{detail:{instance:s,filters:d}});t.dispatchEvent(e)}const r=document.querySelector(`#filter-live-${s||"default"}`);r&&(r.textContent=0===e?"No results found":`Showing ${e} of ${m.length} items`);const o=t.dataset.filterScroll;o&&requestAnimationFrame(()=>{if("top"===o)window.scrollTo({top:0,behavior:"smooth"});else if("anchor"===o){const e=t.dataset.filterScrollAnchor,a=e?document.querySelector(e):t;a?.scrollIntoView({behavior:"smooth",block:"start"})}else{const t=document.querySelector(o);t?.scrollIntoView({behavior:"smooth",block:"start"})}});"true"===t.dataset.filterUrl&&function(t,e){const a=new URLSearchParams(window.location.search),n=t?`filter_${t}_`:"filter_";Array.from(a.keys()).forEach(t=>{t.startsWith(n)&&a.delete(t)}),Object.entries(e).forEach(([t,e])=>{e.length>0&&a.set(`${n}${t}`,e.join(","))});const i=`${window.location.pathname}${a.toString()?`?${a.toString()}`:""}${window.location.hash}`;window.history.pushState({},"",i)}(s,d);const c=t.dataset.filterPersist;c&&function(t,e,a){try{const n=`filter_${t}_${e||"default"}`;localStorage.setItem(n,JSON.stringify(a))}catch(t){console.warn("Failed to save filter state to localStorage",t)}}(c,s,d)})}function d(t){const a=e(t),n="[data-filter-list]",i=a?`[data-filter-instance="${a}"] ${n}, ${n}[data-filter-instance="${a}"]`:`${n}:not([data-filter-instance])`,l=document.querySelector(i);l&&s(l)}const f={setFilter:(t,e,a)=>{const n=`[data-filter-field="${e}"]`,i=t?`[data-filter-instance="${t}"] ${n}, ${n}[data-filter-instance="${t}"]`:`${n}:not([data-filter-instance])`;document.querySelectorAll(i).forEach(t=>{const e=t,n=e.tagName.toLowerCase();if("input"===n){const t=e;"checkbox"===t.type||"radio"===t.type?t.checked=t.value.toLowerCase()===a.toLowerCase():t.value=a}else"select"===n&&(e.value=a)});const l="[data-filter-list]",r=t?`[data-filter-instance="${t}"] ${l}, ${l}[data-filter-instance="${t}"]`:`${l}:not([data-filter-instance])`,o=document.querySelector(r);o&&s(o)},clear:t=>{const e="[data-filter-list]",a=t?`[data-filter-instance="${t}"] ${e}, ${e}[data-filter-instance="${t}"]`:`${e}:not([data-filter-instance])`,n=document.querySelector(a);if(n){const e="[data-filter-field]",a=t?`[data-filter-instance="${t}"] ${e}, ${e}[data-filter-instance="${t}"]`:`${e}:not([data-filter-instance])`;document.querySelectorAll(a).forEach(t=>{const e=t,a=e.tagName.toLowerCase();if("input"===a){const t=e;"checkbox"===t.type||"radio"===t.type?t.checked=!1:t.value=""}else"select"===a?e.selectedIndex=0:e.classList.remove("active")}),s(n)}},getActiveFilters:t=>{const{filters:e}=n(t);return e},refresh:t=>{const e="[data-filter-list]",a=t?`[data-filter-instance="${t}"] ${e}, ${e}[data-filter-instance="${t}"]`:`${e}:not([data-filter-instance])`,n=document.querySelector(a);n&&(c(t,n),s(n))}};let u=!1,m=!1,h=!1,y=!1;function $(){if(u||(window.filterAPI=f),m||(document.querySelectorAll('input[type="checkbox"][data-filter-field]').forEach(t=>{t.addEventListener("change",()=>{d(t)})}),document.querySelectorAll('input[type="radio"][data-filter-field]').forEach(t=>{t.addEventListener("change",()=>{const a=t.dataset.filterField,n=e(t),i=t.name;if(i)document.querySelectorAll(`input[type="radio"][name="${i}"]`).forEach(e=>{e!==t&&(e.checked=!1)});else if(a){const e=n?`input[type="radio"][data-filter-field="${a}"][data-filter-instance="${n}"], input[type="radio"][data-filter-field="${a}"][data-filter-instance="${n}"]`:`input[type="radio"][data-filter-field="${a}"]:not([data-filter-instance])`;document.querySelectorAll(e).forEach(e=>{e!==t&&(e.checked=!1)})}d(t)})}),document.querySelectorAll("select[data-filter-field]").forEach(t=>{t.addEventListener("change",()=>{d(t)})}),document.querySelectorAll('input[type="text"][data-filter-field], input[type="search"][data-filter-field]').forEach(t=>{let e;const a=t,n=a.dataset.filterDebounce&&parseInt(a.dataset.filterDebounce,10)||300;t.addEventListener("input",()=>{clearTimeout(e),e=setTimeout(()=>{d(a)},n)})}),document.querySelectorAll("[data-filter-field]:not(input):not(select)").forEach(t=>{const e=t;e.setAttribute("role","button"),e.setAttribute("tabindex","0");const a=t=>{t.preventDefault();const a=e.querySelector('input[type="checkbox"], input[type="radio"]');a?(a.checked=!a.checked,d(a)):(e.classList.toggle("active"),d(e))};e.addEventListener("click",a),e.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||a(t)})}),m=!0),h||(document.querySelectorAll("[data-filter-clear]").forEach(t=>{t.addEventListener("click",a=>{a.preventDefault();const n=e(t),i="[data-filter-field]",l=n?`[data-filter-instance="${n}"] ${i}, ${i}[data-filter-instance="${n}"]`:`${i}:not([data-filter-instance])`;document.querySelectorAll(l).forEach(t=>{const e=t,a=e.tagName.toLowerCase();if("input"===a){const t=e;"checkbox"===t.type||"radio"===t.type?t.checked=!1:t.value=""}else"select"===a?e.selectedIndex=0:e.classList.remove("active")});const r="[data-filter-list]",o=n?`[data-filter-instance="${n}"] ${r}, ${r}[data-filter-instance="${n}"]`:`${r}:not([data-filter-instance])`,c=document.querySelector(o);if(c){if("true"===c.dataset.filterUrl){const t=new URLSearchParams(window.location.search),e=n?`filter_${n}_`:"filter_";Array.from(t.keys()).forEach(a=>{a.startsWith(e)&&t.delete(a)});const a=`${window.location.pathname}${t.toString()?`?${t.toString()}`:""}${window.location.hash}`;window.history.pushState({},"",a)}const t=c.dataset.filterPersist;if(t)try{const e=`filter_${t}_${n||"default"}`;localStorage.removeItem(e)}catch(t){}s(c);const e=new CustomEvent("filter:clear",{detail:{instance:n}});c.dispatchEvent(e)}})}),h=!0),document.querySelectorAll("[data-filter-list]").forEach(t=>{const a=t,n=e(a),i=a.dataset.filterPersist;i&&function(t,e){try{const a=`filter_${t}_${e||"default"}`,n=localStorage.getItem(a);if(n){const t=JSON.parse(n);Object.entries(t).forEach(([t,a])=>{const n=`[data-filter-field="${t}"]`,i=e?`[data-filter-instance="${e}"] ${n}, ${n}[data-filter-instance="${e}"]`:`${n}:not([data-filter-instance])`;document.querySelectorAll(i).forEach(t=>{const e=t,n=e.tagName.toLowerCase();if("input"===n){const t=e,n=t.value.toLowerCase();"checkbox"===t.type||"radio"===t.type?t.checked=a.includes(n):"text"!==t.type&&"search"!==t.type||(t.value=a[0]||"")}else if("select"===n){const t=e;a.length>0&&(t.value=a[0])}})})}}catch(t){console.warn("Failed to restore filter state from localStorage",t)}}(i,n),"true"===a.dataset.filterUrl&&function(t){const e=new URLSearchParams(window.location.search),a=t?`filter_${t}_`:"filter_";e.forEach((e,n)=>{if(n.startsWith(a)){const i=n.replace(a,""),l=e.split(",").map(t=>t.trim()),r=`[data-filter-field="${i}"]`,o=t?`[data-filter-instance="${t}"] ${r}, ${r}[data-filter-instance="${t}"]`:`${r}:not([data-filter-instance])`;document.querySelectorAll(o).forEach(t=>{const e=t,a=e.tagName.toLowerCase();if("input"===a){const t=e,a=t.value.toLowerCase();"checkbox"===t.type||"radio"===t.type?t.checked=l.includes(a):"text"!==t.type&&"search"!==t.type||(t.value=l[0]||"")}else if("select"===a){const t=e;l.length>0&&(t.value=l[0])}})}})}(n),a.setAttribute("role","region"),a.setAttribute("aria-label","Filtered list"),a.id||(a.id=`filter-list-${n||"default"}-${Date.now()}`);let l=document.querySelector(`#filter-live-${n||"default"}`);l||(l=document.createElement("div"),l.id=`filter-live-${n||"default"}`,l.setAttribute("aria-live","polite"),l.setAttribute("aria-atomic","true"),l.className="sr-only",l.style.cssText="position:absolute;left:-10000px;width:1px;height:1px;overflow:hidden;",document.body.appendChild(l)),c(n,a),s(a)}),!y){new MutationObserver(()=>{document.querySelectorAll("[data-filter-list]").forEach(t=>{const a=t;c(e(a),a)})}).observe(document.body,{childList:!0,subtree:!0}),y=!0}u=!0}return"loading"===document.readyState?document.addEventListener("DOMContentLoaded",$):$(),t.filterAPI=f,t.initFilter=function(){"loading"===document.readyState?document.addEventListener("DOMContentLoaded",$):$()},t}({});
@@ -1,2 +1,2 @@
1
- /*! dm-js-lib/previewDetailSwitcher v0.4.2 */
1
+ /*! dm-js-lib/previewDetailSwitcher v0.4.3 */
2
2
  var PreviewDetailSwitcher=function(e){"use strict";function t(e={}){const{container:t,itemSelector:r="[data-detail-item]",previewIdAttribute:n="data-preview-id",detailIdAttribute:i="data-detail-id",initialIndex:o=0,displayValue:a="block"}=e,c=(()=>{if(!t)return document;if("string"==typeof t){return document.querySelector(t)||document}return t})(),d=e=>{const t=e.currentTarget;if(!t)return;const o=t.getAttribute(n);if(!o)return;const d=c.querySelector(`${r}[${i}="${o}"]`);if(!d)return;c.querySelectorAll(r).forEach(e=>{e&&(e.style.display="none")}),d.style.display=a},l=()=>{const e=c.querySelectorAll(r);if(0===e.length)return;e.forEach(e=>{e&&(e.style.display="none")});const t=e[o];t?t.style.display=a:e[0]&&(e[0].style.display=a);c.querySelectorAll(`[${n}]`).forEach(e=>{e&&e.addEventListener("click",d)})};"loading"===document.readyState?document.addEventListener("DOMContentLoaded",l):l()}return e.initPreviewDetailSwitcher=t,e.initPreviewDetailSwitchers=function(e,r={}){const n=()=>{document.querySelectorAll(e).forEach(e=>{e&&t({...r,container:e})})};"loading"===document.readyState?document.addEventListener("DOMContentLoaded",n):n()},e}({});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dreher-media/dm-js-lib",
3
- "version": "0.4.2",
3
+ "version": "0.5.0",
4
4
  "description": "Centralized JavaScript library for Dreher.Media websites with CDN delivery",
5
5
  "type": "module",
6
6
  "main": "dist/dm-js-lib.min.js",