PageSourceSearch

https://www.maison-claudel.fr/typo3conf/ext/cim_quality/Resources/…/JavaScript/QualityWidget.js?1614608752

js maison-claudel.fr collected 2026-09-30 12:30:01 UTC 2,744 bytes, 88 lines download raw bytes

1/*jshint esversion: 6 */
2(function (global) {
3    "use strict";
4    function QualityWidget(args) {
5        this.args = args;
6        this.widget = $(this.args.selector);
7
8        this.bindForm();
9
10        return this;
11    }
12
13    QualityWidget.prototype.bindForm = function () {
14        let $this = this;
15        let form = this.widget.find('form');
16
17        let input = form.find('input');
18        let submit = form.find('input[type="submit"]');
19
20        let comment = $('#comment');
21        let commentTxt = $('#comment_txt');
22        let showCommentZone = $('#show_comment_zone');
23        let loader = $('#quality_loader');
24
25        form[0].reset();
26
27        input.on('change', function (e) {
28            e.preventDefault();
29            submit.prop('disabled', false).removeClass('is-hidden');
30
31            let checkedInput = form.find('input[value]:checked');
32
33            if (checkedInput.val() === 'Oui') {
34                commentTxt.prop('disabled', true).prop('required', false);
35                comment.addClass('is-hidden');
36                showCommentZone.attr('aria-expanded', 'false');
37            }
38
39            if (checkedInput.val() === 'Non') {
40                commentTxt.prop('disabled', false).prop('required', true);
41                comment.removeClass('is-hidden');
42                showCommentZone.attr('aria-expanded', 'true');
43            }
44        });
45
46        form.on('submit', function (e) {
47            e.preventDefault();
48            loader.removeClass('display_none');
49            $this.submit(form);
50        });
51    };
52
53    QualityWidget.prototype.submit = function (form) {
54        let $this = this;
55        let url = this.widget.attr('data-url');
56        let successMessage = this.widget.attr('data-success-message');
57        let errorMessage = this.widget.attr('data-error-message');
58
59        $.ajax({
60            method: 'POST',
61            url: url,
62            cache: false,
63            data: form.serialize(),
64            success: function (result) {
65                let message;
66                if(result.success) {
67                    message = successMessage;
68                } else {
69                    message = errorMessage;
70                }
71                $this.widget.prop('tabindex', -1).html("<p>" + message + "</p>");
72                $this.widget.focus();
73            },
74            error: function (jqXHR, textStatus, errorThrow) {
75                console.log(jqXHR, textStatus, errorThrow);
76                $this.widget.prop('tabindex', -1).html("<p>" + errorMessage + "</p>");
77                $this.widget.focus();
78            }
79        });
80    };
81
82    let qualityWidget = function (args) {
83        return new QualityWidget(args);
84    };
85
86    global.qualityWidget = qualityWidget;
87
88}(this));

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.