PageSourceSearch

https://www.sicurmoto.it/wp-content/themes/sicurauto/assets/js/sicurauto-ds.js?ver=1.0.0

js sicurmoto.it collected 2026-10-02 18:52:45 UTC 15,077 bytes, 527 lines download raw bytes

1__ready(function() {
2    window.googletag = window.googletag || {cmd: []};
3
4    let intersectionObserver;
5
6    if ('IntersectionObserver' in window) {
7        intersectionObserver = new IntersectionObserver((entries, observer) => {
8            entries.forEach(entry => {
9                if (entry.isIntersecting) {
10                    const el = entry.target;
11
12                    if (el.onIntersect) {
13                        el.onIntersect(entry)
14                    }
15
16                    intersectionObserver.unobserve(el);
17                }
18            });
19        });
20    } else {
21        intersectionObserver = {
22            observe(el) {
23                if (el.onIntersect) {
24                    el.onIntersect()
25                }
26
27                el.unobserve(el)
28            },
29            unobserve(el) {
30            }
31        }
32    }
33
34    class AdSlot {
35        containerId;
36        minWidth = null;
37        minHeight = null;
38        desktop;
39        mobile;
40        lazy = false;
41        adUnitPath;
42        customDivId;
43        sizes;
44        slot;
45
46        /**
47         * @param {Boolean} desktop
48         * @param {Boolean} mobile
49         * @param {String} containerId
50         * @param {String} adUnitPath
51         * @param {String} customDivId
52         * @param {Array<Array<Number>>|Array<Number>|Function|null} sizes
53         * @param {Boolean} lazy
54         * @param {null|Number} minWidth
55         * @param {null|Number} minHeight
56         */
57        constructor(
58            desktop,
59            mobile,
60            containerId,
61            adUnitPath,
62            customDivId,
63            sizes = null,
64            lazy = false,
65            minWidth = null,
66            minHeight = null
67        ) {
68            this.containerId = containerId;
69            this.adUnitPath = adUnitPath;
70            this.customDivId = customDivId;
71            this.sizes = sizes;
72            this.lazy = lazy;
73            this.minWidth = minWidth;
74            this.minHeight = minHeight;
75            this.desktop = desktop;
76            this.mobile = mobile;
77        }
78
79        renderSlotDefinitionInPush() {
80            if (Array.isArray(this.sizes)) {
81                this.slot = googletag.defineSlot(this.adUnitPath, this.sizes, this.customDivId).addService(googletag.pubads());
82            } else if (typeof this.sizes === 'function') {
83                this.slot = googletag.defineOutOfPageSlot(this.adUnitPath, this.sizes()).addService(googletag.pubads());
84            } else {
85                this.slot = googletag.defineOutOfPageSlot(this.adUnitPath, this.customDivId).addService(googletag.pubads());
86            }
87            this.slot.addService(googletag.pubads());
88        }
89
90        getMinWidth() {
91            if (this.minWidth !== null) {
92                return this.minWidth;
93            }
94            if (Array.isArray(this.sizes)) {
95                let max = null;
96                for (let i = 0; i < this.sizes.length; i++) {
97                    if (Array.isArray(this.sizes[i])) {
98                        if (max === null) {
99                            max = this.sizes[i][0];
100                        } else {
101                            max = Math.max(max, this.sizes[i][0])
102                        }
103                    } else {
104                        max = this.sizes[i];
105                        break;
106                    }
107                }
108                return max;
109            }
110            return null;
111        }
112
113        getMinHeight() {
114            if (this.minHeight !== null) {
115                return this.minHeight;
116            }
117            if (Array.isArray(this.sizes)) {
118                let max = null;
119                for (let i = 0; i < this.sizes.length; i++) {
120                    if (Array.isArray(this.sizes[i])) {
121                        if (max === null) {
122                            max = this.sizes[i][1];
123                        } else {
124                            max = Math.max(max, this.sizes[i][1])
125                        }
126                    } else {
127                        max = this.sizes[i + 1];
128                        break;
129                    }
130                }
131                return max;
132            }
133            return null;
134        }
135
136        renderSlot() {
137            const container = document.getElementById(this.containerId);
138
139            if (! container) {
140                return;
141            }
142
143            const child = document.createElement('div');
144            child.id = this.customDivId;
145            child.append(document.createComment(JSON.stringify(this)));
146
147            const ad = this;
148
149            container.append(child);
150
151            if (this.lazy) {
152                child.onIntersect = function (entry) {
153                    googletag.cmd.push(function () {
154                        googletag.pubads().refresh([ad.slot]);
155                    });
156                }
157                intersectionObserver.observe(child);
158            } else {
159                googletag.pubads().refresh([this.slot]);
160            }
161        }
162
163        shouldBeShown() {
164            const breakPoint = 769;
165            if (window.innerWidth < breakPoint) {
166                if (this.mobile) {
167                    return true;
168                }
169            } else {
170                if (this.desktop) {
171                    return true;
172                }
173            }
174
175            return false;
176        }
177    }
178
179    class AdsList {
180        /**
181         * @type {AdSlot[]}
182         */
183        sicurautoAds = [];
184        /**
185         * @type {AdSlot[]}
186         */
187        sicurmotoAds = [];
188
189        addSicurauto(...ads) {
190            for (let i = 0; i < ads.length; i++) {
191                this.sicurautoAds.push(ads[i]);
192            }
193        }
194
195        addSicurmoto(...ads) {
196            for (let i = 0; i < ads.length; i++) {
197                this.sicurmotoAds.push(ads[i]);
198            }
199        }
200
201        /**
202         * @param {'sicurauto'|'sicurmoto'} sicur
203         * @return {AdSlot[]}
204         * @private
205         */
206        _getList(sicur) {
207            let list;
208            if (sicur === 'sicurmoto') {
209                list = this.sicurmotoAds;
210            } else {
211                list = this.sicurautoAds;
212            }
213            return list;
214        }
215
216        /**
217         * @param {'sicurauto'|'sicurmoto'} sicur
218         */
219        run(sicur) {
220            const list = this._getList(sicur);
221            googletag.cmd.push(function() {
222                list.forEach(function (ad) {
223                    if (!ad.shouldBeShown()) {
224                        return;
225                    }
226                    ad.renderSlotDefinitionInPush();
227                })
228                googletag.pubads().disableInitialLoad();
229                googletag.pubads().enableSingleRequest();
230                googletag.enableServices();
231                list.forEach(function (ad) {
232                    if (! ad.shouldBeShown()) {
233                        return;
234                    }
235                    ad.renderSlot();
236                });
237            });
238        }
239
240        /**
241         * @param {'sicurauto'|'sicurmoto'} sicur
242         */
243        getDivs(sicur) {
244            const breakpoint = 769;
245            let text = '';
246            this._getList(sicur).forEach(function (ad) {
247                text = text + `<div id="${ad.containerId}"></div>` + "\n";
248            })
249            this._getList(sicur).forEach(function (ad) {
250                let minWidth, minHeight;
251                // ignora width
252                // if ((minWidth = ad.getMinWidth()) !== null) {
253                //     minWidth = `min-width: ${minWidth}px;`;
254                // }
255                if ((minHeight = ad.getMinHeight()) !== null) {
256                    minHeight = `min-height: ${minHeight}px;`;
257                }
258                if (minWidth || minHeight) {
259                    const cssContent = `
260    #${ad.containerId} {
261        ${minWidth || ''} 
262        ${minHeight || ''}
263    }
264`.trim();
265                    if (ad.mobile) {
266                        text = text + `
267@media screen and (max-width: ${breakpoint - 0.01}px) {
268    ${cssContent}
269}
270`.trim() + "\n";
271                    }
272                    if (ad.desktop) {
273                        text = text + `
274@media screen and (min-width: ${breakpoint}px) {
275    ${cssContent}
276}
277`.trim() + "\n";
278                    }
279                }
280            })
281            console.log(text);
282        }
283    }
284
285    const ads = new AdsList();
286
287    ads.addSicurauto(
288        // new AdSlot(
289        //     true,
290        //     false,
291        //     'ds-body-afterbegin',
292        //     '/1948441/INTROPAGE',
293        //     'div-gpt-ad-1677837836910-0',
294        //     function() { return googletag.enums.OutOfPageFormat.INTERSTITIAL},
295        // ),
296        // new AdSlot(
297        //     false,
298        //     true,
299        //     'ds-body-afterbegin',
300        //     '/1948441/INTROPAGE_MOBILE',
301        //     'div-gpt-ad-1677838077965-0',
302        //     function() { return googletag.enums.OutOfPageFormat.INTERSTITIAL},
303        // ),
304        new AdSlot(
305            true,
306            false,
307            'ds-content-afterbegin',
308            '/1948441/MASTHEAD',
309            'div-gpt-ad-1684930421564-0',
310            [[970, 250], [980, 90], [728, 90], [970, 90]],
311        ),
312        new AdSlot(
313            true,
314            false,
315            'ds-sidebar-top-nofixed-beforeend',
316            '/1948441/BOX_ATF',
317            'div-gpt-ad-1673985190088-0',
318            [[300, 250], [300, 600]],
319            true,
320            null,
321            250
322        ),
323        new AdSlot(
324            true,
325            false,
326            'ds-sidebar-top-fixed-beforeend',
327            '/1948441/BOX_MIDDLE',
328            'div-gpt-ad-1673985491423-0',
329            [[300, 250], [300, 600]],
330            true,
331            null,
332            250
333        ),
334        new AdSlot(
335            true,
336            false,
337            'ds-sidebar-bottom-fixed-beforeend',
338            '/1948441/BOX_BTF',
339            'div-gpt-ad-1673986812137-0',
340            [[300, 250]],
341            true,
342            null,
343            250
344        ),
345        new AdSlot(
346            false,
347            true,
348            'ds-content-date-afterend',
349            '/1948441/BOX_ATF_MOBILE',
350            'div-gpt-ad-1673985259585-0',
351            [[300, 250]],
352            true,
353            null,
354            250
355        ),
356        new AdSlot(
357            false,
358            true,
359            'ds-content-second-h2-beforebegin',
360            '/1948441/BOX_MIDDLE_MOBILE',
361            'div-gpt-ad-1673985568783-0',
362            [[300, 250]],
363            true,
364            null,
365            250
366        ),
367        new AdSlot(
368            false,
369            true,
370            'ds-content-third-h2-beforebegin',
371            '/1948441/BOX_BTF_MOBILE',
372            'div-gpt-ad-1673986845086-0',
373            [[300, 250]],
374            true,
375            null,
376            250
377        ),
378        new AdSlot(
379            true,
380            false,
381            'ds-content-stickyfooter',
382            '/1948441/STICKYFOOTER',
383            'div-gpt-ad-1673987302995-0',
384            [728, 90],
385            false,
386        ),
387        new AdSlot(
388            false,
389            true,
390            'ds-content-stickyfooter',
391            '/1948441/STICKYFOOTER_MOBILE',
392            'div-gpt-ad-1673987330917-0',
393            [[320, 100], [320, 50], [300, 50], [300, 100]],
394            false,
395        ),
396        // new AdSlot(
397        //     true,
398        //     true,
399        //     'ds-body-afterbegin',
400        //     '/1948441/SKIN',
401        //     'div-gpt-ad-1673987259872-0',
402        //     [[1, 1]],
403        //     false,
404        // ),
405    );
406
407    ads.addSicurmoto(
408        // new AdSlot(
409        //     true,
410        //     false,
411        //     'ds-body-afterbegin',
412        //     '/1948441/INTROPAGE_SICURMOTO',
413        //     'div-gpt-ad-1677838301252-0',
414        //     function() { return googletag.enums.OutOfPageFormat.INTERSTITIAL},
415        // ),
416        // new AdSlot(
417        //     false,
418        //     true,
419        //     'ds-body-afterbegin',
420        //     '/1948441/INTROPAGE_MOBILE_SICURMOTO',
421        //     'div-gpt-ad-1677838414509-0',
422        //     function() { return googletag.enums.OutOfPageFormat.INTERSTITIAL},
423        // ),
424        new AdSlot(
425            true,
426            false,
427            'ds-content-afterbegin',
428            '/1948441/MASTHEAD_SICURMOTO',
429            'div-gpt-ad-1673990829562-0',
430            [[970, 250], [980, 90], [728, 90], [970, 90]],
431        ),
432        new AdSlot(
433            true,
434            false,
435            'ds-sidebar-top-nofixed-beforeend',
436            '/1948441/BOX_ATF_SICURMOTO',
437            'div-gpt-ad-1673990202029-0',
438            [[300, 250], [300, 600]],
439            true,
440            null,
441            250
442        ),
443        new AdSlot(
444            true,
445            false,
446            'ds-sidebar-top-fixed-beforeend',
447            '/1948441/BOX_MIDDLE_SICURMOTO',
448            'div-gpt-ad-1673990539927-0',
449            [[300, 250], [300, 600]],
450            true,
451            null,
452            250
453        ),
454        new AdSlot(
455            true,
456            false,
457            'ds-sidebar-bottom-fixed-beforeend',
458            '/1948441/BOX_BTF_SICURMOTO',
459            'div-gpt-ad-1673990441557-0',
460            [[300, 250]],
461            true,
462            null,
463            250
464        ),
465        new AdSlot(
466            false,
467            true,
468            'ds-content-date-afterend',
469            '/1948441/BOX_ATF_MOBILE_SICURMOTO',
470            'div-gpt-ad-1673990167944-0',
471            [[300, 250]],
472            true,
473            null,
474            250
475        ),
476        new AdSlot(
477            false,
478            true,
479            'ds-content-second-h2-beforebegin',
480            '/1948441/BOX_MIDDLE_MOBILE_SICURMOTO',
481            'div-gpt-ad-1673990506117-0',
482            [[300, 250]],
483            true,
484            null,
485            250
486        ),
487        new AdSlot(
488            false,
489            true,
490            'ds-content-third-h2-beforebegin',
491            '/1948441/BOX_BTF_MOBILE_SICURMOTO',
492            'div-gpt-ad-1673990409255-0',
493            [[300, 250]],
494            true,
495            null,
496            250
497        ),
498        new AdSlot(
499            true,
500            false,
501            'ds-content-stickyfooter',
502            '/1948441/STICKYFOOTER_SICURMOTO',
503            'div-gpt-ad-1673990916399-0',
504            [728, 90],
505        ),
506        new AdSlot(
507            false,
508            true,
509            'ds-content-stickyfooter',
510            '/1948441/STICKYFOOTER_MOBILE_SICURMOTO',
511            'div-gpt-ad-1673990889532-0',
512            [[320, 100], [320, 50], [300, 50], [300, 100]],
513        ),
514        // new AdSlot(
515        //     true,
516        //     true,
517        //     'ds-body-afterbegin',
518        //     '1948441/SKIN_SICURMOTO',
519        //     'div-gpt-ad-1673990858519-0',
520        //     [[1, 1]],
521        //     false,
522        // ),
523    );
524
525    ads.run(window.sicurData.sicurMotoOrAuto);
526    // ads.getDivs(window.sicurData.sicurMotoOrAuto);
527});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.