@gaulatti/giorgia 0.1.69 → 0.1.71
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/dist/assets/default-og.jpg +0 -0
- package/dist/assets/default-og.png +0 -0
- package/package.json +4 -2
- package/src/templates/assets/default-og.jpg +0 -0
- package/src/templates/assets/default-og.png +0 -0
- package/src/templates/partials/headers/header-main.hbs +0 -74
- package/src/templates/partials/shell/doc-end.hbs +97 -0
- package/src/templates/partials/shell/doc-start-standard.hbs +1 -1
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gaulatti/giorgia",
|
|
3
3
|
"description": "Server-side Handlebars renderer and templates for ModoItaliano pages.",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.71",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "ModoItaliano",
|
|
7
7
|
"repository": {
|
|
@@ -41,6 +41,8 @@
|
|
|
41
41
|
},
|
|
42
42
|
"./partial-deps.json": "./src/partial-deps.json",
|
|
43
43
|
"./assets/mi.svg": "./dist/assets/mi.svg",
|
|
44
|
+
"./assets/default-og.jpg": "./dist/assets/default-og.jpg",
|
|
45
|
+
"./assets/default-og.png": "./dist/assets/default-og.png",
|
|
44
46
|
"./fonts/fonts.css": "./dist/fonts/fonts.css",
|
|
45
47
|
"./fonts/*": "./dist/fonts/*"
|
|
46
48
|
},
|
|
@@ -55,7 +57,7 @@
|
|
|
55
57
|
"test": "npm run test:unit",
|
|
56
58
|
"test:unit": "vitest run --project unit",
|
|
57
59
|
"prepublishOnly": "npm run build",
|
|
58
|
-
"publish:public": "npm run build && npm publish --access public"
|
|
60
|
+
"publish:public": "npm run build && npm version patch && npm publish --access public"
|
|
59
61
|
},
|
|
60
62
|
"dependencies": {
|
|
61
63
|
"@fontsource/barlow": "^5.3.0",
|
|
Binary file
|
|
Binary file
|
|
@@ -155,80 +155,6 @@
|
|
|
155
155
|
})();
|
|
156
156
|
</script>
|
|
157
157
|
|
|
158
|
-
<script>
|
|
159
|
-
(() => {
|
|
160
|
-
const root = document.querySelector('[data-now-playing]');
|
|
161
|
-
if (!(root instanceof HTMLElement)) return;
|
|
162
|
-
|
|
163
|
-
const endpoint = root.dataset.nowPlayingEndpoint;
|
|
164
|
-
const artwork = root.querySelector('[data-now-playing-artwork]');
|
|
165
|
-
const brand = root.querySelector('[data-now-playing-brand]');
|
|
166
|
-
const status = root.querySelector('[data-now-playing-status]');
|
|
167
|
-
const title = root.querySelector('[data-now-playing-title]');
|
|
168
|
-
const artist = root.querySelector('[data-now-playing-artist]');
|
|
169
|
-
if (!endpoint || !(artwork instanceof HTMLImageElement) || !(brand instanceof HTMLElement) || !(status instanceof HTMLElement) || !(title instanceof HTMLElement) || !(artist instanceof HTMLElement)) return;
|
|
170
|
-
|
|
171
|
-
const fallback = {
|
|
172
|
-
title: title.textContent?.trim() || 'ModoItaliano',
|
|
173
|
-
artist: artist.textContent?.trim() || 'Live radio',
|
|
174
|
-
isPlaceholder: true
|
|
175
|
-
};
|
|
176
|
-
|
|
177
|
-
const setText = (element, value, fallbackValue) => {
|
|
178
|
-
element.textContent = typeof value === 'string' && value.trim() ? value.trim() : fallbackValue;
|
|
179
|
-
};
|
|
180
|
-
|
|
181
|
-
const showBrand = () => {
|
|
182
|
-
brand.classList.remove('hidden');
|
|
183
|
-
artwork.classList.add('hidden');
|
|
184
|
-
artwork.removeAttribute('src');
|
|
185
|
-
artwork.alt = '';
|
|
186
|
-
};
|
|
187
|
-
|
|
188
|
-
const showArtwork = (url, itemTitle, itemArtist) => {
|
|
189
|
-
artwork.src = url;
|
|
190
|
-
artwork.alt = [itemTitle, itemArtist].filter(Boolean).join(' by ');
|
|
191
|
-
artwork.classList.remove('hidden');
|
|
192
|
-
brand.classList.add('hidden');
|
|
193
|
-
};
|
|
194
|
-
|
|
195
|
-
const applyNowPlaying = (item) => {
|
|
196
|
-
const displayTitle = typeof item.title === 'string' && item.title.trim() ? item.title.trim() : fallback.title;
|
|
197
|
-
const displayArtist = typeof item.artist === 'string' && item.artist.trim() ? item.artist.trim() : fallback.artist;
|
|
198
|
-
const artworkUrl = typeof item.artworkUrl === 'string' ? item.artworkUrl.trim() : '';
|
|
199
|
-
const isPlaceholder = item.isPlaceholder === true;
|
|
200
|
-
|
|
201
|
-
setText(title, displayTitle, fallback.title);
|
|
202
|
-
setText(artist, displayArtist, fallback.artist);
|
|
203
|
-
status.textContent = isPlaceholder ? 'En directo' : 'Reproduciendo';
|
|
204
|
-
|
|
205
|
-
if (!isPlaceholder && artworkUrl) {
|
|
206
|
-
showArtwork(artworkUrl, displayTitle, displayArtist);
|
|
207
|
-
} else {
|
|
208
|
-
showBrand();
|
|
209
|
-
}
|
|
210
|
-
};
|
|
211
|
-
|
|
212
|
-
const fetchNowPlaying = async () => {
|
|
213
|
-
const controller = new AbortController();
|
|
214
|
-
const timeout = window.setTimeout(() => controller.abort(), 8000);
|
|
215
|
-
try {
|
|
216
|
-
const response = await fetch(endpoint, { cache: 'no-store', signal: controller.signal });
|
|
217
|
-
if (!response.ok) throw new Error('Now playing request failed');
|
|
218
|
-
const item = await response.json();
|
|
219
|
-
if (item && typeof item === 'object') applyNowPlaying(item);
|
|
220
|
-
} catch {
|
|
221
|
-
if (!title.textContent?.trim()) applyNowPlaying(fallback);
|
|
222
|
-
} finally {
|
|
223
|
-
window.clearTimeout(timeout);
|
|
224
|
-
}
|
|
225
|
-
};
|
|
226
|
-
|
|
227
|
-
fetchNowPlaying();
|
|
228
|
-
window.setInterval(fetchNowPlaying, 45000);
|
|
229
|
-
})();
|
|
230
|
-
</script>
|
|
231
|
-
|
|
232
158
|
<script>
|
|
233
159
|
(() => {
|
|
234
160
|
const slides = [...document.querySelectorAll('[data-radio-slide]')];
|
|
@@ -224,6 +224,103 @@
|
|
|
224
224
|
});
|
|
225
225
|
})();
|
|
226
226
|
</script>
|
|
227
|
+
<script>
|
|
228
|
+
(function () {
|
|
229
|
+
function initNowPlaying(root) {
|
|
230
|
+
if (!(root instanceof HTMLElement) || root.dataset.nowPlayingBound === 'true') return;
|
|
231
|
+
|
|
232
|
+
var endpoint = root.dataset.nowPlayingEndpoint;
|
|
233
|
+
var artwork = root.querySelector('[data-now-playing-artwork]');
|
|
234
|
+
var brand = root.querySelector('[data-now-playing-brand]');
|
|
235
|
+
var status = root.querySelector('[data-now-playing-status]');
|
|
236
|
+
var title = root.querySelector('[data-now-playing-title]');
|
|
237
|
+
var artist = root.querySelector('[data-now-playing-artist]');
|
|
238
|
+
if (!endpoint || !(artwork instanceof HTMLImageElement) || !(brand instanceof HTMLElement) || !(status instanceof HTMLElement) || !(title instanceof HTMLElement) || !(artist instanceof HTMLElement)) return;
|
|
239
|
+
|
|
240
|
+
var fallback = {
|
|
241
|
+
title: (title.textContent || '').trim() || 'ModoItaliano',
|
|
242
|
+
artist: (artist.textContent || '').trim() || 'Live radio',
|
|
243
|
+
isPlaceholder: true
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
function setText(element, value, fallbackValue) {
|
|
247
|
+
element.textContent = typeof value === 'string' && value.trim() ? value.trim() : fallbackValue;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
function showBrand() {
|
|
251
|
+
brand.classList.remove('hidden');
|
|
252
|
+
artwork.classList.add('hidden');
|
|
253
|
+
artwork.removeAttribute('src');
|
|
254
|
+
artwork.alt = '';
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
function showArtwork(url, itemTitle, itemArtist) {
|
|
258
|
+
artwork.src = url;
|
|
259
|
+
artwork.alt = [itemTitle, itemArtist].filter(Boolean).join(' by ');
|
|
260
|
+
artwork.classList.remove('hidden');
|
|
261
|
+
brand.classList.add('hidden');
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
function applyNowPlaying(item) {
|
|
265
|
+
var displayTitle = typeof item.title === 'string' && item.title.trim() ? item.title.trim() : fallback.title;
|
|
266
|
+
var displayArtist = typeof item.artist === 'string' && item.artist.trim() ? item.artist.trim() : fallback.artist;
|
|
267
|
+
var artworkUrl = typeof item.artworkUrl === 'string' ? item.artworkUrl.trim() : '';
|
|
268
|
+
var isPlaceholder = item.isPlaceholder === true;
|
|
269
|
+
|
|
270
|
+
setText(title, displayTitle, fallback.title);
|
|
271
|
+
setText(artist, displayArtist, fallback.artist);
|
|
272
|
+
status.textContent = isPlaceholder ? 'En directo' : 'Reproduciendo';
|
|
273
|
+
|
|
274
|
+
if (!isPlaceholder && artworkUrl) {
|
|
275
|
+
showArtwork(artworkUrl, displayTitle, displayArtist);
|
|
276
|
+
} else {
|
|
277
|
+
showBrand();
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
function fetchNowPlaying() {
|
|
282
|
+
var controller = typeof AbortController === 'function' ? new AbortController() : null;
|
|
283
|
+
var timeout = controller ? window.setTimeout(function () {
|
|
284
|
+
controller.abort();
|
|
285
|
+
}, 8000) : null;
|
|
286
|
+
|
|
287
|
+
fetch(endpoint, {
|
|
288
|
+
cache: 'no-store',
|
|
289
|
+
signal: controller ? controller.signal : undefined
|
|
290
|
+
})
|
|
291
|
+
.then(function (response) {
|
|
292
|
+
if (!response.ok) throw new Error('Now playing request failed');
|
|
293
|
+
return response.json();
|
|
294
|
+
})
|
|
295
|
+
.then(function (item) {
|
|
296
|
+
if (item && typeof item === 'object') applyNowPlaying(item);
|
|
297
|
+
})
|
|
298
|
+
.catch(function () {
|
|
299
|
+
if (!(title.textContent || '').trim()) applyNowPlaying(fallback);
|
|
300
|
+
})
|
|
301
|
+
.finally(function () {
|
|
302
|
+
if (timeout !== null) window.clearTimeout(timeout);
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
root.dataset.nowPlayingBound = 'true';
|
|
307
|
+
fetchNowPlaying();
|
|
308
|
+
window.setInterval(fetchNowPlaying, 45000);
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
function initAllNowPlaying() {
|
|
312
|
+
var roots = document.querySelectorAll('[data-now-playing]');
|
|
313
|
+
roots.forEach(initNowPlaying);
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
window.__brokawInitNowPlaying = initAllNowPlaying;
|
|
317
|
+
if (document.readyState === 'loading') {
|
|
318
|
+
document.addEventListener('DOMContentLoaded', initAllNowPlaying);
|
|
319
|
+
} else {
|
|
320
|
+
initAllNowPlaying();
|
|
321
|
+
}
|
|
322
|
+
})();
|
|
323
|
+
</script>
|
|
227
324
|
<script>
|
|
228
325
|
(function () {
|
|
229
326
|
if (typeof gtag !== 'function') return;
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
{{else}}
|
|
27
27
|
<meta property='og:type' content='website' />
|
|
28
28
|
{{/if}}
|
|
29
|
-
{{#with (socialImageUrl (coalesce seo.ogImage featuredImage.url)) as |socialImage|}}
|
|
29
|
+
{{#with (socialImageUrl (coalesce seo.ogImage featuredImage.url "https://cdn.modoitaliano.fm/assets/default-og.jpg")) as |socialImage|}}
|
|
30
30
|
{{#if socialImage}}
|
|
31
31
|
<meta property='og:image' content='{{socialImage}}' />
|
|
32
32
|
<meta property='og:image:type' content='image/jpeg' />
|