Files
old-ribica/front-ui/app/globals.js
2016-03-16 12:13:47 +01:00

46 lines
1.5 KiB
JavaScript

var conversionRate = 0.51;
module.exports = {
ApiUrl: '@@apiEndpoint',
DefaultPageSize: 24,
ItemGroupIdOfStartPage: "1",
ItemGroupIdOfEmptyCartPage: "1",
BamToEuroConversionRate: conversionRate,
FormatCurrency: function(amount_s) {
var amount = parseFloat(amount_s);
return (amount.toFixed(2) + " KM")
},
FormatPercentage: function(amount_s) {
var amount = parseFloat(amount_s);
return (amount.toFixed(2) + "%")
},
ConvertToEuro: function(amount_s) {
amount = amount_s * conversionRate;
return amount.toFixed(2);
},
IsUrlAbsolute: function(url) {
var r = new RegExp('^(?:[a-z]+:)?//', 'i');
return r.test(url);
},
MaxNumberOfItemsToBeAdded: 1000,
PaypalId: "W7GKS2Q9ZGLGY",
PikpayFormUrl: "https://ipgtest.pikpay.ba/form",
PikpayAuthenticityToken: "1bb1eea16bd6492c01262636897c0c2e3291a1ab",
PikpayKey: "Ribica",
Slugify: function(text) {
if(!text) {
text = "";
}
return text.toString().toLowerCase()
.replace(/š/g,'s')
.replace(/[čć]/g,'c')
.replace(/[ž]/g,'z')
.replace(/\s+/g, '-') // Replace spaces with -
.replace(/[^\w\-]+/g, '') // Remove all non-word chars
.replace(/\-\-+/g, '-') // Replace multiple - with single -
.replace(/^-+/, '') // Trim - from start of text
.replace(/-+$/, ''); // Trim - from end of text
}
};