From a9ca5c4260d4dcc53759b8801a1318f83bcf223b Mon Sep 17 00:00:00 2001 From: Charles Razack Date: Tue, 19 Nov 2019 21:34:26 +0100 Subject: [PATCH] Release 0.1.0-alpha3 --- bower.json | 2 +- dist/jquery.editpricehelper.js | 16 ++++++++-------- dist/jquery.editpricehelper.min.js | 2 +- docs/README.md | 2 +- docs/_coverpage.md | 2 +- docs/index.html | 4 ++-- package.json | 2 +- src/jquery.editpricehelper.js | 4 +--- 8 files changed, 16 insertions(+), 18 deletions(-) diff --git a/bower.json b/bower.json index 049e138..7bf3206 100644 --- a/bower.json +++ b/bower.json @@ -2,7 +2,7 @@ "name": "editpricehelper", "description": "A small jQuery plugin to help edit prices with taxes.", "title": "Edit Price Helper", - "version": "0.1.0-alpha.2", + "version": "0.1.0-alpha.3", "authors": [ "tcharlss " ], diff --git a/dist/jquery.editpricehelper.js b/dist/jquery.editpricehelper.js index e2cc6fd..476d4a7 100644 --- a/dist/jquery.editpricehelper.js +++ b/dist/jquery.editpricehelper.js @@ -1,5 +1,5 @@ /** - * Edit Price Helper 0.1.0-alpha.2 + * Edit Price Helper 0.1.0-alpha.3 * A small jQuery plugin to help edit prices with taxes. * (c) 2019 tcharlss * MIT license @@ -33,9 +33,7 @@ taxRateClass: 'price price_tax-rate', taxRateDisplayClass: 'price__tax-rate', labelClass: 'price__label', - inputClass: 'price__input', - // Debug - debug: false, + inputClass: 'price__input' }; /** @@ -412,17 +410,19 @@ * @return {Number} float - Default = 0 */ Plugin.prototype.getTaxRate = function () { - var taxRate; + var + taxRate, + taxRateOptions = Number.parseFloat(this.options.taxRate) || 0; // Without input, we take the default tax if (!this.hasTaxRateInput) { - taxRate = this.options.taxRate; + taxRate = taxRateOptions; // Otherwise we take the input value } else { taxRate = Number.parseFloat(this.$inputs.taxRate.val()) || 0; // If the input is empty, there can be a default taxe rate - if (!Number.isNumeric(taxRate) && this.options.taxRate) { - taxRate = this.options.taxRate; + if (!Number.isNumeric(this.$inputs.taxRate.val()) && this.options.taxRate) { + taxRate = taxRateOptions; } } // taxRate = taxRate.toFixed(2); diff --git a/dist/jquery.editpricehelper.min.js b/dist/jquery.editpricehelper.min.js index 6381690..86cd223 100644 --- a/dist/jquery.editpricehelper.min.js +++ b/dist/jquery.editpricehelper.min.js @@ -1 +1 @@ -!function(o){"use strict";var i="editpricehelper",a=0,n={priceType:"notax",otherPriceInput:null,taxRateInput:null,taxRate:null,taxRateInPercent:!1,precision:2,urlCalculate:null,displayTaxAmount:!0,mainLabel:"Price",priceTaxLabel:"All taxes included",priceNoTaxLabel:"Pre-tax",taxAmountLabel:"Tax",defaultLabel:"default",priceTaxClass:"price price_tax",priceNoTaxClass:"price price_notax",taxAmountClass:"price price_tax-amount",taxRateClass:"price price_tax-rate",taxRateDisplayClass:"price__tax-rate",labelClass:"price__label",inputClass:"price__input",debug:!1};function r(t,e){this.$element=o(t),this.options=o.extend({},n,e,this.$element.data()),this.identifier=i+"-"+a++,this.priceType=this.options.priceType,this.otherPriceType=this.getOtherPriceType(this.priceType),this.hasSinglePriceInput=0===o(this.options.otherPriceInput).length,this.hasTaxRateInput=0").addClass(n.taxRateDisplay).html(this.displayTaxRate()),o.each(e,function(t){var e,a=o(this).attr("id");o(this).addClass(n.input).wrap(o("").addClass(n[t])),i[t]&&(e=o("