File manager - Edit - /home/premiey/www/wp-content/plugins/ameliabooking/v3/src/assets/js/common/formatting.js
Back
import {settings} from '../../../plugins/settings.js' const thousandSeparatorMap = { 1: ',', 2: '.', 3: ' ', 4: ' ' } const decimalSeparatorMap = { 1: '.', 2: ',', 3: '.', 4: ',' } function getCurrencySymbol () { return settings.payments.currency } function getPriceThousandSeparator () { return thousandSeparatorMap[settings.payments.priceSeparator] } function getPriceDecimalSeparator () { return decimalSeparatorMap[settings.payments.priceSeparator] } function getPriceNumberOfDecimalPlaces () { return settings.payments.priceNumberOfDecimals } function getPricePrefix () { if (settings.payments.priceSymbolPosition === 'after' || settings.payments.priceSymbolPosition === 'afterWithSpace') { return '' } else if (settings.payments.priceSymbolPosition === 'before') { return getCurrencySymbol() } else { return getCurrencySymbol() + ' ' } } function getPriceSuffix () { if (settings.payments.priceSymbolPosition === 'before' || settings.payments.priceSymbolPosition === 'beforeWithSpace') { return '' } else if (settings.payments.priceSymbolPosition === 'after') { return getCurrencySymbol() } else { return ' ' + getCurrencySymbol() } } function useFormattedPrice (price) { let showCurrency = !settings.payments.hideCurrencySymbolFrontend let decimalPlaces = getPriceNumberOfDecimalPlaces() let thousandSeparator = getPriceThousandSeparator() let decimalSeparator = getPriceDecimalSeparator() let pricePrefix = getPricePrefix() let priceSuffix = getPriceSuffix() let i = parseInt(price = Math.abs(+price || 0).toFixed(decimalPlaces)) + '' let j = i.length > 3 ? i.length % 3 : 0 return (showCurrency ? pricePrefix : '') + (j ? i.substr(0, j) + thousandSeparator : '') + i.substr(j).replace(/(\d{3})(?=\d)/g, '$1' + thousandSeparator) + (decimalPlaces ? decimalSeparator + Math.abs(price - i).toFixed(decimalPlaces).slice(2) : '') + (showCurrency ? priceSuffix : '') } function capitalizeFirstLetter (string) { return string.charAt(0).toUpperCase() + string.slice(1) } function useRandomIntFromInterval (min, max) { // min and max included return Math.floor(Math.random() * (max - min + 1) + min) } export { useFormattedPrice, useRandomIntFromInterval, capitalizeFirstLetter }
| ver. 1.4 |
Github
|
.
| PHP 5.4.45 | Generation time: 0 |
proxy
|
phpinfo
|
Settings