PageSourceSearch

https://www.sn-albi.fr/assets/js/iframe.js

js sn-albi.fr collected 2026-10-02 11:36:17 UTC 5,918 bytes, 195 lines download raw bytes

1
2
3const im = iframemanager();
4
5im.run({
6  onChange: ({ changedServices, eventSource }) => {
7    if (eventSource.type === 'click') {
8      const servicesToAccept = [
9        ...CookieConsent.getUserPreferences().acceptedServices['analytics'],
10        ...changedServices,
11      ];
12
13      CookieConsent.acceptService(servicesToAccept, 'analytics');
14    }
15  },
16
17  currLang: 'fr',
18
19  services: {
20
21        dailymotion: {
22            embedUrl: 'https://www.dailymotion.com/embed/video/{data-id}',
23
24            thumbnailUrl: async (dataId, setThumbnail) => {
25                // Use dailymotion's API to fetch the thumbnail
26                const url = `https://api.dailymotion.com/video/${dataId}?fields=thumbnail_large_url`;
27                const response = await (await fetch(url)).json();
28                const thumbnailUlr = response?.thumbnail_large_url;
29                thumbnailUlr && setThumbnail(thumbnailUlr);
30            },
31
32            iframe: {
33                allow: 'accelerometer; encrypted-media; gyroscope; picture-in-picture; fullscreen;',
34            },
35
36            languages: {
37                fr: {
38                    notice: 'Ce contenu est hébergé par un tiers. En affichant le contenu externe, vous acceptez <a rel="noreferrer noopener" href="https://www.dailymotion.com/legal/privacy?localization=en" target="_blank">les termes et conditions</a> de dailymotion.com.',
39                    loadBtn: 'Regarder la vidéo',
40                    loadAllBtn: "Ne plus demander",
41                }
42            }
43        },
44
45
46
47        calameo: {
48
49
50
51            embedUrl: 'https://v.calameo.com/?bkcode={data-id}',
52           
53
54            // global iframe settings (apply to all iframes relative to current service) [OPTIONAL]
55            iframe: {
56                allow: 'fullscreen',           // iframe's allow attribute
57                params: 'mode=mini&showsharemenu=false',     // iframe's url query parameters
58
59                // function run for each iframe configured with current service
60                onload: (dataId, setThumbnail) => {
61                    console.log(`loaded iframe with data-id=${dataId}`);
62                }
63            },
64
65            // cookie is set if the current service is accepted
66            cookie: {
67                name: 'im_calameo',            // cookie name
68                path: '/',                     // cookie path          [OPTIONAL]
69                samesite: 'lax',               // cookie samesite      [OPTIONAL]
70                domain: location.hostname      // cookie domain        [OPTIONAL]
71            },
72
73            languages: {
74                en: {
75                    notice: 'Html <b>notice</b> message',
76                    loadBtn: 'Regarder',
77                    loadAllBtn: "Ne plus demander",
78                }
79            }
80        },
81
82           
83
84      twitch: {
85            embedUrl: `https://player.twitch.tv/?{data-id}&parent=${location.hostname}`,
86
87            iframe: {
88                allow: 'accelerometer; encrypted-media; gyroscope; picture-in-picture; fullscreen;',
89            },
90
91            languages: {
92                fr: {
93                    notice: 'Ce contenu est hébergé par un tiers. En affichant le contenu externe, vous acceptez <a rel="noreferrer noopener" href="https://www.twitch.tv/p/en/legal/terms-of-service/" target="_blank">les termes et condition</a> de twitch.com.',
94                    loadBtn: 'Regarder la vidéo',
95                    loadAllBtn: "Ne plus demander",
96                }
97            }
98        },
99    
100
101    youtube: {
102      embedUrl: 'https://www.youtube-nocookie.com/embed/{data-id}',
103      thumbnailUrl: 'https://i3.ytimg.com/vi/{data-id}/hqdefault.jpg',
104
105      iframe: {
106        allow:
107          'accelerometer; encrypted-media; gyroscope; picture-in-picture; fullscreen;',
108      },
109
110      languages: {
111        fr: {
112          notice:
113            'Ce contenu est hébergé par un tiers. En affichant le contenu externe, vous acceptez <a rel="noreferrer noopener" href="https://www.youtube.com/t/terms" target="_blank">les termes et conditions</a> de youtube.com',
114          loadAllBtn: 'Accepter et regarder la vidéo',
115        },
116      },
117    },
118
119    vimeo: {
120      embedUrl: 'https://player.vimeo.com/video/{data-id}',
121      iframe: {
122        allow: 'fullscreen; picture-in-picture;',
123      },
124
125      thumbnailUrl: async (dataId, setThumbnail) => {
126        const url = `https://vimeo.com/api/v2/video/${dataId}.json`;
127        const response = await (await fetch(url)).json();
128        const thumbnailUrl = response[0]?.thumbnail_large;
129        thumbnailUrl && setThumbnail(thumbnailUrl);
130      },
131
132      languages: {
133        fr: {
134          notice:
135            'Ce contenu est hébergé par un tiers. En affichant le contenu externe, vous acceptez <a rel="noreferrer noopener" href="https://vimeo.com/terms" target="_blank">les termes et conditions</a> de vimeo.com',
136          loadBtn: 'Regarder la vidéo',
137          loadAllBtn: "Ne plus demander",
138        },
139      },
140    },
141
142
143
144
145
146
147  },
148});
149
150CookieConsent.run({
151  guiOptions: {
152    consentModal: {
153      layout: 'box inline',
154      position: 'bottom left',
155      equalWeightButtons: true,
156      flipButtons: false,
157    },
158    preferencesModal: {
159      layout: 'box',
160      equalWeightButtons: true,
161      flipButtons: false,
162    },
163  },
164
165  categories: {
166    necessary: {
167      readOnly: true,
168      enabled: true,
169    },
170    analytics: {
171      services: {
172        youtube: {
173          label: 'Youtube Embed',
174          onAccept: () => im.acceptService('youtube'),
175          onReject: () => im.rejectService('youtube'),
176        },
177        vimeo: {
178          label: 'Vimeo Embed',
179          onAccept: () => im.acceptService('vimeo'),
180          onReject: () => im.rejectService('vimeo'),
181        },
182      },
183    },
184
185    ads: {},
186  },
187
188  language: {
189    default: 'fr',
190
191    translations: {
192      en: './en.json',
193    },
194  },
195});

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.