PageSourceSearch

http://www.laboratorioadolescenza.org/iwetc/res/js/sendForm.js?v=2

js laboratorioadolescenza.org collected 2026-10-08 08:42:06 UTC 2,522 bytes, 71 lines download raw bytes

1/* global i18n */
2
3$(function () {
4  var sentForm = $('<form style="display:none" method="post" action="/iw/core/main/sentForm.jsp">');
5  var sentFormToken = $('<input type="hidden" name="g-recaptcha-response">')
6  var sentFormSubmit=('<input type="submit" value="submit">');
7  sentForm.append(sentFormToken,sentFormSubmit);
8  $("body").prepend(sentForm);
9  var forms = $("form[action*='/iw/core/main/sendForm.jsp']");
10  forms.each(function () {
11    var form = $(this);
12    form.attr("action", "");
13    var os = $(this).attr("onsubmit");
14    if (os) {
15      os = os.trim();
16      if (os.length > 0) {
17        form.data("save-onsubmit", os);
18        form.attr("onsubmit", "");
19      }
20    }
21  });
22  var protectedWithRecaptcha=$("<div class='recaptcha-disclaimer'>"+i18n.get("/js/recaptcha/disclaimer")+"</div>");
23  forms.last().append(protectedWithRecaptcha.clone());
24  forms.submit(function () {
25    var form = $(this);
26    event.preventDefault();
27    // se c'è un onsubmit (tipicamente per validazione) viene eseguito
28    var os = $(this).data("save-onsubmit");
29    if (os) {
30      try {
31        if (!eval("(function() {" + os + "}())")) {
32          return;
33        }
34      } catch (ex) {
35        console.log(ex);
36        // TODO: #7604 loggare in console l'eccezione (altrimenti non si riesce a debuggare)
37        // ignoriamo e andiamo avanti
38        // TODO: valutare comportamento più adatto per Jea
39      }
40    }
41    grecaptcha.ready(function () {
42      // do request for recaptcha token
43      // response is promise with passed token
44      grecaptcha.execute("6LcNNMYUAAAAAOlY8Ncn9sOchxJ9rfXHTxOUjX7h", {action: 'form'})
45        .then(function (token) {
46          // add token to form
47          form.prepend('<input type="hidden" name="g-recaptcha-response" value="' + token + '">');
48          var datastring = form.serialize();
49          $.ajax({
50            type: "POST",
51            url: "/iw/core/main/sendForm.jsp",
52            contentType: "application/x-www-form-urlencoded;charset=UTF-8",
53            data: datastring,
54            dataType: "json",
55            success: function (data) {
56              if (data.success) {
57                sentFormToken.val(token);
58                sentForm.submit();
59              } else {
60                alert("Error: form not sent. Captcha failed! Maybe you are a bot?");
61              }
62            },
63            error: function (xhr, ajaxOptions, thrownError) {
64              alert("" + thrownError);
65            }
66          });
67        });
68      ;
69    });
70  });
71});

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.