function number_format(number, decimals, decPoint, thousandsSep) { number = (number + '').replace(/[^0-9+\-Ee.]/g, '') var n = !isFinite(+number) ? 0 : +number var prec = !isFinite(+decimals) ? 0 : Math.abs(decimals) var sep = (typeof thousandsSep === 'undefined') ? ',' : thousandsSep var dec = (typeof decPoint === 'undefined') ? '.' : decPoint var s = '' var toFixedFix = function (n, prec) { var k = Math.pow(10, prec) return '' + (Math.round(n * k) / k) .toFixed(prec) } s = (prec ? toFixedFix(n, prec) : '' + Math.round(n)).split('.') if (s[0].length > 3) { s[0] = s[0].replace(/\B(?=(?:\d{3})+(?!\d))/g, sep) } if ((s[1] || '').length < prec) { s[1] = s[1] || '' s[1] += new Array(prec - s[1].length + 1).join('0') } return s.join(dec) } function step1collapse(collapse, customText) { if (collapse === undefined) { collapse = true; } if (customText === undefined) { customText = $('#searchAddress').val(); } if (collapse) { $('#collapsedSummary h2').show(); $('#collapsedSummary .step1 .value').text(customText); $('#collapsedSummary .step1').removeClass('collapsed'); $('#step1wrap').removeClass('editing').addClass('collapsed'); } else { $('#collapsedSummary .step1').addClass('collapsed'); $('#step1wrap').addClass('editing edited').removeClass('collapsed'); $('.locationError').text(''); } $('#collapsedSummary .margin').removeClass('margin'); $('#collapsedSummary > div:not(.collapsed):last').addClass('margin'); if ($('#collapsedSummary > div:not(.collapsed)').length == 0) { $('#collapsedSummary h2').hide(); } } function step34collapse(collapse) { if (collapse === undefined) { collapse = true; } if (collapse) { if ($('input[name="weight"]').val() == "") { $('input[name="weight"]').focus(); return false; } $('#collapsedSummary h2').show(); $('#collapsedSummary .step3 .value').text($('input[name="topProduct"]:checked').parent().find('label').text()); $('#collapsedSummary .step4 .value').html('Sendungsgewicht ' + $('input[name="weight"]').val() + ' g'); $('#collapsedSummary').find('.step3,.step4').removeClass('collapsed'); $('#step34wrap').removeClass('editing').addClass('collapsed'); } else { $('#collapsedSummary').find('.step3,.step4').addClass('collapsed'); $('#step34wrap').addClass('editing edited').removeClass('collapsed'); } $('#collapsedSummary .margin').removeClass('margin'); $('#collapsedSummary > div:not(.collapsed):last').addClass('margin'); if ($('#collapsedSummary > div:not(.collapsed)').length == 0) { $('#collapsedSummary h2').hide(); } } function mapFullscreen(fullscreen) { if (fullscreen) { $('body').prepend('
'); $('body.c_map').addClass('mapFullscreen'); window.setTimeout('var center = map.getCenter();google.maps.event.trigger(map, \'resize\');map.setCenter(center);$("#fullscreenOverlay").addClass("active");', 50); } else { $('#fullscreenOverlay').remove(); $('body.c_map').removeClass('mapFullscreen'); window.setTimeout('var center = map.getCenter();google.maps.event.trigger(map, \'resize\');map.setCenter(center);map.setZoom(map.getZoom()-1);', 50); } } function updateKmlLayer() { var kml_url = 'https://flyeralarm-post.at/anx/kml/kml_for_zips.php?'; if (kmlLayer != "") { kmlLayer.setMap(null); } if (zips.length == 0) { console.log('zips.length = 0'); loader(false); return; } var preserveViewport = true; if (typeof (bulkSubmissionInProgress) != 'undefined' && bulkSubmissionInProgress === true) { preserveViewport = false; } if (typeof (preserveViewportKml) != 'undefined' && preserveViewportKml == false) { preserveViewport = preserveViewportKml; } console.log(preserveViewport); if (zips.length > 0) { for (i in zips) { kml_url += 'zips[]=' + zips[i] + '&'; } kmlLayer = new google.maps.KmlLayer({ url: kml_url, suppressInfoWindows: false, map: map, zIndex: 111111, preserveViewport: preserveViewport }); kmlLayer.addListener('metadata_changed', function (kmlEvent) { // loader(false); }); google.maps.event.addListener(kmlLayer, 'click', function (event) { var tmp = $(event.featureData.infoWindowHtml); plz = tmp.find('td:eq(3)').html(); if (event.featureData.infoWindowHtml.indexOf("Gebiet entfernen") == -1) { event.featureData.infoWindowHtml += '

Gebiet entfernen

'; } }); } preserveViewportKml = true; } function loader(showHide) { if (showHide) { $('#loader').fadeIn(200); } else { $('#loader').fadeOut(400); } } function checkMapAllowed() { if ($('input[name="type"]').length > 0 && $('input[name="type"]:checked').length == 0) { $('#loaderDisabling').show(); $('#resetSelection').hide(); return false; } if ($('input[name="weight"]').val() != "" && $('input[name="topProduct"]:checked').val() != "") { $('#loaderDisabling').hide(); $('#resetSelection').show(); return true; } else { $('#loaderDisabling').show(); $('#resetSelection').hide(); return false; } } function centerMyLocation() { loader(true); var $inputElements = $('#searchAddress'); $inputElements.val('Ihre Position wird ermittelt...'); var $loader = $inputElements.next(); $loader.show(); $inputElements.addClass('loading'); navigator.geolocation.getCurrentPosition( function (position) { if (position.coords.accuracy < 1000) { map.setZoom(13); map.setCenter({lat: position.coords.latitude, lng: position.coords.longitude}); $('input[name="lat"]').val(position.coords.latitude); $('input[name="lon"]').val(position.coords.longitude); var geocoder = new google.maps.Geocoder; var latlng = {lat: position.coords.latitude, lng: position.coords.longitude}; geocoder.geocode({'location': latlng}, function (results, status) { if (status === google.maps.GeocoderStatus.OK) { if (results[1]) { $('#searchAddress').val(results[1].formatted_address); if (checkMapAllowed()) { changeBasicSettings(); } step1collapse(); } } }); $loader.hide(); $inputElements.removeClass('loading'); var myLatlng = new google.maps.LatLng(position.coords.latitude, position.coords.longitude); var marker = new google.maps.Marker({ position: myLatlng, map: map }); } else { $loader.hide(); $inputElements.removeClass('loading'); $inputElements.parent().find('.locationError').addClass('visible').html('Ihre Position konnte leider nicht ermittelt werden.
Bitte geben Sie Ihr Zielgebiet händisch ein.'); $inputElements.val(''); } loader(false); }, function () { $loader.hide(); $inputElements.removeClass('loading'); $inputElements.parent().find('.locationError').addClass('visible').html('Ihre Position konnte leider nicht ermittelt werden.
Bitte geben Sie Ihr Zielgebiet händisch ein.'); $inputElements.val(''); loader(false); } ); } function searchAddressPlaceSelected() { var place = placesAutocomplete.getPlace(); if (place.geometry == undefined) { return false; } step1collapse(); map.setCenter(place.geometry.location); map.setZoom(13); $('input[name="lat"]').val(place.geometry.location.lat()); $('input[name="lon"]').val(place.geometry.location.lng()); } function calculatePaperWeight() { var unit = "g"; var unit_kg = "kg"; var a = 0, b = 0, c = ""; !0 === checkInput() && (a = parseInt(jQuery("#paperWidth").val()) * parseInt(jQuery("#paperHeight").val()), a *= parseInt(jQuery("#grammatur").val()), a /= 1e6, b = a * parseInt(jQuery("#amount").val()), c = String(parseFloat(a).toFixed(0)), jQuery("#resultPiece").html(c.replace(/\./g, ",")), $('.submitCalculatedPaperWeight').val(c + ' g Sendungsgewicht übernehmen').fadeIn()) } function checkInput() { var a = !0, b = new Array; return "" != jQuery("#paperWidth").val() && "" != jQuery("#paperHeight").val() || (b.push(jQuery("#paperweightWrapper .sizeMessage").html()), jQuery("#paperWidth").focus(), a = !1), "" == jQuery("#grammatur").val() && (b.push(jQuery("#paperweightWrapper .weightMessage").html()), jQuery("#grammatur").focus(), a = !1), "" == jQuery("#amount").val() && (b.push(jQuery("#paperweightWrapper .quantityMessage").html()), jQuery("#amount").focus(), a = !1), !1 === a && alert(b.join("\n")), a } function resetPaperweight() { jQuery(".paperweigthtable input").val(""), jQuery("#resultPiece").html("0g"), jQuery("#resultAmount").html("0g") } function submitCalculatedPaperWeight() { $('#topProduct_0').attr('checked', 'checked'); $('html, body').animate({scrollTop: $('.tabNavigation').offset().top - 10}, 200); $('input[name="weight"]').val(jQuery("#resultPiece").html()); $.magnificPopup.close(); changeBasicSettings(); step34collapse(); } function resetCurrentSelection() { $.get("https://flyeralarm-post.at/map/ajaxResetSelection", function () { window.location = window.location.href.split('?')[0]; ; }); }