PageSourceSearch

https://reisebuero-preydel.de/wp-content/plugins/smg-customer-port…/Documents/scripts/script.js?ver=7.1

js reisebuero-preydel.de collected 2026-10-07 03:32:20 UTC 6,181 bytes, 210 lines download raw bytes

1window.jQuery(document).ready(function () {
2	var $ = window.jQuery;
3
4	function toggleSelect() {
5		$('.kupo-documents .kupo-select').find('svg').toggle();
6		$('.kupo-documents .kupo-select > ul').toggle('slow');
7	}
8
9	$('.kupo-document-type > header > .cupo_icon_toggle_opened').on('click', function() {
10		$(this).parent().parent().find('> ul').toggle('slow');
11		$(this).parent().find('> .cupo_icon_toggle_closed').toggle();
12		$(this).toggle();
13	});
14
15	$('.kupo-document-type > header > .cupo_icon_toggle_closed').on('click', function() {
16		$(this).parent().parent().find('> ul').toggle('slow');
17		$(this).parent().find('> .cupo_icon_toggle_opened').toggle();
18		$(this).toggle();
19	});
20
21	$('.kupo-documents .kupo-select > header').on('click', function() {
22		toggleSelect();
23	});
24
25	$(window).on('click', function(e) {
26		var kupoSelect = $('.kupo-documents .kupo-select');
27		var kupoSelectList = $('.kupo-documents .kupo-select > ul');
28
29		if (
30			kupoSelect[0]
31			&& kupoSelectList[0]
32			&& $(kupoSelectList).is(':visible')
33			&& !kupoSelect[0].isSameNode(e.target)
34			&& !kupoSelect[0].contains(e.target)
35		) {
36			toggleSelect();
37		}
38	});
39
40	$('.kupo-documents .kupo-select > ul > li').on('click', function() {
41		$(this).parent().parent().find('header > span').html($(this).html());
42
43		toggleSelect();
44
45		switch ($(this).attr('class')) {
46			case 'kupo-travel-filter-future':
47				$('.kupo-document-type.kupo-document-type-default').hide();
48				$('.kupo-document-type.kupo-document-type-travel.kupo-travel-future').show();
49				$('.kupo-document-type.kupo-document-type-travel.kupo-travel-past').hide();
50				break;
51
52			case 'kupo-travel-filter-past':
53				$('.kupo-document-type.kupo-document-type-default').hide();
54				$('.kupo-document-type.kupo-document-type-travel.kupo-travel-future').hide();
55				$('.kupo-document-type.kupo-document-type-travel.kupo-travel-past').show();
56				break;
57
58			case 'kupo-travel-filter-all':
59			default:
60				$('.kupo-document-type.kupo-document-type-default').show();
61				$('.kupo-document-type.kupo-document-type-travel.kupo-travel-future').show();
62				$('.kupo-document-type.kupo-document-type-travel.kupo-travel-past').show();
63				break;
64		}
65	});
66
67	$('.kupo-documents .kupo-search').on('submit', function(e, cupoTravelId = null) {
68		e.preventDefault();
69		e.stopPropagation();
70
71		$('.kupo-no_search_results').hide();
72		$('.kupo-document-type').each(function() {
73			$(this).show();
74			$(this).find('li').show();
75		});
76
77		var found = false;
78		var searchText = $('.kupo-documents .kupo-search input').val();
79
80		if (typeof searchText !== 'string' || searchText.trim().length === 0) {
81			return;
82		}
83
84		searchText = searchText.trim().toUpperCase();
85
86		$('.kupo-document-type').each(function() {
87			if (
88				cupoTravelId !== null && $(this).attr('data-container-no') !== cupoTravelId
89				|| (new RegExp('^\\d+$').test(searchText) && $(this).attr('data-container-no').indexOf(searchText) === -1)
90			) {
91				$(this).hide();
92				return;
93			}
94
95			if ($(this).html().toUpperCase().indexOf(searchText) === -1) {
96				$(this).hide();
97				return;
98			}
99
100			found = true;
101
102			if ($(this).find('ul').html().toUpperCase().indexOf(searchText) !== -1) {
103				$(this).find('li').each(function() {
104					if ($(this).html().toUpperCase().indexOf(searchText) === -1) {
105						$(this).hide();
106					}
107				});
108			}
109		});
110
111		if (found) {
112			$('.kupo-no_search_results').hide();
113		} else {
114			$('.kupo-no_search_results').show();
115		}
116	});
117
118	$('svg.kupo-close-document-iframe').on('click', function() {
119		$('#kupo-document-iframe').attr('src', '').hide();
120		$('#kupo-document-iframe-container').hide();
121	});
122
123	$('.kupo-document-status').on('click', function () {
124		openDocumentPreview($(this), true);
125	});
126
127	$('svg.cupo_icon_download').on('click', function () {
128		openDocumentPreview($(this), false);
129	});
130
131	const url = new URL(window.location);
132	const doc = url.searchParams.get('doc');
133	const signature = url.searchParams.get('signature');
134
135	if (doc !== '') {
136		openDocView(doc, signature);
137	}
138});
139
140function openDocView(documentId, signature) {
141	let btn = $(`.kupo-document[data-id="${documentId}"] svg.cupo_icon_download`);
142
143	if (signature) {
144		btn = $(`.kupo-document[data-id="${documentId}"][data-signed=""] .kupo-document-status`);
145	}
146
147	if (btn) {
148		btn.click();
149	}
150}
151
152function openDocumentPreview(clickedElement, sign = false) {
153	if (typeof cupo_documents_script === 'undefined') {
154		return;
155	}
156
157	if ($(clickedElement).parent().data('new-doc')) {
158		markDocumentAsPrinted($(clickedElement).parent().data('id'));
159	}
160
161	$('.kupo-documents-preloader').detach().appendTo('body').css('display', 'flex');
162
163	$.ajax({
164		type: 'POST',
165		url: cupo_documents_script.ajax_url,
166		data: {
167			'action': 'cupoDocumentSign',
168			'data': {document_id: $(clickedElement).parent().data('id')}
169		},
170		success: function (data) {
171			data = typeof data === 'string' ? JSON.parse(data) : data;
172
173			if (data && typeof data === 'object' && data.status === 'success') {
174				$('.kupo-documents-preloader').css('display', 'none');
175				$('#kupo-document-iframe-container').detach().appendTo('body');
176
177				if (sign) {
178					$('#kupo-document-iframe').attr('src', data.sign_url).show();
179				} else {
180					const documentDownloadUrl = new URL(location.protocol + '//' + location.host + '/portal/document-download/');
181					documentDownloadUrl.searchParams.append('documentName', $(clickedElement).parent().data('name'));
182					documentDownloadUrl.searchParams.append('documentId', $(clickedElement).parent().data('id'));
183					documentDownloadUrl.searchParams.append('noDownload', 'true');
184					documentDownloadUrl.searchParams.append('friendlyName', 'true');
185
186					$('#kupo-document-iframe').attr('src', documentDownloadUrl.toString()).show();
187				}
188				$('#kupo-document-iframe-container').show();
189			}
190		}
191	});
192}
193
194function markDocumentAsPrinted(documentID) {
195	$.ajax({
196		type: 'POST',
197		url: cupo_documents_script.ajax_url,
198		data: {
199			'action': 'cupoMarkDocumentAsSeen',
200			'data': { document_id: documentID }
201		},
202		success: function (data) {
203			data = typeof data === 'string' ? JSON.parse(data) : data;
204
205			if (data && typeof data === 'object' && data.status !== 'success') {
206				// ?? maybe a todo ??
207			}
208		}
209	});
210}

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.