PageSourceSearch

https://loof.asso.fr/modules/contrib/tacjs/js/main.js?tfr2p8

js loof.asso.fr collected 2026-09-24 09:27:52 UTC 3,207 bytes, 97 lines download raw bytes

1/**
2 * @file
3 * Init tarteaucitron.js script.
4 */
5
6(function (Drupal, drupalSettings, tarteaucitron) {
7  /**
8   * Init tarteaucitron.js script.
9   *
10   * @type {Drupal~behavior}
11   *
12   * @prop {Drupal~behaviorAttach} attach
13   *   Attaches the script.
14   */
15  Drupal.behaviors.tacjs = {
16    attach: function attach() {
17      if (window.alreadyLaunch) return;
18
19      // Set base URL for TacJS Log
20      tarteaucitron.baseUrl = drupalSettings.path.baseUrl;
21
22      // Add custom texts to tarteaucitron.
23      tarteaucitronCustomText = drupalSettings.tacjs.texts;
24
25      // Add users identification to tarteaucitron.
26      // Undefined user causes javascript errors #3326860 #3323411.
27      tarteaucitron.user = drupalSettings.tacjs.user || {};
28
29      // Set expiration time in day(s)
30      if (drupalSettings.tacjs.expire) {
31        window.tarteaucitronExpireInDay = true;
32        window.tarteaucitronForceExpire = drupalSettings.tacjs.expire;
33      }
34
35      // Workaround for #3120915: convert multiplegtagUa into a Array
36      // See https://www.drupal.org/project/tacjs/issues/3120915
37      if (tarteaucitron.user.multiplegtagUa) {
38        tarteaucitron.user.multiplegtagUa =
39          tarteaucitron.user.multiplegtagUa.split(", ");
40      }
41
42      // Workaround for #3204238: convert googleFonts into a Array
43      // See https://www.drupal.org/project/tacjs/issues/3204238
44      if (tarteaucitron.user.googleFonts) {
45        tarteaucitron.user.googleFonts =
46          tarteaucitron.user.googleFonts.split(", ");
47      }
48
49      // Add enabled services to tarteaucitron services.
50      Object.keys(drupalSettings.tacjs.services)
51        .filter(function (service) {
52          // Filter enabled services.
53          return drupalSettings.tacjs.services[service].status;
54        })
55        .forEach(function (service) {
56          var s = drupalSettings.tacjs.services[service],
57            lang = drupalSettings.path.currentLanguage,
58            slanguages = s.languages,
59            needConsent = s.needConsent,
60            languages = [];
61
62          // Check service
63          if (!tarteaucitron.services[service]) return;
64
65          // Check service languages
66          if (slanguages) {
67            Object.keys(slanguages)
68              .filter(function (language) {
69                return slanguages[language];
70              })
71              .forEach(function (language) {
72                languages.push(language);
73              });
74          }
75
76          // Check languages
77          if (languages.length !== 0 && !languages.includes(lang)) return;
78
79          // Set consent
80          if (needConsent !== undefined) {
81            tarteaucitron.services[service].needConsent = needConsent;
82          }
83
84          (tarteaucitron.job = tarteaucitron.job || []).push(service);
85        });
86
87      // Initiate tarteaucitron
88      tarteaucitron.init(drupalSettings.tacjs.dialog);
89
90      // Window onload event sometimes occurs before tacjs init is called.
91      if (document.readyState === 'complete') {
92        // Ressources fully loaded, load event already fired, force call.
93        tarteaucitron.initEvents.loadEvent(!window.addEventListener);
94      }
95    },
96  };
97})(Drupal, drupalSettings, tarteaucitron);

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.