PageSourceSearch

https://www.napoleon-cologne.fr/wp-content/plugins/auteurs-custom/assets/js/grille.js?ver=1.3.0

js napoleon-cologne.fr collected 2026-10-02 20:26:18 UTC 3,167 bytes, 98 lines download raw bytes

1/**
2 * Auteurs Custom v1.2.0 — Grille articles
3 * Filtres par catégorie + bouton "Voir plus" (AJAX)
4 */
5( function ( $ ) {
6    'use strict';
7
8    $( document ).ready( function () {
9        $( '.ac-grille-wrap' ).each( function () {
10            acGrilleInit( $( this ) );
11        } );
12    } );
13
14    function acGrilleInit( $wrap ) {
15
16        var $grid    = $wrap.find( '.ac-grille-grid' );
17        var $more    = $wrap.find( '.ac-grille-more' );
18        var $filters = $wrap.find( '.ac-grille-filter' );
19
20        /* Filtres ───────────────────────────────────────── */
21        $filters.on( 'click', function () {
22            var $btn = $( this );
23            if ( $btn.hasClass( 'ac-grille-filter--active' ) ) {
24                return;
25            }
26
27            $filters
28                .removeClass( 'ac-grille-filter--active' )
29                .attr( 'aria-pressed', 'false' );
30            $btn
31                .addClass( 'ac-grille-filter--active' )
32                .attr( 'aria-pressed', 'true' );
33
34            $wrap.data( 'categorie', $btn.data( 'cat' ) );
35            $grid.css( 'opacity', '0.4' );
36
37            acGrilleLoad( $wrap, 1, true );
38        } );
39
40        /* Voir plus ─────────────────────────────────────── */
41        $more.on( 'click', function () {
42            if ( $more.hasClass( 'ac-grille-more--loading' ) ) {
43                return;
44            }
45            var nextPage = parseInt( $wrap.data( 'page' ), 10 ) + 1;
46            acGrilleLoad( $wrap, nextPage, false );
47        } );
48    }
49
50    function acGrilleLoad( $wrap, page, replace ) {
51
52        var $grid  = $wrap.find( '.ac-grille-grid' );
53        var $more  = $wrap.find( '.ac-grille-more' );
54
55        $more.addClass( 'ac-grille-more--loading' );
56
57        $.ajax( {
58            url    : acGrille.ajaxurl,
59            type   : 'POST',
60            data   : {
61                action    : 'ac_grille_load',
62                nonce     : $wrap.data( 'nonce' ),
63                page      : page,
64                par_page  : $wrap.data( 'par-page' ),
65                categorie : $wrap.data( 'categorie' ),
66            },
67            success: function ( response ) {
68                if ( ! response.success ) {
69                    return;
70                }
71
72                var data = response.data;
73
74                if ( replace ) {
75                    $grid.html( data.html );
76                    $grid.css( 'opacity', '1' );
77                } else {
78                    $grid.append( data.html );
79                }
80
81                $wrap.data( 'page', page );
82
83                if ( data.has_more ) {
84                    $more.removeClass( 'ac-grille-more--hidden' );
85                } else {
86                    $more.addClass( 'ac-grille-more--hidden' );
87                }
88            },
89            error: function () {
90                $grid.css( 'opacity', '1' );
91            },
92            complete: function () {
93                $more.removeClass( 'ac-grille-more--loading' );
94            }
95        } );
96    }
97
98} )( jQuery );

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.