Professional Documents
Culture Documents
JavaScript Tools Creator by Christopher Topalian - Version 3
JavaScript Tools Creator by Christopher Topalian - Version 3
JavaScript
Tools Creator
by
Christopher Topalian
All Rights Reserved Copyright 2021
<!-- All Rights Reserved Christopher Topalian Co
pyright 2021 -->
<!-- Topalian JavaScript Tools Creator -->
<!--
Creates Rows of useful Tools and enables easy
design of new Tools, which are then placed on an
y Row chosen, in any order we decide.
Categories of Tools can be created using the S
orting System,
or the person may alternatively choose to creat
e a new array of data, which contains a new set of
Tools.
We can easily sort the Tools by number, date, c
ategory, tag, type, or other.
-->
<!--
Code is Here:
https://github.com/ChristopherTopalian/
Topalian-JavaScript-Tools-Creator
https://github.com/ChristopherTopalian
-->
<!--
Video of the Code is Here:
https://www.youtube.com/watch?v=2AyZ_JwjEvA
and
www.youtube.com/ScriptingCollege
-->
<!--
Website to find more info about the Code is Her
e:
https://CollegeOfScripting.weebly.com/
-->
<!-- College of Scripting Music & Science -->
<html>
<head>
<title> Topalian JavaScript Tools Creator </title>
background-image: url("https://
collegeofscripting.weebly.com/uploads/
6/4/4/8/64482293/stars-nice-edited_orig.png");
}
.theTitle
{
position: relative;
/* left: 100; */
top: 0;
color: rgb(255, 255, 255);
/* letter-spacing: 1px; */
font-size: 35;
font-weight: bolder;
font-family: "Exo Black", Tahoma, Arial;
/* We use Quotation Marks, if the font name con
tains a space */
}
.theDedication
.ourDivStyle
{
position: relative;
/* left: 50; */
top: 5;
background-color: rgb(100,100,125);
width: 100px; /* or 100% for full size of the tools
div */
/* margin: 0px 2px 0px 2px; */
margin: auto;
padding: 2px 4px 2px 4px;
/* top right bottom left */
border: 3px solid rgb(151, 151, 151);
font-size: 10pt;
font-family: Arial;
font-weight: bold;
<script>
//**********************************************//TOOL - C
ALCULATION
//Year Born From Current Year
//YBFCY_ we use this as a namespace, for zero c
onflicts
//Calculate Year Born Based on Current Year Minu
s Age Entered
function YBFCY_ageFinder()
{
let nameSpace = "YBFCY_";
//person enters the age
//we get the age value from the text area that ha
s the id of nameSpace_AgeInput
let age = document.getElementById(nameSpac
e + "AgeInput").value;
//gets the Current Year
let currentYear = YBFCY_getYear();
//display the Current Year in the text area that h
as the id of nameSpace_YearNow
let YBFCY_html = '<html>';
YBFCY_html += '<head>';
YBFCY_html += '<title>Year Born From Current Y
ear</title>';
YBFCY_html += '</head>';
YBFCY_html += '<body>';
YBFCY_html += '<div class ="ourDivStyle">';
YBFCY_html += '<hr>';
YBFCY_html += 'YEAR BORN FROM CURRENT Y
EAR';
YBFCY_html += '<hr>';
YBFCY_html += 'Enter Age';
YBFCY_html += '<br>';
YBFCY_html += '<hr>';
YBFCY_html += 'Current Year is';
YBFCY_html += '<br>';
YBFCY_html += '<textarea id="YBFCY_YearNow"
placeholder="Current Year" rows="1" cols="7" cl
ass="ourTextStyle" type="text" onkeyup="YBFCY
_ageFinder();" readonly></textarea>';
YBFCY_html += '<br><hr>';
YBFCY_html += 'Year Born (est)';
YBFCY_html += '<br>';
YBFCY_html += '<textarea id="YBFCY_Result" pl
aceholder="Result" rows="1" cols="7" class="ou
rTextStyle" type="text" readonly></textarea>';
YBFCY_html += '<hr>';
YBFCY_html += '</div>';
YBFCY_html += '</body>';
YBFCY_html += '</html>';
//**********************************************//
function YBFSY_ageFinder()
{
let nameSpace = "YBFSY_";
//person enters the age
//we get the age value from the text area that ha
s the id of nameSpace_AgeInput
let age = document.getElementById(nameSpac
e + "AgeInput").value;
//person enters the specific year
//we get the specific year value from the text are
a that has the id of nameSpace_YearInput
let specificYear = document.getElementById(na
meSpace + "YearInput").value;
//result of subtracting age from specific year
let result = specificYear - age;
College of Scripting Music & Science CollegeOfScripting.weebly.com
//display Result in the text area that has the id o
f nameSpace_Result
document.getElementById(nameSpace + "Resu
lt").textContent = result;
}
let YBFSY_html = '<html>';
YBFSY_html += '<head>';
YBFSY_html += '<title>Year Born From Specific Y
ear</title>';
YBFSY_html += '</head>';
YBFSY_html += '<body>';
YBFSY_html += '<div class ="ourDivStyle">';
YBFSY_html += '<hr>';
YBFSY_html += 'YEAR BORN FROM SPECIFIC YE
AR';
YBFSY_html += '<hr>';
YBFSY_html += 'Enter Age';
YBFSY_html += '<br>';
YBFSY_html += '<textarea id="YBFSY_AgeInput"
placeholder="Enter" rows="1" cols="7" class="o
urTextStyle" type="text" onkeyup="YBFSY_ageFi
nder();"></textarea>';
YBFSY_html += '<hr>';
YBFSY_html += '<br><hr>';
YBFSY_html += 'Year Born (est)';
YBFSY_html += '<br>';
YBFSY_html += '<textarea id="YBFSY_Result" pl
aceholder="Result" rows="1" cols="7" class="ou
rTextStyle" type="text" readonly></textarea>';
YBFSY_html += '<hr>';
YBFSY_html += '</div>';
YBFSY_html += '</body>';
YBFSY_html += '</html>';
//**********************************************//
//**********************************************//TOOL - C
ONVERSION
//Convert Feet To Meters
function CFTM_convert()
{
let nameSpace = "CFTM_";
let conversionFactor = 0.3048;
//person enters the amount.
//we get the amount from the text area with the i
d nameSpace_Input
let amount = document.getElementById(nameS
pace + "Input").value;
//result of multiplying the amount entered by th
e conversionFactor
let result = amount * conversionFactor;
//display result in the text area that has the id of
nameSpace_Result
document.getElementById(nameSpace + "Resu
lt").textContent = result;
}
let CFTM_html = '<html>';
CFTM_html += '<head>';
CFTM_html += '<br><hr>';
CFTM_html += 'Meters (est)';
CFTM_html += '<br>';
CFTM_html += '<textarea id="CFTM_Result" plac
eholder="Result" rows="1" cols="7" class="ourT
extStyle" type="text" readonly></textarea>';
CFTM_html += '<hr>';
CFTM_html += '</div>';
CFTM_html += '</body>';
CFTM_html += '</html>';
//**********************************************//
function CMTF_convert()
{
let nameSpace = "CMTF_";
let conversionFactor = 3.28084;
//person enters the amount
//we get the amount from the text area with the i
d nameSpace_Input
let amount = document.getElementById(nameS
pace + "Input").value;
//result of multiplying the amount entered by th
e conversionFactor
let result = amount * conversionFactor;
let CMTF_html = '<html>';
CMTF_html += '<head>';
CMTF_html += '<title>Convert Meters To Feet</
title>';
CMTF_html += '</head>';
CMTF_html += '<body>';
CMTF_html += '<div class ="ourDivStyle">';
CMTF_html += '<hr>';
CMTF_html += 'CONVERT METERS TO FEET';
CMTF_html += '<hr>';
CMTF_html += 'Enter Meters';
CMTF_html += '<br>';
CMTF_html += '<textarea id="CMTF_Input" place
holder="Enter" rows="1" cols="7" class="ourText
Style" type="text" onkeyup="CMTF_convert();"><
/textarea>';
CMTF_html += '<br><hr>';
CMTF_html += 'Feet (est)';
CMTF_html += '<br>';
//**********************************************//TOOL - C
ONVERSION
//Convert Meter To Mile
//CMTMI we use this as a namespace, for zero con
flicts
function CMTMI_convert()
{
let nameSpace = "CMTMI_";
let conversionFactor = 0.000621371;
//person enters the amount
//we get the amount from the text area with the i
d nameSpace_Input
College of Scripting Music & Science CollegeOfScripting.weebly.com
let amount = document.getElementById(nameS
pace + "Input").value;
//result of multiplying the amount entered by th
e conversionFactor
let result = amount * conversionFactor;
//display result in the text area that has the id of
nameSpace_Result
document.getElementById(nameSpace + "Resu
lt").textContent = result;
}
let CMTMI_html = '<html>';
CMTMI_html += '<head>';
CMTMI_html += '<title>Convert Meter To Mile</
title>';
CMTMI_html += '</head>';
CMTMI_html += '<body>';
CMTMI_html += '<div class ="ourDivStyle">';
CMTMI_html += '<hr>';
CMTMI_html += 'CONVERT METER TO MILE';
CMTMI_html += '<hr>';
CMTMI_html += 'Enter Meters';
CMTMI_html += '<br>';
CMTMI_html += '<br><hr>';
CMTMI_html += 'Miles (est)';
CMTMI_html += '<br>';
CMTMI_html += '<textarea id="CMTMI_Result" pla
ceholder="Result" rows="1" cols="7" class="our
TextStyle" type="text" readonly></textarea>';
CMTMI_html += '<hr>';
CMTMI_html += '</div>';
CMTMI_html += '</body>';
CMTMI_html += '</html>';
//**********************************************//
//**********************************************//TOOL - C
ONVERSION
//Convert Mile To Meter
//CMITM_ we use this as a namespace, for zero co
nflicts
//person enters the amount
//we get the amount from the text area with the i
d nameSpace_Input
let amount = document.getElementById(nameS
pace + "Input").value;
//result of multiplying the amount entered by th
e conversionFactor
let result = amount * conversionFactor;
//display result in the text area that has the id of
nameSpace_Result
document.getElementById(nameSpace + "Resu
lt").textContent = result;
}
let CMITM_html = '<html>';
CMITM_html += '<head>';
CMITM_html += '<title>Convert Mile To Meter</
title>';
CMITM_html += '</head>';
CMITM_html += '<br><hr>';
CMITM_html += 'Meters (est)';
CMITM_html += '<br>';
CMITM_html += '<textarea id="CMITM_Result" pla
ceholder="Result" rows="1" cols="7" class="our
TextStyle" type="text" readonly></textarea>';
CMITM_html += '<hr>';
CMITM_html += '</div>';
CMITM_html += '</body>';
CMITM_html += '</html>';
//**********************************************//
function CFITM_convert()
{
let nameSpace = "CFITM_";
//person enters the feet
//we get the amount from the text area with the i
d nameSpace_Input
let amount1 = document.getElementById(name
Space + "Input").value;
//convert feet to centimeters
amount1 = amount1 * 30.48;
//person enters the inches
//we get the amount from the text area with the i
d nameSpace_Input2
let amount2 = document.getElementById(name
Space + "Input2").value;
College of Scripting Music & Science CollegeOfScripting.weebly.com
//convert inches to centimeters
amount2 = amount2 * 2.54;
//the total amount of centimeters
let answer = amount1 + amount2;
//convert centimeters to meters
let result = answer / 100;
//display result in the text area that has the id of
nameSpace_Result
document.getElementById(nameSpace + "Resu
lt").textContent = result;
}
let CFITM_html = '<html>';
CFITM_html += '<head>';
CFITM_html += '<title>Convert Feet and Inches to
Meters</title>';
CFITM_html += '</head>';
CFITM_html += '<body>';
CFITM_html += '<div class ="ourDivStyle">';
CFITM_html += '<hr>';
CFITM_html += 'CONVERT<br>FEET AND INCHE
S<br>TO METERS';
CFITM_html += '<br><hr>';
CFITM_html += 'Enter Inches';
CFITM_html += '<br>';
CFITM_html += '<textarea id="CFITM_Input2" plac
eholder="Enter" rows="1" cols="7" class="ourTe
xtStyle" type="text" onkeyup="CFITM_convert();"
></textarea>';
CFITM_html += '<br><hr>';
CFITM_html += 'Meters (est)';
CFITM_html += '<br>';
CFITM_html += '<textarea id="CFITM_Result" pla
ceholder="Result" rows="1" cols="7" class="our
TextStyle" type="text" readonly></textarea>';
CFITM_html += '<hr>';
CFITM_html += '</div>';
CFITM_html += '</body>';
CFITM_html += '</html>';
//**********************************************//
function CMCTF_convert()
{
let nameSpace = "CMCTF_";
//person enters the meters
//we get the amount from the text area with the i
d nameSpace_Input
let amount1 = document.getElementById(name
Space + "Input").value;
//convert meters to inches
amount1 = amount1 * 39.3701;
//person enters the centimeters
//we get the amount from the text area with the i
d nameSpace_Input2
College of Scripting Music & Science CollegeOfScripting.weebly.com
let amount2 = document.getElementById(name
Space + "Input2").value;
//convert centimeters to inches
amount2 = amount2 * 0.393701;
//the total amount of inches
let answer = amount1 + amount2;
//convert inches to feet
let result = answer * 0.0833333;
//display result in the text area that has the id of
nameSpace_Result
document.getElementById(nameSpace + "Resu
lt").textContent = result;
}
let CMCTF_html = '<html>';
CMCTF_html += '<head>';
CMCTF_html += '<title>Convert Meters and Centi
meters to Feet</title>';
CMCTF_html += '</head>';
CMCTF_html += '<body>';
CMCTF_html += '<div class ="ourDivStyle">';
CMCTF_html += '<hr>';
//**********************************************//TOOL - C
ONVERSION
//Convert Mph to Kph (Miles per hour to Kilometer
s per hour)
//CMphToKph_ we use this as a namespace, for z
ero conflicts
function CMphToKph_convert()
{
let nameSpace = "CMphToKph_";
let conversionFactor = 1.60934;
//person enters the amount
//we get the amount from the text area with the i
d nameSpace_Input
let amount = document.getElementById(nameS
pace + "Input").value;
//result of multiplying the amount entered by th
e conversionFactor
let result = amount * conversionFactor;
College of Scripting Music & Science CollegeOfScripting.weebly.com
//display result in the text area that has the id of
nameSpace_Result
document.getElementById(nameSpace + "Resu
lt").textContent = result;
}
let CMphToKph_html = '<html>';
CMphToKph_html += '<head>';
CMphToKph_html += '<title>Convert Mph to Kph<
/title>';
CMphToKph_html += '</head>';
CMphToKph_html += '<body>';
CMphToKph_html += '<div class ="ourDivStyle">'
;
CMphToKph_html += '<hr>';
CMphToKph_html += 'CONVERT<br>MPH TO KP
H';
CMphToKph_html += '<hr>';
CMphToKph_html += 'Enter Mph';
CMphToKph_html += '<br>';
CMphToKph_html += '<textarea id="CMphToKph_
Input" placeholder="Enter" rows="1" cols="7" cla
ss="ourTextStyle" type="text" onkeyup="CMphTo
Kph_convert();"></textarea>';
//**********************************************//TOOL - C
ONVERSION
//Convert Kph to Mph (Kilometers per hour to Mile
s per Hour)
//CKphToMph_ we use this as a namespace, for z
ero conflicts
function CKphToMph_convert()
{
let nameSpace = "CKphToMph_";
College of Scripting Music & Science CollegeOfScripting.weebly.com
let conversionFactor = 0.621371;
//person enters the amount
//we get the amount from the text area with the i
d nameSpace_Input
let amount = document.getElementById(nameS
pace + "Input").value;
//result of multiplying the amount entered by th
e conversionFactor
let result = amount * conversionFactor;
//display result in the text area that has the id of
nameSpace_Result
document.getElementById(nameSpace + "Resu
lt").textContent = result;
}
let CKphToMph_html = '<html>';
CKphToMph_html += '<head>';
CKphToMph_html += '<title>Convert Kph to Mph<
/title>';
CKphToMph_html += '</head>';
CKphToMph_html += '<body>';
CKphToMph_html += '<div class ="ourDivStyle">'
;
CKphToMph_html += '<br><hr>';
CKphToMph_html += 'Mph (est)';
CKphToMph_html += '<br>';
CKphToMph_html += '<textarea id="CKphToMph_
Result" placeholder="Result" rows="1" cols="7"
class="ourTextStyle" type="text" readonly></
textarea>';
CKphToMph_html += '<hr>';
CKphToMph_html += '</div>';
CKphToMph_html += '</body>';
CKphToMph_html += '</html>';
//**********************************************//
function CPTD_convert()
{
let nameSpace = "CPTD_";
let conversionFactor = 100;
//person enters the amount
//we get the amount from the text area with the i
d nameSpace_Input
let amount = document.getElementById(nameS
pace + "Input").value;
//result of dividing the amount by the conversio
nFactor
let result = amount / conversionFactor;
//display result in the text area that has the id of
nameSpace_Result
let CPTD_html = '<html>';
CPTD_html += '<head>';
CPTD_html += '<title>Convert Percent to Decimal
</title>';
CPTD_html += '</head>';
CPTD_html += '<body>';
CPTD_html += '<div class ="ourDivStyle">';
CPTD_html += '<hr>';
CPTD_html += 'CONVERT<br>PERCENT TO DECI
MAL';
CPTD_html += '<hr>';
CPTD_html += 'Enter Percent';
CPTD_html += '<br>';
CPTD_html += '<textarea id="CPTD_Input" placeh
older="Enter" rows="1" cols="7" class="ourTextS
tyle" type="text" onkeyup="CPTD_convert();"></
textarea>';
CPTD_html += '<br><hr>';
CPTD_html += 'Decimal';
CPTD_html += '<br>';
//**********************************************//TOOL - C
ONVERSION
//Convert Decimal to Percent
//CDTP_ we use this as a namespace, for zero con
flicts
function CDTP_convert()
{
let nameSpace = "CDTP_";
let conversionFactor = 100;
//person enters the amount
//we get the amount from the text area with the i
d nameSpace_Input
College of Scripting Music & Science CollegeOfScripting.weebly.com
let amount = document.getElementById(nameS
pace + "Input").value;
//result of multiplying the amount entered by th
e conversionFactor
let result = amount * conversionFactor;
//display result in the text area that has the id of
nameSpace_Result
document.getElementById(nameSpace + "Resu
lt").textContent = result;
}
let CDTP_html = '<html>';
CDTP_html += '<head>';
CDTP_html += '<title>Convert Decimal to Percent
</title>';
CDTP_html += '</head>';
CDTP_html += '<body>';
CDTP_html += '<div class ="ourDivStyle">';
CDTP_html += '<hr>';
CDTP_html += 'CONVERT<br>DECIMAL TO PERC
ENT';
CDTP_html += '<hr>';
CDTP_html += 'Enter Decimal';
CDTP_html += '<br>';
CDTP_html += '<br><hr>';
CDTP_html += 'Percent';
CDTP_html += '<br>';
CDTP_html += '<textarea id="CDTP_Result" place
holder="Result" rows="1" cols="7" class="ourTe
xtStyle" type="text" readonly></textarea>';
CDTP_html += '<hr>';
CDTP_html += '</div>';
CDTP_html += '</body>';
CDTP_html += '</html>';
//**********************************************//
//**********************************************//TOOL - C
ONVERSION
//Convert Fahrenheit to Celsius
//CFTC_ we use this as a namespace, for zero con
flicts
//person enters the amount
//we get the amount from the text area with the i
d nameSpace_Input
let amount = document.getElementById(nameS
pace + "Input").value;
//result of the conversion formula
let result = 5 * (amount - 32) / 9;
//display result in the text area that has the id of
nameSpace_Result
document.getElementById(nameSpace + "Resu
lt").textContent = result;
}
let CFTC_html = '<html>';
CFTC_html += '<head>';
CFTC_html += '<title>Convert Fahrenheit to Celsi
us</title>';
CFTC_html += '</head>';
CFTC_html += '<body>';
CFTC_html += '<div class ="ourDivStyle">';
CFTC_html += '<br><hr>';
CFTC_html += 'Celsius';
CFTC_html += '<br>';
CFTC_html += '<textarea id="CFTC_Result" place
holder="Result" rows="1" cols="7" class="ourTe
xtStyle" type="text" readonly></textarea>';
CFTC_html += '<hr>';
CFTC_html += '</div>';
CFTC_html += '</body>';
CFTC_html += '</html>';
//**********************************************//
function CCTF_convert()
{
let nameSpace = "CCTF_";
//person enters the amount
//we get the amount from the text area with the i
d nameSpace_Input
let amount = document.getElementById(nameS
pace + "Input").value;
//result of the conversion formula
let result = (amount * 1.8) + 32;
//display result in the text area that has the id of
nameSpace_Result
document.getElementById(nameSpace + "Resu
lt").textContent = result;
}
let CCTF_html = '<html>';
CCTF_html += '<br><hr>';
CCTF_html += 'Fahrenheit';
CCTF_html += '<br>';
CCTF_html += '<textarea id="CCTF_Result" place
holder="Result" rows="1" cols="7" class="ourTe
xtStyle" type="text" readonly></textarea>';
CCTF_html += '<hr>';
CCTF_html += '</div>';
CCTF_html += '</body>';
//**********************************************//TOOL - C
ONVERSION
//Convert Hour to Percent
//CHTP_ we use this as a namespace, for zero con
flicts
function CHTP_convert()
{
let nameSpace = "CHTP_";
let conversionFactor = 60;
//person enters the amount
//we get the amount from the text area with the i
d nameSpace_Input
let amount = document.getElementById(nameS
pace + "Input").value;
//result of the conversion formula
let result = (amount * 100) / conversionFactor;
College of Scripting Music & Science CollegeOfScripting.weebly.com
//display result in the text area that has the id of
nameSpace_Result
document.getElementById(nameSpace + "Resu
lt").textContent = result;
}
let CHTP_html = '<html>';
CHTP_html += '<head>';
CHTP_html += '<title>Convert Hour to Percent</
title>';
CHTP_html += '</head>';
CHTP_html += '<body>';
CHTP_html += '<div class ="ourDivStyle">';
CHTP_html += '<hr>';
CHTP_html += 'CONVERT<br>HOUR TO PERCEN
T';
CHTP_html += '<hr>';
CHTP_html += 'Enter Minutes';
CHTP_html += '<br>';
CHTP_html += '<textarea id="CHTP_Input" placeh
older="Enter" rows="1" cols="7" class="ourTextS
tyle" type="text" onkeyup="CHTP_convert();"></
textarea>';
CHTP_html += '<br><hr>';
CHTP_html += 'Percent';
//**********************************************//TOOL - C
ALCULATION
//Calculate Sales Tax
//CST_ we use this as a namespace, for zero confl
icts
function CST_calculate()
{
let nameSpace = "CST_";
//person enters the amount
//we get the amount from the text area with the i
d nameSpace_Input
College of Scripting Music & Science CollegeOfScripting.weebly.com
let amount = document.getElementById(nameS
pace + "Input").value;
//person enters the tax rate
//we get the amount from the text area with the i
d nameSpace_Input
let taxRate = document.getElementById(nameS
pace + "Input2").value;
//result of the conversion formula
let result = (amount / 100) * taxRate;
//display result in the text area that has the id of
nameSpace_Result
document.getElementById(nameSpace + "Resu
lt").textContent = result;
}
let CST_html = '<html>';
CST_html += '<head>';
CST_html += '<title>Calculate Sales Tax</title>';
CST_html += '</head>';
CST_html += '<body>';
CST_html += '<div class ="ourDivStyle">';
CST_html += '<hr>';
CST_html += 'CALCULATE<br>SALES TAX';
CST_html += '<br><hr>';
CST_html += 'Enter Tax Rate';
CST_html += '<br>';
CST_html += '<textarea id="CST_Input2" placehol
der="Enter" rows="1" cols="7" class="ourTextSty
le" type="text" onkeyup="CST_calculate();"></
textarea>';
CST_html += '<br><hr>';
CST_html += 'Sales Tax<br>to Pay';
CST_html += '<br>';
CST_html += '<textarea id="CST_Result" placehol
der="Result" rows="1" cols="7" class="ourTextSt
yle" type="text" readonly></textarea>';
CST_html += '<hr>';
CST_html += '</div>';
CST_html += '</body>';
CST_html += '</html>';
//**********************************************//
function CAON_calculate()
{
let nameSpace = "CAON_";
//person enters numbers separated by commas
//we get the comma separated numbers from th
e text area with the id nameSpace_Input
let amount = document.getElementById(nameS
pace + "Input").value.split(',');
//split separates values according to the charac
ter chosen. As shown above, we separate values
by comma, Ex: 45,34,26
//add the numbers together
//get how many numbers exist in the string
let howMany = amount.length;
//result of dividing theSum by howMany
let result = theSum / howMany;
//display result in the text area that has the id of
nameSpace_Result
document.getElementById(nameSpace + "Resu
lt").textContent = result;
}
let CAON_html = '<html>';
CAON_html += '<head>';
CAON_html += '<title>Calculate Average of Numb
ers</title>';
CAON_html += '</head>';
CAON_html += '<body>';
CAON_html += '<div class ="ourDivStyle">';
CAON_html += '<hr>';
CAON_html += '<br><hr>';
CAON_html += 'Average';
CAON_html += '<br>';
CAON_html += '<textarea id="CAON_Result" plac
eholder="Result" rows="1" cols="7" class="ourT
extStyle" type="text" readonly></textarea>';
CAON_html += '<hr>';
CAON_html += '</div>';
CAON_html += '</body>';
CAON_html += '</html>';
//**********************************************//
function CMON_calculate()
{
let nameSpace = "CMON_";
//person enters numbers separated by commas,
Ex: 45,34,26
//we get the comma separated values from the t
ext area with the id nameSpace_Input
let amount = document.getElementById(nameS
pace + "Input").value.split(',');
//split separates values according to the charac
ter chosen. As shown above, we separate values
by comma. Ex: 45,34,26
//get how many numbers exist in the array
//let howMany = amount.length;
//sort the numbers in ascending order, low to hi
gh
//convert to an array of float values
let ourArray = amount.map(function(item) {
return parseFloat(item, 10);
});
//find the median of ourArray
let median = Math.floor(ourArray.length / 2);
if (ourArray.length % 2)
{
result = ourArray[median];
}
else
{
result = (ourArray[median - 1] + ourArray[me
dian]) / 2.0;
}
//display result in the text area that has the id of
nameSpace_Result
document.getElementById(nameSpace + "Resu
lt").textContent = result;
let CMON_html = '<html>';
CMON_html += '<head>';
CMON_html += '<title>Calculate Median of Numbe
rs</title>';
CMON_html += '</head>';
CMON_html += '<body>';
CMON_html += '<div class ="ourDivStyle">';
CMON_html += '<hr>';
CMON_html += 'CALCULATE MEDIAN OF NUMBE
RS';
CMON_html += '<hr>';
CMON_html += 'Enter Numbers<br>Use Commas'
;
CMON_html += '<br>';
CMON_html += '<textarea id="CMON_Input" place
holder="Enter" rows="1" cols="7" class="ourText
Style" style="overflow:visible"; type="text" onkey
up="CMON_calculate();"></textarea>';
CMON_html += '<br><hr>';
CMON_html += 'Median';
CMON_html += '<br>';
//**********************************************//TOOL - S
ORT
//Sort Numbers in Ascending Order
//SNIAO_ we use this as a namespace, for zero co
nflicts
function SNIAO_calculate()
{
let nameSpace = "SNIAO_";
//person enters numbers separated by commas,
Ex: 45,47,34
//we get the comma separated values from the t
ext area with the id nameSpace_Input
College of Scripting Music & Science CollegeOfScripting.weebly.com
let amount = document.getElementById(nameS
pace + "Input").value.split(',');
//split separates values according to the charac
ter chosen. As shown above, we separate values
by comma, Ex: 45,47,34
//get how many numbers exist in the array
//let howMany = amount.length;
//sort the numbers in ascending order, low to hi
gh
amount.sort(function(a,b){
return a-b;
});
let result = amount;
//display result in the text area that has the id of
nameSpace_Result
document.getElementById(nameSpace + "Resu
lt").textContent = result;
}
let SNIAO_html = '<html>';
SNIAO_html += '<head>';
SNIAO_html += '<br><hr>';
SNIAO_html += 'Sorted<br>Low to High';
SNIAO_html += '<br>';
SNIAO_html += '<textarea id="SNIAO_Result" pla
ceholder="Result" rows="1" cols="7" class="our
TextStyle" style="overflow:visible"; type="text" re
adonly></textarea>';
SNIAO_html += '<hr>';
SNIAO_html += '</div>';
//**********************************************//TOOL - S
ORT
//Sort Numbers in Descending Order
//SNIDO_ we use this as a namespace, for zero co
nflicts
function SNIDO_calculate()
{
let nameSpace = "SNIDO_";
//person enters numbers separated by commas,
Ex: 45,34,26
//we get the comma separated values from the t
ext area with the id nameSpace_Input
let amount = document.getElementById(nameS
pace + "Input").value.split(',');
//get how many numbers exist in the array
//let howMany = amount.length;
//sort the numbers in descending order, high to
low
amount.sort(function(b,a){
return a-b;
});
let result = amount;
//display result in the text area that has the id of
nameSpace_Result
document.getElementById(nameSpace + "Resu
lt").textContent = result;
}
let SNIDO_html = '<html>';
SNIDO_html += '<head>';
SNIDO_html += '<title>Sort Numbers in Descendi
ng Order</title>';
SNIDO_html += '</head>';
SNIDO_html += '<br><hr>';
SNIDO_html += 'Sorted<br>High to Low';
SNIDO_html += '<br>';
SNIDO_html += '<textarea id="SNIDO_Result" pla
ceholder="Result" rows="1" cols="7" class="our
TextStyle" style="overflow:visible"; type="text" re
adonly></textarea>';
SNIDO_html += '<hr>';
SNIDO_html += '</div>';
SNIDO_html += '</body>';
SNIDO_html += '</html>';
//**********************************************//
function CAOAS_calculate()
{
let nameSpace = "CAOAS_";
//person enters the amount
//we get the amount from the text area with the i
d nameSpace_Input
let amount = document.getElementById(nameS
pace + "Input").value;
//result of multiplying the length of any side by i
tself
let result = amount * amount;
//display result in the text area that has the id of
nameSpace_Result
College of Scripting Music & Science CollegeOfScripting.weebly.com
document.getElementById(nameSpace + "Resu
lt").textContent = result;
}
let CAOAS_html = '<html>';
CAOAS_html += '<head>';
CAOAS_html += '<title>Calculate Area of a Squar
e</title>';
CAOAS_html += '</head>';
CAOAS_html += '<body>';
CAOAS_html += '<div class ="ourDivStyle">';
CAOAS_html += '<hr>';
CAOAS_html += 'CALCULATE<br>AREA OF A SQ
UARE';
CAOAS_html += '<hr>';
CAOAS_html += 'Enter Length<br>of Any Side<br
>in Inches';
CAOAS_html += '<br>';
CAOAS_html += '<textarea id="CAOAS_Input" pla
ceholder="Enter" rows="1" cols="7" class="ourT
extStyle" type="text" onkeyup="CAOAS_calculat
e();"></textarea>';
CAOAS_html += '<br><hr>';
CAOAS_html += 'Area<br>(Inches<sup>2</
sup>)';
//**********************************************//TOOL - C
ALCULATION
//Calculate Area of a Rectangle (inches)
//CAOAR_ we use this as a namespace, for zero c
onflicts
function CAOAR_calculate()
{
let nameSpace = "CAOAR_";
//person enters the amount1 (length)
//we get the amount from the text area with the i
d nameSpace_Input1
College of Scripting Music & Science CollegeOfScripting.weebly.com
let amount1 = document.getElementById(name
Space + "Input1").value;
//person enters the amount2 (width)
//we get the amount from the text area with the i
d nameSpace_Input2
let amount2 = document.getElementById(name
Space + "Input2").value;
//result of multiplying the length and width
let result = amount1 * amount2;
//display result in the text area that has the id of
nameSpace_Result
document.getElementById(nameSpace + "Resu
lt").textContent = result;
}
let CAOAR_html = '<html>';
CAOAR_html += '<head>';
CAOAR_html += '<title>Calculate Area of a Recta
ngle</title>';
CAOAR_html += '</head>';
CAOAR_html += '<body>';
CAOAR_html += '<div class ="ourDivStyle">';
CAOAR_html += '<hr>';
CAOAR_html += '<hr>';
CAOAR_html += 'Enter Width<br>in Inches';
CAOAR_html += '<br>';
CAOAR_html += '<textarea id="CAOAR_Input2" p
laceholder="Enter" rows="1" cols="7" class="our
TextStyle" type="text" onkeyup="CAOAR_calcula
te();"></textarea>';
CAOAR_html += '<br><hr>';
CAOAR_html += 'Area<br>(Inches<sup>2</
sup>)';
CAOAR_html += '<br>';
CAOAR_html += '<textarea id="CAOAR_Result" p
laceholder="Result" rows="1" cols="7" class="ou
rTextStyle" type="text" readonly></textarea>';
CAOAR_html += '<hr>';
//**********************************************//TOOL - IN
TERNET
//Website GoTo
//WGT is this tools namespace to avoid name con
flicts
function WGT_goToWebsite(theURL)
{
//Open URL in a New Tab
window.open(theURL, "_blank");
}
let WGT_websites = [
{
name: "Google",
url: "https://www.google.com"
},
{
College of Scripting Music & Science CollegeOfScripting.weebly.com
name: "Weather",
url: "https://www.weatherusa.net/"
},
{
name: "Space Weather",
url: "https://www.spaceweather.com"
}
];
//GOOGLE SEARCH GOOGLE SEARCH
let WGT_googleSearch = '<html>';
WGT_googleSearch += '<head>';
WGT_googleSearch += '<title>Google Search</
title>';
WGT_googleSearch += '</head>';
WGT_googleSearch += '<body>';
WGT_googleSearch += '<div>';
WGT_googleSearch += '<hr>';
WGT_googleSearch += '<button onclick="WGT
_goToWebsite(WGT_websites[0].url);"> GoTo </
button>';
WGT_googleSearch += '<hr>';
WGT_googleSearch += '<h2>GOOGLE<br>SEA
RCH</h2>';
WGT_googleSearch += '</div>';
WGT_googleSearch += '</body>';
//**********************************************//
//WEATHER WEATHER WEATHER
let WGT_theWeather = '<html>';
WGT_theWeather += '<head>';
WGT_theWeather += '<title> Weather </title>';
WGT_theWeather += '</head>';
WGT_theWeather += '<div>';
WGT_theWeather += '<body>';
WGT_theWeather += '<hr>';
WGT_theWeather += '<button onclick="WGT_g
oToWebsite(WGT_websites[1].url);"> GoTo </
button>';
WGT_theWeather += '<hr>';
WGT_theWeather += '<h2> WEATHER </h2>';
WGT_theWeather += '</div>';
WGT_theWeather += '</body>';
WGT_theWeather += '</html>';
//**********************************************//
//SPACE WEATHER SPACE WEATHER
let WGT_spaceWeather = '<html>';
WGT_spaceWeather += '<head>';
WGT_spaceWeather += '<title> Space Weather
</title>';
//**********************************************//
//**********************************************//
//theData Array
//the date is optional, for filtering tools by date
//the number is optional, for filtering tools by num
ber
let theData = [
College of Scripting Music & Science CollegeOfScripting.weebly.com
{
//Year Born From Current Year
theHtml: YBFCY_html,
title: "Year Born From Current Year",
tag1: "calculation",
tag2: "investigations",
date: "04/03/2010 12:00 AM",
number: "1",
category: "research",
type: "tool"
},
{
//Year Born From Specific Year
theHtml: YBFSY_html,
title: "Year Born From Specific Year",
tag1: "calculation",
tag2: "investigations",
date: "04/03/2008 12:00 AM",
number: "2",
category: "research",
type: "tool"
},
{
//Convert Feet To Meters
theHtml: CFTM_html,
title: "Convert Feet To Meters",
//SORT by DATE, ascending or descending order
function sortByDate(whichArray, direction)
{
if(direction == "up") //ASCENDING, low to high
{
function sortIt()
{
//To Sort theData array we choose one of the op
tions below.
//To Sort by date - Most Current to Oldest
sortByDate(theData, "down"); //Descending
//To Sort by date - Oldest to Most Current
//sortByDate(theData, "up"); //Ascending
/*
////To Sort by number in DESCENDING ORDER//
//
//meaning sort from highest to lowest number
/*
////To Sort by number in ASCENDING ORDER////
//meaning sort from lowest to highest number
theData.sort(function(a, b)
{
return a.number.localeCompare(b.number, 'e
n-US', {numeric:"true"});
});
*/
}
sortIt();
//**********************************************
//DISPLAY the DATA by creating a Row
function createTheRow(posX, posY, sizeX, sizeY,
whichArray, criteria1, criteria2)
{
//filter for Multiple MONTHS
//if(whichArray[i].date.substring(0,2) == 8 ||
whichArray[i].date.substring(0,2) == 9)
//filter for a DATE
//if(whichArray[i].date.substring(0,10) == "0
2/29/2018")
//filter for a Multiple DATES
//if(whichArray[i].date.substring(0,10) == "0
2/29/2018" || whichArray[i].date.substring(0,10) ==
"02/29/2020")
//filter for a DAY, of any month, of any year
//if(whichArray[i].date.substring(3,5) == 2)
//filter for MULTIPLE YEARS
//if(whichArray[i].date.substring(6,10) == 20
19 || whichArray[i].date.substring(6,10) == 2020)
//filter for MONTH and YEAR
//if(whichArray[i].date.substring(0,2) == 2 &
& whichArray[i].date.substring(6,10) == 2020)
//You can replace the if statement below,
//with one of the options above.
if(whichArray) //shows all items
{
//TYPE OF ELEMENT TO CREATE, div
let ourDiv = document.createElement("di
v");
//POSITION
ourDiv.style.position = "absolute";
ourDiv.style.left = posX +'px';
ourDiv.style.top = posY + 'px';
//SIZE
//APPEARANCE
ourDiv.style.color = "white";
ourDiv.style.zIndex = "10";
ourDiv.style.fontFamily = "exo";
ourDiv.style.fontWeight = "bold";
ourDiv.style.fontSize = "medium";
ourDiv.style.background = "black";
ourDiv.style.textAlign = "center";
ourDiv.style.border = "solid 2px rgba(100
,100,255,1.0)";
//CONTENT
ourDiv.innerHTML = whichArray[i].theHt
ml;
//ADD CONTENT TO THE PAGE
document.body.append(ourDiv);
//COLUMNS ACROSS
posX = posX + sizeX;
}
}
}
//The First Row yPos starts at 80px from the top o
f the screen
let yPos = 80; //the position of the first row
let sizeX = 160; //default size of the X dimension
let sizeY = 325; //default size of the Y dimension
let spacer = 20; //space between rows
/*
Container for the rows of Tools
auto positions the rows vertically
based on the sizeY of each rows div
and then adds a spacer between rows
*/
function contentContainer1()
{
//CALCULATION ROW - Year Born
createTheRow(100, yPos, sizeX, sizeY - 43, the
Data, 'calculation', 'investigations');
yPos = yPos + sizeY - 43 + spacer;
//CONVERSION ROW - Distance
createTheRow(100, yPos, sizeX, sizeY - 115, the
Data, 'conversion', 'distance');
//CONVERSION ROW - Distance2
createTheRow(100, yPos, sizeX, sizeY - 27, the
Data, 'conversion', 'distance2');
yPos = yPos + sizeY - 27 + spacer;
//CONVERSION ROW - Speed
createTheRow(100, yPos, sizeX, sizeY - 130, the
Data, 'conversion', 'speed');
yPos = yPos + sizeY - 130 + spacer;
//CONVERSION ROW - Temperature
createTheRow(100, yPos, sizeX, sizeY - 100, the
Data, 'conversion', 'temperature');
yPos = yPos + sizeY - 100 + spacer;
//CONVERSION ROW - Percent and Decimal
createTheRow(100, yPos, sizeX, sizeY - 115, the
Data, 'conversion', 'percent');
yPos = yPos + sizeY - 115 + spacer;
//CALCULATION ROW - Sales Tax
createTheRow(100, yPos, sizeX, sizeY - 58, the
Data, 'calculation', 'sales');
yPos = yPos + sizeY - 58 + spacer;
//CALCULATION ROW - Numbers - (Sort)
createTheRow(100, yPos, sizeX, sizeY - 70, the
Data, 'calculation', 'sort');
yPos = yPos + sizeY - 70 + spacer;
//CALCULATION ROW - Geometry
createTheRow(100, yPos, sizeX, sizeY - 10, the
Data, 'calculation', 'geometry');
yPos = yPos + sizeY - 10 + spacer;
//INFORMATION ROW - Internet
createTheRow(100, yPos, sizeX, sizeY - 170, the
Data, 'info', 'any');
yPos = yPos + sizeY - 170 + spacer;
}
</script>
</head>
<center>
<div class = "theDedication">Dedicated to God
the Father</div>
<div class = "theTitle">TOPALIAN JAVASCRIPT
TOOLS CREATOR</div>
</center>
</body>
</html>