Skip to Content

JavaScript File

URL: https://webjack.ru/static/form.js
HTTP Status: 200 OK
MIME Type: application/javascript
Last Modified: Wed, 22 Feb 2023 13:36:53 GMT
Download Time: Less than a second
Cookies: None
Size: 2 KB
HTTP Headers:  5 headers
Links In:  1 pages
OK Issues: No issues found

1function webjack_form(config) {

2 'use strict';

3

4 config.params = config.params || [];

5 config.cookies = config.cookies || [];

6

7 const url = 'https://webjack.ru/webhooks/form/' + config.webhook + '/';

8

9 const params = JSON.parse(localStorage.getItem('__wj_params') || '{}');

10 const urlParams = new URLSearchParams(window.location.search.substring(1));

11 config.params.forEach(name => {

12 const value = urlParams.get(name);

13 if(value) params[name] = value;

14 });

15 localStorage.setItem('__wj_params', JSON.stringify(params));

16

17 function getParams() {

18 const r = {};

19 config.params.forEach(name => {

20 r[name] = params[name];

21 });

22 return r;

23 }

24

25 function getCookies() {

26 const cookies = new Map((document.cookie || '').split(';').map(item => {

27 const delim = item.indexOf('=');

28 const key = item.substring(0, delim).trim();

29 const value = decodeURIComponent(item.substring(delim + 1));

30 return [key, value];

31 }));

32 const r = {};

33 config.cookies.forEach(name => {

34 r[name] = cookies.get(name);

35 });

36 return r;

37 }

38

39 window.addEventListener('submit', function(event) {

40 const formdata = new FormData(event.target);

...

</html>