PageSourceSearch

https://www.mediatheque-lucien-herr.fr/vendors/decalog/opac/js/catalog.js

js mediatheque-lucien-herr.fr collected 2026-09-26 18:57:11 UTC 25,456 bytes, 635 lines download raw bytes

1$(document).ready(function () {
2    // Sidebar facets Menu Toggle Script
3    $("#aside-toggle, .aside-toggle-mobile").click(function (e) {
4        e.preventDefault();
5        $("aside.aside-facets").toggleClass("closed");
6        $("section.section-catalog").toggleClass("opened");
7        $("#aside-toggle > .fa").toggleClass("fa-flip-horizontal");
8    });
9
10    if (
11        /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
12            navigator.userAgent
13        )
14    ) {
15        $("#aside-toggle").click();
16    }
17
18    $(".btn-share").click(function (e) {
19        $(this).next(".share-buttons").show("clip", {}, 500);
20        $(this).parent().find(".img-fit").addClass("img-blur");
21    });
22
23    $(".btn-share, .wish-like, .wish-unlike, .wish-drop").mouseover(function (
24        e
25    ) {
26        $(this).next(".share-buttons").show("clip", {}, 500);
27        $(this).parent().find(".img-fit").addClass("img-blur");
28    });
29
30    $(".catalog-page .panel-card").mouseleave(function (e) {
31        $(this).find(".share-buttons").hide("clip", {}, 250);
32        $(this).find(".img-fit").removeClass("img-blur");
33    });
34
35    $(".btn-share")
36        .parent()
37        .mouseleave(function (e) {
38            $(this).find(".share-buttons").hide("clip", {}, 250);
39        });
40
41    $(document).on(
42        "click",
43        ".wish-like-group .dropdown-menu-wishlist",
44        function (e) {
45            e.stopPropagation();
46        }
47    );
48
49    $(document).on("click", ".wishlist-save", function (e) {
50        var wishlist_id = $(this).attr("data-wishlist-id");
51        let alreadyRetrieved = [];
52        var record_ids = $(".wish-like, .wish-like-button")
53            .map(function () {
54                const record_id = $(this).attr("record_id");
55                // pour éviter les doublons
56                if (!alreadyRetrieved.includes(record_id)) {
57                    alreadyRetrieved.push(record_id);
58                    return record_id;
59                }
60            })
61            .get();
62
63        $('.wish-like[data-wishlist-id!="' + wishlist_id + '"]').each(
64            function () {
65                $(this)
66                    .find("i.fa")
67                    .removeClass(
68                        "far fa-square fa-check-square fa-trash fa-plus"
69                    )
70                    .addClass("fa-spinner-third fa-spin fas");
71            }
72        );
73
74        $('.wish-like-button[data-wishlist-id!="' + wishlist_id + '"]').each(
75            function () {
76                $(this)
77                    .find("i.fa")
78                    .removeClass(
79                        "far fa-square fa-check-square fa-trash fa-plus"
80                    )
81                    .addClass("fa-spinner-third fa-spin fas");
82            }
83        );
84
85        $('.wishlist-save[data-wishlist-id!="' + wishlist_id + '"]').each(
86            function () {
87                $(this)
88                    .find("i.fa")
89                    .removeClass(
90                        "far fa-square fa-check-square fa-trash fa-plus wishlist-save-icon-plus wishlist-save-icon-new"
91                    )
92                    .addClass("fa-spinner-third fa-spin fas");
93            }
94        );
95
96        $.ajax({
97            url: Application.baseUrl() + "/opac/wishlist/like",
98            type: "post",
99            data: {
100                wishlist_id: wishlist_id,
101                record_ids: record_ids,
102            },
103            success: function (result) {
104                if (result !== "0") {
105                    $.each(jQuery.parseJSON(result), function (index, value) {
106                        var allGood = true;
107
108                        $('.wish-like[record_id="' + index + '"]').each(
109                            function () {
110                                if (
111                                    $(this).attr("record_id") === index &&
112                                    value === 1
113                                ) {
114                                    $(this).addClass("wish-unlike");
115                                    $(this).removeClass("wish-like");
116                                    $(this).attr(
117                                        "title",
118                                        "Retirer de ma liste"
119                                    );
120                                    $(this).html(
121                                        '<i class="fa fas fa-tras
121h fa-fw my-0 mx-3"></i><span class="fs-09 wish-text">Retirer de ma liste</span>'
122                                    );
123                                } else {
124                                    allGood = false;
125                                    $.notify(
126                                        {
127                                            icon: "fas fa fa-exclamation-triangle",
128                                            message:
129                                                "Impossible de sauvegarder cette notice !",
130                                        },
131                                        {
132                                            type: "custom",
133                                            newest_on_top: true,
134                                            delay: 1000,
135                                        }
136                                    );
137                                }
138                            }
139                        );
140
141                        $(
142                            '.wish-like-button[record_id="' +
143                                index +
144                                '"][data-wishlist-id="' +
145                                wishlist_id +
146                                '"]'
147                        ).each(function () {
148                            if (
149                                $(this).attr("record_id") === index &&
150                                value === 1
151                            ) {
152                                $(this).attr("class", "wish-unlike-button");
153                                $(this)
154                                    .find("i.fa")
155                                    .attr("class", "fa fas fa-check-square");
156                            } else {
157                                allGood = false;
158                                $.notify(
159                                    {
160                                        icon: "fas fa fa-exclamation-triangle",
161                                        message:
162                                            "Impossible de sauvegarder cette notice !",
163                                    },
164                                    {
165                                        type: "custom",
166                                        newest_on_top: true,
167                                        delay: 1000,
168                                    }
169                                );
170                            }
171                        });
172
173                        if (allGood) {
174                            $(
175                                '.wishlist-save[data-wishlist-id="' +
176                                    wishlist_id +
177                                    '"]'
178                            ).each(function () {
179                                $(this)
180                                    .addClass("wishlist-unsave")
181                                    .removeClass("wishlist-save");
182                                $(this)
183                                    .find("i.fa")
184                                    .attr("class", "fa fas fa-check-square");
185                            });
186
187                            $("#add-wishlist-selection")
188                                .find("i.fa")
189                                .attr(
190                                    "class",
191                                    "wishlist-save-icon-minus wishlist-save-icon-new fas fa fa-bars fa-2x mt-n1"
192                                );
193                        }
194                    });
195
196                    $(".fa.fa-spinner-third.fa-spin.fas").attr(
197                        "class",
198                        "fa far fa-square"
199                    );
200
201                    $.notify(
202                        {
203                            icon: "fas fa fa-plus-circle",
204                            message:
205                                "Ces documents ont été ajoutés à votre liste d'envies",
206                        },
207                        {
208                            type: "custom",
209                            newest_on_top: true,
210                            delay: 1000,
211                        }
212                    );
213                } else {
214                    $.notify(
215                        {
216                            icon: "fas fa fa-times-circle-o",
217                            message:
218                                "Impossible d'ajouter ces documents à votre liste d'envies",
219                        },
220                        {
221                            type: "warning",
222                            newest_on_top: true,
223                            delay: 1000,
224                        }
225                    );
226                }
227            },
228        });
229    });
230
231    $(document).on("click", ".wishlist-unsave", function (e) {
232        var wishlist_id = $(this).attr("data-wishlist-id");
233        var record_ids = $(".wish-unlike, .wish-unlike-button")
234            .map(function () {
235                return $(this).attr("record_id");
236            })
237            .get();
238
239        $('.wish-unlike[data-wishlist-id!="' + wishlist_id + '"]').each(
240            function () {
241                $(this)
242                    .find("i.fa")
243                    .removeClass(
244                        "far fa-square fa-check-square fa-trash fa-plus"
245                    )
246                    .addClass("fa-spinner-third fa-spin fas");
247            }
248        );
249
250        $('.wish-unlike-button[data-wishlist-id!="' + wishlist_id + '"]').each(
251            function () {
252                $(this)
253                    .find("i.fa")
254                    .removeClass(
255                        "far fa-square fa-check-square fa-trash fa-plus"
256                    )
257                    .addClass("fa-spinner-third fa-spin fas");
258            }
259        );
260
261        $('.wishlist-unsave[data-wishlist-id!="' + wishlist_id + '"]').each(
262            function () {
263                $(this)
264                    .find("i.fa")
265                    .removeClass(
266                        "far fa-square fa-check-square fa-trash fa-plus wishlist-save-icon-plus wishlist-save-icon-new"
267                    )
268                    .addClass("fa-spinner-third fa-spin fas");
269            }
270        );
271
272        $.ajax({
273            url: Application.baseUrl() + "/opac/wishlist/unlike",
274            type: "get",
275            data: {
276                wishlist_id: wishlist_id,
277                record_ids: record_ids,
278            },
279            success: function (result) {
280                if (result !== "0") {
281                    $.each(jQuery.parseJSON(result), function (index, value) {
282                        var allGood = true;
283
284                        $('.wish-unlike[record_id="' + index + '"]').each(
285                            function () {
286                                if (
287                                    $(this).attr("record_id") === index &&
288                                    value === 1
289                                ) {
290                                    $(this).addClass("wish-like");
291                                    $(this).removeClass("wish-unlike");
292                                    $(this).attr(
293                                        "title",
294                                        "Ajouter à une liste"
295                                    );
296                                    $(this).html(
297                                        '<i class="fa fas fa-plus fa-fw my-0 mx-3"></i><span class="fs-09 wish-text">Ajouter à une liste</span>'
298                                    );
299                                } else {
300                                    allGood = false;
301                                    $.notify(
302                                        {
303                                            icon: "fas fa fa-exclamation-triangle",
304                                            message:
305                                                "Impossible de sauvegarder cette notice !",
306                                        },
307                                        {
308                                            type: "custom",
309                                            newest_on_top: true,
310                                            delay: 1000,
311                                        }
312                                    );
313                                }
314                            }
315                        );
316
317                        $(
318                            '.wish-unlike-button[record_id="' +
319                                index +
320                                '"][data-wishlist-id="' +
321                                wishlist_id +
322                                '"]'
323                        ).each(function () {
324                            if (
325                                $(this).attr("record_id") === index &&
326                                value === 1
327                            ) {
328                                $(this).attr("class", "wish-like-button");
329                                $(this)
330                                    .find("i.fa")
331                                    .attr("class", "fa far fa-square");
332                            } else {
333                                allGood = false;
334                                $.notify(
335                                    {
336                                        icon: "fas fa fa-exclamation-triangle",
337                                        message:
338                                            "Impossible de sauvegarder cette notice !",
339                                    },
340                                    {
341                                        type: "custom",
342                                        newest_on_top: true,
343                                        delay: 1000,
344                                    }
345                                );
346                            }
347                        });
348
349                        if (allGood) {
350                            $(
351                                '.wishlist-unsave[data-wishlist-id="' +
352                                    wishlist_id +
353                                    '"]'
354                            ).each(function () {
355                                $(this)
356                                    .addClass("wishlist-save")
357                                    .removeClass("wishlist-unsave");
358                                $(this)
359                                    .find("i.fa")
360                                    .attr("class", "fa far fa-square");
361                            });
362
363                            $("#add-wishlist-selection")
364                                .find("i.fa")
365                                .attr(
366                                    "class",
367                                    "wishlist-save-icon-plus wishlist-save-icon-new fas fa fa-bars fa-2x mt-n1"
368                                );
369                        }
370                    });
371
372                    $(".fa.fa-spinner-third.fa-spin.fas").attr(
373                        "class",
374                        "fa fas fa-check-square"
375                    );
376
377                    $.notify(
378                        {
379                            icon: "fas fa fa-minus-circle",
380                            message:
381                                "Ces documents ont été supprimés de votre liste d'envies",
382                        },
383                        {
384                            type: "custom",
385                            newest_on_top: true,
386                            delay: 1000,
387                        }
388                    );
389                } else {
390                    $.notify(
391                        {
392                            icon: "fas fa fa-times-circle-o",
393                            message:
394                                "Impossible de supprimer ces documents à votre liste d'envies",
395                        },
396                        {
397                            type: "warning",
398                            newest_on_top: true,
399                            delay: 1000,
400                        }
401                    );
402                }
403            },
404        });
405    });
406
407    $(document).on("click", ".wish-like, .wish-like-button", function () {
408        var wish = $(this);
409        var wishlist_id = wish.attr("data-wishlist-id")
410            ? wish.attr("data-wishlist-id")
411            : wish.attr("wishlist_id");
412
413        var wishIcon = wish.find("i.fa-square");
414        wishIcon
415            .removeClass("fa-square far")
416            .addClass("fa-spinner-third fa-spin fas");
417
418        var wishNoChoiceIcon = wish.find("i.fa-plus");
419        wishNoChoiceIcon
420            .removeClass("fa-plus")
421            .addClass("fa-spinner-third fa-spin");
422
423        $.ajax({
424            url: Application.baseUrl() + "/opac/wishlist/like",
425            type: "get",
426            data: {
427                wishlist_id: wishlist_id,
428                record_id: wish.attr("record_id"),
429            },
430            success: function (result) {
431                if (result !== "0") {
432                    if (wish.hasClass("wish-like")) {
433                        wish.addClass("wish-unlike");
434                        wish.removeClass("wish-like");
435                        wish.attr("wishlist_id", "-1");
436                        wish.attr("title", "Retirer de ma liste");
437                        wish.html(
438                            '<i class="fa fas fa-trash fa-fw my-0 mx-3"></i><span class="fs-09 wish-text">Retirer de ma liste</span>'
439                        );
440                    } else {
441                        wish.attr("class", "wish-unlike-button");
442                        wishIcon
443                            .removeClass("fa-spinner-third fa-spin")
444                            .addClass("fa-check-square");
445                    }
446
447                    $.notify(
448                        {
449                            icon: "fas fa fa-plus-circle",
450                            message:
451                                "Ce document a été ajouté à votre liste d'envies" +
452                                (wish.attr("data-wishlist-title")
453                                    ? " : " +
454                                      atob(wish.attr("data-wishlist-title"))
455                                    : ""),
456                        },
457                        {
458                            type: "custom",
459                            newest_on_top: true,
460                            delay: 1500,
461                        }
462                    );
463                } else {
464                    wishIcon
465                        .addClass("fa-square far")
466                        .removeClass("fa-spinner-third fa-spin fas");
467                    wishNoChoiceIcon
468                        .addClass("fa-plus")
469                        .removeClass("fa-spinner-third fa-spin");
470
471                    $.notify(
472                        {
473                            icon: "fas fa fa-exclamation-triangle",
474                            message: "Impossible de sauvegarder cette notice !",
475                        },
476                        {
477                            type: "custom",
478                            newest_on_top: true,
479                            delay: 1500,
480                        }
481                    );
482                }
483            },
484            error: function () {
485                wishIcon
486                    .addClass("fa-square far")
487                    .removeClass("fa-spinner-third fa-spin fas");
488                wishNoChoiceIcon
489                    .addClass("fa-plus")
490                    .removeClass("fa-spinner-third fa-spin");
491            },
492        });
493    });
494
495    $(".close-wish-list").on("click", function () {
496        $(this).parent().parent().parent().removeClass("open");
497        $(this).parent().before().attr("aria-expended", false);
498    });
499
500    $(document).on("click", ".wish-unlike, .wish-unlike-button", function () {
501        var wish = $(this);
502        var wishlist_id = wish.attr("data-wishlist-id")
503            ? wish.attr("data-wishlist-id")
504            : wish.attr("wishlist_id");
505
506        var wishIcon = wish.find("i.fa-check-square");
507        wishIcon
508            .removeClass("fa-check-square")
509            .addClass("fa-spinner-third fa-spin");
510
511        var wishNoChoiceIcon = wish.find("i.fa-trash");
512        wishNoChoiceIcon
513            .removeClass("fa-trash fas")
514            .addClass("fa-spinner-third fa-spin far");
515
516        $.ajax({
517            url: Application.baseUrl() + "/opac/wishlist/unlike",
518            type: "get",
519            data: {
520                wishlist_id: wishlist_id,
521                record_id: wish.attr("record_id"),
522            },
523            success: function (result) {
524                if (result !== "0") {
525                    if (wish.hasClass("wish-unlike")) {
526                        wish.addClass("wish-like");
527                        wish.removeClass("wish-unlike");
528                        wish.attr("wishlist_id", "-1");
529                        wish.attr(
530                            "title",
531                            "Ajouter ce résultat à une liste d'envies"
532                        );
533                        wish.html(
534                            '<i class="fa fas fa-plus fa-fw my-0 mx-3"></i><span class="fs-09 wish-text">Ajouter à une liste</span>'
535                        );
536                    } else {
537                        wish.attr("class", "wish-like-button");
538                        wishIcon
539                            .removeClass("fa-spinner-third fa-spin fas")
540                            .addClass("fa-square far");
541                    }
542
543                    $.notify(
544                        {
545                            icon: "fas fa fa-minus-circle",
546                            message:
547                                "Ce document a été retiré de votre liste d'envies" +
548                                (wish.attr("data-wishlist-title")
549                                    ? " : " +
550                                      atob(wish.attr("data-wishlist-title"))
551                                    : ""),
552                        },
553                        {
554                            type: "custom",
555                            newest_on_top: true,
556                            delay: 1500,
557                        }
558                    );
559                } else {
560                    wishIcon
561                        .addClass("fa-check-square")
562                        .removeClass("fa-spinner-third fa-spin");
563                    wishNoChoiceIcon
564                        .addClass("fa-trash fas")
565                        .removeClass("fa-spinner-third fa-spin far");
566
567                    $.notify(
568                        {
569                            icon: "fas fa fa-exclamation-triangle",
570                            message: "Impossible de supprimer cette notice !",
571                        },
572                        {
573                            type: "custom",
574                            newest_on_top: true,
575                            delay: 1500,
576                        }
577                    );
578                }
579            },
580            error: function () {
581                wishIcon
582                    .addClass("fa-check-square")
583                    .removeClass("fa-spinner-third fa-spin");
584                wishNoChoiceIcon
585                    .addClass("fa-trash fas")
586                    .removeClass("fa-spinner-third fa-spin far");
587            },
588        });
589    });
590
591    $(".wish-drop").click(function () {
592        var wish = $(this);
593        var wishNoChoiceIcon = wish.find("i.fa-trash");
594        wishNoChoiceIcon
595            .removeClass("fa-trash fas")
596            .addClass("fa-spinner-third fa-spin far");
597        $.ajax({
598            url: Application.baseUrl() + "/opac/wishlist/unlike",
599            type: "get",
600            data: {
601                record_id: wish.attr("record_id"),
602                wishlist_id: wish.attr("wishlist_id"),
603            },
604            success: function (result) {
605                if (result !== "0") {
606                    wish.parent().parent().remove();
607                    $.notify(
608                        {
609                            icon: "fas fa fa-minus-circle",
610                            message:
611                                "Ce document a été retiré de votre liste d'envies",
612                        },
613                        {
614                            type: "custom",
615                            newest_on_top: true,
616                            delay: 1500,
617                        }
618                    );
619                } else {
620                    $.notify(
621                        {
622                            icon: "fas fa fa-exclamation-triangle",
623                            message: "Impossible de supprimer cette notice !",
624                        },
625                        {
626                            type: "custom",
627                            newest_on_top: true,
628                            delay: 1500,
629                        }
630                    );
631                }
632            },
633        });
634    });
635});

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.