PageSourceSearch

https://www.cegema.de/_assets/6dbb7bd8c213faea46896aa8e654c07c/JavaScript/Frontend/Captcha.js?1782386041

js cegema.de collected 2026-10-07 04:15:14 UTC 2,637 bytes, 78 lines download raw bytes

1window.BwCaptcha = {
2  init() {
3    this.initReloadButton();
4    this.initImage();
5    this.initAudioButton();
6  },
7
8  initReloadButton() {
9    document.querySelectorAll('a.captcha__reload:not([data-initialized="true"])').forEach(element => {
10      element.addEventListener('click', this.handleReloadClick);
11      element.setAttribute('data-initialized', 'true');
12    });
13  },
14
15  handleReloadClick(event) {
16    event.preventDefault();
17    const div = event.currentTarget.parentElement;
18    div.classList.add('captcha--reloading', 'captcha--spin');
19    const captchaUrl = event.currentTarget.dataset.url;
20    event.currentTarget.previousElementSibling.setAttribute('src', `${captchaUrl}${/\?/.test(captchaUrl) ? '&' : '?'}now=${Date.now()}`);
21    setTimeout(() => div.classList.remove('captcha--spin'), 400);
22  },
23
24  initImage() {
25    document.querySelectorAll('.captcha img[aria-live="polite"]:not([data-initialized="true"])').forEach(element => {
26      element.addEventListener('load', this.handleImageLoad);
27      element.setAttribute('data-initialized', 'true');
28    });
29  },
30
31  handleImageLoad(event) {
32    const div = event.currentTarget.parentElement;
33    div.classList.remove('captcha--reloading');
34  },
35
36  initAudioButton() {
37    document.querySelectorAll('a.captcha__audio:not([data-initialized="true"])').forEach(element => {
38      element.addEventListener('click', this.handleAudioClick);
39      element.setAttribute('data-initialized', 'true');
40    });
41  },
42
43  handleAudioClick(event) {
44    event.preventDefault();
45    const div = event.currentTarget.parentElement;
46    window.captchaAudio = window.captchaAudio || new Audio();
47    window.captchaAudio.addEventListener('ended', () => div.classList.remove('captcha--playing'));
48
49    if (window.captchaAudio.paused) {
50      div.classList.add('captcha--playing');
51      window.BwCaptcha.playCaptchaAudio(div, event.currentTarget.dataset.url);
52    } else {
53      window.captchaAudio.pause();
54      div.classList.remove('captcha--playing');
55    }
56  },
57
58  playCaptchaAudio(div, audioUrl) {
59    const img = div.querySelector('img');
60    const canvas = document.createElement('canvas');
61    const ctx = canvas.getContext('2d');
62    const data = new FormData();
63
64    canvas.width = img.naturalWidth;
65    canvas.height = img.naturalHeight;
66    ctx.drawImage(img, 0, 0);
67    data.append('captchaDataUrl', canvas.toDataURL());
68
69    fetch(audioUrl, {method: 'POST', body: data})
70      .then(response => response.blob())
71      .then(blob => {
72        window.captchaAudio.src = window.URL.createObjectURL(blob);
73        window.captchaAudio.play();
74      });
75  }
76};
77
78window.BwCaptcha.init();

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.