-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathnumerologically.js
More file actions
557 lines (509 loc) · 18.3 KB
/
numerologically.js
File metadata and controls
557 lines (509 loc) · 18.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
// PREPARING DATA
// Initial global variables
var arrBig = ["Birthday", "FirstName", "MiddleName", "LastName"];
var arrBigLength = arrBig.length;
var arrAlphabet = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","_"];
var arrAlphabetValue = ["1","2","3","4","5","6","7","8","9","1","2","3","4","5","6","7","8","9","1","2","3","4","5","6","7","8","7"];
// Remove dashes and spaces from string
function formatString(str)
{
// If you need to check if it's a number, you can do an if statement here
var lowerCase = str.toLowerCase();
var noDashes = lowerCase.replace(/-/g, "");
var formattedThing = noDashes.replace(" ","");
var formattedString = formattedThing.toString();
return formattedString;
}
// Get form values, format them, store them in global variables
function formatFieldsAndStore()
{
for (i=0;i<4;i++)
{
var currentFieldName = arrBig[i];
var currentFieldValue = document.forms.numerologicalForm[currentFieldName].value;
var formattedString = formatString(currentFieldValue);
switch (currentFieldName)
{
case "Birthday":
window.strBirthday = formattedString;
break;
case "FirstName":
window.strFirstName = formattedString;
break;
case "MiddleName":
window.strMiddleName = formattedString;
break;
case "LastName":
window.strLastName = formattedString;
break;
}
}
var strFullName = strFirstName.concat(strMiddleName,strLastName);
var firstLetterFirstName = strFirstName.substr(0,1);
var firstLetterMiddleName = strMiddleName.substr(0,1);
var firstLetterLastName = strLastName.substr(0,1);
var strFirstNameLength = strFirstName.length;
var strMiddleNameLength = strMiddleName.length;
var strLastNameLength = strLastName.length;
var lastLetterFirstName = strFirstName.substr(strFirstNameLength - 1);
var lastLetterMiddleName = strMiddleName.substr(strMiddleNameLength - 1);
var lastLetterLastName = strLastName.substr(strLastNameLength - 1);
window.strFirstLetterFirstName = firstLetterFirstName;
window.strFirstLetterMiddleName = firstLetterMiddleName;
window.strFirstLetterLastName = firstLetterLastName;
window.strLastLetterFirstName = lastLetterFirstName;
window.strLastLetterMiddleName = lastLetterMiddleName;
window.strLastLetterLastName = lastLetterLastName;
window.strFullName = strFullName;
}
// breakUp and start addTogether
function breakUp(str, arrayLength)
{
var characterArray = [];
for (i=0;i<4;i++)
{
var character = str.charAt(i);
characterArray.push(character);
}
addTogether(characterArray);
}
// ADDING
// Basic addition
function addition(string) {
string = string.split(''); //split into individual characters
var sum = 0; //have a storage ready
for (var i = 0; i < string.length; i++) { //iterate through
sum += parseInt(string[i],10); //convert from string to int
}
return sum; //return when done
}
// Add, then add together again until 1 digit
function reduce(string) {
var strFirstAddition = addition(string);
var stringLength = strFirstAddition.toString().length;
if (stringLength >= 2)
{
var prepare = strFirstAddition.toString();
var reduction = addition(prepare);
return reduction;
} else {
var reduction = strFirstAddition;
return reduction;
}
}
// Add array together and send to print
function arrayAddTogether(arr)
{
function add(a, b)
{
return a + b;
}
var singleString = arr.join("");
var singleStringLength = singleString.length;
var sumOfString = addition(singleString);
var stringLength = sumOfString.toString().length;
if (stringLength >= 2)
{
var sumOfStringString = sumOfString.toString();
var sumOfString2 = addition(sumOfStringString);
return sumOfString2;
} else {
return sumOfString;
}
}
// ASSIGNING GROUPING
// Make year, month, and day
function defineDates(str)
{
var strBirthYear = str.substr(0,4);
var strBirthYearLength = strBirthYear.length;
var strBirthMonth = str.substr(4,2);
var strBirthMonthLength = strBirthMonth.length;
var strBirthDay = str.substr(6,2);
var strBirthDayLength = strBirthDay.length;
window.strBirthYear = strBirthYear;
window.strBirthYearLength = strBirthYearLength;
window.strBirthMonth = strBirthMonth;
window.strBirthYearLength = strBirthYearLength;
window.strBirthDay = strBirthDay;
window.strBirthYearLength = strBirthYearLength;
}
// Make first letters, last letters with letterPositionTag
function letterPositionTag()
{
var strThisNameLength = formattedString.length;
var strFirstLetter = formattedString.substr(0,1);
// Smart method from stackOverflow
var strLastLetter = formattedString.substr(strThisNameLength - 1);
}
// Make vowels, consonants with arrays
// Get vowels only
function getVowels(str)
{
var arrThisNameVowels = [];
var arrThisNameConsonants = [];
var strThisNameLength = str.length;
for (i=0;i<strThisNameLength;i++)
{
var strThisLetter = str.substr(0+i,1);
var strThisLetterYeah = strThisLetter.toString();
// Check for vowels or consonants, _ represents y as a vowel
if (strThisLetterYeah === "a" || strThisLetterYeah === "e" || strThisLetterYeah === "i" || strThisLetterYeah === "o" || strThisLetterYeah === "u" || strThisLetterYeah === "_")
{
arrThisNameVowels.push(strThisLetterYeah);
}
else {
arrThisNameConsonants.push(strThisLetterYeah);
}
}
return arrThisNameVowels;
}
// Get consonants only
function getConsonants(str)
{
var arrThisNameVowels = [];
var arrThisNameConsonants = [];
var strThisNameLength = str.length;
for (i=0;i<strThisNameLength;i++)
{
var strThisLetter = str.substr(0+i,1);
var strThisLetterYeah = strThisLetter.toString();
// Check for vowels or consonants, _ represents y as a vowel
if (strThisLetterYeah === "a" || strThisLetterYeah === "e" || strThisLetterYeah === "i" || strThisLetterYeah === "o" || strThisLetterYeah === "u" || strThisLetterYeah === "_")
{
arrThisNameVowels.push(strThisLetterYeah);
}
else {
arrThisNameConsonants.push(strThisLetterYeah);
}
}
return arrThisNameConsonants;
}
// Convert letters into numbers from array
function lettersToNumbersArray(arr, arrLength)
{
var arrNumberArray = [];
for (i=0;i<arrLength;i++)
{
for (k=0;k<26;k++)
{
var strThisLetter = arr[i];
if (strThisLetter === arrAlphabet[k])
{
var thisNumber = arrAlphabetValue[k];
var strThisNumber = thisNumber.toString();
arrNumberArray.push(strThisNumber);
} else {}
}
}
}
// Convert letters into numbers from string
function lettersToNumbersString(str)
{
var newArr = str.split("");
var newArrLength = newArr.length;
var arrNumberArray = [];
for (i=0;i<newArrLength;i++)
{
for (k=0;k<26;k++)
{
var strThisLetter = newArr[i];
if (strThisLetter === arrAlphabet[k])
{
var thisNumber = arrAlphabetValue[k];
var strThisNumber = thisNumber.toString();
arrNumberArray.push(strThisNumber);
} else {}
}
}
return arrNumberArray;
}
// NUMBER FUNCTIONS
// Life Path
function lifePath()
{
var strBirthYearNumber = reduce(strBirthYear);
var strBirthMonthNumber = reduce(strBirthMonth);
var strBirthDayNumber = reduce(strBirthDay);
var strFirstAddition = strBirthYearNumber + strBirthMonthNumber + strBirthDayNumber;
if (strFirstAddition >= 2)
{
if (strFirstAddition != 22)
{
if (strFirstAddition !=11)
{
var prepare = strFirstAddition.toString();
var lifePath = addition(prepare);
window.strLifePathNumber = lifePath;
} else {
var lifePath = 11;
window.strLifePathNumber = lifePath;
}
} else {
var lifePath = 22;
window.strLifePathNumber = lifePath;
}
} else {
var lifePath = strFirstAddition;
window.strLifePathNumber = lifePath;
}
}
// Challenge Numbers
function challengeNumbers ()
{
var strBirthYearNumber = reduce(strBirthYear);
var strBirthMonthNumber = reduce(strBirthMonth);
var strBirthDayNumber = reduce(strBirthDay);
var challengeOne = strBirthDayNumber - strBirthMonthNumber;
var challengeTwo = strBirthDayNumber - strBirthYearNumber;
var challengeThree = challengeOne - challengeTwo;
var challengeFour = strBirthYearNumber - strBirthMonthNumber;
var arrChallengeNumbers = [challengeOne, challengeTwo, challengeThree, challengeFour];
window.arrChallengeNumbers = arrChallengeNumbers;
}
// Pinnacle Numbers
function pinnacleNumbers ()
{
var strBirthYearNumber = reduce(strBirthYear);
var strBirthMonthNumber = reduce(strBirthMonth);
var strBirthDayNumber = reduce(strBirthDay);
var pinnacleOne = strBirthDayNumber + strBirthMonthNumber;
var pinnacleTwo = strBirthDayNumber + strBirthYearNumber;
var pinnacleThree = pinnacleOne + pinnacleTwo;
var pinnacleFour = strBirthYearNumber + strBirthMonthNumber;
var pinnacleOneNumber = addition(pinnacleOne.toString());
var pinnacleTwoNumber = addition(pinnacleTwo.toString());
var pinnacleThreeNumber = addition(pinnacleThree.toString());
var pinnacleFourNumber = addition(pinnacleFour.toString());
var arrPinnacleNumbers = [pinnacleOneNumber, pinnacleTwoNumber, pinnacleThreeNumber, pinnacleFourNumber];
window.arrPinnacleNumbers = arrPinnacleNumbers;
}
// Special letters
function specialVowel()
{
var strFirstNameLength = strFirstName.length;
for (i=0;i<strFirstNameLength;i++)
{
var strThisLetter = strFirstName.substr(0+i,1);
switch (strThisLetter)
{
case "a":
window.strSpecialVowel = strThisLetter;
return;
case "e":
window.strSpecialVowel = strThisLetter;
return;
case "i":
window.strSpecialVowel = strThisLetter;
return;
case "o":
window.strSpecialVowel = strThisLetter;
return;
case "u":
window.strSpecialVowel = strThisLetter;
return;
case "_":
window.strSpecialVowel = strThisLetter;
return;
}
}
}
// Expression Number
function expressionNumber()
{
var arrExpressionNumbers = lettersToNumbersString(strFullName);
var strExpressionNumber = arrayAddTogether(arrExpressionNumbers);
window.strExpressionNumber = strExpressionNumber;
}
// Heart's Desire Number
function heartsDesire()
{
var arrHeartsDesireLetters = getVowels(strFullName);
var turnToString = arrHeartsDesireLetters.join("");
var arrHeartsDesireNumbers = lettersToNumbersString(turnToString);
var strHeartsDesireNumber = arrayAddTogether(arrHeartsDesireNumbers);
window.strHeartsDesireNumber = strHeartsDesireNumber;
}
// Personality Number
function personalityNumber()
{
var arrPersonalityLetters = getConsonants(strFullName);
var turnToString = arrPersonalityLetters.join("");
var arrPersonalityNumbers = lettersToNumbersString(turnToString);
var strPersonalityNumber = arrayAddTogether(arrPersonalityNumbers);
window.strPersonalityNumber = strPersonalityNumber;
}
// Balance Number
function balanceNumber()
{
var balanceLetters = strFirstLetterFirstName + strFirstLetterMiddleName + strFirstLetterLastName;
var arrBalanceNumbers = lettersToNumbersString(balanceLetters);
var strBalanceNumber = arrayAddTogether(arrBalanceNumbers);
window.strBalanceNumber = strBalanceNumber;
}
// Maturity Number
function maturityNumber()
{
var thisMaturityNumber = (strLifePathNumber + strExpressionNumber).toString();
var strMaturityNumber = addition(thisMaturityNumber);
window.strMaturityNumber = strMaturityNumber;
}
// Subconscious Self
function subconsciousSelf ()
{
var arrAllNumbers = new Array();
var arrPossible = [1, 2, 3, 4, 5, 6, 7, 8, 9];
var objNumberValues = new Object();
var strFullNameLength = strFullName.length;
var arrFullNameNumbers = lettersToNumbersString(strFullName);
for (i=0;i<strFullNameLength;i++)
{
var strThisNumber = arrFullNameNumbers[i];
for (k=0;k<9;k++)
{
var checkThisNumber = arrPossible[k];
if (strThisNumber == checkThisNumber)
{
objNumberValues[strThisNumber] = "y";
} else {
}
}
}
var strSubconciousSelf = Object.keys(objNumberValues).length;
window.strSubconsciousSelfNumber = strSubconciousSelf;
}
// Rational Thought
function rationalThought()
{
var arrFirstNameNumbers = lettersToNumbersString(strFirstName);
var oneFirstNameNumber = arrayAddTogether(arrFirstNameNumbers);
var rationalThought = oneFirstNameNumber + strBirthDay;
var strRationalThoughtNumber = reduce(rationalThought);
window.strRationalThoughtNumber = strRationalThoughtNumber;
}
// Life chart
function lifeChart()
{
//TRANSIT NUMBERS
// Create name objects
var arrFirstName = new Array();
var arrMiddleName = new Array();
var arrLastName = new Array();
var arrFirstNameNumbers = new Array();
var arrMiddleNameNumbers = new Array();
var arrLastNameNumbers = new Array();
// Create arrays
var arrNames = [strFirstName, strMiddleName, strLastName];
var arrArrays = [arrFirstName, arrMiddleName, arrLastName];
var arrNameNumbers = [arrFirstNameNumbers, arrMiddleNameNumbers, arrLastNameNumbers];
var arrAddThis = [];
// Check and set up further arrays
for (j=0;j<3;j++)
{
var thisArray = arrArrays[j];
var thisNumberArray = arrNameNumbers[j]
var strThisName = arrNames[j];
var arrThisName = strThisName.split("");
var thisNameLength = arrThisName.length;
for (i=0;i<thisNameLength;i++)
{
var strThisLetter = arrThisName[i];
for (k=0;k<26;k++)
{
if (strThisLetter === arrAlphabet[k])
{
var thisNumber = arrAlphabetValue[k];
var strThisNumber = thisNumber.toString();
thisArray.push(strThisLetter);
thisNumberArray.push(strThisNumber);
} else {}
}
}
// Print transit
thisArrayLength = thisArray.length;
var arrShortTransit = [];
var arrShortTransitNumbers = [];
for (l=0;l<thisArrayLength;l++)
{
var thisLetter = thisArray[l];
var thisNumber = thisNumberArray[l];
for (k=0;k<thisNumber;k++)
{
arrShortTransit.push(thisLetter);
arrShortTransitNumbers.push(thisNumber);
}
}
var arrShortTransitLength = arrShortTransit.length;
var timesToRepeat = (110 / arrShortTransitLength);
for (i=0;i<timesToRepeat;i++)
{
appendThis(arrShortTransit, "Physical Transit #: ");
}
}
// Essence number
// Grab the arrNameNumbers and add them up up to the end of the chart
// Make each number, as it passes through iteration, get placed into an array with the other numbers related to it vertically, then add them together and print it after they each go through
// Karmic Debt
// Do like subconscious self; check numbers in name, put them into object with all numbers already there. They can overwrite, but I need them to count as well (+=?)
// Personal Year
// Period Cycle
}
// NUMEROLOGICALLY
function numerologically()
{
// First get the fields, store them, and group them
formatFieldsAndStore();
defineDates(strBirthday);
// Execute functions for each number
lifePath();
expressionNumber();
heartsDesire();
personalityNumber();
balanceNumber();
maturityNumber();
subconsciousSelf();
rationalThought();
challengeNumbers();
pinnacleNumbers();
specialVowel();
// lifeChart();
// Show numbers to the user
appendThis(strBirthday, "Birthday: ");
appendThis(strBirthYear, "Birth Year: ");
appendThis(strBirthMonth, "Birth Month: ");
appendThis(strBirthDay, "Birth Day: ");
appendThis(strFullName, "Full Name: ");
appendThis(strFirstName, "First Name: ");
appendThis(strMiddleName, "Middle Name: ");
appendThis(strLastName, "Last Name: ");
appendThis(strLifePathNumber, "Life Path: ");
appendThis(strExpressionNumber, "Expression Number: ");
appendThis(strHeartsDesireNumber, "Heart's Desire Number: ");
appendThis(strPersonalityNumber, "Personality Number: ");
appendThis(strBalanceNumber, "Balance Number: ");
appendThis(strMaturityNumber, "Maturity Number: ");
appendThis(strSubconsciousSelfNumber, "Subconscious Self Number: ");
appendThis(strRationalThoughtNumber, "Rational Thought Number: ");
appendThis(arrChallengeNumbers, "Challenge Numbers: ");
appendThis(arrPinnacleNumbers, "Pinnacle Numbers: ");
appendThis(strFirstLetterFirstName, "Cornerstone: ");
appendThis(strLastLetterFirstName, "Capstone: ");
appendThis(strSpecialVowel, "Special Vowel: ");
}
// USEFUL SHORTCUT FUNCTIONS
function alertThis(str)
{
alert(str);
}
function appendThis(str,numberName)
{
var maindiv = document.getElementById("output");
var newHThree = document.createElement("h3");
var newHThreeText = document.createTextNode(numberName + str);
newHThree.appendChild(newHThreeText);
maindiv.appendChild(newHThree);
}
// Notes:
// Latest update, now I have all the necessary variables: birth year, birth month, birth day, name whole, name firstletter, name lastletter, name vowels, name consonants
// Needs: support for different keyboards, accents, etc
// NEXT: karmic debt chart.