PageSourceSearch

https://media.edenred.com/wp-content/themes/epp-root/lib/modules/f…/assets/js/enqueue_functions.js?ver=1.0

js edenred.com collected 2026-09-24 09:23:09 UTC 2,425 bytes, 70 lines download raw bytes

1
2// file-scope array that will collect deferred functions
3var funqueue = [];
4
5// Wrap a function with a fixed "this" and params.
6// fn - reference to function
7// context - what you want "this" to be when calling fn
8// params - object of parameters to pass to fn
9var wrap_function = function (fn, context, params) {
10    return function () {
11        fn.call(context, params);
12    };
13};
14
15// Bootstrap all flux blocks that PHP a rendus dans la page.
16// Chaque bloc de config est un <script type="application/json" id="flux-config-<hash>">...</script>
17// On va lire ces configs, créer la fonction différée correspondante, et la mettre dans funqueue.
18var init_flux_queue_from_dom = function () {
19    // Récupère tous les blocs de config générés par Flux_data::print_view()
20    var configNodes = document.querySelectorAll(
21        'script[type="application/json"][id^="flux-config-"]'
22    );
23
24    configNodes.forEach(function (node) {
25        var cfg;
26
27        try {
28            cfg = JSON.parse(node.textContent);
29        } catch (e) {
30            // JSON illisible -> on skip
31            return;
32        }
33
34        // On s'attend à avoir des fonctions globales comme init_flux_post, init_flux_image, etc.
35        var initFnName = 'init_flux_' + cfg.flux_type;
36        var initFn = window[initFnName];
37
38        // On ne push que si la fonction d'init correspondante existe
39        if (typeof initFn === 'function') {
40            var func = wrap_function(initFn, window, {
41                posts_per_page: cfg.posts_per_page,
42                query_args: cfg.query_args,
43                hash: cfg.hash,
44                load_more_is_activated: cfg.load_more_is_activated,
45                type: cfg.type,
46                total: cfg.total,
47                prev: cfg.prev,
48                next: cfg.next,
49                show_total_page: cfg.show_total_page,
50                number_page_to_show: cfg.number_page_to_show,
51                unique_id_nonce: cfg.unique_id_nonce
52            });
53
54            funqueue.push(func);
55        }
56    });
57};
58
59// Quand la fenêtre est chargée :
60// 1. on lit le DOM pour remplir funqueue
61// 2. on exécute toutes les fonctions en file
62window.onload = function () {
63    // Étape 1 : alimenter funqueue à partir des blocs JSON
64    init_flux_queue_from_dom();
65
66    // Étape 2 : vider funqueue, exécuter chaque fonction
67    while (funqueue.length > 0) {
68        (funqueue.shift())();
69    }
70};

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.