PageSourceSearch

https://diaphanes.net/js_NE/d_service.js?v=13

js diaphanes.net collected 2026-10-02 05:29:04 UTC 29,980 bytes, 1,109 lines download raw bytes

1/**
2 * build by rantoni 2011
3 * 
4 * service functions for diaphanes shop
5 * 
6 */
7
8$(document).ready(function() {
9	d_service_check_bestellung();
10	// d_service_check_and_cover();
11	d_service_check_cover_bestellung();
12	d_service_check_bestelluebersicht();
13	//Count Cart Items
14	ne_service_update_carditems();
15});
16
17function d_service_isLightbox(){
18	return $('BODY.df-lightbox').length > 0;
19}
20
21function d_service_check_and_cover(){
22	$.get(URLBASE + 'service/checklogin', function(data) {
23		if (data == 1){
24			d_service_uncover_bestellung();
25		} else {
26			d_service_cover_bestellung();
27		}
28	});
29	
30}
31
32// prüft ob der Warenkorb leer ist
33function d_service_check_bestelluebersicht(){
34	console.log('d_service_check_bestelluebersicht', $('.js-card-empty').length  );
35	d_service_remove_error('chk_bestelluebersicht');
36	if ($('.js-card-empty').length > 0){
37		d_service_set_error('chk_bestelluebersicht');
38		$('#card').find('li').addClass('alert-danger');
39	} else {
40		d_service_remove_error('chk_bestelluebersicht');
41		$('#card').find('li').removeClass('alert-danger');
42	}
43}
44
45function d_service_check_bestellung(){
46	var isLightbox = ($('BODY.df-lightbox').length) ? true : false;
47	
48	if (isLightbox) {
49		if (parent.$('.divinshop').length <= 0) {
50			$('.shoponly').remove();
51			$('.notinshop').show();
52		} else {
53			$('.shoponly').show();
54			$('.notinshop').remove();
55		}
56	} else {
57		if ($('.divinshop').length <= 0) {
58			$('.shoponly').remove();
59			$('.notinshop').show();
60		} else {
61			$('.shoponly').show();
62			$('.notinshop').remove();
63		}
64	}
65	
66	if ($('#divinregistry').length > 0 ) {
67		$('.noregistry').remove();
68	} 
69	
70	//if ($('#divlieferadresse').length <= 0 ){$('.lieferonly').remove();}
71	//if ($('#smallanmeldung').length <= 0 )	{$('.smallonly').remove();}
72	//if ($('#divanmeldung').length <= 0 )	{$('.bigonly').remove();}
73	//$('#spalte2').masonry( 'reload' );
74	//reloadMasonry('#spalte2');
75}
76
77function d_service_load_smallcard(){
78	if ($('#d-warenkorb').length){
79		$.get(URLBASE + 'service/divsmallcard', function(data) {
80			$('#smallcard-autorenrabatt').remove();
81			$('#d-warenkorb .d-box-off').html(data);
82			$('#spalte2').masonry( 'reload' );
83			if ($('#smallcard-autorenrabatt').length){
84				$('#smallcard-header').after($('#smallcard-autorenrabatt'));
85			}
86			if ($('.emptycard').length){
87				$('#d-warenkorb .d-box-icon-less').trigger('click');
88			} else {
89				$('#d-warenkorb .d-box-icon-more').trigger('click');
90			}
91		});
92	}
93}
94
95function ne_service_update_carditems() {
96	if ($('SPAN#js-cart-items').length) {
97		//Count Cart Items
98		$.ajax({
99			url: URLBASE + 'service/ajaxCardCount',
100			success: function(data) {
101				var cartItems = (data > 0) ? data : '';
102				$('SPAN#js-cart-items').text(cartItems);
103			}
104		});
105	}
106}
107
108function openModal(target) {
109	$('#df-modal').load(target, function() {
110		$(this)
111			.modal({
112				backdrop: 'static',
113				keyboard: false
114			})
115			.modal('show');
116	});
117	
118}
119
120
121
122function d_service_load_card() {
123	var isLightbox = ($('BODY.df-lightbox').length) ? true : false;
124	if (isLightbox) {
125		if (parent.$('#card').length) {
126			$.get(URLBASE + 'service/divcard', function(data) {
127				parent.$('#card').html(data);
128				//d_service_check_bestellung();
129			});
130		}
131	} else {
132		if ($('#card').length) {
133			$.get(URLBASE + 'service/divcard', function(data) {
134				$('#card').html(data);
135				// prüft ob der Warenkorb leer ist
136				d_service_check_bestelluebersicht();
137				//d_service_check_bestellung();
138			});
139		}
140	}
141}
142
143function d_service_load_kontakt(nachricht){
144	$.get(URLBASE + 'service/divkontaktinfo', function(data) {
145		$('#divkontaktform').html(data);
146		$('#js-submit-kontaktform').hide();
147		$('#js-close-kontaktform').toggleClass('btn-default btn-primary');
148	});
149}
150
151function d_service_load_rezensionen(){
152	$.get(URLBASE + 'service/divrezensioneninfo', function(data) {
153		$('#divrezensionen').replaceWith(data);
154	});
155}
156
157function d_service_handle_gfm(nachricht){
158	$.get(URLBASE + 'autor/divgfminfo', function(data) {
159		$('#divgfmform').after(data);
160		$('#divgfmform').remove();
161		//d_service_replace_div('divsmalldigital');
162		//$('#divsmallanmeldung').trigger('click');
163	});
164}
165
166function d_service_handle_logoutlogin_gfm(){
167	if ($('#divgfmintro').length)
168	{
169		// console.log('#divgfmintro FOUND');
170		$('#divgfmform').remove();
171		$('#divgfminfo').remove();
172		$.get(URLBASE + 'autor/divgfmintro', function(data) {
173			$('#divgfmintro').replaceWith(data);
174		});
175		$.get(URLBASE + 'autor/divgfmform', function(data) {
176			$('#divgfmintro').after(data);
177		});
178	} else {
179		return;
180		//console.log('#divgfmintro NOT FOUND');
181	}
182}
183
184
185function d_service_load_rights(nachricht){
186	if ($('#divrightsinfo').length)
187	{
188		$.get(URLBASE + 'service/divrightsinfo', function(data) {
189			$('#divrightsinfo').replaceWith(data);
190			$('#divrightsinfonachricht_nachricht').html(nachricht);
191		});
192	}
193	else if ($('#divrightsform').length)
194	{
195		$.get(URLBASE + 'service/divrightsinfo', function(data) {
196			$('#divrightsform').parent().append(data);
197			$('#divrightsinfonachricht_nachricht').html(nachricht);
198		});
199	}
200}
201
202function d_service_load_adressbuch(){
203	if ($('#divadressbuch').length){
204		$.get(URLBASE + 'service/divadressbuch', function(data) {
205			$('#divadressbuch').replaceWith(data);
206			parent.$.fancybox.update();
207		});
208	}
209}
210
211
212function d_service_load_lieferadresseform(){
213	if ($('#divlieferadresse').length){
214		$.get(URLBASE + 'service/divlieferadresseform', function(data) {
215			$('#divlieferadresse').replaceWith(data);
216			d_service_check_bestellung();
217		});
218	}
219}
220
221function d_service_load_versandform() {
222	var isLightbox = ($('BODY.df-lightbox').length) ? true : false;
223	if (isLightbox) {
224		if (parent.$('#versandform').length) {
225			$.get(URLBASE + 'service/divversandform', function(data) {
226				parent.$('#versandform').html(data);
227			});
228		}
229	} else {
230		if ($('#versandform').length) {
231			$.get(URLBASE + 'service/divversandform', function(data) {
232				$('#versandform').html(data);
233			});
234		}
235	}
236}
237
238function d_service_load_zahlungsart() {
239	var isLightbox = ($('BODY.df-lightbox').length) ? true : false;
240	if (isLightbox) {
241		if (parent.$('#divzahlungsart').length){
242			$.get(URLBASE + 'service/divzahlungsart', function(data) {
243				parent.$('#divzahlungsart').replaceWith(data);
244			});
245		}
246	} else {
247		if ($('#divzahlungsart').length){
248			$.get(URLBASE + 'service/divzahlungsart', function(data) {
249				$('#divzahlungsart').replaceWith(data);
250			});
251		}
252	}
253}
254
255function d_service_load_divadresse(adressetype){
256	if ($('#div'+adressetype).length){
257		$.get(URLBASE + 'service/divadresse/'+adressetype, function(data) {
258			$('#div'+adressetype).replaceWith(data);
259			d_service_check_bestellung();
260		});
261	}
262}
263
264function d_service_load_divlieferadresse(){
265	$.get(URLBASE + 'service/divlieferadresse', function(data) {
266		if (d_service_isLightbox()){
267			parent.$('#divlieferadresse').replaceWith(data);
268		} else {
269			$('#divlieferadresse').replaceWith(data);
270		}
271		d_service_check_cover_bestellung();
272	});
273}
274function d_service_load_divrechnungsadresse(){
275	$.get(URLBASE + 'service/divrechnungsadresse', function(data) {
276		if (d_service_isLightbox()){
277			parent.$('#divrechnungsadresse').replaceWith(data);
278		} else {
279			$('#divrechnungsadresse').replaceWith(data);
280		}
281	});
282}
283
284function d_service_load_anmeldungform(){
285	if ($('#divanmeldung').length){
286		$.get(URLBASE + 'service/divanmeldungform', function(data) {
287			$('#divanmeldung').replaceWith(data);
288			d_service_check_bestellung();
289			//$('#spalte2').masonry( 'reload' );
290			//d_diaphanes_set_navi_hover('#divanmeldung');
291		});
292	} else if ($('#divsmallanmeldung').length) {
293		$.get(URLBASE + 'service/divsmallanmeldungform/open', function(data) {
294			$('#divsmallanmeldung').replaceWith(data);
295			d_service_check_bestellung();
296			//$('#spalte2').masonry( 'reload' );
297			//d_diaphanes_set_navi_hover('#divsmallanmeldung');
298		});
299	}
300}
301function d_service_passwort_vergessen(data){
302	if (!data) data = '';
303	if ($('#divanmeldung').length){
304		$.get(URLBASE + 'service/divpasswortvergessenform/'+data, function(data) {
305			$('#divanmeldung').replaceWith(data);
306			$('#divpasswortvergessen').attr('id','divanmeldung');
307		});
308	} else if ($('#divsmallanmeldung').length) {
309		$.get(URLBASE + 'service/divsmallpasswortvergessenform/'+data, function(data) {
310			$('#divsmallanmeldung').replaceWith(data);
311			$('#divsmallpasswortvergessen').attr('id','divsmallanmeldung');
312		});
313	}
314}
315function d_service_passwort_vergessen_close(){
316	d_service_load_anmeldungform();
317}
318
319function d_service_load_anmeldung(){
320	if ($('#divanmeldung').length){
321		$.get(URLBASE + 'service/divanmeldung', function(data) {
322			$('#divsmallanmeldung').replaceWith(data);
323			//d_diaphanes_set_navi_hover('#divanmeldung');
324			d_service_check_bestellung();
325		});
326	} else if ($('#divsmallanmeldung').length) {
327		$.get(URLBASE + 'service/divsmallanmeldungform', function(data) {
328			$('#divsmallanmeldung').replaceWith(data);
329			d_service_check_bestellung();
330			$('#spalte2').masonry( 'reload' );
331			//d_diaphanes_set_navi_hover('#divsmallanmeldung');
332		});
333	}
334}
335
336function d_service_buy(format_id,number){
337	number = typeof(number) != 'undefined' ? number : $('#number_'+format_id).val();
338	if (typeof(number) != 'undefined' ) {
339		url = URLBASE + 'service/cardset/'+format_id+'/'+number;
340	} else {
341		url = URLBASE + 'service/cardbuy/'+format_id;	
342	}
343
344	$.get(url, function(data) {
345		//Count Cart Items
346		ne_service_update_carditems();
347		
348		//Show Modal Buy
349		openModal(URLBASE + 'service/modal/buy/format/' + format_id);
350	});
351	return false;
352}
353
354function d_service_login(type){
355	//Show Modal Login
356	openModal(URLBASE + 'service/modal/login' + (type?'/omt|' + type:''));
357	//openModal(URLBASE + 'service/modal/login');
358}
359
360function d_service_buy_book(projekt_id,number){
361	number = typeof(number) != 'undefined' ? number : $('#number_'+projekt_id).val();
362	if (typeof(number) != 'undefined' ) {
363		url = URLBASE + 'service/cardsetbook/'+projekt_id+'/'+number;
364	} else {
365		url = URLBASE + 'service/cardbuybook/'+projekt_id;	
366	}
367	
368	$.get(url, function(data) {
369		d_service_load_smallcard();
370	});
371	return false;
372}
373
374function d_service_set(format_id,number,simple){
375	number = typeof(number) != 'undefined' ? number : $('#number_'+format_id).val();
376	url = URLBASE + 'service/cardset/'+format_id+'/'+number;
377	$.get(url, function(data) {
378		if ( typeof(simple) == 'undefined' || simple != 1){
379			$.get(URLBASE + 'service/checklogin', function(data) {
380				if ($('#anmeldung').length || data != 1){
381					d_service_load_anmeldungform();
382				}		
383			});
384			d_service_load_card();
385			d_service_load_versandform();
386			d_service_load_zahlungsart();
387		}
388	});
389	return false;
390}
391
392function d_service_add_buy(format_id,simple){
393	d_service_set(format_id,$('#number_'+format_id).val(),simple);
394}
395
396function d_service_del_buy(format_id){
397	d_service_set(format_id,0);
398}
399
400function d_service_set_lbaddition(format_id,number,simple){
401	var inShop = (parent.$('BODY.df-service-bestellung').length) ? true : false;
402	console.log(inShop);
403	
404	number = typeof(number) != 'undefined' ? number : $('#number_'+format_id).val();
405	url = URLBASE + 'service/cardset/'+format_id+'/'+number;
406	
407	$.get(url, function(data) {
408		if ( typeof(simple) == 'undefined' || simple != 1){		
409			$.get(URLBASE + 'service/divwarenkorb', function(data) {
410				$('#warenkorbuebersicht').replaceWith(data);
411				parent.$.fancybox.update();
412			});
413			
414			if (inShop) {
415				d_service_load_card();
416				d_service_load_versandform();
417				d_service_load_zahlungsart();
418			}
419		}
420	});
421	return false;
422}
423
424function d_service_add_buy_lbaddition(format_id,simple){
425	d_service_set_lbaddition(format_id,$('#number_'+format_id).val(),simple);
426}
427
428function d_service_del_buy_lbaddition(format_id){
429	d_service_set_lbaddition(format_id,0);
430	
431}
432
433function d_service_set_cardaddition(key,number,simple){
434	number = typeof(number) != 'undefined' ? number : $('#cardaddition_'+key).val();
435	url = URLBASE + 'service/cardadditionset/'+key+'/'+number;
436	
437	$.get(url, function(data) {
438		if ( typeof(simple) == 'undefined' || simple != 1){
439			d_service_load_card();
440			d_service_load_versandform();
441		}
442	});
443	return false;
444}
445
446function d_service_add_cardaddition(key,simple){
447	d_service_set_cardaddition(key,$('#cardaddition_'+key).val(),simple);
448}
449
450function d_service_del_cardaddition(key){
451	d_service_set_cardaddition(key,0,0);
452}
453
454function d_service_versand(){
455	format_id = $('INPUT[name=versandart]:checked').val();
456	$.post(URLBASE + 'service/changeversand/'+format_id, function(data) {
457		d_service_load_card();
458	});
459	return false;
460}
461
462function d_service_init_form(form_id){
463	$("#"+form_id+" input").each(function(i){
464		d_service_init_input_field($(this).attr('id'));
465	}); 
466	$("#"+form_id+" select").each(function(i){
467		d_service_init_select_field($(this).attr('id'));
468	}); 
469	$("#"+form_id+" textarea").each(function(i){
470		d_service_init_input_field($(this).attr('id'));
471	}); 
472}
473
474function d_service_reset_form(form_id){
475	$("#"+form_id+" input").each(function(i){
476		if (! $(this).hasClass('dontreset')){
477			$(this).val('');
478		}
479	}); 
480	$("#"+form_id+" select").each(function(i){
481		if (! $(this).hasClass('dontreset')){
482			$(this).val('');
483		}
484	}); 
485	$("#"+form_id+" textarea").each(function(i){
486		if (! $(this).hasClass('dontreset')){
487			$(this).val('');
488		}
489	}); 
490	d_service_init_form(form_id);
491}
492
493function d_service_validate_form(form_id){
494	var validate = true;
495	switch(form_id)
496	{
497	case 'smallanmeldung':
498	case 'registrierung':
499		if (		$("#"+form_id+"_passwort").length > 0 
500				&&  $("#"+form_id+"_passwortkontrolle").length > 0 
501				&&  $("#"+form_id+"_passwort").val() != $("#"+form_id+"_passwortkontrolle").val() ){
502			validate = false;
503			$("#"+form_id+"_passwort").addClass('alert-danger');
504			$("#"+form_id+"_passwortkontrolle").addClass('alert-danger');
505		}
506		break;
507	case 'anmeldung':
508		console.log(form_id);
509		/*
510//		
511		login = $("#"+form_id+" input:radio:checked").val();
512		if (!login){
513			$("#"+form_id+" .js-check-radio").parent().css('background-color','MistyRose');
514			validate = false;
515			$("#"+form_id+"_passwort").removeClass('js-required');
516		} else {
517			$("#"+form_id+" .js-check-radio").parent().css('background-color','');
518			if (login == 0 ){
519				$("#"+form_id+"_passwort").addClass('js-required');
520			} else {
521				$("#"+form_id+"_passwort").removeClass('js-required');
522				$("#"+form_id+"_passwort").parent().css('background-color','');
523			}
524		}
525		*/
526		break;
527	case 'form_rezensionen': 
528		// das muss asycron laufen 
529		if (!d_service_submit_form_async('lieferadresse')){
530			validate = false;
531		}
532		if (form_id == 'form_rezensionen') {
533			if ($("#table_rezensionen > li").length <= 0){
534				validate = false;
535				$('#rezension_titel').addClass('alert-danger');
536			} else {
537				$('#rezension_titel').removeClass('alert-danger');
538			}
539		}
540		break;
541	case 'kontaktform':
542		d_service_unload_div('divkontaktinfo');
543		d_service_unload_div('divkontaktinfonachricht');
544		break;
545		
546	case 'rightsform':
547		d_service_unload_div('divrightsinfo');
548		d_service_unload_div('divrightsinfonachricht');
549		break;
550		
551	case 'newsletter':
552		 //$('#divnewsletter_msg').hide();
553		 $('#divnewsletter-error').show();
554		 break;
555	}
556	$("#"+form_id+" .js-required").each(function(i){
557		var name = $(this).attr('name');
558		var init = initials[name];
559		$(this).val($.trim($(this).val()));
560		if ($(this).val() == init || $.trim($(this).val()) == '' ){
561			validate = false;
562			$(this).addClass('alert-danger');
563		}
564	});
565	$("#"+form_id+" .js-val-email").each(function(i){
566		if (!d_service_validate_email($(this).val())){
567			validate = false;
568			$(this).addClass('alert-danger');
569		}
570	});
571	$("#"+form_id+" .js-val-number").each(function(i){
572		if (!d_service_validate_number($(this).val())){
573			validate = false;
574			$(this).addClass('alert-danger');
575		}
576	});
577	$("#"+form_id+" .js-chk-required").each(function(i){
578		if (! $(this).is(':checked')){
579			validate = false;
580			$(this).closest('LI').addClass('alert-danger');
581		} else {
582			$(this).closest('LI').removeClass('alert-danger');
583		}
584	});
585	if ($("#"+form_id+" .js-check-equal-pass").length){
586		var tmpVal = '';
587		$("#"+form_id+" .js-check-equal-pass").removeClass('alert-danger');
588		$("#"+form_id+" .js-check-equal-pass").each(function(i){
589			if (tmpVal == ''){
590				tmpVal = $(this).val();
591			} 
592			if (tmpVal != $(this).val()){
593				validate = false;
594				$("#"+form_id+" .js-check-equal-pass").addClass('alert-danger');
595			}
596		});
597	}
598	// No HTML in the Formular allowed
599	showalert = false;
600	$("#"+form_id+" input"+",#"+form_id+" textarea").each(function(i){
601		if ($(this).val().match(/<(\w+)((?:\s+\w+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/)) {
602			validate	= false;
603			showalert	= true;
604			$(this).addClass('alert-danger');
605		}
606	});
607	if (showalert){
608		d_alertErrorCode(1004);
609	}
610	if (validate){
611		$("#"+form_id+" .js-check-initials").each(function(i){
612			var name = $(this).attr('name');
613			var init = initials[name];
614			if ($(this).val() == init){
615				 $(this).val('');
616			}
617		});
618	}
619	if(validate) {
620		d_service_remove_error(form_id);
621	} else {
622		d_service_set_error(form_id);
623	}
624	return validate;
625}
626
627function d_service_handlediv_after_submit(form_id,data){
628	type = $("#"+form_id).attr( 'action' );
629	console.log('d_service_handlediv_after_submit');
630	console.log(form_id);
631	switch(form_id)
632	{
633	case 'smallanmeldung':
634		console.log(data);
635		console.log( $('#smallanmeldung input[name="login"]').length );
636		var l = $('#smallanmeldung input[name="login"]').val() ;
637		if (l >= 0 && data == 'success'){ // wenn login Status != -1 (hier wird nur die E-Mail überprüft) und success vorliegt Seite neu laden
638			localStorage.setItem('loginReload',true);
639			location.reload(); 
640		} else {
641			$.get(URLBASE + 'service/divsmallanmeldung', function(data) {
642				d_service_handlelogin();
643				$('#divsmallanmeldung').replaceWith(data);
644				return false;
645			});
646			
647		}
648		
649		break;
650	case 'spracheinstellungen':
651		console.log(data);
652		location.reload(); 
653		break;
654	case 'registrierung':
655		console.log(data);
656		console.log( $('#registrierung input[name="login"]').length );
657		var l = $('#registrierung input[name="login"]').val() ;
658		if (l >= 0 && data == 'success'){ 
659			d_service_replace_div('divanmeldung');
660			d_service_replace_div('divregistrierung');
661		}
662		
663		break;
664	case 'anmeldung':
665		$.get(URLBASE + 'service/divanmeldung', function(data) {
666			d_service_handlelogin();
667			$('#divanmeldung').replaceWith(data);
668			d_service_load_divlieferadresse();
669			d_service_load_zahlungsart();
670			d_service_load_versandform();
671			d_service_load_card();
672			d_service_replace_div('divregistrierung');
673			d_service_uncover_bestellung();
674			d_service_replace_div('divkaufen');
675			return false;
676		});
677		
678		break;
679	case 'lieferadresse':
680		d_service_load_divlieferadresse();
681		d_service_load_divrechnungsadresse();
682			//d_diaphanes_set_navi_hover('#divlieferadresse');
683		d_service_load_card();
684		d_service_load_versandform();
685		//d_service_load_adressbuch();
686		d_service_load_zahlungsart();
687		d_service_uncover_bestellung();
688		break;
689	case 'rechnungsadresse':
690		d_service_load_divlieferadresse();
691		d_service_load_divrechnungsadresse();
692
693		//d_diaphanes_set_navi_hover('#divrechnungsadresse');
694		d_service_load_divlieferadresse();
695		d_service_load_card();
696		d_service_load_versandform();
697		//d_service_load_adressbuch();
698		d_service_load_zahlungsart();
699		break;
700	case 'addadresse':
701		d_service_load_adressbuch();
702		//d_service_check_bestellung();
703		break;
704	case 'zahlungsart':
705		d_service_replace_div('divzahlungsart');
706		d_service_replace_div('divpayone');
707		break;
708	case 'form_filter':
709		break;
710	case 'form_rezensionen':
711		d_service_load_rezensionen();
712		d_service_reset_form('form_rezensionen');
713		//d_service_replace_div('divrezensionen');
714		//d_service_replace_div('divsmallrezensionen');
715		//d_service_show_div('divrezensionen_status');
716		break;
717	case 'passwortvergessen':
718		if (data == 1){
719			d_service_passwort_vergessen(data);
720		} else {
721			d_service_passwort_vergessen_close();
722		}
723		break;
724	case 'passwortaendern':
725		$.get(URLBASE + 'service/divpasswortaendernform/'+data, function(data) {
726			//$('#divpasswortaendern').replaceWith(data);
727			return false;
728		});
729		break;
730	case 'kontoloeschen':
731		if (data == 2) { // Konto ist gelöscht 
732			location.href = URLBASE + 'service/registrieren';
733			return false;
734		}
735		$.get(URLBASE + 'service/divkontoloeschenform/'+data, function(data) {
736			$('#divkontoloeschen').replaceWith(data);
737			return false;
738		});
739		
740		break;
741	case 'kontaktform':
742		nachricht = $('#kontaktform_nachricht').val();
743		d_service_load_kontakt(nachricht);
744		d_service_reset_form('kontaktform');
745		break;
746	case 'gfmform':
747		d_service_handle_gfm();
748		break;
749	case 'rightsform':
750		nachricht = $('#rightsform_nachricht').val();
751		d_service_load_rights(nachricht);
752		d_service_reset_form('rightsform');
753		break;
754	case 'newsletter':
755		console.log(data);
756		/*
757		if (data == 1){
758			$('FORM#newsletter').replaceWith('<div class="df-box-article"><p>
758' + d_service_newsletter_anmelden_text + '</p></div>');
759		} else if(data == 0) {
760			$('FORM#newsletter').replaceWith('<div class="df-box-article"><p>' + d_service_newsletter_abmelden_text + '</p></div>');
761		}
762		*/
763		break;
764	case 'smallnewsletter':
765		console.log(data);
766		var d = JSON.parse(data);
767		$('#smallnewsletter').hide();
768		$('#js-newsletter-msg-ul').show();
769		$('#js-newsletter-msg-div').html(d.msgMsg);
770		$('#js-submit-newsletter').hide();
771		break;
772	case 'merkenliste':
773		//jAlert(d_service_msg_merkenliste);
774		break;
775	case 'newsletterfull':
776		//jAlert(d_service_msg_newsletterfull);
777		break;
778	case 'filterfull':
779		//jAlert(d_service_msg_filterfull);
780		break;
781	default:
782		if (form_id.substring(0, 8) == 'adresse_'){
783			$.get(URLBASE + 'service/divadresse/'+form_id, function(data) {
784				$('#div'+form_id).replaceWith(data);
785				parent.$.fancybox.update();
786				d_service_load_divlieferadresse();
787				d_service_load_divrechnungsadresse();
788				d_service_load_card();
789				d_service_load_versandform();
790				d_service_load_zahlungsart();
791				d_service_replace_div('divkaufen');
792				return false;
793			});
794		} 
795	}
796	return false;
797}
798function d_service_handlediv_after_submit_error(form_id,data){
799	switch(form_id)
800	{
801	case 'smallanmeldung':
802	case 'anmeldung':
803		d_service_unload_div('divfilter');
804		console.log(data);
805		if (data == 0){
806			 code = 1001;
807s		} else if (data == 1){
808			 code = 1002;
809		} else {
810			 code = 1003;
811		}
812		d_getErrorCode(code, function (text) { 
813			console.log('showERROR code');
814			$('#divsmallanmeldung').find('.alert').addClass( 'alert-danger' ); 
815			$('#divsmallanmeldung').find('.alert .df-box-paragraph').html( text ); 
816		} );
817		break;
818	case 'gfmform':
819		var e = data.split("_"); 
820		d_alertErrorCode(e[1]);
821		break;
822	default:
823		console.log('No handling defined in d_service_handlediv_after_submit_error for ' + form_id);
824	}
825	return false;
826}
827
828function d_service_adresse_add(){
829	$.get(URLBASE + 'service/divaddadresseform', function(data) {
830		$('#divaddadresse').replaceWith(data);
831		parent.$.fancybox.update();
832		return false;
833	});
834	return false;
835}
836
837function d_service_adresse_edit(form_id){
838	switch(form_id)
839	{
840	case 'lieferadresse':
841		d_service_load_lieferadresseform();
842		return false;
843		break;
844	case 'rechnungsadresse':
845		$.get(URLBASE + 'service/divrechnungsadresseform', function(data) {
846			$('#divrechnungsadresse').replaceWith(data);
847			return false;
848		});
849		break;
850	default:
851		$.get(URLBASE + 'service/divadresseform/'+form_id, function(data) {
852			$('#div'+form_id).replaceWith(data);
853			parent.$.fancybox.update();
854			return false;
855		});
856		break;
857	}
858	return false;
859}
860
861function d_service_adresse_del(form_id,confirmtext){
862	var r = confirm(confirmtext);
863	if (r == true) {
864		d_service_adresse_del_real(form_id);
865	}
866	/*
867	jConfirm(confirmtext,'',function(r){
868			if (r) {d_service_adresse_del_real(form_id);} 
869		});
870	*/
871}
872	
873function d_service_adresse_del_real(form_id){
874	switch(form_id)
875	{
876	case 'lieferadresse':
877		$.get(URLBASE + 'service/deladresse/lieferadresse', function(data) {
878			d_service_replace_div('divlieferadresse');
879			// d_service_load_lieferadresseform();
880			d_service_load_card();
881			d_service_load_versandform();
882			d_service_load_adressbuch();
883			return false;
884		});
885		break;
886	case 'rechnungsadresse':
887		$.get(URLBASE + 'service/deladresse/rechnungsadresse', function(data) {
888			//d_service_load_rechnungsadresseform();
889			d_service_replace_div('divrechnungsadresse');
890			d_service_load_card();
891			d_service_load_versandform();
892			d_service_load_adressbuch();
893			return false;
894			
895			/*
896			d_service_load_card();
897			d_service_load_versandform();
898			d_service_load_adressbuch();
899			return false;
900			*/
901		});
902		break;
903	default:
904		if (form_id.substring(0, 8) == 'adresse_'){
905			$.get(URLBASE + 'service/deladresse/'+form_id, function(data) {
906				if (data == 'lieferadresse' || data == 'rechnungsadresse'){
907					d_service_replace_div('divlieferadresse');
908					d_service_replace_div('divrechnungsadresse');
909					d_service_load_card();
910					d_service_load_versandform();
911				} 
912				d_service_load_adressbuch();
913				return false;
914			});
915		} else {
916			console.log('No handling defined in d_service_handlediv_after_submit for ' + form_id);
917		}
918		break;
919	}
920	return false;
921}
922
923function d_service_adresse_to_lieferadresse(adresse_id){
924	$.get(URLBASE + 'service/changeadresse/lieferadresse/'+adresse_id, function(data) {
925		d_service_load_adressbuch();
926		d_service_load_card();
927		d_service_load_versandform();
928		d_service_load_zahlungsart();
929		d_service_replace_div('divlieferadresse');
930		d_service_replace_div('divrechnungsadresse');
931		return false;
932	});
933	
934}
935
936function d_service_adresse_to_rechnungsadresse(adresse_id){
937	$.get(URLBASE + 'service/changeadresse/rechnungsadresse/'+adresse_id, function(data) {
938		d_service_load_adressbuch();
939		d_service_replace_div('divrechnungsadresse');
940		d_service_load_card();
941		d_service_load_versandform();
942		d_service_load_zahlungsart();
943		return false;
944	});
945}
946
947function d_service_submit_form_zahlungsart(){
948
949	var sel = $('#z_art').val();
950	if (sel){
951		window['pepr_payone_' + sel + '_check']();
952	} else {
953		d_service_submit_form('zahlungsart');
954	}
955	
956}
957
958function d_service_check_all(url){
959	d_service_submit_form_zahlungsart();
960	d_service_submit_form('anmeldung');
961	d_service_submit_form('lieferadresse');
962	d_service_submit_form('rechnungsadresse');
963	pepr_watchdog('CHECK ALL');
964	$('body').ajaxStop(function() {
965		// console.log(url);
966		setTimeout(function(){
967			if (d_service_var_errors.length <= 0){
968				$(location).attr('href',url);
969			} else {
970				console.log('ERROR: ' + d_service_var_errors.length);
971			}
972		}, 500 ); 
973		
974	});
975}
976
977function d_service_logout(){
978	$.get(URLBASE + 'service/logout', function(data) {
979		d_service_handlelogout();
980		location.reload();
981		return false;
982	});
983}
984
985function d_service_handlelogin(){
986	$('.show_not_loggedin').hide();
987	$('.show_loggedin').show();
988	// Throw custom events
989	$(document).trigger('d_login',[true]);
990}
991
992function d_service_handlelogout(){
993	$('.show_not_loggedin').show();
994	$('.show_loggedin').hide();
995	// Throw custom events
996	$(document).trigger('d_logout',[true]);
997}
998
999function d_service_logout_url(url){
1000	$.get(URLBASE + 'service/logout', function(data) {
1001		d_service_load_anmeldungform();
1002		$(location).attr('href',url);
1003	});
1004}
1005
1006function d_service_cover_bestellung(){
1007	$( document ).ajaxStop(function() {
1008		setTimeout( function(){ d_service_uncover_bestellung(); }, 500 ); 
1009	});
1010	d_service_check_cover_bestellung();
1011//	d_service_check_cover_bestellung();
1012}
1013
1014function d_service_uncover_bestellung(){
1015	$( document ).ajaxStop(function() {
1016		setTimeout( function(){ d_service_uncover_bestellung(); }, 500 ); 
1017	});
1018	d_service_check_cover_bestellung();
1019}
1020
1021function d_service_check_cover_bestellung(){
1022	var loggedIN = false;
1023	var hasLieferadresse = false;
1024	if (d_service_isLightbox()){
1025		loggedIN = parent.$('.js-u').length > 0;
1026		hasLieferadresse = parent.$('.js-has-lieferadresse').length > 0;
1027	} else {
1028		loggedIN = $('.js-u').length > 0;
1029		hasLieferadresse = $('.js-has-lieferadresse').length > 0;
1030	}
1031	if ( loggedIN ) {
1032		boxUnCover('divlieferadresse');
1033	} else {
1034		boxCover('divlieferadresse');
1035	}
1036	console.log('js-has-lieferadresse - ' + hasLieferadresse );
1037	if ( hasLieferadresse ){
1038		boxUnCover('divrechnungsadresse');
1039		boxUnCover('versandart');
1040		boxUnCover('divzahlungsart');
1041		boxUnCover('bestelluebersicht');
1042		boxUnCover('divregistrierung');
1043		boxUnCover('divkaufen');
1044	} else {
1045		boxCover('divrechnungsadresse');
1046		boxCover('versandart');
1047		boxCover('divzahlungsart');
1048		boxCover('bestelluebersicht');
1049		boxCover('divregistrierung');
1050		boxCover('divkaufen');
1051	}
1052}
1053
1054/*
1055 * neue Funktion löst den Kauf auf auf der Kasse ( 'Jetzt kaufen' Button )
1056 */
1057function d_service_buynow(){
1058	console.log('BUY NOW!');
1059	// lieferadresse, wenn noch nicht ausgelöst dann abschicken
1060	if ($('#lieferadresse').length > 0){
1061		d_service_submit_form('lieferadresse');
1062	}
1063	d_service_versand();
1064	d_service_submit_form_zahlungsart();
1065	d_service_submit_form_agb();
1066	d_service_submit_form('newsletter');
1067	// Registrierungsformular nur abschicken, wenn es auch gefüllt ist
1068//	if ($('#registrierung').length > 0 && $('#registrierung_passwort').val() != '' ){
1069		d_service_submit_form('registrierung');
1070//	}
1071	console.log('d_service_buynow FINISH 1');
1072	console.log(d_service_var_errors.length);
1073	$( document ).one("ajaxStop", function() {
1074		console.log('d_service_buynow FINISH 2');
1075		if (d_service_var_errors.length <= 0){
1076			d_init_bestellung();
1077		} else {
1078			console.log('ERROR: ' + d_service_var_errors.length);
1079			console.log(d_service_var_errors);
1080		}
1081	}); 
1082}
1083
1084function jAlert(a){
1085	console.log(jAlert);
1086	console.log(a);
1087}
1088
1089
1090function d_service_submit_form_agb(){
1091	console.log('d_service_submit_form_agb');
1092	
1093	if ($('#chk_agb').prop('checked') ){
1094		$('#chk_agb').closest('LI').removeClass('alert-danger');
1095		d_service_remove_error('chk_agb');
1096	} else {
1097		$('#chk_agb').closest('LI').addClass('alert-danger');
1098		d_service_set_error('chk_agb');
1099	}
1100	
1101	if ($('#chk_dsgvo').prop('checked') ){
1102		$('#chk_dsgvo').closest('LI').removeClass('alert-danger');
1103		d_service_remove_error('chk_dsgvo');
1104	} else {
1105		$('#chk_dsgvo').closest('LI').addClass('alert-danger');
1106		d_service_set_error('chk_dsgvo');
1107	}
1108}
1109  

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.