PageSourceSearch

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

js edenred.com collected 2026-09-24 09:23:07 UTC 9,601 bytes, 272 lines download raw bytes

1/*! fluxAtt v1.0 */
2
3/**
4 * init flux
5 * @param array args
6 * args.posts_per_page
7 * args.load_more_is_activated
8 * args.hash random useful to have many flux in the same page - hash is a part of IDs in dom
9 * args.query_args wp query args
10 * @return void
11 */
12function init_flux_attachment(args) {
13
14    var scriptElement = document.getElementById('fluxAttString');
15    var urlParams = new URLSearchParams(scriptElement.src.split('?')[1]);
16    var paramsOnce = urlParams.get('param').split('=');
17
18    if (paramsOnce) {
19        var nonce = paramsOnce[1];
20    }else {
21        var nonce = ajaxurlPostNonce.nonce;
22    }
23
24
25    load_download_all_att(args,nonce);
26    //console.log(posts_per_page);
27    print_first_row_att(args,nonce);
28    //console.log(args.load_more_is_activated);
29    if (args.load_more_is_activated) {
30        load_more_att(
31            {
32                posts_per_page: args.posts_per_page,
33                hash: args.hash,
34                query_args: args.query_args,
35                type: args.type,
36                total: args.total,
37                load_more_is_activated: args.load_more_is_activated,
38                prev: args.prev,
39                next: args.next,
40                show_total_page: args.show_total_page,
41                number_page_to_show: args.number_page_to_show,
42            },nonce);
43    }
44}
45
46/**
47 * Display the button download
48 * @param int hash
49 * @param bool load_more_is_activated
50 * @param json query_args
51 * @return void
52 */
53function load_download_all_att(args,nonce) {
54
55
56    jQuery.post(
57        ajaxurlAtt,
58        {
59            'action': 'downloadAll_Att', // action in lib/modules/flux_data/models/ft_attAjax.php
60            'query_args': args.query_args,
61            'posts_per_page': args.posts_per_page,
62            'type': args.type,
63            'load_more_is_activated': args.load_more_is_activated,
64            'hash': args.hash,
65            'total': args.total,
66            'prev': args.prev,
67            'next': args.next,
68            'show_total_page': args.show_total_page,
69            'number_page_to_show': args.number_page_to_show,
70            'security': nonce,
71        },
72        function (response) {
73            if (response) {
74                jQuery('#download_all_' + args.hash).append(response);
75                //console.log("fluxImg->0");
76            } else {
77                if (args.type == 'loadmore') {
78                    jQuery('#load_more_flux_' + args.hash).hide(); //We hide spin loader
79                } else {
80                    jQuery('.paginate_div_' + args.hash).hide();
81                }
82            }
83
84            if (args.load_more_is_activated) {
85                if (args.type == 'loadmore') {
86                    jQuery('#loading_more_spin_' + args.hash).hide(); //We hide spin loader
87                }
88            }
89
90        }
91    );
92}
93
94/**
95 * Displays the first row
96 * @param array args
97 * args.posts_per_page
98 * args.load_more_is_activated
99 * args.hash
100 * args.query_args
101 * @return void
102 */
103function print_first_row_att(args,nonce) {
104
105
106
107    //console.log(args);
108    jQuery.post(
109        ajaxurlAtt,
110        {
111            'action': 'mon_action_Att', //action in lib/modules/flux_data/models/ft_attAjax.php
112            'query_args': args.query_args,
113            'posts_per_page': args.posts_per_page,
114            'type': args.type,
115            'load_more_is_activated': args.load_more_is_activated,
116            'hash': args.hash,
117            'total': args.total,
118            'prev': args.prev,
119            'next': args.next,
120            'show_total_page': args.show_total_page,
121            'number_page_to_show': args.number_page_to_show,
122            'security': nonce,
123        },
124        function (response) {
125            if (response) {
126                jQuery('#row_att_' + args.hash).append(response);
127            } else  {
128                if (args.type == 'loadmore') {
129                    jQuery('#load_more_flux_' + args.hash).hide(); //We hide spin loader
130                } else {
131                    jQuery('.paginate_div_' + args.hash).hide();
132                }
133            }
134
135            if (args.load_more_is_activated) {
136                if (args.type == 'loadmore') {
137                    jQuery('#loading_more_spin_' + args.hash).hide(); //We hide spin loader
138                }
139            }
140        }
141    );
142
143}
144
145/**
146 * Displays the second row after clicking on load more
147 * @param array args
148 * args.posts_per_page
149 * args.hash
150 * args.query_args
151 * @return void
152 */
153function load_more_att(args,nonce) {
154    var offset = 0;
155
156    jQuery('body').on('change', '.select-number-element', function () {
157        var self = jQuery(this);
158        offset = 0;
159        args.posts_per_page = parseInt(self.val(), 10);
160
161        jQuery.post(
162            ajaxurlPost,
163            {
164                'action': 'load_more_Att', //action in lib/modules/flux_data/models/ft_postAjax.php
165                'offset': offset, // 'offset' after clicking load more
166                'query_args': args.query_args,
167                'posts_per_page': args.posts_per_page,
168                'type': args.type,
169                'load_more_is_activated': args.load_more_is_activated,
170                'hash': args.hash,
171                'total': args.total,
172                'prev': args.prev,
173                'next': args.next,
174                'show_total_page': args.show_total_page,
175                'number_page_to_show': args.number_page_to_show,
176                'security': nonce,
177                //'post_id': args.post_id
178            },
179            function (response) {
180                if (response) {
181                    jQuery('.row_att').html(response);
182                    jQuery('#load_more_flux_' + args.hash).show(); //if no response we hide "load-more" button
183                    jQuery('#no_more_flux_' + args.hash).hide();
184                } else {
185                    if (args.type == 'loadmore') {
186                        jQuery('#load_more_flux_' + args.hash).hide(); //We hide spin loader
187                    } else {
188                        jQuery('.paginate_div_' + args.hash).hide();
189                    }
190                }
191
192                if (args.load_more_is_activated) {
193                    if (args.type == 'loadmore') {
194                        jQuery('#loading_more_spin_' + args.hash).hide(); //We hide spin loader
195                    }
196                }
197            }
198        );
199    });
200
201
202    jQuery('body').on('click', '#load_more_flux_' + args.hash, function () {
203        offset = offset + args.posts_per_page;
204        jQuery('#loading_more_spin_' + args.hash).show(); //We show spin loader on click
205        jQuery('#no_more_flux_' + args.hash).hide(); //and we hide 'no-more' all the time
206        jQuery('#load_more_flux_' + args.hash).removeClass("load-more_Att");//and we remove Class "load-more" to avoid clicking
207        jQuery.post(
208            ajaxurlAtt,
209            {
210                'action': 'load_more_Att', // action in lib/modules/flux_data/models/ft_attAjax.php
211                'offset': offset, // 'offset' after clicking load more
212                'query_args': args.query_args,
213                'posts_per_page': args.posts_per_page,
214                'type': args.type,
215                'load_more_is_activated': args.load_more_is_activated,
216                'hash': args.hash,
217                'total': args.total,
218                'prev': args.prev,
219                'next': args.next,
220                'show_total_page': args.show_total_page,
221                'number_page_to_show': args.number_page_to_show,
222                'security': nonce,
223
224            },
225            function (response) {
226                if (response) {
227                    offset = offset + args.posts_per_page;
228                    jQuery('#row_att_' + args.hash).append(response);
229                    jQuery('#load_more_flux_' + args.hash).addClass("load-more_Att"); //we add Class "load-more" to activate clicking
230                } else {
231                    jQuery('#load_more_flux_' + args.hash).hide(); //if no response we hide "load-more" button
232                    jQuery('#no_more_flux_' + args.hash).show(); //and we show "no-more" button
233                }
234                jQuery('#loading_more_spin_' + args.hash).hide(); //We hide spin loader
235            }
236        );
237    });
238
239    jQuery('body').on('click', '.page-link', function (e) {
240        e.preventDefault();
241        var self = jQuery(this);
242        var page = parseInt(self.attr('data-page'));
243        offset = (page - 1) * args.posts_per_page;
244
245        if(!isNaN(page)) {
246            jQuery.post(
247                ajaxurlPost,
248                {
249                    'action': 'load_more_Att', //action in lib/modules/flux_data/models/ft_postAjax.php
250                    'offset': offset, // 'offset' after clicking load more
251                    'query_args': args.query_args,
252                    'posts_per_page': args.posts_per_page,
253                    'type': args.type,
254                    'load_more_is_activated': args.load_more_is_activated,
255                    'hash': args.hash,
256                    'total': args.total,
257                    'prev': args.prev,
258                    'next': args.next,
259                    'show_total_page': args.show_total_page,
260                    'number_page_to_show': args.number_page_to_show,
261                    'security': nonce,
262                    //'post_id': args.post_id
263                },
264                function (response) {
265                    if (response) {
266                        jQuery('.row_att').html(response);
267                    }
268                }
269            );
270        }
271    });
272}

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.