Skip to content

Commit

Permalink
calculator changes commit
Browse files Browse the repository at this point in the history
  • Loading branch information
arolus committed Nov 14, 2023
1 parent 63b3010 commit ff53746
Show file tree
Hide file tree
Showing 3 changed files with 168 additions and 28 deletions.
132 changes: 132 additions & 0 deletions assets/js/all-calculators.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,12 @@ var allCalculators = [
"uri": "/simplifying-fractions-calculator/",
"image": "../images/icon-96.png"
},
{
"title": "Investment Calculator",
"description": "This free investment calculator considers the initial and ending balances, return rate, and investment time when evaluating various investment circumstances.",
"uri": "/investment-calculator/",
"image": "../images/icon-96.png"
},
{
"title": "Simple Interest Calculator",
"description": "The simple interest calculator can be used to provide a quick and accurate calculation of interest assessed on a loan or investment.",
Expand Down Expand Up @@ -263,6 +269,12 @@ var allCalculators = [
"uri": "/long-division-calculator/",
"image": "../images/icon-96.png"
},
{
"title": "Triangle Calculator",
"description": "The triangle calculator finds all triangle measurements – side lengths, triangle angles, area, perimeter, semiperimeter, heights, medians, inradius, and circumradius.",
"uri": "/triangle-calculator/",
"image": "../images/icon-96.png"
},
{
"title": "BAC Calculator",
"description": "The Blood Alcohol Concentration Calculator provides an accurate estimate of your current blood alcohol concentration based on several key inputs and personal characteristics. ",
Expand All @@ -281,6 +293,12 @@ var allCalculators = [
"uri": "/percentage-change-calculator/",
"image": "../images/icon-96.png"
},
{
"title": "Volume Calculator",
"description": "The online volume calculator performs calculations for 11 different geometric shapes. The tool supports different units of measurement and demonstrates the solution steps.",
"uri": "/volume-calculator/",
"image": "../images/icon-96.png"
},
{
"title": "Scientific Notation Converter",
"description": "Scientific notation calculator converts numbers to scientific notation, standard form, engineering notation, scientific e-notation, and word form and finds the order of magnitude.",
Expand All @@ -305,6 +323,12 @@ var allCalculators = [
"uri": "/gcf-calculator/",
"image": "../images/icon-96.png"
},
{
"title": "Financial Calculator",
"description": "You can use free financial calculators online to estimate your investments’ future value (FV), compounding periods (N), interest rate (I/Y), periodic payment (PMT), and present value (PV).",
"uri": "/financial-calculator/",
"image": "../images/icon-96.png"
},
{
"title": "Payment Calculator",
"description": "Define the monthly payment amount or time period to pay off a loan with a set term or fixed payment with our free payment calculator.",
Expand Down Expand Up @@ -347,12 +371,30 @@ var allCalculators = [
"uri": "/hours-and-minutes-calculator/",
"image": "../images/icon-96.png"
},
{
"title": "Area Calculator",
"description": "Area calculator to find the surface area of the following shapes - rectangle, triangle, circle, sector, ellipse, trapezoid, and parallelogram.",
"uri": "/area-calculator/",
"image": "../images/icon-96.png"
},
{
"title": "Interest Calculator",
"description": "With this free interest calculator you can compute accumulation schedules, final balances, and accrued interest.",
"uri": "/interest-calculator/",
"image": "../images/icon-96.png"
},
{
"title": "Average Calculator",
"description": "The average calculator helps find a data set's average or arithmetic mean. It also shows the calculation steps and other important statistics.",
"uri": "/average-calculator/",
"image": "../images/icon-96.png"
},
{
"title": "Concrete Calculator",
"description": "Estimate the right amount of concrete for home improvement projects. Concrete calculators do the math to figure out how many bags of mix to buy for driveway slabs, deck footings, stairs, and DIY projects.",
"uri": "/concrete-calculator/",
"image": "../images/icon-96.png"
},
{
"title": "Roman Numeral Converter",
"description": "Roman numeral converter produces Roman numerals from Arabic numbers or converts Arabic numbers to Roman numerals, with values between 1 and 3,999,999.",
Expand Down Expand Up @@ -419,6 +461,12 @@ var allCalculators = [
"uri": "/interest-rate-calculator/",
"image": "../images/icon-96.png"
},
{
"title": "Calories Burned Calculator",
"description": "Track your calorie burn with our free calorie calculator. Quickly estimate your calories burned based on activity and duration.",
"uri": "/calories-burned-calculator/",
"image": "../images/icon-96.png"
},
{
"title": "Mixed Fraction Calculator",
"description": "Mixed number to improper fraction calculator to convert mixed numbers, consisting of a whole number and a proper fraction, to improper fractions.",
Expand Down Expand Up @@ -503,6 +551,12 @@ var allCalculators = [
"uri": "/scientific-notation-calculator/",
"image": "../images/icon-96.png"
},
{
"title": "Future Value Calculator",
"description": "Free future value calculator that uses the formula FV = PV (1 + I/Y)n to find the future value of an investment with periodic deposits.",
"uri": "/future-value-calculator/",
"image": "../images/icon-96.png"
},
{
"title": "Adding Fractions Calculator",
"description": "Adding fractions calculator to add and subtract proper and improper fractions. The calculator performs operations with up to nine given fractions.",
Expand All @@ -515,6 +569,12 @@ var allCalculators = [
"uri": "/decimal-to-percent-calculator/",
"image": "../images/icon-96.png"
},
{
"title": "Period Calculator",
"description": "With our free period calculator, you can find out more about your menstrual cycle and accurately predict when your next period will be.",
"uri": "/period-calculator/",
"image": "../images/icon-96.png"
},
{
"title": "Meters to Feet Converter",
"description": "Convert meters to feet & inches using a meters to feet calculator. Choose decimal places or fractions of an inch for rounding and calculation.",
Expand All @@ -533,6 +593,12 @@ var allCalculators = [
"uri": "/hex-calculator/",
"image": "../images/icon-96.png"
},
{
"title": "Tank Volume Calculator",
"description": "The tank volume calculator finds the total volume of various tank shapes in gallons, liters, and cubic meters. It calculates the liquid volume of partially filled tanks.",
"uri": "/tank-volume-calculator/",
"image": "../images/icon-96.png"
},
{
"title": "Standard Form Calculator",
"description": "Standard form calculator converts any number to standard form or scientific notation. It accepts number notation, e-notation, and scientific notation.",
Expand Down Expand Up @@ -569,6 +635,12 @@ var allCalculators = [
"uri": "/roi-calculator/",
"image": "../images/icon-96.png"
},
{
"title": "Cubic Yards Calculator",
"description": "Cubic yard calculator calculates cubic yards, feet, meters for landscape materials. Enter measurements in yards and feet and get volume conversions.",
"uri": "/cubic-yards-calculator/",
"image": "../images/icon-96.png"
},
{
"title": "Arithmetic and Geometric Sequence Calculator",
"description": "Number sequence calculator to find the nth term of arithmetic, geometric, and Fibonacci sequences. The calculator also finds the sum of the terms of a sequence.",
Expand All @@ -587,6 +659,18 @@ var allCalculators = [
"uri": "/distance-formula-calculator/",
"image": "../images/icon-96.png"
},
{
"title": "Prime Factorization Calculator",
"description": "The prime factorization calculator finds a number's prime factors. The calculator demonstrates the prime factors tree and all factors of the number. ",
"uri": "/prime-factorization-calculator/",
"image": "../images/icon-96.png"
},
{
"title": "Business Loan Calculator",
"description": "Free business loan calculator that lets entrepreneurs estimate monthly payments, calculate interest on loans, and understand the total cost of the business loan.",
"uri": "/business-loan-calculator/",
"image": "../images/icon-96.png"
},
{
"title": "Odds Calculator",
"description": "The odds probability calculator can convert the odds of winning and losing to the probability of winning and losing. Learn the differences between odds and probability.",
Expand Down Expand Up @@ -635,6 +719,12 @@ var allCalculators = [
"uri": "/roman-numeral-date-converter/",
"image": "../images/icon-96.png"
},
{
"title": "Rental Property Calculator",
"description": "Free rental property calculator that uses the formula NPV = [CF^1 / (1 + R^1)] - PC. A rental ROI calculator that helps analyze and compare investment rental properties.",
"uri": "/rental-property-calculator/",
"image": "../images/icon-96.png"
},
{
"title": "Time to Decimal Calculator",
"description": "Time to decimal calculator can convert the time format from hh:mm:ss to decimal hours, minutes, and seconds. Learn to convert hours to decimal form.",
Expand Down Expand Up @@ -683,12 +773,30 @@ var allCalculators = [
"uri": "/distance-calculator/",
"image": "../images/icon-96.png"
},
{
"title": "Days Calculator",
"description": "The free days calculator makes it easy to figure out how many days it has been since some date. This day tracker can include or exclude weekends and holidays.",
"uri": "/days-calculator/",
"image": "../images/icon-96.png"
},
{
"title": "Percent to Fraction Calculator",
"description": "The percent to fraction calculator converts the given percentages into fractions. If the percent value exceeds 100, the calculator performs percent to mixed number conversion.",
"uri": "/percent-to-fraction-calculator/",
"image": "../images/icon-96.png"
},
{
"title": "Pythagorean Theorem Calculator",
"description": "Pythagorean theorem calculator finds the unknown side length of a right triangle. It also calculates angles, area, perimeter, and altitude to hypotenuse.",
"uri": "/pythagorean-theorem-calculator/",
"image": "../images/icon-96.png"
},
{
"title": "Retirement Calculator",
"description": "Retirement savings calculator that uses the formula FV = PV (1 + R)^n to help users plan for retirement and calculate retirement income.",
"uri": "/retirement-calculator/",
"image": "../images/icon-96.png"
},
{
"title": "Percentage Decrease Calculator",
"description": "The percentage decrease calculator finds a percentage decrease from the starting value to the final value and identifies whether the change is an increase or a decrease.",
Expand All @@ -701,6 +809,12 @@ var allCalculators = [
"uri": "/present-value-calculator/",
"image": "../images/icon-96.png"
},
{
"title": "Cylinder Volume Calculator",
"description": "This calculator can be used as a cylinder volume calculator and surface area calculator. It also finds the lateral, base, and top surface areas.",
"uri": "/cylinder-volume-calculator/",
"image": "../images/icon-96.png"
},
{
"title": "Proportion Calculator ",
"description": "The ratio calculator finds a missing ratio number based on the given proportion. The calculator can also scale ratios, enlarging or shrinking them.",
Expand All @@ -719,12 +833,30 @@ var allCalculators = [
"uri": "/refinance-calculator/",
"image": "../images/icon-96.png"
},
{
"title": "Roofing Calculator",
"description": "Use a free roofing square footage calculator to determine your roof size and get the right amount of roofing shingles for your job. Estimate cost, time, and labor for DIY or contractors.",
"uri": "/roofing-calculator/",
"image": "../images/icon-96.png"
},
{
"title": "FHA Loan Calculator",
"description": "The FHA loan calculator lets you plug in the numbers and calculate the monthly payments, interest, and total amount paid over time.",
"uri": "/fha-loan-calculator/",
"image": "../images/icon-96.png"
},
{
"title": "Annuity Calculator",
"description": "Annuity calculator that uses the formula FV = PV (1 + R)^n to help investors calculate annuity growth over time and make retirement decisions.",
"uri": "/annuity-calculator/",
"image": "../images/icon-96.png"
},
{
"title": "Simple Investment Calculator",
"description": "Free investment calculator that uses the formula PV (1 + R)^n to help investors understand how to calculate investment returns and analyze investments.",
"uri": "/simple-investment-calculator/",
"image": "../images/icon-96.png"
},
{
"title": "Credit Card Payoff Calculator",
"description": "Free online credit card calculator that provides valuable information to users, including how to minimize debt and a credit payment calculator with recommended payment amounts.",
Expand Down
34 changes: 27 additions & 7 deletions assets/js/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,17 +104,20 @@ window.output = {

// check erroneous result of expression (or if it's not string - check itself)
// usefull in cases when erroneous values of input fields are unknown
window.calc = (expression) => {
window.calc = (expression,scope) => {
let result = expression;
if(typeof expression == 'string'){
result = math.evaluate(expression); // can throw error as well
result = math.evaluate(expression,scope||{}); // can throw error as well
}
if(isNaN(result)||result==Infinity||result==-Infinity||result.im) {
if(isNaN(result)||result.im) {
throw new Error(`result is ${result}.`);
}
return result;
};

// allows to show accurate results with fixed precision/length (instead of using BigNumber)
window.format = number => math.format(number,{precision:7})

window.input = {
box: $('#error-box'),
list: $('#error-list'),
Expand Down Expand Up @@ -147,6 +150,9 @@ window.input = {
this.list.append(element);
if(last) this.processed = true;
},
// sometimes it's complicated to check input values
// so we're checking `calc` result for an erroneous result, show exception and return
// e.g.: try{calc(...);}catch(e){input.exception(field{s},e);return;}
exception(inputId, message){
if(typeof message != 'string'){
let error = '';
Expand All @@ -167,10 +173,14 @@ window.input = {
get: function(elementId){
this.elementId = elementId;
let element = _(elementId);
this.value = element.value;
this.silent = false;
for (; element && element !== document; element = element.parentNode ) {
if(element.classList.contains('related-item-hidden')) this.silent = true;
if(element == null){
this.value = null;
} else {
this.value = element.value;
for (; element && element !== document; element = element.parentNode ) {
if(element.classList.contains('related-item-hidden')) this.silent = true;
}
}
return this;
},
Expand Down Expand Up @@ -278,6 +288,16 @@ window.input = {
if(this.value === '' || isNaN(Number(this.value))) this.error(this.elementId, errorText);
return this;
},
probability: function(errorText = `The "${this.elementId}" must be a number between 0 and 1.`){
if(this.value === '' || isNaN(Number(this.value)) || Number(this.value) < 0 || Number(this.value) > 1)
this.error(this.elementId, errorText);
return this;
},
percentage: function(errorText = `The "${this.elementId}" must be a number between 0 and 100.`){
if(this.value === '' || isNaN(Number(this.value)) || Number(this.value) < 0 || Number(this.value) > 100)
this.error(this.elementId, errorText);
return this;
},
numbers: function(errorText = `The ${this.elementId} must be a set of numbers.`){
if (this.value.filter(value => isNaN(Number(value))).length) this.error(this.elementId, errorText);
return this;
Expand Down Expand Up @@ -327,7 +347,7 @@ window.input = {
return !!this.value;
},
val: function(){
if(this.value === '') return null;
if(this.value === '' || this.value === null) return null;
return Number(this.value);
},
vals: function(){
Expand Down
30 changes: 9 additions & 21 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,41 +9,29 @@ License URI: https://www.gnu.org/licenses/gpl-2.0.html

Not sure when you’re ovulating? Use this free ovulation calculator to estimate your most fertile days and know when you are most likely to conceive.

== Description ==

Not sure when you’re ovulating? Use this free ovulation calculator to estimate your most fertile days and know when you are most likely to conceive.

[https://www.calculator.io/ovulation-calculator/](https://www.calculator.io/ovulation-calculator/)

__Ovulation Calculator Shortcode__

`[ci_ovulation_calculator]`
== Usage ==

== Installation ==
Add the Ovulation Calculator shortcode to your page, post or sidebar:

1. Upload the /ci_ovulation_calculator/ folder to the /wp-content/plugins/ directory.
2. Activate the [Ovulation Calculator](https://www.calculator.io/ovulation-calculator/ "Ovulation Calculator Homepage") plugin through the "Plugins" menu in WordPress.
`[ci_ovulation_calculator]`

== Ovulation Calculator Usage ==
Add the following code to your template where you would like the Ovulation Calculator to appear:

* Add the shortcode `[ci_ovulation_calculator]` to your page, post or sidebar.
* Add the following code: `<?php display_ci_ovulation_calculator(); ?>` to your template where you would like the Ovulation Calculator to appear.
`<?php display_ci_ovulation_calculator(); ?>`

== Screenshots ==

1. The Ovulation Calculator Input Form.
2. The Ovulation Calculator Calculation Results.

== Libraries used in Ovulation Calculator ==
== Installation ==

1. https://mathjs.org/
2. https://katex.org/
3. https://github.com/aFarkas/lazysizes
4. https://github.com/RobinHerbots/Inputmask
5. https://air-datepicker.com/
6. https://www.chartjs.org/
1. Upload the Ovulation Calculator /ci_ovulation_calculator/ folder to the /wp-content/plugins/ directory.
2. Activate the Ovulation Calculator plugin through the "Plugins" menu in WordPress.

== Changelog ==

= 1.0.0 =
* Initial release
* Initial release of Ovulation Calculator

0 comments on commit ff53746

Please sign in to comment.