Si è verificato un errore nell'elaborarazione del modello.
The following has evaluated to null or missing: ==> response.data.docs.getJSONObject(0) [in template "3572636#3572671#4340004" at line 21, column 24] ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign doc = response.data.docs.getJ... [in template "3572636#3572671#4340004" at line 21, column 9] ----
1<#import "_TEMPLATE_CONTEXT_/3572636/3574130/23609/3793037" as d40>
2
3<#setting url_escaping_charset="UTF-8">
4
5<#assign
6 PUTIL = objectUtil("com.liferay.portal.kernel.util.PortalUtil")
7 uuid = themeDisplay.getURLCurrent()?keep_after("-/c/n/")?keep_after_last("_")
8 langId = locale?keep_before("_")
9 contentType = "poi"
10 vueActions = ""
11 doc = ""
12 lat = "0"
13 lng = "0"
14 hasCoords = false
15/>
16
17<#if uuid?has_content>
18 <#assign response = d40.fetchData("https://guestapp.d40.it/v1/search/apt-trento/${contentType}/?uuid=${uuid}")>
19
20 <#if !response.error && response.data.docs?has_content>
21 <#assign doc = response.data.docs.getJSONObject(0)>
22
23 ${request.session.removeAttribute("circularCategories")}
24 ${request.session.setAttribute("circularCategories", doc.details.assetCategoryIds)}
25 </#if>
26</#if>
27
28<#if doc?has_content>
29 <#if doc.details?? && doc.details.name[langId]?has_content>
30 ${PUTIL.setPageTitle(doc.details.name[langId], request)}
31 </#if>
32
33 <#assign vueActions = "getFavorites();">
34
35 <#if doc.details.location.geoCoords.lat?has_content && doc.details.location.geoCoords.lon?has_content>
36 <#assign
37 hasCoords = true
38 lat = doc.details.location.geoCoords.lat
39 lng = doc.details.location.geoCoords.lon
40 vueActions = "getFavorites();buildMap(${lat}, ${lng})"
41 />
42 </#if>
43</#if>
44
45<style>
46 .swiper-button-next:after{
47 content: "";
48 }
49 .swiper-button-prev:after{
50 content: "";
51 }
52 .bg-darkgray{
53 background-color: #e5e5e5 !important;
54 }
55 .min-h-12{
56 min-height: 3rem;
57 }
58 .-ml-5{
59 margin-left: -5%;
60 }
61</style>
62
63<div v-scope id="${d40.portletNamespace}" @vue:mounted="${vueActions}" v-cloak>
64 <#if doc?has_content>
65 <#if themeDisplay.getLayout().getAncestors()?has_content>
66 <section id="breadcrumb" class="z-15 mt-25">
67 <div class="container">
68 <ol class="breadcrumb flex lg:justify-center">
69 <li class="pl-1 text-sm mr-2 relative">${d40.getLabel("sei_in")}:</li>
70
71 <li class="breadcrumb-item">
72 <a href="/" class="breadcrumb-link" title="Home">
73 <span class="breadcrumb-text-truncate text-dark underline">Home</span>
74 </a>
75 </li>
76
77 <#list themeDisplay.getLayout().getAncestors()?reverse as ancestor>
78 <li class="breadcrumb-item">
79 <a href="${ancestor.getFriendlyURL()}" class="breadcrumb-link" title="${d40.escape(ancestor.getHTMLTitle(locale))}">
80 <span class="breadcrumb-text-truncate text-dark underline">
81 ${d40.escape(ancestor.getHTMLTitle(locale))}
82 </span>
83 </a>
84 </li>
85 </#list>
86
87 <li class="breadcrumb-item active">
88 <span class="breadcrumb-text-truncate text-dark">
89 ${doc.details.name[langId]}
90 </span>
91 </li>
92 </ol>
93 </div>
94 </section>
95 </#if>
96
97 <section class="relative mt-20">
98 <div class="container">
99 <div class="row">
100 <div class="col-12 col-lg-7">
101 <div class="card-row flex-col lg:flex-row mb-10">
102 <div class="autofit-col autofit-col-expand order-2 lg:order-1">
103 <div class="autofit-section">
104 <p class="text-dark font-semibold font-heading text-3xl lg:text-4xl uppercase">
105 ${doc.details.name[langId]}
106 </p>
107 </div>
108 </div>
109 <div class="autofit-col justify-start order-1 lg:order-2 mb-3 lg:mb-0">
110 <div class="autofit-section">
111 <div class="flex space-x-4">
112 <button type="button" v-if="isFavorite('${doc.uuid}')" @click="removeFavorite($event, '${doc.uuid}')" class="btn btn-link px-2">
113 <i class="fas fa-heart text-dark fa-2x"></i>
114 </button>
115 <button type="button" v-else @click="setFavorite($event, {id: '${doc.uuid}', contentJSON: {title: '${doc.details.name[langId]?js_string}', previewDescription: '', description: '', geoRef: '', previewPicture: '${d40.getDTNPreview(doc)}', viewUrl: '${d40.getDTNUrl(doc.details.name[langId], doc.uuid, contentType)}'}})" class="btn btn-link px-2">
116 <i class="fal fa-heart text-dark fa-2x"></i>
117 </button>
118
119 <button type="button" @click="share('${doc.details.name[langId]}', '')" class="btn btn-link px-2">
120 <i class="fas fa-share-alt text-dark fa-2x"></i>
121 </button>
122 </div>
123 </div>
124 </div>
125 </div>
126
127 <#if doc.timetables.timeDescription[langId]?has_content>
128 <div class="text-dark text-lg font-light mb-15 mt-5">
129 ${doc.timetables.timeDescription[langId]}
130 </div>
131 </#if>
132
133 <#if doc.details.description[langId]?has_content>
134 <div class="underline-grow text-dark font-light lg:text-lg leading-loose">
135 ${doc.details.description[langId]}
136 </div>
137 </#if>
138 </div>
139
140 <div class="xl:absolute col-12 col-lg-5 xl:max-w-xl lg:right-0">
141 <div class="bg-light">
142 <div class="card-body px-5 pt-5 lg:px-10 lg:pt-10 pb-0">
143 <p class="text-dark font-bold uppercase text-lg mb-0">
144 ${d40.getLabel("informazioni_contatti")}
145 </p>
146 <#if doc.details.townLabel != "{}">
147 <p class="text-dark text-lg mb-0">
148 ${d40.getLabel("localita")}: <span class="text-capitalize">${doc.details.townLabel[langId]}</span>
149 </p>
150 </#if>
151 <#if doc.timetables.time_infos?has_content>
152 <p class="text-dark font-bold text-lg mb-0 mt-3">
153 ${d40.getLabel("date_apertura")}
154 </p>
155 </#if>
156 </div>
157
158 <#if doc.timetables.time_infos?has_content>
159 <div class="flex min-h-12">
160 <details class="bg-darkgray w-full lg:w-105% right-0 -ml-5">
161 <summary class="btn btn-link text-dark no-underline my-1 ml-12">
162 <i class="fal fa-calendar-alt"></i>
163 <span>${doc.timetables.time_infos.getJSONObject(0).date_from} - ${doc.timetables.time_infos.getJSONObject(0).time_from} - ${doc.timetables.time_infos.getJSONObject(0).time_to}</span>
164 <i class="fal fa-chevron-down fa-lg ml-5"></i>
165 </summary>
166
167 <div class="card-body px-5 lg:px-10">
168 <ul>
169 <#list doc.timetables.time_infos.iterator() as datetime>
170 <li class="text-dark mb-1">
171 ${d40.getLabel("dal")} ${datetime.date_from}
172 ${d40.getLabel("al")} ${datetime.date_to}
173 ${d40.getLabel("dalle")} ${datetime.time_from}
174 ${d40.getLabel("alle")} ${datetime.time_to}
175 </li>
176 </#list>
177 </ul>
178 </div>
179 </details>
180 </div>
181 </#if>
182 <div class="card-body px-5 lg:px-10">
183 <#if doc.contacts.getJSONObject(0).telephone?? && doc.contacts.getJSONObject(0).telephone?has_content>
184 <#list doc.contacts.getJSONObject(0).telephone.iterator() as phone>
185 <p class="text-dark text-lg mb-0">
186 Tel: ${phone}
187 </p>
188 </#list>
189 </#if>
190 <#if doc.contacts.getJSONObject(0).mail?? && doc.contacts.getJSONObject(0).mail?has_content>
191 <a href="mailto:${doc.contacts.getJSONObject(0).mail}" class="block no-underline text-dark text-lg space-x-2 mb-0">
192 <i class="far fa-envelope text-dark"></i>
193 <u>${doc.contacts.getJSONObject(0).mail}</u>
194 </a>
195 </#if>
196 <#if doc.contacts.getJSONObject(0).websiteUrl[langId]?? && doc.contacts.getJSONObject(0).websiteUrl[langId]?has_content>
197 <a href="${doc.contacts.getJSONObject(0).websiteUrl[langId]}" class="block no-underline text-dark text-lg space-x-2 mb-0" target="_blank">
198 <i class="far fa-external-link text-dark"></i>
199 <u>${d40.getLabel("sito_web")}</u>
200 </a>
201 </#if>
202
203 <#if langId == 'en'>
204 <#assign ri_url = "/contact-tourist-office-trento" />
205 <#elseif langId == 'de'>
206 <#assign ri_url = "/kontakt-info-anfrage-trento" />
207 <#else>
208 <#assign ri_url = "/richiesta-informazioni" />
209 </#if>
210
211 <a href="${ri_url}" class="btn bg-green text-white font-bold uppercase px-4 py-2 rounded-0 mt-10">
212 ${d40.getLabel("richiedi_info")}
213 </a>
214 </div>
215
216 <#if hasCoords>
217 <div class="relative flex h-70">
218 <div class="absolute w-full lg:w-105% h-full right-0">
219 <div id="suggesto-map" class="monochrome-map size-full border-0"></div>
220 </div>
221 </div>
222 <div class="card-body p-5 lg:px-10">
223 <a href="https://www.google.com/maps/@${lat},${lng},14z" class="d-block no-underline space-x-5">
224 <span class="font-bold text-dark uppercase">
225 ${d40.getLabel("indicazioni_stradali")}
226 </span>
227 <img src="${d40.icons_folder}/arrow_circle-dark.svg" class="w-20" />
228 </a>
229 </div>
230 </#if>
231 </div>
232 </div>
233 </div>
234 </div>
235 </section>
236
237 <#if doc.details.images?has_content>
238 <#assign usePreview = false>
239
240 <section id="gallery" class="relative overflow-x-hidden mt-20 lg:mt-40">
241 <div class="container">
242 <p class="text-dark uppercase text-lg lg:text-3xl mb-7">
243 ${d40.getLabel("galleria_immagini")}
244 </p>
245
246 <div class="swiper-container">
247 <div class="swiper-wrapper">
248 <#if doc.details.cover != "[]">
249 <#assign usePreview = true>
250
251 <#list doc.details.cover.iterator() as pic>
252 <div class="swiper-slide">
253 <a href="javascript:void(0);" class="card shadow-none border-0 bg-transparent no-underline" data-toggle="modal" data-target="#lightbox-modal" data-slider="${pic?index}" data-senna-off="true">
254 <div class="relative">
255 <img data-src="${d40.getKitPrefix(pic[langId], 'n-preview_h')}" loading="lazy" class="lazyload rounded-custom size-full fit-cover" alt="" />
256 </div>
257 </a>
258 </div>
259
260 <#break>
261 </#list>
262 </#if>
263
264 <#list doc.details.images.iterator() as pic>
265 <#if usePreview>
266 <#assign counter = pic?counter>
267 <#else>
268 <#assign counter = pic?index>
269 </#if>
270
271 <div class="swiper-slide">
272 <a href="javascript:void(0);" class="card shadow-none border-0 bg-transparent no-underline" data-toggle="modal" data-target="#lightbox-modal" data-slider="${counter}" data-senna-off="true">
273 <div class="relative">
274 <img data-src="${d40.getKitPrefix(pic[langId], 'n-preview_h')}" loading="lazy" class="lazyload rounded-custom size-full fit-cover" alt="" />
275 </div>
276 </a>
277 </div>
278 </#list>
279 </div>
280 </div>
281 </div>
282 <div class="btn-square absolute btn-prev bg-white left-0">
283 <span class="sr-only">${d40.getLabel("precedente")}</span>
284 <i class="fas fa-chevron-left text-dark w-6 h-6"></i>
285 </div>
286 <div class="btn-square absolute btn-next bg-white right-0">
287 <span class="sr-only">${d40.getLabel("successivo")}</span>
288 <i class="fas fa-chevron-right text-dark w-6 h-6"></i>
289 </div>
290 </section>
291
292 <div id="lightbox-modal" tabindex="-1" role="dialog" class="modal fade">
293 <div class="modal-dialog modal-full-screen inset-0 border-0 shadow-none">
294 <div class="modal-content bg-transparent">
295 <div class="modal-body overflow-hidden">
296 <div class="absolute top-0 right-0 z-5">
297 <button type="button" data-dismiss="modal" class="btn btn-monospaced btn-secondary m-3">
298 <span class="sr-only">${d40.getLabel("chiudi")}</span>
299 <i class="fal fa-times fa-lg"></i>
300 </button>
301 </div>
302
303 <#-- lightbox -->
304 <div id="lightbox-swiper" class="swiper-container h-75 my-auto">
305 <div class="swiper-button-prev w-12 h-12">
306 <span class="sticker sticker-circle bg-green size-full">
307 <span class="sticker-overlay">
308 <i class="fas fa-chevron-left fa-2x text-white"></i>
309 </span>
310 </span>
311 </div>
312
313 <div class="swiper-button-next w-12 h-12">
314 <span class="sticker sticker-circle bg-green size-full">
315 <span class="sticker-overlay">
316 <i class="fas fa-chevron-right fa-2x text-white"></i>
317 </span>
318 </span>
319 </div>
320
321 <div class="swiper-wrapper h-full">
322 <#if doc.details.cover != "[]">
323 <#list doc.details.cover.iterator() as pic>
324 <div class="swiper-slide h-full">
325 <img data-src="${d40.getKitPrefix(pic[langId], 'n-full_hd')}" loading="lazy" class="lazyload flex h-full object-contain mx-auto" alt="">
326 </div>
327 <#break>
328 </#list>
329 </#if>
330
331 <#list doc.details.images.iterator() as pic>
332 <div class="swiper-slide h-full">
333 <img data-src="${d40.getKitPrefix(pic[langId], 'n-full_hd')}" loading="lazy" class="lazyload flex h-full object-contain mx-auto" alt="">
334 </div>
335 </#list>
336 </div>
337 </div>
338
339 <#-- thumbnails -->
340 <div id="thumbnail-swiper" class="swiper-container" thumbsSlider="">
341 <div class="swiper-wrapper">
342 <#if doc.details.cover != "[]">
343 <#list doc.details.cover.iterator() as pic>
344 <div class="swiper-slide">
345 <img data-src="${d40.getKitPrefix(pic[langId], 'n-preview_h')}" loading="lazy" class="lazyload object-cover cursor-pointer size-full" alt="">
346 </div>
347 <#break>
348 </#list>
349 </#if>
350
351 <#list doc.details.images.iterator() as pic>
352 <div class="swiper-slide">
353 <img data-src="${d40.getKitPrefix(pic[langId], 'n-preview_h')}" loading="lazy" class="lazyload object-cover cursor-pointer size-full" alt="">
354 </div>
355 </#list>
356 </div>
357 </div>
358 </div>
359 </div>
360 </div>
361 </div>
362 </#if>
363
364 <#-- SEZIONE NON USATA
365 <section class="mt-20">
366 <div class="container">
367 <div class="bg-light max-w-xl p-5 lg:p-10">
368 <div class="card-row space-x-5">
369 <div class="autofit-col">
370 <div class="autofit-section">
371 <i class="fas fa-download text-dark w-7 h-7"></i>
372 </div>
373 </div>
374 <div class="autofit-col autofit-col-expand">
375 <div class="autofit-section">
376 <p class="text-dark font-bold text-lg lg:text-xl uppercase mb-0"> Programma completo </p>
377 </div>
378 </div>
379 </div>
380 </div>
381
382 <div class="row mt-10 lg:mt-20">
383 <div class="col-12 col-lg-8">
384 <div class="space-y-10">
385 <p class="text-dark uppercase text-lg lg:text-3xl">
386 ${d40.getLabel("dettagli")}
387 </p>
388 <div class="space-y-5">
389 <div class="row">
390 <div class="col-12 col-md-3 col-lg-2">
391 <p class="text-dark font-bold uppercase">Data</p>
392 </div>
393 <div class="col-12 col-md-9 col-lg-10">
394 <div class="text-dark font-light text-lg">
395 Dettagli
396 </div>
397 </div>
398 </div>
399 </div>
400 </div>
401 </div>
402 </div>
403 </div>
404 </section>
405 -->
406
407 <section class="mt-20">
408 <div class="container">
409 <div class="bg-light">
410 <div class="space-y-10 p-5 lg:p-10">
411 <p class="text-dark uppercase text-lg lg:text-3xl mb-0">
412 ${d40.getLabel("organizzazione")}
413 </p>
414 <div class="space-y-2">
415 <#if doc.contacts.getJSONObject(0).address.fulltext?? && doc.contacts.getJSONObject(0).address.fulltext?has_content>
416 <p class="text-dark mb-0">
417 ${doc.contacts.getJSONObject(0).address.fulltext}
418 </p>
419 </#if>
420
421 <#if doc.contacts.getJSONObject(0).mail?? && doc.contacts.getJSONObject(0).mail?has_content>
422 <a href="mailto:${doc.contacts.getJSONObject(0).mail}" class="d-block text-dark underline">
423 ${doc.contacts.getJSONObject(0).mail}
424 </a>
425 </#if>
426
427 <#if doc.contacts.getJSONObject(0).telephone?? && doc.contacts.getJSONObject(0).telephone?has_content>
428 <#list doc.contacts.getJSONObject(0).telephone.iterator() as phone>
429 <p class="text-dark mb-0">
430 <span class="font-bold">${d40.getLabel("telefono")}:</span>
431 ${phone}
432 </p>
433 </#list>
434 </#if>
435 </div>
436 </div>
437 </div>
438 </div>
439 </section>
440
441 <#--
442 <section class="mt-10">
443 <div class="container">
444 <p class="text-dark uppercase text-lg lg:text-3xl mb-7"> Info sezione </p>
445 <p class="text-dark text-lg font-light mb-0"> Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. </p>
446 </div>
447 </section>
448 -->
449 <#else>
450 <div class="text-center mt-35">
451 <p class="text-dark">
452 ${d40.getLabel("errore_caricamento_contenuto")}
453 </p>
454 </div>
455 </#if>
456</div>
457
458<script type="module">
459 import { createApp } from "https://cdnjs.cloudflare.com/ajax/libs/petite-vue/0.4.1/petite-vue.es.min.js";
460
461 createApp({
462 isMobile: window.innerWidth < 768,
463 favorites: [],
464 getFavorites() {
465 if(localStorage.getItem("favorites") !== null) {
466 this.favorites = JSON.parse(localStorage.getItem("favorites"));
467 }
468 },
469 setFavorite(e, item) {
470 e.preventDefault();
471 this.getFavorites();
472
473 var newFavorite = {
474 id: item.id,
475 contentJSON: {
476 title: item.contentJSON.title,
477 previewDescription: item.contentJSON.previewDescription,
478 description: item.contentJSON.description,
479 geoRef: item.contentJSON.geoRef,
480 previewPicture: item.contentJSON.previewPicture,
481 viewUrl: item.contentJSON.viewUrl,
482 type: "lfr",
483 }
484 };
485
486 this.favorites.push(newFavorite);
487 this.saveFavorites();
488 },
489 removeFavorite(e, itemId) {
490 e.preventDefault();
491 this.favorites = this.favorites.filter((obj) => obj.id !== itemId);
492 this.saveFavorites();
493 },
494 saveFavorites() {
495 localStorage.setItem("favorites", JSON.stringify(this.favorites));
496 },
497 isFavorite(itemId) {
498 if (this.favorites.some((e) => e.id == itemId)) {
499 return true;
500 }
501
502 return false;
503 },
504 buildMap(lat, lng) {
505 var map = new SuggestoMap("suggesto-map"),
506 location = [parseFloat(lat), parseFloat(lng)];
507
508 var svgIcon = L.divIcon({
509 html: `
510 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 44.537 64.343">
511 <path d="M32.952,68c-4.491-5.935-9.221-11.692-12.837-18.251-3.4-6.175-5.892-12.453-4.094-19.725,2.422-9.787,12.253-17.363,22.112-16.878,11.322.558,20.189,8.638,21.649,19.385.8,5.867-1.25,10.892-3.84,15.837A105.38,105.38,0,0,1,43.958,65.889c-.687.844-1.309,1.739-1.96,2.611-.953,1.06-1.971,2.068-2.841,3.191-.965,1.245-1.729,1.629-2.844.1A50.506,50.506,0,0,0,32.952,68m4.722-46.328A14.156,14.156,0,0,0,23.76,35.59c-.168,7.053,6.542,13.748,13.813,13.783A14.234,14.234,0,0,0,51.46,35.693,14.138,14.138,0,0,0,37.674,21.676" transform="translate(-15.419 -13.129)" fill="#5098c6"/>
512 <path d="M31.941,63.206A50.288,50.288,0,0,1,35.3,67c1.116,1.526,1.878,1.142,2.844-.1.87-1.123,1.889-2.132,2.841-3.191a8.579,8.579,0,0,1,5.414,2.22c1.659,1.642,1.586,3.631-.455,4.627a21.209,21.209,0,0,1-16.871.723c-1.611-.565-3.293-1.51-3.092-3.645.19-2.018,1.855-2.718,3.511-3.342.833-.315,1.791-.363,2.447-1.079" transform="translate(-14.408 -8.331)" fill="#222"/>
513 <path d="M36.946,20.929A14.137,14.137,0,0,1,50.732,34.944,14.236,14.236,0,0,1,36.844,48.626c-7.27-.036-13.98-6.732-13.813-13.783A14.157,14.157,0,0,1,36.946,20.929m-.023,5.445a8.4,8.4,0,1,0,8.394,8.22,8.5,8.5,0,0,0-8.394-8.22" transform="translate(-14.69 -12.381)" fill="#fdfcf9"/>
514 <path d="M36.45,25.9a8.4,8.4,0,0,1,.077,16.809A8.405,8.405,0,1,1,36.45,25.9" transform="translate(-14.218 -11.905)" fill="#222"/>
515 </svg>`,
516 className: "",
517 iconSize: [44.537, 64.343],
518 iconAnchor: [22.287, 64.343],
519 });
520
521 var mapData = {
522 tilelayer: "osm",
523 gestureHandling: true,
524 fitBounds: false,
525 mapcenter: location,
526 zoom: 15,
527 markersFilter: "*",
528 markers: [],
529 layers: []
530 };
531
532 map.sm.createMap(mapData);
533
534 L.circleMarker(location, {
535 radius: 0,
536 color: "#000",
537 fillOpacity: 0,
538 weight: 0
539 }).addTo(map.sm.lmap);
540
541 L.marker(location, {
542 icon: svgIcon
543 }).addTo(map.sm.lmap);
544 },
545 share(title, desc, mode = "legacy") {
546 if (this.isMobile) {
547 var shareData = {
548 title: title,
549 text: desc,
550 url: window.location.href.replaceAll("{", "%7B").replaceAll("}", "%7D")
551 };
552
553 try {
554 navigator.share(shareData);
555 } catch (err) {
556 console.error("Error sharing: " + err);
557
558 if (mode == "legacy") {
559 this.legacyShare();
560 } else if (mode == "social") {
561 this.socialShare(title, desc);
562 }
563 }
564 } else {
565 if (mode == "legacy") {
566 this.legacyShare();
567 } else if (mode == "social") {
568 this.socialShare(title, desc);
569 }
570 }
571 },
572 legacyShare() {
573 var clip = document.createElement("input"),
574 toCopy = window.location.href.replaceAll("{", "%7B").replaceAll("}", "%7D");
575
576 document.body.appendChild(clip);
577 clip.value = toCopy;
578 clip.select();
579 clip.setSelectionRange(0, 999999);
580
581 navigator.clipboard.writeText(clip.value);
582 document.body.removeChild(clip);
583
584 alert("Link copiato");
585 },
586 socialShare(title, desc, image = "") {
587 var link = "#",
588 winHeight = 450,
589 winWidth = 600,
590 winTop = window.screen.height / 2 - winHeight / 2,
591 winLeft = window.screen.width / 2 - winWidth / 2,
592 params = "scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no,width=" + winWidth + ",height=" + winHeight + ",left=" + winLeft + ",top=" + winTop;
593
594 link = "http://www.facebook.com/sharer.php?s=100&p[title]=" + encodeURIComponent(title) + "&p[summary]=" + encodeURIComponent(desc) + "&p[url]=" + window.location.href + "&p[images][0]=" + image;
595
596 window.open(link, "Facebook", params);
597 }
598 }).mount("#${d40.portletNamespace}");
599</script>
600
601<#if doc?has_content>
602 <script>
603 document.addEventListener("DOMContentLoaded", function(){
604 if(${(doc.details.images?has_content)?c}){
605 new Swiper("#gallery .swiper-container", {
606 slidesPerView: 1,
607 spaceBetween: 50,
608 centerSlides: true,
609 centerInsufficientSlides: true,
610 breakpoints: {
611 768: {
612 slidesPerView: 2,
613 spaceBetween: 25
614 },
615 992: {
616 slidesPerView: 3,
617 spaceBetween: 25
618 }
619 },
620 navigation: {
621 prevEl: "#gallery .btn-prev",
622 nextEl: "#gallery .btn-next"
623 }
624 });
625
626 var thumbnails = new Swiper("#thumbnail-swiper", {
627 spaceBetween: 10,
628 slidesPerView: 2,
629 centerInsufficientSlides: true,
630 freeMode: true,
631 watchSlidesVisibility: true,
632 watchSlidesProgress: true,
633 breakpoints: {
634 768: {
635 slidesPerView: 3
636 },
637 992: {
638 slidesPerView: 4
639 },
640 1200: {
641 slidesPerView: 5
642 }
643 },
644 });
645
646 var lightbox = new Swiper("#lightbox-swiper", {
647 spaceBetween: 10,
648 autoHeight: true,
649 observer: true,
650 observeSlideChildren: true,
651 keyboard: {
652 enabled: true
653 },
654 navigation: {
655 nextEl: ".swiper-button-next",
656 prevEl: ".swiper-button-prev"
657 },
658 thumbs: {
659 swiper: thumbnails
660 }
661 });
662
663 $("#lightbox-modal").on("shown.bs.modal", function(e){
664 lightbox.update();
665 thumbnails.update();
666 lightbox.slideTo($(e.relatedTarget).data("slider"));
667 lightbox.update();
668 });
669
670 $("#lightbox-modal .swiper-wrapper").on("click", function(e){
671 if($(e.target).attr("class").includes("swiper-slide")){
672 $("#lightbox-modal").modal("hide");
673 }
674 });
675 }
676 });
677 </script>
678</#if>