PageSourceSearch

https://mairie-taradeau.fr/wp-content/themes/egovt/library/js/wagaia.js

js mairie-taradeau.fr collected 2026-10-02 18:03:10 UTC 4,104 bytes, 107 lines download raw bytes

1// Restricts input for each element in the set of matched elements to the given inputFilter.
2(function ($) {
3    $.fn.inputFilter = function (inputFilter) {
4        return this.on("input keydown keyup mousedown mouseup select contextmenu drop", function () {
5            if (inputFilter(this.value)) {
6                this.oldValue = this.value;
7                this.oldSelectionStart = this.selectionStart;
8                this.oldSelectionEnd = this.selectionEnd;
9            } else if (this.hasOwnProperty("oldValue")) {
10                this.value = this.oldValue;
11                this.setSelectionRange(this.oldSelectionStart, this.oldSelectionEnd);
12            } else {
13                this.value = "";
14            }
15        });
16    };
17
18    function encodeQueryData(data) {
19        const ret = [];
20        for (let d in data)
21            ret.push(encodeURIComponent(d) + '=' + encodeURIComponent(data[d]));
22        return ret.join('&');
23    }
24
25    const tipi = $('#tipi');
26    if (tipi.length) {
27
28        $("#amount").inputFilter(function (value) {
29            return /^\d*$/.test(value);
30        });
31        $("#refdet").inputFilter(function (value) {
32            return /^[0-9a-f]*$/i.test(value);
33        });
34        $("#cents").inputFilter(function (value) {
35            return /^\d*$/.test(value);
36        });
37
38        tipi.submit(function (e) {
39            e.preventDefault();
40            tipi.find('p.error').remove();
41
42            let refdet = $.trim($('#refdet').val()),
43                amount = $.trim($('#amount').val()),
44                cents = $.trim($('#cents').val()),
45                email = $.trim($('#email').val()),
46                numcli = $.trim($('#numcli').val()),
47                saisie = $.trim($('#saisie').val());
48
49            if (saisie === '' || saisie === undefined) {
50                tipi.append("<p class='error'>Une erreur est survenue concernant le paramètre saisie du formulaire.</p>");
51            }
52
53            if (numcli === '' || numcli === undefined || (numcli !== '042045' && numcli !== '022368')) {
54                tipi.append("<p class='error'>Une erreur est survenue concernant le paramètre numéro client du formulaire.</p>");
55            }
56
57            if (refdet == '') {
58                $('#refdet').parent().append("<p class='error'>Veullez renseigner la référence de l'avis de paiement.</p>");
59            }
60            if (amount == '') {
61                $('#amount').closest('td').append("<p class='error'>Veullez saisir le montant en euro.</p>");
62            }
63            if (cents == '') {
64                $('#cents').closest('td').append("<p class='error'>Veullez saisir les centimes.</p>");
65            }
66            if (email != $('#email_confirm').val()) {
67                $('#email_confirm').parent().append("<p class='error'>Les adresses e-email ne sont pas" +
68                    " identiques.</p>");
69            }
70
71            if (tipi.find('.error').length > 0) {
72                return false;
73            }
74
75            let d = new Date(), month = d.getMonth(), year = d.getFullYear();
76
77            if (month > 5) {
78                year = year + 1;
79            }
80            const data = {
81                'numcli': numcli, // Eau 042045 // M 022368 / Multiservice
82                'exer': year,
83                'refdet': refdet,
84                'objet': '',
85                'montant': amount.concat(cents),
86                'mel':email,
87                'saisie':saisie,
88                'urlcl':'https://mairie-taradeau.fr/confirmation-paiement/'
89            };
90            const querystring = encodeQueryData(data);
91
92            console.table(data);
93            console.log(querystring);
94
95            /*
96            if (numcli == '022368') {
97                console.log('https://www.tipi.budget.gouv.fr/tpa/paiement.web?'+querystring);
98                return false;
99            }
100            */
101            window.location.href = 'https://www.payfip.gouv.fr/tpa/paiement.web?'+querystring;
102
103        });
104    }
105
106}(jQuery));
107

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.