diff --git a/+/autocomplete.html b/+/autocomplete.html new file mode 100644 index 0000000..79d065b --- /dev/null +++ b/+/autocomplete.html @@ -0,0 +1,161 @@ + \ No newline at end of file diff --git a/+/autoconvert.html b/+/autoconvert.html index 5881e37..390a4c4 100644 --- a/+/autoconvert.html +++ b/+/autoconvert.html @@ -27,90 +27,93 @@ // modified from creative commons share-alike source authored by 'bpbutti' // https://codereview.stackexchange.com/questions/90349/changing-number-to-words-in-javascript - function english(dollars, cents) { - if(dollars === 0){ // penny check, forget printing dollar amount - return cents + ' cents' - } + // trigger autoconvert for paylinks: + if((location+'').indexOf('&amount') >= 0){ $('.amount .font').trigger('blur') } +})(); - //Creates an array with the number's digits and - //adds the necessary amount of 0 to make it fully - //divisible by 3 - var digits = String(dollars).split(''); - var digitsNeeded = 3 - digits.length % 3; - if (digitsNeeded !== 3) { //prevents this : (123) ---> (000123) - while (digitsNeeded > 0) { - digits.unshift('0'); - digitsNeeded--; - } - } - //Groups the digits in groups of three - var digitsGroup = []; - var numberOfGroups = digits.length / 3; - for (var i = 0; i < numberOfGroups; i++) { - digitsGroup[i] = digits.splice(0, 3); - } - // console.log(digitsGroup) //debug - - //Change the group's numerical values to text - var digitsGroupLen = digitsGroup.length; - var numTxt = [ - [null, 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine'], //hundreds - [null, 'ten', 'twenty', 'thirty', 'forty', 'fifty', 'sixty', 'seventy', 'eighty', 'ninety'], //tens - [null, 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine'] //ones - ]; - var tenthsDifferent = ['ten', 'eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen', 'sixteen', 'seventeen', 'eighteen', 'nineteen'] - - // j maps the groups in the digitsGroup - // k maps the element's position in the group to the numTxt equivalent - // k values: 0 = hundreds, 1 = tens, 2 = ones - for (var j = 0; j < digitsGroupLen; j++) { - for (var k = 0; k < 3; k++) { - var currentValue = digitsGroup[j][k]; - digitsGroup[j][k] = numTxt[k][currentValue] - if (k === 0 && currentValue !== '0') { // !==0 avoids creating a string "null hundred" - digitsGroup[j][k] += ' hundred '; - } - else if (k === 1 && currentValue === '1') { //Changes the value in the tens place and erases the value in the ones place - digitsGroup[j][k] = tenthsDifferent[digitsGroup[j][2]]; - digitsGroup[j][2] = 0; //Sets to null. Because it sets the next k to be evaluated, setting this to null doesn't work. - } - } - } +function english(dollars, cents) { - // console.log(digitsGroup) //debug + if(dollars === 0){ // penny check, forget printing dollar amount + return cents + ' cents' + } - //Adds '-' for grammar, cleans all null values, joins the group's elements into a string - for (var l = 0; l < digitsGroupLen; l++) { - if (digitsGroup[l][1] && digitsGroup[l][2]) { - digitsGroup[l][1] += '-'; - } - digitsGroup[l].filter(function (e) { return e !== null }); - digitsGroup[l] = digitsGroup[l].join(''); - } + //Creates an array with the number's digits and + //adds the necessary amount of 0 to make it fully + //divisible by 3 + var digits = String(dollars).split(''); + var digitsNeeded = 3 - digits.length % 3; + if (digitsNeeded !== 3) { //prevents this : (123) ---> (000123) + while (digitsNeeded > 0) { + digits.unshift('0'); + digitsNeeded--; + } + } - // console.log(digitsGroup) //debug - - //Adds thousand, millions, billion and etc to the respective string. - var posfix = [null, 'thousand', 'million', 'billion', 'trillion', 'quadrillion', 'quintillion', 'sextillion']; - if (digitsGroupLen > 1) { - var posfixRange = posfix.splice(0, digitsGroupLen).reverse(); - for (var m = 0; m < digitsGroupLen - 1; m++) { //'-1' prevents adding a null posfix to the last group - if (digitsGroup[m]) { // avoids 10000000 being read (one billion million) - digitsGroup[m] += ' ' + posfixRange[m]; - } - } - } + //Groups the digits in groups of three + var digitsGroup = []; + var numberOfGroups = digits.length / 3; + for (var i = 0; i < numberOfGroups; i++) { + digitsGroup[i] = digits.splice(0, 3); + } + // console.log(digitsGroup) //debug - // drop the and if its not needed + //Change the group's numerical values to text + var digitsGroupLen = digitsGroup.length; + var numTxt = [ + [null, 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine'], //hundreds + [null, 'ten', 'twenty', 'thirty', 'forty', 'fifty', 'sixty', 'seventy', 'eighty', 'ninety'], //tens + [null, 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine'] //ones + ]; + var tenthsDifferent = ['ten', 'eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen', 'sixteen', 'seventeen', 'eighteen', 'nineteen'] - //Joins all the string into one and returns it - return digitsGroup.join(' ').replace(/\s+/g, ' ') + ' and ' + cents + '/100' + // j maps the groups in the digitsGroup + // k maps the element's position in the group to the numTxt equivalent + // k values: 0 = hundreds, 1 = tens, 2 = ones + for (var j = 0; j < digitsGroupLen; j++) { + for (var k = 0; k < 3; k++) { + var currentValue = digitsGroup[j][k]; + digitsGroup[j][k] = numTxt[k][currentValue] + if (k === 0 && currentValue !== '0') { // !==0 avoids creating a string "null hundred" + digitsGroup[j][k] += ' hundred '; + } + else if (k === 1 && currentValue === '1') { //Changes the value in the tens place and erases the value in the ones place + digitsGroup[j][k] = tenthsDifferent[digitsGroup[j][2]]; + digitsGroup[j][2] = 0; //Sets to null. Because it sets the next k to be evaluated, setting this to null doesn't work. + } + } + } - }; //End of numToWords function + // console.log(digitsGroup) //debug + + //Adds '-' for grammar, cleans all null values, joins the group's elements into a string + for (var l = 0; l < digitsGroupLen; l++) { + if (digitsGroup[l][1] && digitsGroup[l][2]) { + digitsGroup[l][1] += '-'; + } + digitsGroup[l].filter(function (e) { return e !== null }); + digitsGroup[l] = digitsGroup[l].join(''); + } + + // console.log(digitsGroup) //debug + + //Adds thousand, millions, billion and etc to the respective string. + var posfix = [null, 'thousand', 'million', 'billion', 'trillion', 'quadrillion', 'quintillion', 'sextillion']; + if (digitsGroupLen > 1) { + var posfixRange = posfix.splice(0, digitsGroupLen).reverse(); + for (var m = 0; m < digitsGroupLen - 1; m++) { //'-1' prevents adding a null posfix to the last group + if (digitsGroup[m]) { // avoids 10000000 being read (one billion million) + digitsGroup[m] += ' ' + posfixRange[m]; + } + } + } + + // drop the and if its not needed + + //Joins all the string into one and returns it + return digitsGroup.join(' ').replace(/\s+/g, ' ') + ' and ' + cents + '/100' + +} //End of numToWords function - // trigger autoconvert for paylinks: - if((location+'').indexOf('&amount') >= 0){ $('.amount .font').trigger('blur') } -})(); diff --git a/+/help/deposit.html b/+/help/deposit.html index 9f443c0..ec93ffa 100644 --- a/+/help/deposit.html +++ b/+/help/deposit.html @@ -35,9 +35,9 @@ width: 100%; height: 2px; background-image: linear-gradient( - to right, - #86cfeb var(--progress, 0%), - #7da4ae50 var(--progress, 0%) + to right, + #86cfeb var(--progress, 0%), + #7da4ae50 var(--progress, 0%) ); z-index: 1; } @@ -156,7 +156,7 @@ padding: 1.5rem; border-radius: 0.5rem; box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), - 0 8px 10px -6px rgb(0 0 0 / 0.1); + 0 8px 10px -6px rgb(0 0 0 / 0.1); background-color: #000; display: flex; align-items: start; @@ -216,22 +216,22 @@