PageSourceSearch

https://www.evkirchebb.de/_assets/11adf19ab749093060fb15029262d34b/JavaScript/freeCap.js?1791529597

js evkirchebb.de collected 2026-10-10 02:36:37 UTC 5,493 bytes, 138 lines download raw bytes

1/***************************************************************
2*  Copyright notice
3*
4*  (c) 2007-2023 Stanislas Rolland <typo3AAAA(arobas)sjbr.ca>
5*  All rights reserved
6*
7*  This script is part of the TYPO3 project. The TYPO3 project is
8*  free software; you can redistribute it and/or modify
9*  it under the terms of the GNU General Public License as published by
10*  the Free Software Foundation; either version 2 of the License, or
11*  (at your option) any later version.
12*
13*  The GNU General Public License can be found at
14*  http://www.gnu.org/copyleft/gpl.html.
15*  A copy is found in the textfile GPL.txt and important notices to the license
16*  from the author is found in LICENSE.txt distributed with these scripts.
17*
18*
19*  This script is distributed in the hope that it will be useful,
20*  but WITHOUT ANY WARRANTY; without even the implied warranty of
21*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22*  GNU General Public License for more details.
23*
24*
25*  This copyright notice MUST APPEAR in all copies of the script!
26***************************************************************/
27/*
28 * Javascript functions for TYPO3 extension freeCap CAPTCHA (sr_freecap)
29 *
30 */
31(function () {
32	SrFreecap = {
33
34		/*
35		 * Loads a new freeCap image
36		 *
37		 * @param string id: identifier used to uniiquely identify the image
38		 * @param string noImageMessage: message to be displayed if the image element cannot be found
39		 * @return void
40		 */
41		newImage: function (id) {
42			// extract image name from image source (i.e. cut off ?randomness)
43			var theImage = document.getElementById('tx_srfreecap_captcha_image_' + id);
44			var parts = theImage.src.split('&freecapSet');
45			theImage.src = parts[0] + '&freecapSet=' + Math.round(Math.random()*100000);
46		},
47
48		imageLinkOnClick: function(event) {
49			event.preventDefault();
50			var links = document.querySelectorAll('a[data-srfreecap-image]');
51			var link = links[0];
52			var fakeId = link.getAttribute('data-srfreecap-image');
53			link.blur();
54			SrFreecap.newImage(fakeId);
55			return false;
56		},
57		
58		/*
59		 * Plays the audio captcha
60		 *
61		 * @param string id: identifier used to uniquely identify the wav file
62		 * @param string wavUrl: url of the wave file generating script
63		 * @param string noPlayMessage: message to be displayed if the audio file cannot be rendered
64		 * @return void
65		 */
66		playCaptcha: function (id, wavUrl, noPlayMessage) {
67			if (document.getElementById) {
68				var theAudio = document.getElementById('tx_srfreecap_captcha_playAudio_' + id);
69				var url = wavUrl + '&freecapSet=' + Math.round(Math.random()*100000);
70				while (theAudio.firstChild) {
71					theAudio.removeChild(theAudio.firstChild);
72				}
73				var audioElement = document.createElement('audio');
74				if (audioElement.canPlayType) {
75					// HTML 5 audio
76					if (audioElement.canPlayType('audio/mpeg') === 'maybe' || audioElement.canPlayType('audio/mpeg') === 'probably') {
77						url = url.replace('formatName=wav', 'formatName=mp3');
78					}
79					audioElement.setAttribute('src', url);
80					audioElement.setAttribute('id', 'tx_srfreecap_captcha_playAudio_audio' + id);
81					theAudio.appendChild(audioElement);
82					audioElement.load();
83					audioElement.play();
84				} else {
85					url = url.replace('formatName=wav', 'formatName=mp3');
86					// In IE, use the default player for audio/mpeg, probably Windows Media Player
87					var objectElement = document.createElement('object');
88					objectElement.setAttribute('id', 'tx_srfreecap_captcha_playAudio_object' + id);
89					objectElement.setAttribute('type', 'audio/mpeg');
90					theAudio.appendChild(objectElement);
91					objectElement.style.height = 0;
92					objectElement.style.width = 0;
93					var parameters = {
94						autoplay: 'true',
95						autostart: 'true',
96						controller: 'false',
97						showcontrols: 'false'
98					};
99					for (var parameter in parameters) {
100						if (parameters.hasOwnProperty(parameter)) {
101							var paramElement = document.createElement('param');
102							paramElement.setAttribute('name', parameter);
103							paramElement.setAttribute('value', parameters[parameter]);
104							paramElement = objectElement.appendChild(paramElement);
105						}
106					}
107					objectElement.setAttribute('altHtml', '<a style="display:inline-block; margin-left: 5px; width: 200px;" href="' + url + '">' + (noPlayMessage ? noPlayMessage : 'Sorry, we cannot play the word of the image.') + '</a>');
108				}
109			} else {
110				alert(noPlayMessage ? noPlayMessage : 'Sorry, we cannot play the word of the image.');
111			}
112		},
113
114        audioLinkOnClick: function(event) {
115	        event.preventDefault();
116	        var links = document.querySelectorAll('a[data-srfreecap-audio],input[data-srfreecap-audio]');
117	        var link = links[0];
118			var fakeId = link.getAttribute('data-srfreecap-audio');
119			link.blur();
120			var audioUrl = link.getAttribute('data-srfreecap-audio-url');
121			var noPlayMessage = link.getAttribute('data-srfreecap-audio-noplay');
122			SrFreecap.playCaptcha(fakeId, audioUrl, noPlayMessage);
123			return false;
124		}
125	};
126	document.addEventListener('DOMContentLoaded', (event) => {
127		document.body.addEventListener('click', function(event) {
128		    if (event.target.closest('a[data-srfreecap-image]')) {
129		        event.stopImmediatePropagation();
130		        SrFreecap.imageLinkOnClick(event);
131		    }
132		    if (event.target.closest('a[data-srfreecap-audio],input[data-srfreecap-audio]')) {
133		        event.stopImmediatePropagation();
134		        SrFreecap.audioLinkOnClick(event);
135		    }
136		});
137	});
138})();

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.