Versionen im Vergleich

Schlüssel

  • Diese Zeile wurde hinzugefügt.
  • Diese Zeile wurde entfernt.
  • Formatierung wurde geändert.
Kommentar: Removed translated content for 'fr'
<script> $(document).ready(function() { // fix dropdown width var dropdown = $('select[name="Mindestlaufzeit"], select[name="période minimale"]'); dropdown.parents('div.dropdown-list').css('width','auto')
;
// get purchase pricing

var priceArr
 
=
 
dropdown.parents('table').find('tbody tr td:nth-child(2)').map(function(){return
 
parseFloat($(this).text().replace(/[€\.\s]/g,'').trim());
}).get();
   dropdown.change(
		function() {
			let min_duration = $(this).val();
			let index = dropdown.prop('selectedIndex');
			let tds = $(this).parents('table').find('tbody tr td:nth-child(3)');
			tds.each(
				function(tdIndex) {
					let purchasePrice = priceArr[tdIndex];
					//let price = priceArr[tdIndex] / ((parseInt(min_duration, 10)/1.75) + (12 + index));
					let price = purchasePrice / ((parseInt(min_duration, 10)/1.75) + ((16 + index) - Math.sqrt(min_duration)));
					if (price <= 7) { price = 7; };
					let priceTag = Number(price)
					$(this).text(priceTag.toFixed(2).replace('.',',') + " €");
				}
			);
		}
   );
   dropdown.prop('selectedIndex', 2);
   dropdown.change(); // calculate on load
});
</script>
Sv translation
languagede
HTML-Format
<script async>
$(document).ready(function() {
   // fix dropdown width
   var dropdown = $('select[name="Mindestlaufzeit"]');
   dropdown.parents('div.dropdown-list').css('width','auto');
   // get purchase pricing
   var priceArr = dropdown.parents('table').find('tbody tr td:nth-child(2)').map(function(){
		// match extracts the first price (in case there are multiple prices)
		var p = parseFloat($(this).text().match(/^([\d\.,]*\s€)/)[0].replace(/[€\.\s]/g,'').trim());
		console.log("Base Price: " + p);
		return p
; }).get(); dropdown.change( function() { let min_duration = $(this).val(); let index = dropdown.prop('selectedIndex'); let tds = $(this).parents('table').find('tbody tr td:nth-child(3)'); tds.each( function(tdIndex) { let purchasePrice = priceArr[tdIndex]; //let price = priceArr[tdIndex] / ((parseInt(min_duration, 10)/1.75) + (12 + index)); let price = purchasePrice / ((parseInt(min_duration, 10)/1.75) + ((16 + index) - Math.sqrt(min_duration))); if (price <= 7) { price = 7; }; let priceTag = Number(price) $(this).text(priceTag.toFixed(2).replace('.',',') + " €"); } ); } ); dropdown.prop('selectedIndex', 2); dropdown.change(); // calculate on load }); </script>
Sv translation
languagefr
HTML-Format