PageSourceSearch

https://www.hecalumni.fr/js/mevia/card-paginator.js?version=1790837367

js hecalumni.fr collected 2026-10-01 12:24:06 UTC 2,839 bytes, 121 lines download raw bytes

1var Card_Paginator = {};
2
3(function (window, document, obj) {
4    "use strict";
5
6    /**
7     * The paginator count selector.
8     *
9     * @type {String}
10     */
11    var PAGINATOR_COUNT = "[data-role='card-paginator-count']";
12
13    /**
14     * The paginator left selector.
15     *
16     * @type {String}
17     */
18    var PAGINATOR_LEFT = "#card-paginator-left";
19
20    /**
21     * The paginator right selector.
22     *
23     * @type {String}
24     */
25    var PAGINATOR_RIGHT = "#card-paginator-right";
26
27    /**
28     * The paginator input selector.
29     *
30     * @type {String}
31     */
32    var PAGINATOR_INPUT = "[data-role='card-paginator-input']";
33
34    /**
35     * Binds the card paginator to the current fullsearch implementation.
36     *
37     * @return {{}}
38     */
39    obj.init = function () {
40        // Read the state with .prop(), never .attr(): the arrows are anchors
41        // (see twig/responsive/cards/link.html.twig), and `disabled` is not an
42        // IDL attribute of HTMLAnchorElement, so sync() below writes a plain
43        // property that is never reflected into an attribute.
44        obj.left().on('click', function (event) {
45            event.preventDefault();
46            if (!obj.left().prop('disabled')) {
47                obj.input().val(parseInt(obj.input().val()) - 1).trigger('change');
48                obj.sync();
49            }
50        });
51
52        obj.right().on('click', function (event) {
53            event.preventDefault();
54            if (!obj.right().prop('disabled')) {
55                obj.input().val(parseInt(obj.input().val()) + 1).trigger('change');
56                obj.sync();
57            }
58        });
59
60        return obj.sync();
61    };
62
63    /**
64     * Sync the paginator with the current results implementation.
65     *
66     * @return {{}}
67     */
68    obj.sync = function () {
69        obj.left().prop('disabled', false);
70        obj.right().prop('disabled', false);
71
72        var count = parseInt(obj.count().text()),
73            value = parseInt(obj.input().val());
74
75        if (value >= count) {
76            obj.right().prop('disabled', true);
77        }
78
79        if (value < 2) {
80            obj.left().prop('disabled', true);
81        }
82
83        return obj;
84    };
85
86    /**
87     * Returns the paginator left.
88     *
89     * @return {{}}
90     */
91    obj.left = function () {
92        return $(PAGINATOR_LEFT);
93    };
94
95    /**
96     * Returns the paginator right.
97     *
98     * @return {{}}
99     */
100    obj.right = function () {
101        return $(PAGINATOR_RIGHT);
102    };
103
104    /**
105     * Returns the paginator input.
106     *
107     * @return {{}}
108     */
109    obj.input = function () {
110        return $(PAGINATOR_INPUT);
111    };
112
113    /**
114     * Returns the paginator count.
115     *
116     * @return {{}}
117     */
118    obj.count = function () {
119        return $(PAGINATOR_COUNT);
120    };
121}(window, document, Card_Paginator));

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.