PageSourceSearch

https://www.ihre-pvs.de/_assets/5649051d389af9f5df212331f807446a/J…/pvs_seminare_anmeldung.js?1693214626

js ihre-pvs.de collected 2026-10-09 22:39:38 UTC 3,574 bytes, 165 lines download raw bytes

1/**
2 * PvsSeminare module
3 *
4 * @module PvsSeminare
5 */
6(function PvsSeminare() {
7
8	/**
9	 * @class PvsSeminareAnmeldung
10	 * @constructor
11	 */
12	function PvsSeminareAnmeldung() {
13
14		/**
15		 * @property that
16		 * @type {PvsSeminareAnmeldung}
17		 */
18		var that = this;
19
20		/**
21		 * @property body
22		 * @private
23		 * @type {string}
24		 */
25		this.body = 'body';
26
27		/**
28		 * @property form
29		 * @private
30		 * @type {string}
31		 */
32		this.form = '#seminar-form';
33
34		/**
35		 * @property dataControl
36		 * @private
37		 * @type {string}
38		 */
39		this.dataControl = 'button[data-control]';
40
41		/**
42		 * @property hiddenClass
43		 * @private
44		 * @type {string}
45		 */
46		this.hiddenClass = 'hidden';
47
48		/**
49		 * @property disabledClass
50		 * @private
51		 * @type {string}
52		 */
53		this.disabledClass = 'disabled';
54
55		/**
56		 * @method init
57		 */
58		this.init = function () {
59			that.initDataControls();
60			$.validate();
61		};
62
63
64		/**
65		 * @method initDataControls
66		 */
67		this.initDataControls = function () {
68
69			$(that.body).on('click', that.dataControl, function (e) {
70				e.preventDefault();
71
72				var $this = $(this),
73					controlAction = $this.attr('data-control'),
74					target = $this.attr('data-control-target'),
75					container = $this.attr('data-control-container'),
76					$container = $('[data-container="' + container + '"]'),
77					$clonable = $container
78						.find('[data-control-selector-index="0"]')
79						.first(),
80					$clones = $container
81						.find('[data-control-selector="participant"]')
82						.not($clonable),
83					clonesCount = $clones.length;
84
85				// remove action
86				if (controlAction === 'remove') {
87					var $cloneToRemove = $container.find('[data-control-selector-index="' + target + '"]');
88
89					if ($cloneToRemove.length === 0) return;
90
91					$clones.not($cloneToRemove).each(function (index, clone) {
92
93						$(clone)
94							.attr('data-control-selector-index', index + 1)
95
96						$(clone)
97							.find('[data-control-target]')
98							.attr('data-control-target', index + 1);
99
100						$(clone)
101							.find('[data-control-count-increment]')
102							.attr('data-control-count-increment', index + 2)
103							.html(index + 2);
104					});
105
106					$cloneToRemove.detach();
107
108					if (clonesCount < 5) {
109						$(that.dataControl).show().removeClass(that.disabledClass);
110					}
111				}
112
113				// add action
114				if (controlAction === 'add' && $clonable.length && clonesCount < 4) {
115
116					if (clonesCount === 3) {
117						$this.hide().addClass(that.disabledClass);
118					}
119
120					var $clone = $clonable.clone(),
121						targetIndex = clonesCount + 1;
122
123					$clone
124						.attr('data-control-selector-index', targetIndex)
125						.removeClass(that.hiddenClass);
126
127					$clone
128						.find('[data-control-target]')
129						.attr('data-control-target', targetIndex);
130
131					$clone
132						.find('[data-control-count-increment]')
133						.attr('data-control-count-increment', targetIndex + 1)
134						.html(targetIndex + 1);
135
136					$clone
137						.find('[name][data-increase-selector="1"]')
138						.each(function () {
139							var $this = $(this), nameAttr = $this.attr('name'), idAttr = $this.attr('id');
140							if (typeof nameAttr !== typeof undefined && nameAttr !== false) {
141								$this.attr('name', nameAttr.replace(0, targetIndex));
142							}
143							if (typeof idAttr !== typeof undefined && idAttr !== false) {
144								$this.attr('id', idAttr.replace(0, targetIndex));
145							}
146							$this.prop('disabled', false);
147						});
148
149					$container.append($clone);
150				}
151			});
152		};
153
154
155		/**
156		 * init
157		 */
158		this.init();
159	}
160
161	$(document).ready(function () {
162		var pvsSeminareAnmeldung = new PvsSeminareAnmeldung();
163	});
164
165})();

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.