first commit - committing all files to the repository
No files matched your search
@@ -0,0 +1,16 @@
|
||||
## Hyperdope Gematria Calculator
|
||||

|
||||
---
|
||||
> NOTE: Use a desktop Chromium based browser for best experience
|
||||
|
||||
### Features:
|
||||
<ul>
|
||||
<li>AUTOLOADING DATABASE for instant query matching</li>
|
||||
<li>Dynamic highlighter with filtering</li>
|
||||
<li>Support for characters with diacritical marks</li>
|
||||
<li>History export/import (CSV format)</li>
|
||||
<li>Fully customizable ciphers (Unicode)</li>
|
||||
<li>Color controls</li>
|
||||
<li>Screenshot tools</li>
|
||||
<li>Quickstart guide included</li>
|
||||
</ul>
|
||||
@@ -0,0 +1,404 @@
|
||||
// ================= Word Breakdown & Cipher Chart ==================
|
||||
|
||||
function getSum(total, num) { // used to .reduce() array, adds all values
|
||||
return total + num;
|
||||
}
|
||||
|
||||
function gemCalcModeLabel(curCipher) {
|
||||
if (optGemMultCharPos && curCipher.LetterCount > 0) return ' - x1 ... x'+curCipher.LetterCount
|
||||
else if (optGemMultCharPosReverse && curCipher.LetterCount > 0) return ' - x'+curCipher.LetterCount+' ... x1'
|
||||
return ""
|
||||
}
|
||||
|
||||
function updateWordBreakdown(impName = breakCipher, impBool = false, chartUpd = true) { // false - preview temporary (hover), true - lock breakdown to a specific cipher
|
||||
var x, curCipher, curCiphCol, cSpot
|
||||
var o, oo, acw, acl
|
||||
|
||||
updateEnabledCipherCount()
|
||||
$("#BreakTableContainer").removeClass("hideValue") // unhide breakdown
|
||||
$("#BreakdownDetails").attr("style", "") // reset padding (gematria card)
|
||||
|
||||
if (impBool == true) breakCipher = impName // lock to a specific cipher
|
||||
|
||||
if (!optShowCipherChart) $("#ChartSpot").attr("style", "border: none;"); // reset gradient for cipher chart
|
||||
if (enabledCiphCount == 0 || breakCipher == "" && impName == "") {
|
||||
document.getElementById("BreakdownSpot").innerHTML = ""
|
||||
document.getElementById("ChartSpot").innerHTML = ""
|
||||
$("#ChartSpot").attr("style", "border: none;"); // reset gradient for cipher chart
|
||||
return;
|
||||
}
|
||||
|
||||
for (x = 0; x < cipherList.length; x++) {
|
||||
if (cipherList[x].cipherName == impName) {
|
||||
cSpot = x
|
||||
if (chartUpd) updateCipherChart(cipherList[x])
|
||||
break
|
||||
}
|
||||
}
|
||||
curCipher = cipherList[cSpot]
|
||||
curCiphCol = (optColoredCiphers) ? 'color: hsl('+curCipher.H+' '+curCipher.S+'% '+curCipher.L+'% / 1)' : ''
|
||||
curGradCol = (optColoredCiphers) ? 'hsl('+curCipher.H+' '+curCipher.S+'% '+curCipher.L+'% / 0.2)' : 'hsl(0 0% 0% / 0.1)'
|
||||
|
||||
var leftToRightBreak = true
|
||||
// if Hebrew Aleph is assigned in current cipher
|
||||
if (curCipher.cArr.indexOf(1488) > -1) {
|
||||
curCipher.calcBreakdown(sVal().replace(/[\u0591-\u05BD\u05BF-\u05C7]/g,"")) // remove Hebrew vowels, exclude dash
|
||||
}
|
||||
// if Arabic Alef is assigned in current cipher
|
||||
if (curCipher.cArr.indexOf(1575) > -1) {
|
||||
curCipher.calcBreakdown(sVal().replace(/[\u0600-\u061F\u0640\u064B-\u066D\u06D4\u06D6-\u06ED\u06F0-\u06F9]/g,"")) // remove Arabic marks and non letter characters
|
||||
}
|
||||
// use right to left writing (Hebrew, Arabic)
|
||||
if (curCipher.cArr.indexOf(1488) > -1 || curCipher.cArr.indexOf(1575) > -1) {
|
||||
curCipher.cp.reverse(); curCipher.cv.reverse(); curCipher.sumArr.reverse() // right-to-left direction
|
||||
if (curCipher.WordCount > 1) {
|
||||
curCipher.cp.push(curCipher.cp.shift()) // remove first element and add to the end of array (space, used for word sum)
|
||||
curCipher.cv.push(curCipher.cv.shift())
|
||||
}
|
||||
leftToRightBreak = false
|
||||
} else { // left to right, use regular word breakdown
|
||||
curCipher.calcBreakdown(sVal()) // calculate breakdown for current phrase
|
||||
}
|
||||
|
||||
if (curCipher.sumArr.length > 0) {
|
||||
|
||||
var oStart = ''; var o ='';
|
||||
|
||||
var RTLclass = '';
|
||||
if (!leftToRightBreak) RTLclass = 'BreakRTL' // use different container padding for right to left direction
|
||||
|
||||
if (optLetterWordCount == true) {
|
||||
if (curCipher.LetterCount > 1 || curCipher.LetterCount == 0) {acl = " letters, "} else {acl = " letter, "}
|
||||
if (curCipher.WordCount > 1) {acw = " words"} else {acw = " word"}
|
||||
oStart += '<div class="LetterCounts">' + curCipher.LetterCount + acl + curCipher.WordCount + acw + '</div>'
|
||||
}
|
||||
|
||||
if (optCompactBreakdown == true) {
|
||||
var simplePhr = ""
|
||||
if (optAllowPhraseComments) {
|
||||
simplePhr = sValNoComments() // exclude text inside [...]
|
||||
} else {
|
||||
simplePhr = sVal() // display full phrase
|
||||
}
|
||||
oStart += '<div id="SimpleBreak">'
|
||||
oStart += '<span class="breakPhrase">' + simplePhr + '</span><span class="breakPhrase"> = </span><span class="breakSum">' + curCipher.sumArr.reduce(getSum) + ' </span>' // add all values in array
|
||||
oStart += '<span class="breakCipher"><font style="'+curCiphCol+'"> (' + curCipher.cipherName + gemCalcModeLabel(curCipher) + ')</font></span>'
|
||||
}
|
||||
|
||||
if (optWordBreakdown == true && curCipher.cp.length <= chLimit ) { // character limit, calculated even if out of screen bounds
|
||||
var tdCount = 0; var wCount = 0;
|
||||
|
||||
o += '</div><div id="BreakTableContainer" class="'+RTLclass+'"><table class="BreakTable">'
|
||||
o += '<tbody><tr>'
|
||||
|
||||
if (leftToRightBreak) { // left to right
|
||||
for (x = 0; x < curCipher.cp.length; x++) {
|
||||
if (curCipher.cp[x] !== " ") {
|
||||
if (String(curCipher.cp[x]).substring(0, 3) == "num") {
|
||||
o += '<td class="BreakChar" style="'+curCiphCol+'">' + curCipher.cp[x].substring(3, curCipher.cp[x].length) + '</td>'
|
||||
} else {
|
||||
o += '<td class="BreakChar" style="'+curCiphCol+'">' + String.fromCharCode(curCipher.cp[x]) + '</td>'
|
||||
}
|
||||
} else {
|
||||
o += '<td class="BreakWordSum" rowspan="2">' + curCipher.sumArr[wCount] + '</td>'
|
||||
wCount++
|
||||
}
|
||||
tdCount++
|
||||
}
|
||||
o += '<td class="BreakPhraseSum" rowspan="2"><font style="'+curCiphCol+'">' + curCipher.sumArr.reduce(getSum) + '</font></td>'
|
||||
o += '</tr><tr>'
|
||||
tdCount++
|
||||
for (z = 0; z < x; z++) {
|
||||
if (curCipher.cv[z] !== " ") {
|
||||
o += '<td class="BreakVal">' + curCipher.cv[z] + '</td>'
|
||||
}
|
||||
}
|
||||
} else { // right to left (Hebrew, Arabic)
|
||||
o += '<td class="BreakPhraseSum" rowspan="2"><font style="'+curCiphCol+'">' + curCipher.sumArr.reduce(getSum) + '</font></td>'
|
||||
var curBreakWord = '' // current word, added to main 'o' string
|
||||
for (x = 0; x < curCipher.cp.length; x++) {
|
||||
if (curCipher.cp[x] !== " ") {
|
||||
if (String(curCipher.cp[x]).substring(0, 3) == "num") {
|
||||
curBreakWord += '<td class="BreakChar" style="'+curCiphCol+'">' + curCipher.cp[x].substring(3, curCipher.cp[x].length) + '</td>'
|
||||
} else {
|
||||
curBreakWord += '<td class="BreakChar" style="'+curCiphCol+'">' + String.fromCharCode(curCipher.cp[x]) + '</td>'
|
||||
}
|
||||
} else {
|
||||
curBreakWord = '<td class="BreakWordSum" rowspan="2">' + curCipher.sumArr[wCount] + '</td>' + curBreakWord // prepend word sum (displayed on the left)
|
||||
o += curBreakWord
|
||||
curBreakWord = ''
|
||||
wCount++
|
||||
}
|
||||
tdCount++
|
||||
}
|
||||
if (curCipher.WordCount == 1) o += curBreakWord // single word
|
||||
o += '</tr><tr>'
|
||||
tdCount++
|
||||
for (z = 0; z < x; z++) {
|
||||
if (curCipher.cv[z] !== " ") {
|
||||
o += '<td class="BreakVal">' + curCipher.cv[z] + '</td>'
|
||||
}
|
||||
}
|
||||
}
|
||||
ciphEndClass = (leftToRightBreak) ? "CipherEnd" : "CipherEndRTL"
|
||||
if (optCompactBreakdown == true) o += '</tr><tr><td colspan=' + tdCount + ' class="'+ciphEndClass+'"><font style="'+curCiphCol+'">' + curCipher.cipherName + gemCalcModeLabel(curCipher) + '</font></td></tr></table></div>'
|
||||
else o += '</tr></tbody></table></div>'
|
||||
|
||||
o = oStart + o // prepend phrase, word/letter count
|
||||
|
||||
} else if (optWordBreakdown == true && curCipher.cp.length > chLimit) { // breakdown for long phrases
|
||||
|
||||
var wrdCount = 0; var z = 0;
|
||||
var breakArr = buildLongBreakdown(curCipher) // index of word in phraseBox, used to mark table end
|
||||
var curBreakRow = '' // current row, added to main 'o' string
|
||||
|
||||
if (leftToRightBreak) { // left to right
|
||||
curBreakRow = '<table class="BreakTableRow" style="padding-top: 0.5em;"><tbody><tr>'
|
||||
for (x = 0; x < curCipher.cp.length; x++) {
|
||||
if (curCipher.cp[x] !== " ") {
|
||||
if (String(curCipher.cp[x]).substring(0, 3) == "num") {
|
||||
curBreakRow += '<td class="BreakChar">' + curCipher.cp[x].substring(3, curCipher.cp[x].length) + '</td>'
|
||||
} else {
|
||||
curBreakRow += '<td class="BreakChar">' + String.fromCharCode(curCipher.cp[x]) + '</td>'
|
||||
}
|
||||
} else { // show character values and word sum if space
|
||||
curBreakRow += '<td class="BreakWordSum" rowspan="2"><font style="'+curCiphCol+'">' + curCipher.sumArr[wrdCount] + '</font></td>'
|
||||
if (breakArr.indexOf(wrdCount) > -1 || wrdCount == curCipher.WordCount-1) { // include values for last word
|
||||
curBreakRow += '</tr><tr>'
|
||||
for (z; z < x; z++) {
|
||||
if (curCipher.cv[z] !== " ") {
|
||||
curBreakRow += '<td class="BreakValDark">' + curCipher.cv[z] + '</td>'
|
||||
}
|
||||
}
|
||||
curBreakRow += '</tr></tbody></table>'
|
||||
if (wrdCount !== curCipher.WordCount-1) curBreakRow += '<table class="BreakTableRow"><tbody><tr>'
|
||||
}
|
||||
wrdCount++
|
||||
}
|
||||
}
|
||||
if (curCipher.cp.indexOf(" ") == -1) { // show character values if one long word (has no " ")
|
||||
curBreakRow += '</tr><tr>'
|
||||
for (z; z < x; z++) {
|
||||
if (curCipher.cv[z] !== " ") {
|
||||
curBreakRow += '<td class="BreakValDark">' + curCipher.cv[z] + '</td>'
|
||||
}
|
||||
}
|
||||
curBreakRow += '</tr></tbody></table>'
|
||||
}
|
||||
o = '</div><div id="BreakTableContainer" class="'+RTLclass+'">' + curBreakRow
|
||||
} else { // right to left (Hebrew, Arabic)
|
||||
curBreakRow = '<table class="BreakTableRow"><tbody><tr>'
|
||||
if (curCipher.WordCount > 1) curBreakRow += '<td class="BreakWordSum" rowspan="2"><font style="'+curCiphCol+'">' + curCipher.sumArr[wrdCount] + '</font></td>'
|
||||
for (x = 0; x < curCipher.cp.length; x++) {
|
||||
if (curCipher.cp[x] !== " ") {
|
||||
if (String(curCipher.cp[x]).substring(0, 3) == "num") {
|
||||
curBreakRow += '<td class="BreakChar">' + curCipher.cp[x].substring(3, curCipher.cp[x].length) + '</td>'
|
||||
} else {
|
||||
curBreakRow += '<td class="BreakChar">' + String.fromCharCode(curCipher.cp[x]) + '</td>'
|
||||
}
|
||||
} else { // show character values and word sum if space or last character
|
||||
if (breakArr.indexOf(wrdCount) > -1 || wrdCount == curCipher.WordCount-1) { // include values for last word
|
||||
curBreakRow += '</tr><tr>'
|
||||
for (z; z < x; z++) {
|
||||
if (curCipher.cv[z] !== " ") {
|
||||
curBreakRow += '<td class="BreakValDark">' + curCipher.cv[z] + '</td>'
|
||||
}
|
||||
}
|
||||
curBreakRow += '</tr></tbody></table>'
|
||||
o = curBreakRow + o // prepend current row to main table
|
||||
if (wrdCount !== curCipher.WordCount-1) curBreakRow = '<table class="BreakTableRow"><tbody><tr>'
|
||||
}
|
||||
wrdCount++
|
||||
if (wrdCount !== curCipher.WordCount) curBreakRow += '<td class="BreakWordSum" rowspan="2"><font style="'+curCiphCol+'">' + curCipher.sumArr[wrdCount] + '</font></td>'
|
||||
}
|
||||
}
|
||||
if (curCipher.cp.indexOf(" ") == -1) { // show character values if one long word (has no " ")
|
||||
curBreakRow += '</tr><tr>'
|
||||
for (z; z < x; z++) {
|
||||
if (curCipher.cv[z] !== " ") {
|
||||
curBreakRow += '<td class="BreakValDark">' + curCipher.cv[z] + '</td>'
|
||||
}
|
||||
}
|
||||
curBreakRow += '</tr></tbody></table>'
|
||||
o = curBreakRow + o // prepend current row to main table
|
||||
}
|
||||
o = '</div><div id="BreakTableContainer" class="'+RTLclass+'"><div style="padding: 0.25em"></div>' + o // prepend opening div, include padding
|
||||
}
|
||||
o = oStart + o // prepend phrase, word/letter count
|
||||
if (optCompactBreakdown == true) {
|
||||
o += '<div id="BreakSumLong"><span class="breakSumDark">' + curCipher.sumArr.reduce(getSum) + ' </span>'
|
||||
o += '<span class="breakCipher" style="'+curCiphCol+'">' + curCipher.cipherName + gemCalcModeLabel(curCipher) + '</span></div></div>'
|
||||
} else {
|
||||
o += '<div style="padding: 0.5em"></div>'
|
||||
}
|
||||
}
|
||||
} else {
|
||||
o = ""
|
||||
}
|
||||
|
||||
document.getElementById("BreakdownSpot").innerHTML = o
|
||||
|
||||
if (curCipher.sumArr.length > 0 && optCompactBreakdown == false) { // include plain phrase inside breakdown chart
|
||||
var simplePhr = ""
|
||||
if (optAllowPhraseComments) {
|
||||
simplePhr = sValNoComments() // exclude text inside [...]
|
||||
} else {
|
||||
simplePhr = sVal() // display full phrase
|
||||
}
|
||||
var chartClass = 'SimpleBreakChart'
|
||||
if (curCipher.cp.length > chLimit) chartClass = 'SimpleBreakChartLong'
|
||||
o = '<tr><td colspan=' + tdCount + '>'
|
||||
o += '<div class="'+chartClass+'"><span class="breakPhraseChart">' + simplePhr + ' = ' + curCipher.sumArr.reduce(getSum) + ' </span>' // add all values in array
|
||||
o += '<span class="breakPhraseChartCiphName" style="'+curCiphCol+'">(' + curCipher.cipherName + gemCalcModeLabel(curCipher) + ')</span></div></td></tr>'
|
||||
$('#BreakTableContainer').prepend(o) // insert in the beginning of the table
|
||||
}
|
||||
|
||||
oo = 'background: var(--body-bg-accent);'
|
||||
if (optGradientCharts) {
|
||||
oo = 'background: '+bgCol+' -webkit-linear-gradient(0deg,'+curGradCol+', rgba(0,0,0,0.0));'
|
||||
oo += 'background: '+bgCol+' -o-linear-gradient(0deg,'+curGradCol+', rgba(0,0,0,0.0));'
|
||||
oo += 'background: '+bgCol+' -moz-linear-gradient(0deg,'+curGradCol+', rgba(0,0,0,0.0));'
|
||||
oo += 'background: '+bgCol+' linear-gradient(0deg,'+curGradCol+', rgba(0,0,0,0.0));'
|
||||
}
|
||||
$("#BreakTableContainer").attr("style", oo);
|
||||
}
|
||||
|
||||
function buildLongBreakdown(curCipher) {
|
||||
var i;
|
||||
var newLine = true; words = 0; n = "";
|
||||
var breakArr = []; var widthCount = 0;
|
||||
|
||||
for (i = 0; i < curCipher.cv.length; i++) {
|
||||
if (curCipher.cv[i] !== " ") {
|
||||
if (n == "") {n = i}
|
||||
if (curCipher.cv[i] > 99) {
|
||||
widthCount += 1.5
|
||||
} else {
|
||||
widthCount++
|
||||
}
|
||||
if (widthCount > maxRowWidth && newLine == false) {
|
||||
breakArr.push(words - 1)
|
||||
widthCount = 0
|
||||
i = n - 1
|
||||
newLine = true
|
||||
}
|
||||
} else {
|
||||
widthCount += 2
|
||||
words++
|
||||
n = ""
|
||||
newLine = false
|
||||
}
|
||||
}
|
||||
return breakArr
|
||||
}
|
||||
|
||||
function updateCipherChart(curCipher) {
|
||||
|
||||
if (optShowCipherChart == false) {
|
||||
document.getElementById("ChartSpot").innerHTML = ""
|
||||
return
|
||||
}
|
||||
|
||||
curCiphCol = (optColoredCiphers) ? 'color: hsl('+curCipher.H+' '+curCipher.S+'% '+curCipher.L+'% / 1)' : ''
|
||||
curGradCol = (optColoredCiphers) ? 'hsl('+curCipher.H+' '+curCipher.S+'% '+curCipher.L+'% / 0.2)' : 'hsl(0 0% 0% / 0.1)'
|
||||
|
||||
var o = 'background: var(--body-bg-accent);'
|
||||
if (optGradientCharts) {
|
||||
o = 'background: '+bgCol+' -webkit-linear-gradient(0deg,'+curGradCol+', rgba(0,0,0,0.0));'
|
||||
o += 'background: '+bgCol+' -o-linear-gradient(0deg,'+curGradCol+', rgba(0,0,0,0.0));'
|
||||
o += 'background: '+bgCol+' -moz-linear-gradient(0deg,'+curGradCol+', rgba(0,0,0,0.0));'
|
||||
o += 'background: '+bgCol+' linear-gradient(0deg,'+curGradCol+', rgba(0,0,0,0.0));'
|
||||
}
|
||||
o += 'min-height: 166px;' // avoid layout shift when Agrippa ciphers are active
|
||||
o += 'margin-top: 1em;'
|
||||
o += 'margin-bottom: 0.5em;'
|
||||
o += 'padding: 0.8em;'
|
||||
$("#ChartSpot").attr("style", o);
|
||||
|
||||
o = '<table id="ChartTable">'
|
||||
o += '<tbody><tr>'
|
||||
|
||||
o += '<td colspan="' + curCipher.cArr.length + '">'
|
||||
o += '<font style="font-size: 150%; font-weight: 500; '+curCiphCol+'">' + curCipher.cipherName + '</font>'
|
||||
o += '</td></tr><tr>'
|
||||
|
||||
var halfL = curCipher.cArr.length / 2
|
||||
for (var x = 0; x < curCipher.cArr.length; x++) {
|
||||
if (x - halfL == 0 || x - halfL == 0.5) {
|
||||
o += '</tr><tr>'
|
||||
for (var y = 0; y < x; y++) { // 2nd row (values)
|
||||
o += '<td class="ChartVal">' + curCipher.vArr[y] + '</td>'
|
||||
}
|
||||
o += '</tr><tr>'
|
||||
}
|
||||
o += '<td class="ChartChar" font style="'+curCiphCol+'">' + String.fromCodePoint(curCipher.cArr[x]) + '</td>'
|
||||
}
|
||||
if (curCipher.cArr.length % 2 == 1) { o += '<td class="ChartChar" font style="'+curCiphCol+'"></td>' } // empty character cell to make even rows
|
||||
o += '</tr><tr>'
|
||||
for (y; y < x; y++) {
|
||||
o += '<td class="ChartVal">' + curCipher.vArr[y] + '</td>' // 4th row (values)
|
||||
}
|
||||
if (curCipher.cArr.length % 2 == 1) { o += '<td class="ChartVal"></td>' } // empty value cell to make even rows
|
||||
o += '</tr></tbody></table>'
|
||||
|
||||
document.getElementById("ChartSpot").innerHTML = o
|
||||
}
|
||||
|
||||
function updateCipherChartGemCard(impName = breakCipher) {
|
||||
|
||||
if (optShowCipherChart == false) {
|
||||
document.getElementById("ChartSpot").innerHTML = ""
|
||||
return
|
||||
}
|
||||
|
||||
curCiphCol = (optColoredCiphers) ? 'color: hsl('+curCipher.H+' '+curCipher.S+'% '+curCipher.L+'% / 1)' : ''
|
||||
curGradCol = (optColoredCiphers) ? 'hsl('+curCipher.H+' '+curCipher.S+'% '+curCipher.L+'% / 0.2)' : 'hsl(0 0% 0% / 0.1)'
|
||||
|
||||
var cSpot
|
||||
for (x = 0; x < cipherList.length; x++) {
|
||||
if (cipherList[x].cipherName == impName) { cSpot = x; break; }
|
||||
}
|
||||
curCipher = cipherList[cSpot]
|
||||
|
||||
// gradient table background based on cipher color
|
||||
o = '<table id="ChartTable" style="background: var(--body-bg-accent);">'
|
||||
if (optGradientCharts) {
|
||||
o = '<table id="ChartTable" style="background: '+bgCol+' -webkit-linear-gradient(0deg,'+curGradCol+', rgba(0,0,0,0.0));'
|
||||
o += 'background: '+bgCol+' -o-linear-gradient(0deg,'+curGradCol+', rgba(0,0,0,0.0));'
|
||||
o += 'background: '+bgCol+' -moz-linear-gradient(0deg,'+curGradCol+', rgba(0,0,0,0.0));'
|
||||
o += 'background: '+bgCol+' linear-gradient(0deg,'+curGradCol+', rgba(0,0,0,0.0));">'
|
||||
}
|
||||
o += '<tbody><tr>'
|
||||
|
||||
o += '<td colspan="' + curCipher.cArr.length + '">'
|
||||
o += '<font style="font-size: 150%; font-weight: 500; '+curCiphCol+'">' + curCipher.cipherName + '</font>'
|
||||
o += '</td></tr><tr>'
|
||||
|
||||
var halfL = curCipher.cArr.length / 2
|
||||
for (var x = 0; x < curCipher.cArr.length; x++) {
|
||||
if (x - halfL == 0 || x - halfL == 0.5) {
|
||||
o += '</tr><tr>'
|
||||
for (var y = 0; y < x; y++) { // 2nd row (values)
|
||||
o += '<td class="ChartVal">' + curCipher.vArr[y] + '</td>'
|
||||
}
|
||||
o += '</tr><tr>'
|
||||
}
|
||||
o += '<td class="ChartChar" font style="'+curCiphCol+'">' + String.fromCodePoint(curCipher.cArr[x]) + '</td>'
|
||||
}
|
||||
if (curCipher.cArr.length % 2 == 1) { o += '<td class="ChartChar" font style="'+curCiphCol+'"></td>' } // empty character cell to make even rows
|
||||
o += '</tr><tr>'
|
||||
for (y; y < x; y++) {
|
||||
o += '<td class="ChartVal">' + curCipher.vArr[y] + '</td>' // 4th row (values)
|
||||
}
|
||||
if (curCipher.cArr.length % 2 == 1) { o += '<td class="ChartVal"></td>' } // empty value cell to make even rows
|
||||
o += '</tr></tbody></table>'
|
||||
|
||||
document.getElementById("ChartSpot").innerHTML = o
|
||||
$("#ChartTable").addClass("borderCipherTable") // cipher chart with borders
|
||||
|
||||
o = 'border: none;' // clear div gradient background, remove border
|
||||
o += 'margin-top: 1em;'
|
||||
o += 'margin-bottom: 0.5em;'
|
||||
o += 'padding: 0.4em;'
|
||||
$("#ChartSpot").attr("style", o)
|
||||
}
|
||||
@@ -0,0 +1,797 @@
|
||||
// ciphers.js
|
||||
|
||||
/*
|
||||
new cipher(
|
||||
"English Ordinal", // cipher name
|
||||
"English", // category
|
||||
120, 57, 36, // hue, saturation, lightness
|
||||
[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], // lowercase characters
|
||||
[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], // values
|
||||
true, // characters with diacritic marks have the same value as regular ones, default is "true"
|
||||
true // enabled state, default is "false"
|
||||
false // case sensitive cipher, default is "false"
|
||||
)
|
||||
*/
|
||||
|
||||
cipherList = [
|
||||
new cipher(
|
||||
"English Ordinal",
|
||||
"English",
|
||||
120, 65, 62,
|
||||
[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],
|
||||
[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],
|
||||
true,
|
||||
true,
|
||||
false
|
||||
),
|
||||
new cipher(
|
||||
"English Reduction",
|
||||
"English",
|
||||
216, 95, 73,
|
||||
[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],
|
||||
[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],
|
||||
true,
|
||||
true,
|
||||
false
|
||||
),
|
||||
new cipher(
|
||||
"Reverse Ordinal",
|
||||
"English",
|
||||
146, 74, 50,
|
||||
[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],
|
||||
[26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1],
|
||||
true,
|
||||
true,
|
||||
false
|
||||
),
|
||||
new cipher(
|
||||
"Reverse Reduction",
|
||||
"English",
|
||||
180, 60, 69,
|
||||
[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],
|
||||
[8,7,6,5,4,3,2,1,9,8,7,6,5,4,3,2,1,9,8,7,6,5,4,3,2,1],
|
||||
true,
|
||||
true,
|
||||
false
|
||||
),
|
||||
new cipher(
|
||||
"Single Reduction",
|
||||
"English",
|
||||
219, 61, 72,
|
||||
[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],
|
||||
[1,2,3,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9,10,2,3,4,5,6,7,8],
|
||||
true,
|
||||
false,
|
||||
false
|
||||
),
|
||||
new cipher(
|
||||
"English Sumerian",
|
||||
"English",
|
||||
95, 41, 69,
|
||||
[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],
|
||||
[6,12,18,24,30,36,42,48,54,60,66,72,78,84,90,96,102,108,114,120,126,132,138,144,150,156],
|
||||
true,
|
||||
false,
|
||||
false
|
||||
),
|
||||
new cipher(
|
||||
"Reverse Sumerian",
|
||||
"Reverse",
|
||||
50, 51, 72,
|
||||
[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],
|
||||
[156,150,144,138,132,126,120,114,108,102,96,90,84,78,72,66,60,54,48,42,36,30,24,18,12,6],
|
||||
true,
|
||||
false,
|
||||
false
|
||||
),
|
||||
new cipher(
|
||||
"English Extended",
|
||||
"English",
|
||||
50, 78, 63,
|
||||
[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],
|
||||
[1,2,3,4,5,6,7,8,9,10,20,30,40,50,60,70,80,90,100,200,300,400,500,600,700,800],
|
||||
true,
|
||||
false,
|
||||
false
|
||||
),
|
||||
new cipher(
|
||||
"Reverse Extended",
|
||||
"Reverse",
|
||||
48, 49, 72,
|
||||
[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],
|
||||
[800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],
|
||||
true,
|
||||
false,
|
||||
false
|
||||
),
|
||||
new cipher(
|
||||
"Capitals Added",
|
||||
"English",
|
||||
94, 88, 63,
|
||||
[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,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],
|
||||
[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],
|
||||
true,
|
||||
false,
|
||||
true
|
||||
),
|
||||
new cipher(
|
||||
"Capitals Mixed",
|
||||
"English",
|
||||
117, 42, 54,
|
||||
[65,97,66,98,67,99,68,100,69,101,70,102,71,103,72,104,73,105,74,106,75,107,76,108,77,109,78,110,79,111,80,112,81,113,82,114,83,115,84,116,85,117,86,118,87,119,88,120,89,121,90,122],
|
||||
[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],
|
||||
true,
|
||||
false,
|
||||
true
|
||||
),
|
||||
new cipher(
|
||||
"Satanic",
|
||||
"English",
|
||||
350, 55, 61,
|
||||
[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],
|
||||
[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],
|
||||
true,
|
||||
false,
|
||||
false
|
||||
),
|
||||
new cipher(
|
||||
"Reverse Satanic",
|
||||
"Reverse",
|
||||
350, 55, 69,
|
||||
[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],
|
||||
[61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36],
|
||||
true,
|
||||
false,
|
||||
false
|
||||
),
|
||||
new cipher(
|
||||
"Reverse Single Reduction",
|
||||
"Reverse",
|
||||
176, 60, 62,
|
||||
[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],
|
||||
[8,7,6,5,4,3,2,10,9,8,7,6,5,4,3,2,1,9,8,7,6,5,4,3,2,1],
|
||||
true,
|
||||
false,
|
||||
false
|
||||
),
|
||||
new cipher(
|
||||
"Reverse Caps Added",
|
||||
"Reverse",
|
||||
93, 100, 67,
|
||||
[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,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],
|
||||
[52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1],
|
||||
true,
|
||||
false,
|
||||
true
|
||||
),
|
||||
new cipher(
|
||||
"Reverse Caps Mixed",
|
||||
"Reverse",
|
||||
127, 40, 60,
|
||||
[97,65,98,66,99,67,100,68,101,69,102,70,103,71,104,72,105,73,106,74,107,75,108,76,109,77,110,78,111,79,112,80,113,81,114,82,115,83,116,84,117,85,118,86,119,87,120,88,121,89,122,90],
|
||||
[52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1],
|
||||
true,
|
||||
false,
|
||||
true
|
||||
),
|
||||
new cipher(
|
||||
"Bacon Simple",
|
||||
"Baconian",
|
||||
120, 65, 62,
|
||||
[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],
|
||||
[1,2,3,4,5,6,7,8,9,9,10,11,12,13,14,15,16,17,18,19,20,20,21,22,23,24],
|
||||
true,
|
||||
false,
|
||||
false
|
||||
),
|
||||
new cipher(
|
||||
"Bacon Reverse",
|
||||
"Baconian",
|
||||
146, 74, 50,
|
||||
[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],
|
||||
[24,23,22,21,20,19,18,17,16,16,15,14,13,12,11,10,9,8,7,6,5,5,4,3,2,1],
|
||||
true,
|
||||
false,
|
||||
false
|
||||
),
|
||||
new cipher(
|
||||
"Bacon Short",
|
||||
"Baconian",
|
||||
180, 60, 69,
|
||||
[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],
|
||||
[1,2,3,4,5,6,7,8,9,9,1,2,3,4,5,6,7,8,9,1,2,2,3,4,5,6],
|
||||
true,
|
||||
false,
|
||||
false
|
||||
),
|
||||
new cipher(
|
||||
"Bacon R Short",
|
||||
"Baconian",
|
||||
207, 77, 64,
|
||||
[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],
|
||||
[6,5,4,3,2,1,9,8,7,7,6,5,4,3,2,1,9,8,7,6,5,5,4,3,2,1],
|
||||
true,
|
||||
false,
|
||||
false
|
||||
),
|
||||
new cipher(
|
||||
"Bacon Kaye",
|
||||
"Baconian",
|
||||
0, 65, 66,
|
||||
[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],
|
||||
[27,28,29,30,31,32,33,34,35,35,10,11,12,13,14,15,16,17,18,19,20,20,21,22,23,24],
|
||||
true,
|
||||
false,
|
||||
false
|
||||
),
|
||||
new cipher(
|
||||
"Modern Kaye",
|
||||
"Baconian",
|
||||
352, 61, 78,
|
||||
[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],
|
||||
[27,28,29,30,31,32,33,34,35,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26],
|
||||
true,
|
||||
false,
|
||||
false
|
||||
),
|
||||
new cipher(
|
||||
"Illuminati Novice",
|
||||
"Illuminati",
|
||||
33, 91, 58,
|
||||
[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],
|
||||
[12,11,10,9,8,7,6,5,4,4,3,2,1,13,14,15,16,17,18,19,20,20,21,22,23,24],
|
||||
true,
|
||||
false,
|
||||
false
|
||||
),
|
||||
new cipher(
|
||||
"Illuminati Reverse",
|
||||
"Illuminati",
|
||||
60, 53, 62,
|
||||
[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],
|
||||
[24,23,22,21,20,19,18,17,16,16,15,14,13,1,2,3,4,5,6,7,8,8,9,10,11,12],
|
||||
true,
|
||||
false,
|
||||
false
|
||||
),
|
||||
new cipher(
|
||||
"Latin",
|
||||
"Latin",
|
||||
260, 100, 70,
|
||||
[97,98,99,100,101,102,103,104,105,107,108,109,110,111,112,113,114,115,116,117,120,121,122,106,118,119],
|
||||
[1,2,3,4,5,6,7,8,9,10,20,30,40,50,60,70,80,90,100,200,300,400,500,600,700,900],
|
||||
true,
|
||||
false,
|
||||
false
|
||||
),
|
||||
new cipher(
|
||||
"Latin Ordinal",
|
||||
"Latin",
|
||||
259, 65, 68,
|
||||
[97,98,99,100,101,102,103,104,105,107,108,109,110,111,112,113,114,115,116,117,120,121,122,106,118,119],
|
||||
[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,27],
|
||||
true,
|
||||
false,
|
||||
false
|
||||
),
|
||||
new cipher(
|
||||
"Latin Reduction",
|
||||
"Latin",
|
||||
277, 46, 58,
|
||||
[97,98,99,100,101,102,103,104,105,107,108,109,110,111,112,113,114,115,116,117,120,121,122,106,118,119],
|
||||
[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,9],
|
||||
true,
|
||||
false,
|
||||
false
|
||||
),
|
||||
new cipher(
|
||||
"Agrippa Key",
|
||||
"Latin",
|
||||
256, 95, 76,
|
||||
[97,98,99,100,101,102,103,104,105,107,108,109,110,111,112,113,114,115,116,117,120,121,122,106,118,10680,119],
|
||||
[1,2,3,4,5,6,7,8,9,10,20,30,40,50,60,70,80,90,100,200,300,400,500,600,700,800,900],
|
||||
true,
|
||||
false,
|
||||
false
|
||||
),
|
||||
new cipher(
|
||||
"Beatus of Liebana",
|
||||
"Latin",
|
||||
216, 95, 73,
|
||||
[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],
|
||||
[1,2,3,4,5,6,7,8,9,9,10,20,30,40,50,60,70,80,90,100,200,200,200,300,400,500],
|
||||
true,
|
||||
false,
|
||||
false
|
||||
),
|
||||
new cipher(
|
||||
"Agrippa Ordinal",
|
||||
"Latin",
|
||||
264, 90, 82,
|
||||
[97,98,99,100,101,102,103,104,105,107,108,109,110,111,112,113,114,115,116,117,120,121,122,106,118,10680,119],
|
||||
[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],
|
||||
true,
|
||||
false,
|
||||
false
|
||||
),
|
||||
new cipher(
|
||||
"Beatus Ordinal",
|
||||
"Latin",
|
||||
216, 87, 80,
|
||||
[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],
|
||||
[1,2,3,4,5,6,7,8,9,9,10,11,12,13,14,15,16,17,18,19,20,20,20,21,22,23],
|
||||
true,
|
||||
false,
|
||||
false
|
||||
),
|
||||
new cipher(
|
||||
"Agrippa Reduction",
|
||||
"Latin",
|
||||
236, 95, 86,
|
||||
[97,98,99,100,101,102,103,104,105,107,108,109,110,111,112,113,114,115,116,117,120,121,122,106,118,10680,119],
|
||||
[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,9],
|
||||
true,
|
||||
false,
|
||||
false
|
||||
),
|
||||
new cipher(
|
||||
"Beatus Reduction",
|
||||
"Latin",
|
||||
216, 53, 68,
|
||||
[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],
|
||||
[1,2,3,4,5,6,7,8,9,9,1,2,3,4,5,6,7,8,9,1,2,2,2,3,4,5],
|
||||
true,
|
||||
false,
|
||||
false
|
||||
),
|
||||
new cipher(
|
||||
"English Qaballa",
|
||||
"Thelemic",
|
||||
13, 68, 64,
|
||||
[97,108,119,104,115,100,111,122,107,118,103,114,99,110,121,106,117,102,113,98,109,120,105,116,101,112],
|
||||
[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],
|
||||
true,
|
||||
false,
|
||||
false
|
||||
),
|
||||
new cipher(
|
||||
"Cipher X",
|
||||
"Thelemic",
|
||||
36, 94, 64,
|
||||
[107,102,119,114,109,100,121,116,97,118,113,104,99,120,111,106,101,108,103,98,115,110,105,122,117,112],
|
||||
[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],
|
||||
true,
|
||||
false,
|
||||
false
|
||||
),
|
||||
new cipher(
|
||||
"Trigrammaton Qabalah",
|
||||
"Thelemic",
|
||||
195, 68, 69,
|
||||
[105,108,99,104,112,97,120,106,119,116,111,103,102,101,114,115,113,107,121,122,98,109,118,100,110,117],
|
||||
[0,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],
|
||||
true,
|
||||
false,
|
||||
false
|
||||
),
|
||||
new cipher(
|
||||
"Primes",
|
||||
"Mathematic",
|
||||
44, 56, 62,
|
||||
[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],
|
||||
[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101],
|
||||
true,
|
||||
false,
|
||||
false
|
||||
),
|
||||
new cipher(
|
||||
"Reverse Primes",
|
||||
"Mathematic",
|
||||
35, 46, 62,
|
||||
[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],
|
||||
[101,97,89,83,79,73,71,67,61,59,53,47,43,41,37,31,29,23,19,17,13,11,7,5,3,2],
|
||||
true,
|
||||
false,
|
||||
false
|
||||
),
|
||||
new cipher(
|
||||
"Trigonal",
|
||||
"Mathematic",
|
||||
34, 47, 59,
|
||||
[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],
|
||||
[1,3,6,10,15,21,28,36,45,55,66,78,91,105,120,136,153,171,190,210,231,253,276,300,325,351],
|
||||
true,
|
||||
false,
|
||||
false
|
||||
),
|
||||
new cipher(
|
||||
"Reverse Trigonal",
|
||||
"Mathematic",
|
||||
23, 43, 53,
|
||||
[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],
|
||||
[351,325,300,276,253,231,210,190,171,153,136,120,105,91,78,66,55,45,36,28,21,15,10,6,3,1],
|
||||
true,
|
||||
false,
|
||||
false
|
||||
),
|
||||
new cipher(
|
||||
"Squares",
|
||||
"Mathematic",
|
||||
55, 39, 56,
|
||||
[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],
|
||||
[1,4,9,16,25,36,49,64,81,100,121,144,169,196,225,256,289,324,361,400,441,484,529,576,625,676],
|
||||
true,
|
||||
false,
|
||||
false
|
||||
),
|
||||
new cipher(
|
||||
"Reverse Squares",
|
||||
"Mathematic",
|
||||
58, 29, 53,
|
||||
[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],
|
||||
[676,625,576,529,484,441,400,361,324,289,256,225,196,169,144,121,100,81,64,49,36,25,16,9,4,1],
|
||||
true,
|
||||
false,
|
||||
false
|
||||
),
|
||||
new cipher(
|
||||
"Septenary",
|
||||
"Mathematic",
|
||||
37, 54, 55,
|
||||
[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],
|
||||
[1,2,3,4,5,6,7,6,5,4,3,2,1,1,2,3,4,5,6,7,6,5,4,3,2,1],
|
||||
true,
|
||||
false,
|
||||
false
|
||||
),
|
||||
new cipher(
|
||||
"Keypad",
|
||||
"Mathematic",
|
||||
300, 30, 72,
|
||||
[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],
|
||||
[2,2,2,3,3,3,4,4,4,5,5,5,6,6,6,7,7,7,7,8,8,8,9,9,9,9],
|
||||
true,
|
||||
false,
|
||||
false
|
||||
),
|
||||
new cipher(
|
||||
"Fibonacci",
|
||||
"Mathematic",
|
||||
25, 55, 70,
|
||||
[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],
|
||||
[1,1,2,3,5,8,13,21,34,55,89,144,233,233,144,89,55,34,21,13,8,5,3,2,1,1],
|
||||
true,
|
||||
false,
|
||||
false
|
||||
),
|
||||
new cipher(
|
||||
"Zeroing Key",
|
||||
"Zeroing",
|
||||
216, 50, 69,
|
||||
[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],
|
||||
[13,12,11,10,9,8,7,6,5,4,3,2,1,-1,-2,-3,-4,-5,-6,-7,-8,-9,-10,-11,-12,-13],
|
||||
true,
|
||||
false,
|
||||
false
|
||||
),
|
||||
new cipher(
|
||||
"Mirroring Key",
|
||||
"Zeroing",
|
||||
144, 33, 64,
|
||||
[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],
|
||||
[1,2,3,4,5,6,7,8,9,10,11,12,13,-13,-12,-11,-10,-9,-8,-7,-6,-5,-4,-3,-2,-1],
|
||||
true,
|
||||
false,
|
||||
false
|
||||
),
|
||||
new cipher(
|
||||
"Alphanumeric Halves",
|
||||
"Zeroing",
|
||||
11, 29, 64,
|
||||
[48,49,50,51,52,53,54,55,56,57,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],
|
||||
[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,-17,-16,-15,-14,-13,-12,-11,-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0],
|
||||
true,
|
||||
false,
|
||||
false
|
||||
),
|
||||
new cipher(
|
||||
"Cheiro Numerology",
|
||||
"Other",
|
||||
79, 36, 61,
|
||||
[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],
|
||||
[1,2,3,4,5,8,3,5,1,1,2,3,4,5,7,8,1,2,3,4,6,6,6,5,1,7],
|
||||
true,
|
||||
false,
|
||||
false
|
||||
),
|
||||
new cipher(
|
||||
"Septenary",
|
||||
"Other",
|
||||
26, 100, 65,
|
||||
[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],
|
||||
[1,2,3,4,5,6,7,6,5,4,3,2,1,1,2,3,4,5,6,7,6,5,4,3,2,1],
|
||||
true,
|
||||
false,
|
||||
false
|
||||
),
|
||||
new cipher(
|
||||
"Alphanumeric Qabbala",
|
||||
"Other",
|
||||
60, 33, 62,
|
||||
[48,49,50,51,52,53,54,55,56,57,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],
|
||||
[0,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],
|
||||
true,
|
||||
false,
|
||||
false
|
||||
),
|
||||
new cipher(
|
||||
"Alphanumeric Satanic",
|
||||
"Other",
|
||||
32, 68, 62,
|
||||
[48,49,50,51,52,53,54,55,56,57,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,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],
|
||||
[0,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],
|
||||
true,
|
||||
false,
|
||||
true
|
||||
),
|
||||
new cipher(
|
||||
"Keypad",
|
||||
"Other",
|
||||
300, 100, 75,
|
||||
[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],
|
||||
[2,2,2,3,3,3,4,4,4,5,5,5,6,6,6,7,7,7,7,8,8,8,9,9,9,9],
|
||||
true,
|
||||
false,
|
||||
false
|
||||
),
|
||||
new cipher(
|
||||
"Case Sensitive",
|
||||
"Other",
|
||||
190, 50, 60,
|
||||
[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,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],
|
||||
[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],
|
||||
true,
|
||||
false,
|
||||
true
|
||||
),
|
||||
new cipher(
|
||||
"Alt Case Sensitive",
|
||||
"Other",
|
||||
127, 36, 62,
|
||||
[65,97,66,98,67,99,68,100,69,101,70,102,71,103,72,104,73,105,74,106,75,107,76,108,77,109,78,110,79,111,80,112,81,113,82,114,83,115,84,116,85,117,86,118,87,119,88,120,89,121,90,122],
|
||||
[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],
|
||||
true,
|
||||
false,
|
||||
true
|
||||
),
|
||||
new cipher(
|
||||
"Hebrew Gematria",
|
||||
"Hebrew",
|
||||
50, 78, 63,
|
||||
[1488,1489,1490,1491,1492,1493,1494,1495,1496,1497,1499,1500,1502,1504,1505,1506,1508,1510,1511,1512,1513,1514,1498,1501,1503,1507,1509],
|
||||
[1,2,3,4,5,6,7,8,9,10,20,30,40,50,60,70,80,90,100,200,300,400,20,40,50,80,90],
|
||||
true,
|
||||
false,
|
||||
false
|
||||
),
|
||||
new cipher(
|
||||
"Hebrew Ordinal",
|
||||
"Hebrew",
|
||||
33, 91, 58,
|
||||
[1488,1489,1490,1491,1492,1493,1494,1495,1496,1497,1499,1500,1502,1504,1505,1506,1508,1510,1511,1512,1513,1514,1498,1501,1503,1507,1509],
|
||||
[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,11,13,14,17,18],
|
||||
true,
|
||||
false,
|
||||
false
|
||||
),
|
||||
new cipher(
|
||||
"Hebrew Reduction",
|
||||
"Hebrew",
|
||||
45, 95, 53,
|
||||
[1488,1489,1490,1491,1492,1493,1494,1495,1496,1497,1499,1500,1502,1504,1505,1506,1508,1510,1511,1512,1513,1514,1498,1501,1503,1507,1509],
|
||||
[1,2,3,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9,1,2,3,4,2,4,5,8,9],
|
||||
true,
|
||||
false,
|
||||
false
|
||||
),
|
||||
new cipher(
|
||||
"Hebrew Soffits",
|
||||
"Hebrew",
|
||||
44, 62, 73,
|
||||
[1488,1489,1490,1491,1492,1493,1494,1495,1496,1497,1499,1500,1502,1504,1505,1506,1508,1510,1511,1512,1513,1514,1498,1501,1503,1507,1509],
|
||||
[1,2,3,4,5,6,7,8,9,10,20,30,40,50,60,70,80,90,100,200,300,400,500,600,700,800,900],
|
||||
true,
|
||||
false,
|
||||
false
|
||||
),
|
||||
new cipher(
|
||||
"Mispar Siduri",
|
||||
"Hebrew",
|
||||
33, 91, 58,
|
||||
[1488,1489,1490,1491,1492,1493,1494,1495,1496,1497,1499,1500,1502,1504,1505,1506,1508,1510,1511,1512,1513,1514,1498,1501,1503,1507,1509],
|
||||
[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,11,13,14,17,18],
|
||||
true,
|
||||
false,
|
||||
false
|
||||
),
|
||||
new cipher(
|
||||
"Mispar Katan",
|
||||
"Hebrew",
|
||||
45, 95, 53,
|
||||
[1488,1489,1490,1491,1492,1493,1494,1495,1496,1497,1499,1500,1502,1504,1505,1506,1508,1510,1511,1512,1513,1514,1498,1501,1503,1507,1509],
|
||||
[1,2,3,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9,1,2,3,4,2,4,5,8,9],
|
||||
true,
|
||||
false,
|
||||
false
|
||||
),
|
||||
new cipher(
|
||||
"Mispar Hechrachi",
|
||||
"Hebrew",
|
||||
50, 78, 63,
|
||||
[1488,1489,1490,1491,1492,1493,1494,1495,1496,1497,1499,1500,1502,1504,1505,1506,1508,1510,1511,1512,1513,1514,1498,1501,1503,1507,1509],
|
||||
[1,2,3,4,5,6,7,8,9,10,20,30,40,50,60,70,80,90,100,200,300,400,20,40,50,80,90],
|
||||
true,
|
||||
false,
|
||||
false
|
||||
),
|
||||
new cipher(
|
||||
"Mispar Gadol",
|
||||
"Hebrew",
|
||||
44, 62, 73,
|
||||
[1488,1489,1490,1491,1492,1493,1494,1495,1496,1497,1499,1500,1502,1504,1505,1506,1508,1510,1511,1512,1513,1514,1498,1501,1503,1507,1509],
|
||||
[1,2,3,4,5,6,7,8,9,10,20,30,40,50,60,70,80,90,100,200,300,400,500,600,700,800,900],
|
||||
true,
|
||||
false,
|
||||
false
|
||||
),
|
||||
new cipher(
|
||||
"Greek Ordinal",
|
||||
"Greek",
|
||||
154, 70, 67,
|
||||
[945,946,947,948,949,989,987,950,951,952,953,954,955,956,957,958,959,960,985,961,963,962,964,965,966,967,968,969,993],
|
||||
[1,2,3,4,5,6,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,20,21,22,23,24,25,26,27],
|
||||
true,
|
||||
false,
|
||||
false
|
||||
),
|
||||
new cipher(
|
||||
"Greek Reduction",
|
||||
"Greek",
|
||||
141, 53, 80,
|
||||
[945,946,947,948,949,989,987,950,951,952,953,954,955,956,957,958,959,960,985,961,963,962,964,965,966,967,968,969,993],
|
||||
[1,2,3,4,5,6,6,7,8,9,1,2,3,4,5,6,7,8,9,1,2,2,3,4,5,6,7,8,9],
|
||||
true,
|
||||
false,
|
||||
false
|
||||
),
|
||||
new cipher(
|
||||
"Greek Isopsephy",
|
||||
"Greek",
|
||||
191, 71, 71,
|
||||
[945,946,947,948,949,989,987,950,951,952,953,954,955,956,957,958,959,960,985,961,963,962,964,965,966,967,968,969,993],
|
||||
[1,2,3,4,5,6,6,7,8,9,10,20,30,40,50,60,70,80,90,100,200,200,300,400,500,600,700,800,900],
|
||||
true,
|
||||
false,
|
||||
false
|
||||
),
|
||||
new cipher(
|
||||
"Greek Ordinal 24",
|
||||
"Greek",
|
||||
218, 75, 81,
|
||||
[945,946,947,948,949,950,951,952,953,954,955,956,957,958,959,960,961,963,962,964,965,966,967,968,969],
|
||||
[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,18,19,20,21,22,23,24],
|
||||
true,
|
||||
false,
|
||||
false
|
||||
),
|
||||
new cipher(
|
||||
"Arabic Ordinal",
|
||||
"Arabic",
|
||||
25, 59, 64,
|
||||
[1575,1649,1650,1651,1653,1576,1580,1583,1607,1577,1608,1586,1581,1591,1610,1609,1603,1604,1605,1606,1587,1593,1601,1589,1602,1585,1588,1578,1579,1582,1584,1590,1592,1594],
|
||||
[1,1,1,1,1,2,3,4,5,5,6,7,8,9,10,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28],
|
||||
true,
|
||||
false,
|
||||
false
|
||||
),
|
||||
new cipher(
|
||||
"Arabic Reduction",
|
||||
"Arabic",
|
||||
25, 54, 69,
|
||||
[1575,1649,1650,1651,1653,1576,1580,1583,1607,1577,1608,1586,1581,1591,1610,1609,1603,1604,1605,1606,1587,1593,1601,1589,1602,1585,1588,1578,1579,1582,1584,1590,1592,1594],
|
||||
[1,1,1,1,1,2,3,4,5,5,6,7,8,9,1,1,2,3,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9,1],
|
||||
true,
|
||||
false,
|
||||
false
|
||||
),
|
||||
new cipher(
|
||||
"Arabic Gematria",
|
||||
"Arabic",
|
||||
25, 64, 59,
|
||||
[1575,1649,1650,1651,1653,1576,1580,1583,1607,1577,1608,1586,1581,1591,1610,1609,1603,1604,1605,1606,1587,1593,1601,1589,1602,1585,1588,1578,1579,1582,1584,1590,1592,1594],
|
||||
[1,1,1,1,1,2,3,4,5,5,6,7,8,9,10,10,20,30,40,50,60,70,80,90,100,200,300,400,500,600,700,800,900,1000],
|
||||
true,
|
||||
false,
|
||||
false
|
||||
),
|
||||
new cipher(
|
||||
"Russian Ordinal",
|
||||
"Russian",
|
||||
120, 65, 62,
|
||||
[1072,1073,1074,1075,1076,1077,1105,1078,1079,1080,1081,1082,1083,1084,1085,1086,1087,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,1101,1102,1103],
|
||||
[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],
|
||||
false,
|
||||
false,
|
||||
false
|
||||
),
|
||||
new cipher(
|
||||
"Russian Reduction",
|
||||
"Russian",
|
||||
216, 95, 73,
|
||||
[1072,1073,1074,1075,1076,1077,1105,1078,1079,1080,1081,1082,1083,1084,1085,1086,1087,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,1101,1102,1103],
|
||||
[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,9,1,2,3,4,5,6],
|
||||
false,
|
||||
false,
|
||||
false
|
||||
),
|
||||
new cipher(
|
||||
"Russian R Ordinal",
|
||||
"Russian",
|
||||
146, 74, 50,
|
||||
[1072,1073,1074,1075,1076,1077,1105,1078,1079,1080,1081,1082,1083,1084,1085,1086,1087,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,1101,1102,1103],
|
||||
[33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1],
|
||||
false,
|
||||
false,
|
||||
false
|
||||
),
|
||||
new cipher(
|
||||
"Russian R Reduction",
|
||||
"Russian",
|
||||
180, 60, 69,
|
||||
[1072,1073,1074,1075,1076,1077,1105,1078,1079,1080,1081,1082,1083,1084,1085,1086,1087,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,1101,1102,1103],
|
||||
[6,5,4,3,2,1,9,8,7,6,5,4,3,2,1,9,8,7,6,5,4,3,2,1,9,8,7,6,5,4,3,2,1],
|
||||
false,
|
||||
false,
|
||||
false
|
||||
),
|
||||
new cipher(
|
||||
"Full KV Reduction",
|
||||
"English",
|
||||
200, 77, 63,
|
||||
[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],
|
||||
[1,2,3,4,5,6,7,8,9,1,11,3,4,5,6,7,8,9,1,2,3,22,5,6,7,8],
|
||||
true,
|
||||
false,
|
||||
false
|
||||
),
|
||||
new cipher(
|
||||
"Reverse KV Reduction",
|
||||
"Reverse",
|
||||
165, 40, 56,
|
||||
[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],
|
||||
[8,7,6,5,22,3,2,1,9,8,7,6,5,4,3,11,1,9,8,7,6,5,4,3,2,1],
|
||||
true,
|
||||
false,
|
||||
false
|
||||
),
|
||||
new cipher(
|
||||
"Single KV Reduction",
|
||||
"English",
|
||||
204, 79, 64,
|
||||
[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],
|
||||
[1,2,3,4,5,6,7,8,9,1,11,3,4,5,6,7,8,9,10,2,3,22,5,6,7,8],
|
||||
true,
|
||||
false,
|
||||
false
|
||||
),
|
||||
new cipher(
|
||||
"Reverse S KV Reduction",
|
||||
"Reverse",
|
||||
144, 21, 54,
|
||||
[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],
|
||||
[8,7,6,5,22,3,2,10,9,8,7,6,5,4,3,11,1,9,8,7,6,5,4,3,2,1],
|
||||
true,
|
||||
false,
|
||||
false
|
||||
)
|
||||
]
|
||||
@@ -0,0 +1,84 @@
|
||||
// ================ Matrix code rain (HTML5 canvas) =================
|
||||
|
||||
function initCodeRain() {
|
||||
|
||||
height_html = $(window).height()
|
||||
|
||||
canvas = document.getElementById("canv")
|
||||
ctx = canvas.getContext("2d")
|
||||
|
||||
if (navigator.userAgent.toLowerCase().indexOf('firefox') > -1) $('#canv').css({'filter':'blur(1px)'}) // blur effect for Firefox
|
||||
|
||||
// set width and height of the canvas
|
||||
w = canvas.width = document.body.offsetWidth
|
||||
h = canvas.height = height_html
|
||||
|
||||
// draw a plain color rectangle of width and height same as that of the canvas
|
||||
ctx.fillStyle = "hsl("+interfaceHue+","+(22*interfaceSat)+"%,"+(16*interfaceLit)+"%)" // CSS var(--body-bg-accent)
|
||||
ctx.fillRect(0, 0, w, h)
|
||||
|
||||
cols = Math.floor(w / 14) + 1 // px
|
||||
ypos = Array(cols).fill(0)
|
||||
}
|
||||
|
||||
function matrix() {
|
||||
|
||||
// draw a semitransparent black rectangle on top of previous drawing
|
||||
ctx.fillStyle = "#00000010"
|
||||
if(navigator.userAgent.toLowerCase().indexOf('firefox') == -1) { // if not Firefox
|
||||
// ctx.shadowColor = "rgba(0,0,0,0)" // reset blurred shadows for old characters
|
||||
ctx.shadowColor = "hsla(0,0%,0%,0.0)" // reset blurred shadows for old characters
|
||||
ctx.shadowBlur = 0 // reset blurred shadows
|
||||
}
|
||||
ctx.fillRect(0, 0, w, h)
|
||||
|
||||
// set color and font in the drawing context
|
||||
ctx.fillStyle = "hsl("+coderainHue+","+(coderainSat*100)+"%,"+(coderainLit*100)+"%)"
|
||||
ctx.font = "bold 18pt matrix-font"
|
||||
if(navigator.userAgent.toLowerCase().indexOf('firefox') == -1) { // if not Firefox
|
||||
ctx.shadowColor = "hsla("+coderainHue+",100%,50%,0.4)"
|
||||
ctx.shadowBlur = 4
|
||||
}
|
||||
|
||||
var matrixChars = [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,
|
||||
48,49,50,51,52,53,54,55,56,57,36,43,45,42,47,61,37,34,39,35,38,95,40,41,44,46,59,58,63,33,92,124,123,125,60,62,91,93,94,126]
|
||||
var aLen = matrixChars.length // glyphs from matrix font
|
||||
|
||||
// for each column put a random character at the end
|
||||
ypos.forEach((y, ind) => {
|
||||
|
||||
// choose a random character from array
|
||||
text = String.fromCharCode(matrixChars[rndInt(0,aLen-1)])
|
||||
|
||||
// x coordinate of the column, y coordinate is already given
|
||||
x = ind * 14 // px
|
||||
// render the character at (x, y)
|
||||
ctx.fillText(text, x, y)
|
||||
|
||||
// randomly reset the end of the column if it's at least 100px high
|
||||
if (y > 100 + Math.random() * 10000) ypos[ind] = 0
|
||||
// otherwise just move the y coordinate for the column 20px down
|
||||
else ypos[ind] = y + 21 // px
|
||||
});
|
||||
}
|
||||
|
||||
function rndInt(min, max) { // inclusive
|
||||
return Math.floor(Math.random()*(max-min+1)+min)
|
||||
}
|
||||
|
||||
function toggleCodeRain() {
|
||||
if (optMatrixCodeRain) {
|
||||
clearInterval(code_rain) // reset previous instance
|
||||
document.getElementById("canv").style.display = "none"
|
||||
initCodeRain() // recalculate canvas size
|
||||
code_rain = setInterval(matrix, 50)
|
||||
document.getElementById("canv").style.display = ""
|
||||
return
|
||||
} else {
|
||||
clearInterval(code_rain)
|
||||
document.getElementById("canv").style.display = "none"
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
toggleCodeRain()
|
||||
@@ -0,0 +1,531 @@
|
||||
// ============================ Database ============================
|
||||
|
||||
function queryDatabase() {
|
||||
var cVal
|
||||
if(sVal() == "") return // empty input
|
||||
|
||||
if (liveDatabaseMode == true) calcLiveDatabase(userDBlive) // calculate gematria for live database for enabled ciphers
|
||||
|
||||
$("#calcMain").addClass("splitInterface") // split screen
|
||||
|
||||
if (document.getElementById("queryArea") == null) { // create div if it doesn't exist
|
||||
var o = '<div id="queryArea"></div>'
|
||||
$(o).appendTo('body');
|
||||
}
|
||||
|
||||
mArr = [] // array with matching phrases from database
|
||||
gemArr = [] // gematria of current phrase for enabled ciphers
|
||||
gemArrCiph = [] // indices of enabled ciphers
|
||||
|
||||
numericalMode = NumberArray() // boolean
|
||||
|
||||
var num_index = 0 // numerical array
|
||||
for (i = 0; i < cipherList.length; i++) {
|
||||
if (cipherList[i].enabled) {
|
||||
if (!numericalMode) {
|
||||
val = cipherList[i].calcGematria(sVal())
|
||||
// if (val == 0) val = "n/a"
|
||||
gemArr.push(val) // value for current phrase in each enabled cipher
|
||||
} else { // numerical mode
|
||||
if (num_index < pArr.length) { gemArr.push(pArr[num_index]); num_index++ } // assign first number to first enabled cipher
|
||||
else { gemArr.push('-') } // if more ciphers than numbers push zero
|
||||
}
|
||||
gemArrCiph.push(i) // corresponding cipher index
|
||||
}
|
||||
}
|
||||
// console.log(gemArr)
|
||||
// console.log(gemArrCiph)
|
||||
if (optFiltCrossCipherMatch) { searchDBcrossCipher() }
|
||||
else if (optFiltSameCipherMatch) { searchDBsameCipher() }
|
||||
|
||||
queryResultInitial = [...queryResult] // save initial matches
|
||||
|
||||
// console.log(queryResult)
|
||||
|
||||
// var longestPhr = 0; var tmp
|
||||
// for (i = 0; i < queryResult.length; i++) {
|
||||
// tmp = queryResult[i][1].length
|
||||
// if (tmp > longestPhr) longestPhr = tmp
|
||||
// }
|
||||
// var tWidth = longestPhr*11 + 58*gemArrCiph.length // 2x1px outer borders + phrase cell and amount of ciphers
|
||||
|
||||
var tWidth = 202 + 58*gemArrCiph.length // 2x1px outer borders + phrase cell and amount of ciphers
|
||||
$("#queryArea").css("min-width", tWidth) // set initial/minimal width for the table
|
||||
$("#queryArea").css("width", tWidth) // set initial/minimal width for the table
|
||||
/*var o = 'min-width:'+tWidth+';width:'+tWidth+';'
|
||||
$("#queryArea").attr("style", o) // set minimal/initial width for the table*/
|
||||
updateDatabaseQueryTable(0, dbPageItems)
|
||||
}
|
||||
|
||||
function clearDatabaseQueryTable() {
|
||||
$("#calcMain").removeClass("splitInterface")
|
||||
$("#queryArea").remove() // remove element from page
|
||||
searchBarValue = '' // clear search bar
|
||||
queryResult = [] // clear
|
||||
queryResultInitial = [] // clear
|
||||
}
|
||||
|
||||
function searchDBcrossCipher() { // populate "queryResult" array with matching phrases
|
||||
var p, m, n
|
||||
queryResult = [] // reset matching phrases
|
||||
var tmpArr = [] // one phrase with score and gematria
|
||||
var tmpVal = 0 // current phrase value
|
||||
var gemArrCiphUsed = [...gemArrCiph]
|
||||
if (liveDatabaseMode == true) { // 0,1,2...
|
||||
len = gemArrCiph.length
|
||||
gemArrCiphUsed = []
|
||||
for (n = 0; n < len; n++) {
|
||||
gemArrCiphUsed.push(n)
|
||||
}
|
||||
}
|
||||
// take phrase, take cipher, all values match in cipher add score, build string, next phrase, then sort by score
|
||||
for (p = 0; p < userDB.length; p++) { // for each phrase in database
|
||||
tmpArr = [0, userDB[p][0]] // reset, set score[0], phrase[1]
|
||||
for (m = 0; m < gemArrCiphUsed.length; m++) { // for each enabled cipher index
|
||||
tmpVal = Number(userDB[p][gemArrCiphUsed[m]+1]) // value for that phrase (+1 because [0] contains phrase), string to number
|
||||
tmpArr.push(tmpVal) // first add values irrelevant of match validity
|
||||
for (n = 0; n < gemArr.length; n++) { // for each gematria value (cross cipher)
|
||||
if (tmpVal == gemArr[m]) {
|
||||
// tmpArr[0] += gemArr[n] * 10 // add score for a matching value, same cipher
|
||||
tmpArr[0] += 10 + 0.00001*tmpVal // add score for a matching value, same cipher
|
||||
n = gemArr.length // exit innermost loop (score is added once for same cross cipher values)
|
||||
} else if (tmpVal == gemArr[n]) {
|
||||
// tmpArr[0] += gemArr[n] // cross cipher
|
||||
tmpArr[0] += 1 + 0.00001*tmpVal // cross cipher
|
||||
n = gemArr.length // exit innermost loop
|
||||
}
|
||||
}
|
||||
}
|
||||
if (tmpArr[0] > 0) queryResult.push(tmpArr) // if total score is more than zero, add phrase to array
|
||||
}
|
||||
queryResult.sort(function(a, b) { // sort by score (descending)
|
||||
return b[0] - a[0]; // sort based on index 0 values ("freq" is array of arrays), (b-a) descending order, (a-b) ascending
|
||||
});
|
||||
}
|
||||
|
||||
function searchDBsameCipher() { // populate "queryResult" array with matching phrases
|
||||
var p, m, n
|
||||
queryResult = [] // reset matching phrases
|
||||
var tmpArr = [] // one phrase with score and gematria
|
||||
var tmpVal = 0 // current phrase value
|
||||
var gemArrCiphUsed = [...gemArrCiph]
|
||||
if (liveDatabaseMode == true) { // 0,1,2...
|
||||
len = gemArrCiph.length
|
||||
gemArrCiphUsed = []
|
||||
for (n = 0; n < len; n++) {
|
||||
gemArrCiphUsed.push(n)
|
||||
}
|
||||
}
|
||||
// take phrase, take cipher, all values match in cipher add score, build string, next phrase, then sort by score
|
||||
for (p = 0; p < userDB.length; p++) { // for each phrase in database
|
||||
tmpArr = [0, userDB[p][0]] // reset, set score[0], phrase[1]
|
||||
for (m = 0; m < gemArrCiphUsed.length; m++) { // for each enabled cipher index
|
||||
tmpVal = Number(userDB[p][gemArrCiphUsed[m]+1]) // value for that phrase (+1 because [0] contains phrase), string to number
|
||||
tmpArr.push(tmpVal) // first add values irrelevant of match validity
|
||||
if (tmpVal == gemArr[m]) {
|
||||
// tmpArr[0] += gemArr[m] // same cipher, add score
|
||||
tmpArr[0] += 1 + 0.00001*gemArr[m] // same cipher, add score
|
||||
}
|
||||
}
|
||||
if (tmpArr[0] > 0) queryResult.push(tmpArr) // if total score is more than zero, add phrase to array
|
||||
}
|
||||
queryResult.sort(function(a, b) { // sort by score (descending)
|
||||
return b[0] - a[0]; // sort based on index 0 values ("freq" is array of arrays), (b-a) descending order, (a-b) ascending
|
||||
});
|
||||
}
|
||||
|
||||
function searchBarDBQuery(str) { // search bar
|
||||
searchBarValue = str // save input
|
||||
if (str == "") {
|
||||
queryResult = [...queryResultInitial] // restore inital matches
|
||||
updateDatabaseQueryTable(0, dbPageItems)
|
||||
document.getElementById('querySearchInput').focus()
|
||||
return
|
||||
}
|
||||
var i; var tmpPhr = ''; var tmpPhr2 = '';
|
||||
queryResult = [] // clear current matches
|
||||
for (i = 0; i < queryResultInitial.length; i++) {
|
||||
tmpPhr = queryResultInitial[i]
|
||||
if (encodingMenuOpened) { // encoding mode
|
||||
if (encodingMode == 0 && optGemSubstitutionMode) { // syllables, substitution mode
|
||||
tmpPhr2 = tmpPhr.replace(/\[.+\]/g, '').trim() // exclude comments when searching (anagram link)
|
||||
if (tmpPhr2.match(new RegExp(str)) !== null) {
|
||||
queryResult.push(tmpPhr)
|
||||
}
|
||||
} else if (tmpPhr.match(new RegExp(str)) !== null) {
|
||||
queryResult.push(tmpPhr)
|
||||
}
|
||||
} else { // database match
|
||||
if (tmpPhr[1].match(new RegExp(str)) !== null) queryResult.push(tmpPhr)
|
||||
}
|
||||
}
|
||||
updateDatabaseQueryTable(0, dbPageItems)
|
||||
}
|
||||
|
||||
function updateDatabaseQueryTable(stPos = 0, dItems, scrollBarEvent = false) { // starting position, total displayed items
|
||||
var ms, x, y, mCross, mSame, curCiph, curCiphCol
|
||||
|
||||
// stPos - starting position
|
||||
// dbPageItems - number of phrases in one section
|
||||
var nextBlock = stPos+dbPageItems // position for next section
|
||||
if (nextBlock > queryResult.length) nextBlock = queryResult.length // out of bounds
|
||||
var valPos = 2 // used to retrive gematria from "gemArr" (no recalculation, [0] - score, [1] - phrase)
|
||||
var firstPhrase = true // display cipher names before the first phrase
|
||||
var tmpComment, commentMatch, dispPhrase // temporary variables to display comments [...]
|
||||
|
||||
$("#queryArea").removeClass("minimizeQuery") // unhide query area
|
||||
var curPos = stPos // current position begins with starting index
|
||||
var endPos = stPos + dItems // ending position
|
||||
if (curPos < 0) curPos = 0 // out of bounds
|
||||
|
||||
if (!scrollBarEvent) {
|
||||
if (endPos > queryResult.length) endPos = queryResult.length
|
||||
sliderMax = Math.floor(queryResult.length/dbPageItems)
|
||||
if (queryResult.length % dbPageItems == 0) sliderMax -= 1 // if total is divisible, no pagination for last element
|
||||
curSliderPos = Math.round(curPos/dbPageItems)
|
||||
ms = '<span class="minimizeLabel">Click to minimize</span>'
|
||||
ms += '<div id="queryMinBtn">_</div>' // minimize button
|
||||
ms += '<input type="range" min="0" max="'+sliderMax+'" value="'+curSliderPos+'" class="qSlider" id="queryScrollbar">' // slider/scrollbar
|
||||
ms += '<input id="querySearchInput" type="text" spellcheck="false" autocomplete="off" value="'+searchBarValue+'" placeholder="Find...">' // search bar
|
||||
ms += '<table id="QueryTable" class="HistoryTable" data-startpos='+stPos+' data-dispitems='+dItems+'>'
|
||||
ms += '<tbody>'
|
||||
} else { // scrollbar used
|
||||
if (endPos > queryResult.length) { // last page
|
||||
endPos = queryResult.length
|
||||
stPos = queryResult.length - dItems
|
||||
curPos = queryResult.length - dItems
|
||||
}
|
||||
$('#QueryTable').data('startpos', stPos); // update table index
|
||||
$('#QueryTable').data('dispitems', dItems);
|
||||
ms = '<tbody>'
|
||||
}
|
||||
|
||||
for (x = curPos; x < endPos; x++) { // for phrases within range
|
||||
|
||||
if (firstPhrase) { // open row on the first phrase
|
||||
firstPhrase = false
|
||||
ms += '<tr class="cH"><td class="mPQ">'
|
||||
ms += queryResult.length.toLocaleString('en')+' matches'
|
||||
ms += '<br><br>'
|
||||
ms += '<div style="display: inline-flex;">'
|
||||
ms += '<input class="queryPageBtn" id="queryPrevPageBtn" type="button" value="<" onclick="queryShowPrevPage()">'
|
||||
ms += '<input id="queryPosInput" type="tel" autocomplete="off" value="'+curPos+'">'
|
||||
ms += '<input class="queryPageBtn" id="queryNextPageBtn" type="button" value=">" onclick="queryShowNextPage()">'
|
||||
ms += '</div>'
|
||||
ms += '<br>-'
|
||||
ms += '<br>'+nextBlock
|
||||
ms += '</td>'
|
||||
for (z = 0; z < gemArrCiph.length; z++) { // use compact layout
|
||||
curCiph = cipherList[ gemArrCiph[z] ]
|
||||
curCiphCol = (optColoredCiphers) ? 'hsl('+curCiph.H+' '+curCiph.S+'% '+curCiph.L+'% / 1)' : ''
|
||||
// ms += '<td class="hCVQ"><span class="hCV2" style="color: '+curCiphCol+'">'+curCiph.cipherName.replace(/ /g, "<br>")+'</span></td>' // color of cipher displayed in the table
|
||||
ms += '<td class="hCVQ" style="height: '+calcCipherNameHeightPx(curCiph.cipherName)+'px;"><span class="hCV2" style="color: '+curCiphCol+'">'
|
||||
ms += curCiph.cipherName+'</span></td>' // color of cipher displayed in the table
|
||||
}
|
||||
ms += "</tr>"
|
||||
curPos += dbPageItems
|
||||
}
|
||||
|
||||
if (optAllowPhraseComments) {
|
||||
tmpComment = "" // reset
|
||||
commentMatch = (encodingMenuOpened) ? queryResult[x].match(/\[.+\]/g) : queryResult[x][1].match(/\[.+\]/g) // find comment
|
||||
if (commentMatch !== null) {
|
||||
tmpComment = commentMatch[0]
|
||||
}
|
||||
// comment first, phrase without comment and leading/trailing spaces
|
||||
dispPhrase = (encodingMenuOpened) ? '<span class="pCHT">'+tmpComment+'</span>' + queryResult[x].replace(/\[.+\]/g, '').trim() : '<span class="pCHT">'+tmpComment+'</span>' + queryResult[x][1].replace(/\[.+\]/g, '').trim()
|
||||
} else {
|
||||
dispPhrase = (encodingMenuOpened) ? queryResult[x] : queryResult[x][1]
|
||||
}
|
||||
ms += '<tr><td class="hPQ" data-ind="'+x+'">' + dispPhrase + '</td>' // phrase at index 1
|
||||
|
||||
valPos = 2 // reset position for new phrase
|
||||
for (y = 0; y < gemArrCiph.length; y++) { // gemArrCiph contains indices of ciphers used for query
|
||||
curCiph = cipherList[ gemArrCiph[y] ]
|
||||
curCiphCol = (optColoredCiphers) ? 'hsl('+curCiph.H+' '+curCiph.S+'% '+curCiph.L+'% / 1)' : ''
|
||||
|
||||
if (liveDatabaseMode == true) {
|
||||
gemVal = (encodingMenuOpened) ? curCiph.calcGematria(queryResult[x]) : curCiph.calcGematria(queryResult[x][1]) // recalculate displayed value
|
||||
} else {
|
||||
gemVal = queryResult[x][valPos] // value only
|
||||
}
|
||||
// if (gemVal == 0) gemVal = "-"
|
||||
valPos++ // increment value position
|
||||
|
||||
// mSame - same cipher match, mCross - cross cipher match
|
||||
if ( gemVal == gemArr[y] ) {mSame = true} else {mSame = false} // if value is at the same index (meaning same cipher)
|
||||
if (gemArr.indexOf(gemVal) > -1) {mCross = true} else {mCross = false}
|
||||
|
||||
ms += '<td class="tCQ">' // use instead of .tC to disable highlighting/blinking/hide effects on click
|
||||
|
||||
if (mSame) { ms += '<span style="color: '+curCiphCol+'"' }
|
||||
else if (!mSame && mCross) { ms += '<span style="color: hsl(0deg 0% 50% / 1);"' }
|
||||
else if (!mSame && !mCross) {
|
||||
curCiphCol = (optColoredCiphers) ? 'hsl('+curCiph.H+' '+curCiph.S+'% '+curCiph.L+'% / '+alphaHlt+')' : 'hsl(0 0% 50% / '+alphaHlt+')'
|
||||
ms += '<span style="color: '+curCiphCol+'"'
|
||||
}
|
||||
ms += ' class="gVQ"> '+gemVal+' </span></td>' // number properties are available
|
||||
}
|
||||
ms += '</tr>'
|
||||
}
|
||||
|
||||
ms += '</tbody></table>'
|
||||
if (scrollBarEvent) {
|
||||
document.getElementById("QueryTable").innerHTML = ms // update table only
|
||||
} else {
|
||||
document.getElementById("queryArea").innerHTML = ms
|
||||
}
|
||||
if (navigator.maxTouchPoints <= 1 && !scrollBarEvent) { // ignore scrollbar event
|
||||
if (document.getElementById("queryPosInput") !== null) document.getElementById("queryPosInput").focus() // restore focus on desktop devices
|
||||
}
|
||||
}
|
||||
|
||||
function NumberArray() {
|
||||
var x, isNum
|
||||
pArr = sVal().split(" ")
|
||||
isNum = true
|
||||
for (x = 0; x < pArr.length; x++) {
|
||||
if (isNaN(pArr[x])) { // is not a number
|
||||
isNum = false
|
||||
break;
|
||||
} else {
|
||||
pArr[x] = Number(pArr[x])
|
||||
}
|
||||
}
|
||||
return isNum
|
||||
}
|
||||
|
||||
function queryShowPrevPage() {
|
||||
st = Number( document.getElementById('queryPosInput').value ) - dbPageItems
|
||||
if (st < 0) {
|
||||
st = 0
|
||||
$(this).val(0)
|
||||
}
|
||||
n = $("#QueryTable").data("dispitems")
|
||||
$("#queryArea").html() // clear previous table
|
||||
updateDatabaseQueryTable(st, n) // redraw table at new position
|
||||
if (navigator.maxTouchPoints <= 1) document.getElementById("queryPosInput").focus() // restore focus on desktop devices
|
||||
}
|
||||
|
||||
function queryShowNextPage() {
|
||||
st = Number( document.getElementById('queryPosInput').value ) + dbPageItems
|
||||
if (st >= queryResult.length) {
|
||||
st = queryResult.length - (queryResult.length % dbPageItems) // last page
|
||||
if (queryResult.length % dbPageItems == 0) st -= dbPageItems // if total is divisible, no pagination for last element
|
||||
$(this).val(st);
|
||||
}
|
||||
n = $("#QueryTable").data("dispitems")
|
||||
$("#queryArea").html() // clear previous table
|
||||
updateDatabaseQueryTable(st, n) // redraw table at new position
|
||||
if (navigator.maxTouchPoints <= 1) document.getElementById("queryPosInput").focus() // restore focus on desktop devices
|
||||
}
|
||||
|
||||
function unloadDatabase() {
|
||||
clearDatabaseQueryTable()
|
||||
var curCiphArr = [] // save currently enabled cipher names (database)
|
||||
for (var n = 0; n < cipherList.length; n++) {
|
||||
if (curCiphArr.indexOf(cipherList[n].cipherName) == -1 && cipherList[n].enabled) {
|
||||
curCiphArr.push(cipherList[n].cipherName)
|
||||
}
|
||||
}
|
||||
updateTables() // update
|
||||
|
||||
if (!liveDatabaseMode) { // restore ciphers only when precalculated database is unloaded
|
||||
/*
|
||||
cipherList = [...cipherListSaved] // restore initial ciphers
|
||||
interfaceHue = interfaceHueDefault // restore hue
|
||||
interfaceLit = interfaceLitDefault // restore saturation
|
||||
interfaceSat = interfaceSatDefault // restore lightness
|
||||
fontHue = fontHueDefault
|
||||
fontLit = fontLitDefault
|
||||
fontSat = fontSatDefault
|
||||
coderainHue = coderainHueDefault
|
||||
coderainLit = coderainLitDefault
|
||||
coderainSat = coderainSatDefault
|
||||
optGradientCharts = optGradientChartsDefault // restore gradient charts
|
||||
*/
|
||||
restoreCalcSettingsLocalStorage(true) // restore settings from localStorage
|
||||
$('#showExtraCiphOption').removeClass('hideValue') // show "Show Extra Ciphers" option
|
||||
}
|
||||
userDB = [] // clear previous DB
|
||||
userDBlive = [] // clear live DB
|
||||
|
||||
document.getElementById("calcOptionsPanel").innerHTML = "" // clear menu panel
|
||||
initCalc() // reinit
|
||||
defaultCipherArray = [...defaultCipherArraySaved] // restore default ciphers choice
|
||||
disableAllCiphers()
|
||||
|
||||
for (n = 0; n < cipherList.length; n++) { //enable previous ciphers choice if available (from database)
|
||||
if (curCiphArr.indexOf(cipherList[n].cipherName) > -1) {
|
||||
cipherList[n].enabled = true
|
||||
cur_chkbox = document.getElementById("cipher_chkbox"+n)
|
||||
if (cur_chkbox !== null) cur_chkbox.checked = true // update checkbox if present
|
||||
}
|
||||
}
|
||||
updateTables() // update tables
|
||||
updateInterfaceColor() // update interface color
|
||||
|
||||
$("#queryDBbtn").addClass("hideValue") // hide query button
|
||||
$("#clearDBqueryBtn").addClass("hideValue") // clear button
|
||||
$("#unloadDBBtn").addClass("hideValue") // unload database button
|
||||
$("#btn-export-db-query").addClass("hideValue") // export button
|
||||
$("#edCiphBtn").removeClass("hideValue") // show "Edit Ciphers"
|
||||
$("#liveDBOption").removeClass("hideValue") // show "Live Database Mode"
|
||||
|
||||
closeAllOpenedMenus() // close "Edit Ciphers"
|
||||
precalcDBLoaded = false // precalculated database unloaded, enable cipher rearrangement
|
||||
liveDatabaseMode = true // restore live database mode
|
||||
|
||||
console.log("Database unloaded!")
|
||||
displayCalcNotification("Database unloaded!", 1000)
|
||||
return
|
||||
}
|
||||
|
||||
function calcLiveDatabase(arr) {
|
||||
var i, n
|
||||
var tmpArr = []
|
||||
userDB = [] // reset database values
|
||||
for (i = 0; i < arr.length; i++) {
|
||||
tmpArr = [] // reset
|
||||
tmpArr.push(arr[i]) // add phrase
|
||||
for (n = 0; n < cipherList.length; n++) {
|
||||
if (cipherList[n].enabled) {
|
||||
tmpArr.push(cipherList[n].calcGematria(arr[i])) // gematria value for each enabled cipher
|
||||
}
|
||||
}
|
||||
userDB.push(tmpArr) // add row with phrase and gematria for enabled ciphers
|
||||
}
|
||||
}
|
||||
|
||||
function db_PhrLenStats(column = 1) { // phrase length statistics inside current database, column can be value[0] or matches[1]
|
||||
var pLenArr = [] // phrase length array
|
||||
var db = []
|
||||
if (precalcDBLoaded) {
|
||||
db = userDB // precalculated database
|
||||
for (i = 0; i < db.length; i++) {
|
||||
pLenArr.push(db[i][0].length) // read length of each phrase
|
||||
}
|
||||
} else {
|
||||
db = userDBlive // live database
|
||||
for (i = 0; i < db.length; i++) {
|
||||
pLenArr.push(db[i].length) // read length of each phrase
|
||||
}
|
||||
}
|
||||
var pStat = countMatches(pLenArr) // number of matches[1] for each value[0]
|
||||
pStat.sort(function(a, b) { // sort by score (descending)
|
||||
return b[column] - a[column]; // sort based on index 1 values, (b-a) descending order, (a-b) ascending
|
||||
});
|
||||
var res = ""
|
||||
for (i = 0; i < pStat.length; i++) {
|
||||
res += pStat[i][0]+','+pStat[i][1]+'\n'
|
||||
}
|
||||
res = res.slice(0,-1) // remove last new line
|
||||
copy(res)
|
||||
console.log("Copied to clipboard!")
|
||||
}
|
||||
|
||||
function db_CopyPhrOfLen(low, up) { // copy phrases of length within range (inclusive) from database
|
||||
var pLenArr = [] // phrase length array
|
||||
var db = []
|
||||
if (precalcDBLoaded) {
|
||||
db = userDB // precalculated database
|
||||
for (i = 0; i < db.length; i++) {
|
||||
if (db[i][0].length >= low && db[i][0].length <= up) pLenArr.push(db[i][0]) // load phrase
|
||||
}
|
||||
} else {
|
||||
db = userDBlive // live database
|
||||
for (i = 0; i < db.length; i++) {
|
||||
if (db[i].length >= low && db[i].length <= up) pLenArr.push(db[i]) // load phrase
|
||||
}
|
||||
}
|
||||
var res = ""
|
||||
for (i = 0; i < pLenArr.length; i++) {
|
||||
res += pLenArr[i]+'\n'
|
||||
}
|
||||
res = res.slice(0,-1) // remove last new line
|
||||
copy(res)
|
||||
console.log("Copied to clipboard!")
|
||||
}
|
||||
|
||||
function db_CopyWordRange(low, up) { // copy phrases that have specific amount of words within range (inclusive) from database
|
||||
var pLenArr = [] // phrase length array
|
||||
var tmp = []
|
||||
var db = []
|
||||
if (precalcDBLoaded) {
|
||||
db = userDB // precalculated database
|
||||
for (i = 0; i < db.length; i++) {
|
||||
tmp = db[i][0].split(' ')
|
||||
if (tmp.length >= low && tmp.length <= up) pLenArr.push(db[i][0]) // load phrase
|
||||
}
|
||||
} else {
|
||||
db = userDBlive // live database
|
||||
for (i = 0; i < db.length; i++) {
|
||||
tmp = db[i].split(' ')
|
||||
if (tmp.length >= low && tmp.length <= up) pLenArr.push(db[i]) // load phrase
|
||||
}
|
||||
}
|
||||
var res = ""
|
||||
for (i = 0; i < pLenArr.length; i++) {
|
||||
res += pLenArr[i]+'\n'
|
||||
}
|
||||
res = res.slice(0,-1) // remove last new line
|
||||
copy(res)
|
||||
console.log("Copied to clipboard!")
|
||||
}
|
||||
|
||||
function db_ConvertProperCase() { // convert current database to Proper Case
|
||||
var i, n; var tmp = []; var tStr = ''; var out = 'CREATE_GEMATRO_DB\n'
|
||||
var db = []
|
||||
if (precalcDBLoaded) {
|
||||
db = userDB // precalculated database
|
||||
} else {
|
||||
db = userDBlive // live database
|
||||
}
|
||||
for (i = 0; i < db.length; i++) {
|
||||
tStr = ''
|
||||
if (precalcDBLoaded) { // current phrase to separate words
|
||||
tmp = db[i][0].split(' ')
|
||||
} else {
|
||||
tmp = db[i].split(' ')
|
||||
}
|
||||
for (n = 0; n < tmp.length; n++) { // build string, each first letter is capitalized
|
||||
tStr += tmp[n].substring(0,1).toUpperCase() + tmp[n].substring(1,tmp[n].length).toLowerCase() + ' '
|
||||
}
|
||||
out += tStr.trim() + '\n'
|
||||
}
|
||||
out = 'data:text/plain;charset=utf-8,'+encodeURIComponent(out.slice(0,-1)) // format as text file, remove last new line
|
||||
download("GEMATRO_DB_PROPER_CASE_"+getTimestamp()+".txt", out); // download file
|
||||
}
|
||||
|
||||
function createDictFromFile(file) {
|
||||
var i; var reader = new FileReader()
|
||||
var sb = "" // string builder
|
||||
reader.onload = (event) => { // actions to perform after file is read
|
||||
file = event.target.result // full file contents
|
||||
// new line, tabs, sequential spaces, sequential dash, remove punctuation and numbers
|
||||
file = file.replace(/\r\n|\n/g, ' ').replace(/\t/g, ' ').replace(/ +/g, ' ').replace(/\-+/g, '-').replace(/[.,\/#!$%\^&\*;:{}=_`~()"\?\|@\(\)\[\]/<>0123456789]/g, '')
|
||||
var wordList = file.split(' ') // to string array, space as separator
|
||||
|
||||
var uniqueList = []
|
||||
var lowercaseList = []
|
||||
for (i = 0; i < wordList.length; i++) {
|
||||
if (lowercaseList.indexOf(wordList[i].toLowerCase()) == -1 && wordList[i].length > 0) {
|
||||
lowercaseList.push(wordList[i].toLowerCase()) // avoid "word" and "Word" duplicates
|
||||
uniqueList.push(wordList[i])
|
||||
}
|
||||
}
|
||||
uniqueList.sort( (a, b) => a.localeCompare(b, undefined, {sensitivity: 'base'}) ) // sort ascending, case insensitive
|
||||
if (uniqueList.indexOf('-') > -1) uniqueList.splice(uniqueList.indexOf('-'), 1) // remove '-'
|
||||
|
||||
var o = ''
|
||||
for (i = 0; i < uniqueList.length; i++) {
|
||||
o += uniqueList[i]+'\n'
|
||||
}
|
||||
o = 'data:text/plain;charset=utf-8,'+encodeURIComponent('CREATE_GEMATRO_DB\n' + o.slice(0,-1)) // format as text file
|
||||
download("GEMATRO_DB_DICT_"+getTimestamp()+".txt", o); // download file
|
||||
}
|
||||
reader.onerror = (event) => {
|
||||
alert(event.target.error.name)
|
||||
};
|
||||
reader.readAsText(file) // issue command to start reading file
|
||||
}
|
||||
@@ -0,0 +1,594 @@
|
||||
// ======================== Date Calculator =========================
|
||||
|
||||
function updDates(offsetMode = false, ctrlClass = '') { // offsetMode - add/subtract
|
||||
|
||||
// date 1
|
||||
var d1 = new Date($('#d1y').val(), $('#d1m').val()-1, $('#d1d').val()) // year, month, date
|
||||
saved_d1 = new Date(d1) // save date
|
||||
if (ctrlClass !== 'dateInputYear') $('#d1y').val(d1.getFullYear()) // update controls with valid values
|
||||
$('#d1m').val(d1.getMonth()+1)
|
||||
$('#d1d').val(d1.getDate())
|
||||
$('#d1full').text(monthNames(d1.getMonth())+' '+d1.getDate()+', '+d1.getFullYear()) // update date 1
|
||||
|
||||
// date 2
|
||||
var d2
|
||||
if (!offsetMode) { // date was set by date 2 controls
|
||||
d2 = new Date($('#d2y').val(), $('#d2m').val()-1, $('#d2d').val()) // year, month, date
|
||||
saved_d2 = new Date(d2) // save date
|
||||
} else { // date was calculated (add/subtract controls)
|
||||
d2 = new Date(saved_d2) // use precalculated date
|
||||
$('#d2y').val(d2.getFullYear()) // update year
|
||||
}
|
||||
if (ctrlClass !== 'dateInputYear') $('#d2y').val(d2.getFullYear()) // update controls with valid values
|
||||
$('#d2m').val(d2.getMonth()+1)
|
||||
$('#d2d').val(d2.getDate())
|
||||
$('#d2full').text(monthNames(d2.getMonth())+' '+d2.getDate()+', '+d2.getFullYear()) // update date 2
|
||||
|
||||
var d_min = new Date( Math.min(d1,d2) ) // dates used for calculation
|
||||
var d_max = new Date( Math.max(d1,d2) )
|
||||
var d_max_disp = new Date( Math.max(d1,d2) ) // date for display
|
||||
d_max.setDate(d_max.getDate() + endDate) // +1 day to include end date, -1 day to if necessary
|
||||
|
||||
// from Date 1 to Date 2 is:
|
||||
var o = '<span class="weekDayLabel">'+dayOfWeek(d_min.getDay())+',</span>'+' '
|
||||
o += '<span class="dateFullTable2">'+monthNames(d_min.getMonth())+' '+d_min.getDate()+', '+d_min.getFullYear()+'</span>'
|
||||
o += '<br>'
|
||||
o += '<span class="dateNthLabel">'
|
||||
o += dFmt(dayOfYear(d_min))+'<span style="font-weight: 600;">'+n_th(dayOfYear(d_min), d_min.getFullYear())+' day of the year / <span>'
|
||||
o += dFmt(daysLeftInYear(d_min))+'<span style="font-weight: 600;"> days remaining</span>'
|
||||
o += '</span>'
|
||||
$('#d1full_t2').html(o)
|
||||
|
||||
var o = '<span class="weekDayLabel">'+dayOfWeek(d_max_disp.getDay())+',</span>'+' '
|
||||
o += '<span class="dateFullTable2">'+monthNames(d_max_disp.getMonth())+' '+d_max_disp.getDate()+', '+d_max_disp.getFullYear()+'</span>'
|
||||
o += '<br>'
|
||||
o += '<span class="dateNthLabel">'
|
||||
o += dFmt(dayOfYear(d_max_disp))+'<span style="font-weight: 600;">'+n_th(dayOfYear(d_max_disp), d_max_disp.getFullYear())+' day of the year / <span>'
|
||||
o += dFmt(daysLeftInYear(d_max_disp))+'<span style="font-weight: 600;"> days remaining</span>'
|
||||
o += '</span>'
|
||||
$('#d2full_t2').html(o)
|
||||
|
||||
// date difference
|
||||
var YMWD_arr = getYMWDdiff(d_min, d_max) // functions sort dates as well
|
||||
var YMD_arr = getYMDdiff(d_min, d_max)
|
||||
var YWD_arr = getYWDdiff(d_min, d_max)
|
||||
var YD_arr = getYDdiff(d_min, d_max)
|
||||
var MWD_arr = getMWDdiff(d_min, d_max)
|
||||
var MD_arr = getMDdiff(d_min, d_max)
|
||||
var WD_arr = getWDdiff(d_min, d_max)
|
||||
|
||||
o = ''
|
||||
if (YMWD_arr.Y !== 0) { // exclude durations if less than a year
|
||||
if (YMWD_arr.M !== 0 && YMWD_arr.W !== 0) o += dDurLine( dFmt(YMWD_arr.Y,0) + dFmt(YMWD_arr.M,1) + dFmt(MWD_arr.W,2) + dFmt(YMWD_arr.D,3) )
|
||||
if (YMD_arr.M !== 0) o += dDurLine( dFmt(YMD_arr.Y,0) + dFmt(YMD_arr.M,1) + dFmt(YMD_arr.D,3) )
|
||||
if (YWD_arr.W !== 0) o += dDurLine( dFmt(YWD_arr.Y,0) + dFmt(YWD_arr.W,2) + dFmt(YWD_arr.D,3) )
|
||||
o += dDurLine( dFmt(YD_arr.Y,0) + dFmt(YD_arr.D,3) )
|
||||
}
|
||||
if (MWD_arr.M !== 0 && MWD_arr.W !== 0) o += dDurLine( dFmt(MWD_arr.M,1) + dFmt(MWD_arr.W,2) + dFmt(MWD_arr.D,3) )
|
||||
if (MD_arr.M !== 0) o += dDurLine( dFmt(MD_arr.M,1) + dFmt(MD_arr.D,3) )
|
||||
if (WD_arr.W !== 0) o += dDurLine( dFmt(WD_arr.W,2) + dFmt(WD_arr.D,3) )
|
||||
o += dDurLine( dFmt(getDayDiff(d_max, d_min),3) )
|
||||
|
||||
if (endDate == 1) o += '<div><span class="dateOffsetLabel">(including end date)</span></div>'
|
||||
else if (endDate == -1) o += '<div><span class="dateOffsetLabel">(excluding start date)</span></div>'
|
||||
|
||||
if (d_min.getTime() == d_max.getTime()) o = dDurLine('<span class="durVal">0</span> days') // same dates
|
||||
$('#dateDurValues').html(o)
|
||||
}
|
||||
|
||||
function dDurLine(val) { // build string to display date duration
|
||||
val = val.trim() // remove spaces
|
||||
val = '<div><span class="dateDurLine">'+val+'</span></div>'// add class for highlighting
|
||||
return val
|
||||
}
|
||||
|
||||
function dFmt(val, mode) { // formatting and label for date durations, y,m,w,d is 0,1,2,3 (optional)
|
||||
var o = ''
|
||||
var dLabel = ['years','months','weeks','days']
|
||||
if (val == 1) dLabel = ['year','month','week','day']
|
||||
if (typeof mode !== 'undefined') { o = '<span class="durVal">'+val+'</span>'+' '+dLabel[mode]+' ' }
|
||||
else { o = '<span class="dOfYear">'+val+'</span>' } // // day of year, days remaining
|
||||
if (val == 0 && mode == 3) o = '' // exclude "0 days"
|
||||
return o
|
||||
}
|
||||
|
||||
function dFmt2(val, mode) { // label for date durations (array), y,m,w,d is 0,1,2,3 (optional)
|
||||
var o = ''
|
||||
var dLabel = ['years','months','weeks','days']
|
||||
if (val == 1) dLabel = ['year','month','week','day']
|
||||
if (typeof mode !== 'undefined') { o = val+' '+dLabel[mode]+' ' }
|
||||
return o
|
||||
}
|
||||
|
||||
function n_th(i, yr) { // number ordinal suffix - 1st, 2nd, etc, marked with asterisk on leap year
|
||||
var out;
|
||||
var j = i % 10
|
||||
var k = i % 100
|
||||
if (j == 1 && k !== 11) {
|
||||
// return i + "st"
|
||||
out = "st"
|
||||
} else if (j == 2 && k !== 12) {
|
||||
out = "nd"
|
||||
} else if (j == 3 && k !== 13) {
|
||||
out = "rd"
|
||||
} else {
|
||||
out = "th"
|
||||
}
|
||||
if (isLeapYear(yr) && i >= 60) out += "*" // February 29th or March 1st
|
||||
return out
|
||||
}
|
||||
|
||||
function toggleDateCalcMenu() {
|
||||
if (!dateCalcMenuOpened) {
|
||||
closeAllOpenedMenus()
|
||||
dateCalcMenuOpened = true
|
||||
|
||||
var d2 = new Date(saved_d2) // load previously saved dates
|
||||
var d1 = new Date(saved_d1)
|
||||
|
||||
var o = '<div class="dateCalcContainer">'
|
||||
o += '<input class="closeMenuBtn" type="button" value="×" onclick="closeAllOpenedMenus()">'
|
||||
|
||||
// table with date selection
|
||||
o += '<table class="dateCalcTable"><tbody>'
|
||||
o += '<tr><td colspan=4><span id="d1full"></span></td></tr>' // full date 1
|
||||
|
||||
o += '<tr>' // controls
|
||||
o += '<td><input id="d1m" class="dateInput" type="number" step="1" min="0" max="13" value="'+(d1.getMonth()+1)+'"></td>'
|
||||
o += '<td><input id="d1d" class="dateInput" type="number" step="1" min="0" max="32" value="'+d1.getDate()+'"></td>'
|
||||
o += '<td colspan=2 style="text-align: right;"><input id="d1y" class="dateInputYear" type="number" step="1" min="1" max="9999" value="'+d1.getFullYear()+'"></td>'
|
||||
o += '</tr>'
|
||||
|
||||
o += '<tr style="line-height: 0.6em;">' // labels
|
||||
o += '<td style="padding-bottom: 0.3em;"><span class="dateInputLabel">Month</span></td>'
|
||||
o += '<td style="padding-bottom: 0.3em;"><span class="dateInputLabel">Day</span></td>'
|
||||
o += '<td colspan=2 style="padding-bottom: 0.3em;"><span class="dateInputLabel">Year</span></td>'
|
||||
o += '</tr>'
|
||||
|
||||
o += '<tr><td colspan=4><span id="d2full"></span></td></tr>' // full date 2
|
||||
|
||||
o += '<tr>' // controls
|
||||
o += '<td><input id="d2m" class="dateInput" type="number" step="1" min="0" max="13" value="'+(d2.getMonth()+1)+'"></td>'
|
||||
o += '<td><input id="d2d" class="dateInput" type="number" step="1" min="0" max="32" value="'+d2.getDate()+'"></td>'
|
||||
o += '<td colspan=2 style="text-align: right;"><input id="d2y" class="dateInputYear" type="number" step="1" min="1" max="9999" value="'+d2.getFullYear()+'"></td>'
|
||||
o += '</tr>'
|
||||
|
||||
o += '<tr style="line-height: 0.6em;">' // labels
|
||||
o += '<td style="padding-bottom: 1em;"><span class="dateInputLabel">Month</span></td>'
|
||||
o += '<td style="padding-bottom: 1em;"><span class="dateInputLabel">Day</span></td>'
|
||||
o += '<td colspan=2 style="padding-bottom: 1em;"><span class="dateInputLabel">Year</span></td>'
|
||||
o += '</tr>'
|
||||
|
||||
var endCheckedState = "";
|
||||
var startCheckedState = "";
|
||||
if (endDate == 1) endCheckedState = "checked"
|
||||
if (endDate == -1) startCheckedState = "checked"
|
||||
if (!endChkEnabled) { endCheckedState = "disabled"; startCheckedState = "disabled"; }
|
||||
o += '<tr><td colspan=3 style="text-align: left;"><label class="chkLabel endDateLabel">Include End Date<input type="checkbox" id="chkbox_incEndDate" onclick="toggleEndDateCalc()" '+endCheckedState+'><span class="custChkBox"></span></label></td></tr>'
|
||||
o += '<tr><td colspan=3 style="text-align: left;"><label class="chkLabel endDateLabel">Exclude Start Date<input type="checkbox" id="chkbox_excStartDate" onclick="toggleStartDateCalc()" '+startCheckedState+'><span class="custChkBox"></span></label></td></tr>'
|
||||
|
||||
// add/subtract date
|
||||
o += '<tr>'
|
||||
o += '<td colspan=2 style="padding: 0.4em 0em;"><span class="dateInputLabel">Add/Subtract</span></td>'
|
||||
o += '<td colspan=2 style="padding: 0.4em 0em;"><input class="intBtnResetDate" type="button" value="Reset All Dates" onclick="resetDateControls()"></td>'
|
||||
o += '</tr>'
|
||||
o += '<tr>'
|
||||
o += '<td><input id="offsetY" class="offsetDateInput" type="number" step="1" min="-9999" max="9999" value="'+offsetYMWD[0]+'"></td>'
|
||||
o += '<td><input id="offsetM" class="offsetDateInput" type="number" step="1" min="-9999" max="9999" value="'+offsetYMWD[1]+'"></td>'
|
||||
o += '<td><input id="offsetW" class="offsetDateInput" type="number" step="1" min="-9999" max="9999" value="'+offsetYMWD[2]+'"></td>'
|
||||
o += '<td><input id="offsetD" class="offsetDateInput" type="number" step="1" min="-9999999" max="9999999" value="'+offsetYMWD[3]+'"></td>'
|
||||
o += '</tr>'
|
||||
o += '<tr style="line-height: 0.6em;">' // labels
|
||||
o += '<td style="padding-bottom: 0.5em;"><span class="dateInputLabel">Year</span></td>'
|
||||
o += '<td style="padding-bottom: 0.5em;"><span class="dateInputLabel">Month</span></td>'
|
||||
o += '<td style="padding-bottom: 0.5em;"><span class="dateInputLabel">Week</span></td>'
|
||||
o += '<td style="padding-bottom: 0.5em;"><span class="dateInputLabel">Day</span></td>'
|
||||
o += '</tr>'
|
||||
|
||||
o += '</tbody></table>'
|
||||
|
||||
// table with difference between dates
|
||||
o += '<div class="dateCalcBg">'
|
||||
|
||||
o += '<table class="dateCalcTable2"><tbody>'
|
||||
o += '<tr style="line-height: 0.9em;"><td><div id="dateDesc1Area"><input class="dateDescription" id="dateDesc1" value="'+dateDesc1Saved+'"></div></td></tr>' // Date 1 label
|
||||
o += '<tr style="line-height: 0.9em;"><td style="padding-bottom: 0.5em;"><span id="d1full_t2" class="dateDetailsText"></span></td></tr>' // Date 1
|
||||
o += '<tr style="line-height: 0.9em;"><td><div id="dateDesc2Area"><input class="dateDescription" id="dateDesc2" value="'+dateDesc2Saved+'"></div></td></tr>' // Date 2 label
|
||||
o += '<tr style="line-height: 0.9em;"><td style="padding-bottom: 0.5em;"><span id="d2full_t2" class="dateDetailsText"></span></td></tr>' // Date 2
|
||||
o += '<tr><td style="background: var(--menu-bg-accent); padding: 0.4em 0.75em 0.5em 0.75em;"><span id="dateDurValues" class="dateDetailsText"></span></td></tr>'
|
||||
o += '</tbody></table>'
|
||||
|
||||
o += '</div>' // dateCalcBg
|
||||
|
||||
o += '</div>' // dateCalcContainer
|
||||
|
||||
document.getElementById("dateCalcMenuArea").innerHTML = o
|
||||
updDates() // update values
|
||||
} else {
|
||||
document.getElementById("dateCalcMenuArea").innerHTML = "" // close Date Calculator
|
||||
dateCalcMenuOpened = false
|
||||
}
|
||||
}
|
||||
|
||||
function resetDateControls() {
|
||||
saved_d1 = new Date(reset_d1) // initial dates
|
||||
$('#d1y').val(saved_d1.getFullYear()) // update date1 controls
|
||||
$('#d1m').val(saved_d1.getMonth()+1)
|
||||
$('#d1d').val(saved_d1.getDate())
|
||||
|
||||
saved_d2 = new Date(reset_d2)
|
||||
$('#d2y').val(saved_d2.getFullYear()) // update date2 controls
|
||||
$('#d2m').val(saved_d2.getMonth()+1)
|
||||
$('#d2d').val(saved_d2.getDate())
|
||||
|
||||
document.getElementById("dateDesc1").value = "From" // clear date descriptions
|
||||
document.getElementById("dateDesc2").value = "to"
|
||||
|
||||
endChkEnabled = true // allow to toggle checkbox
|
||||
$('#chkbox_incEndDate').prop("disabled", "")
|
||||
$('#chkbox_excStartDate').prop("disabled", "")
|
||||
endDate = 0 // exclude end date from calculation
|
||||
$('#chkbox_incEndDate').prop("checked", "") // uncheck box
|
||||
$('#chkbox_excStartDate').prop("checked", "") // uncheck box
|
||||
|
||||
offsetYMWD = [0,0,0,0] // reset offset controls
|
||||
$('#offsetY').val(0)
|
||||
$('#offsetM').val(0)
|
||||
$('#offsetW').val(0)
|
||||
$('#offsetD').val(0)
|
||||
updDates() // update tables, true to reset date 2 controls
|
||||
}
|
||||
|
||||
function toggleStartDateCalc() {
|
||||
if (endDate !== -1) {
|
||||
endDate = -1
|
||||
el = document.getElementById('chkbox_incEndDate')
|
||||
if (el !== null) el.checked = false
|
||||
} else {
|
||||
endDate = 0
|
||||
}
|
||||
updDates()
|
||||
}
|
||||
|
||||
function toggleEndDateCalc() {
|
||||
if (endDate !== 1) {
|
||||
endDate = 1
|
||||
el = document.getElementById('chkbox_excStartDate')
|
||||
if (el !== null) el.checked = false
|
||||
} else {
|
||||
endDate = 0
|
||||
|
||||
}
|
||||
updDates()
|
||||
}
|
||||
|
||||
function isLeapYear(y) {
|
||||
return ( y%4 == 0 && y%100 !== 0 ) || y%400 == 0;
|
||||
}
|
||||
|
||||
function monthNames(m) {
|
||||
// var mNames = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
|
||||
var monthArr = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]
|
||||
return monthArr[m]
|
||||
}
|
||||
|
||||
function dayOfYear(d) {
|
||||
tmp = new Date(d.getFullYear()-1, 11, 31) // previous year, Dec 31
|
||||
d_of_year = Math.round( (d - tmp) / 86400000 ) // day of the year
|
||||
return d_of_year
|
||||
}
|
||||
|
||||
function daysLeftInYear(d) {
|
||||
tmp = new Date(d.getFullYear(), 11, 31) // this year, Dec 31
|
||||
d_left = Math.round( (tmp - d) / 86400000 ) // remaining days in year
|
||||
return d_left
|
||||
}
|
||||
|
||||
function daysInMonth(m, y) { // amount of days in month for given year
|
||||
mDaysArr = [31,28,31,30,31,30,31,31,30,31,30,31] // 0 - January
|
||||
if ( m == 1 && ( (y%4 == 0 && y%100 !== 0) || y%400 == 0 ) ) return 29 // if February on leap year
|
||||
return mDaysArr[m]
|
||||
}
|
||||
|
||||
function dayOfWeek(n) {
|
||||
var dayArr = ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday']
|
||||
// var dayArr = ['Sun','Mon','Tue','Wed','Thu','Fri','Sat']
|
||||
return dayArr[n]
|
||||
}
|
||||
|
||||
function getYMWDdiff(d1, d2) { // year, month, week, day difference
|
||||
// console.clear()
|
||||
var d_min = new Date( Math.min(d1, d2) ) // earlier date
|
||||
var d_max = new Date( Math.max(d1, d2) ) // later date
|
||||
var y_diff = d_max.getFullYear() - d_min.getFullYear() // year difference
|
||||
|
||||
var m_diff = 0
|
||||
// if month of smaller date is greater, or if same month but day of smaller date is greater
|
||||
if ( d_min.getMonth() > d_max.getMonth() || (d_min.getMonth() == d_max.getMonth() && d_min.getDate() > d_max.getDate()) ) {
|
||||
y_diff-- // last year is not full
|
||||
m_diff = d_max.getMonth() - d_min.getMonth() + 12 // partial year
|
||||
} else {
|
||||
m_diff = d_max.getMonth() - d_min.getMonth()
|
||||
}
|
||||
|
||||
// console.log('d_max.getMonth()-1:'+(d_max.getMonth()-1)+' d_max.getFullYear():'+d_max.getFullYear())
|
||||
var dPrevMonth = daysInMonth(d_max.getMonth()-1, d_max.getFullYear()) // prev month from d_max
|
||||
|
||||
var WD_diff; var tmp;
|
||||
var prev_date = d_min.getDate(); // last day of previous month
|
||||
|
||||
if ( d_min.getDate() > d_max.getDate() ) { // less than a month
|
||||
m_diff-- // last month is not full
|
||||
// if current day of month is greater than number of days in previous month, use max available day for prev month
|
||||
if ( d_min.getDate() > dPrevMonth ) prev_date = dPrevMonth
|
||||
tmp = new Date(d_max.getFullYear(), d_max.getMonth()-1, prev_date) // switch to previous month (d_max)
|
||||
// console.log('dPrevMonth:'+dPrevMonth)
|
||||
// console.log('tmp:'+tmp.toDateString()+' d_max:'+d_max.toDateString())
|
||||
} else { // more than a month
|
||||
tmp = new Date(d_max.getFullYear(), d_max.getMonth(), d_min.getDate()) // switch to d_min date for d_max
|
||||
}
|
||||
WD_diff = getWDdiff(d_max, tmp) // get remaining week, day difference
|
||||
|
||||
return {Y: y_diff, M: m_diff, W: WD_diff.W, D: WD_diff.D} // object
|
||||
}
|
||||
|
||||
function getYMDdiff(d1, d2) { // year, month, day difference
|
||||
// console.clear()
|
||||
var d_min = new Date( Math.min(d1, d2) ) // earlier date
|
||||
var d_max = new Date( Math.max(d1, d2) ) // later date
|
||||
var y_diff = d_max.getFullYear() - d_min.getFullYear() // year difference
|
||||
|
||||
var m_diff = 0
|
||||
// if month of smaller date is greater, or if same month but day of smaller date is greater
|
||||
if ( d_min.getMonth() > d_max.getMonth() || (d_min.getMonth() == d_max.getMonth() && d_min.getDate() > d_max.getDate()) ) {
|
||||
y_diff-- // last year is not full
|
||||
m_diff = d_max.getMonth() - d_min.getMonth() + 12 // partial year
|
||||
} else {
|
||||
m_diff = d_max.getMonth() - d_min.getMonth()
|
||||
}
|
||||
|
||||
// console.log('d_max.getMonth()-1:'+(d_max.getMonth()-1)+' d_max.getFullYear():'+d_max.getFullYear())
|
||||
var dPrevMonth = daysInMonth(d_max.getMonth()-1, d_max.getFullYear()) // prev month from d_max
|
||||
|
||||
var d_diff; var tmp;
|
||||
var prev_date = d_min.getDate(); // last day of previous month
|
||||
|
||||
if ( d_min.getDate() > d_max.getDate() ) { // less than a month
|
||||
m_diff-- // last month is not full
|
||||
// if current day of month is greater than number of days in previous month, use max available day for prev month
|
||||
if ( d_min.getDate() > dPrevMonth ) prev_date = dPrevMonth
|
||||
tmp = new Date(d_max.getFullYear(), d_max.getMonth()-1, prev_date) // switch to previous month (d_max)
|
||||
// console.log('dPrevMonth:'+dPrevMonth)
|
||||
// console.log('tmp:'+tmp.toDateString()+' d_max:'+d_max.toDateString())
|
||||
} else { // more than a month
|
||||
tmp = new Date(d_max.getFullYear(), d_max.getMonth(), d_min.getDate()) // switch to d_min date for d_max
|
||||
}
|
||||
d_diff = getDayDiff(d_max, tmp) // get remaining day difference
|
||||
|
||||
return {Y: y_diff, M: m_diff, D: d_diff} // object
|
||||
}
|
||||
|
||||
function getYWDdiff(d1, d2) { // year, week, day difference
|
||||
var d_min = new Date( Math.min(d1, d2) ) // earlier date
|
||||
var d_max = new Date( Math.max(d1, d2) ) // later date
|
||||
var y_diff = d_max.getFullYear() - d_min.getFullYear() // year difference
|
||||
|
||||
var tmp;
|
||||
// if month of earlier date is greater or if same month and earlier date has a greater day of month
|
||||
if ( d_min.getMonth() > d_max.getMonth() || (d_max.getMonth() == d_min.getMonth() && d_min.getDate() > d_max.getDate()) ) {
|
||||
y_diff-- // decrement year difference
|
||||
// same month, day as d_min - use prev year of d_max, since diff is less than a full year
|
||||
tmp = new Date(d_max.getFullYear()-1, d_min.getMonth(), d_min.getDate())
|
||||
} else {
|
||||
// same month, day as d_min - use year of d_max since diff is more than a full year
|
||||
tmp = new Date(d_max.getFullYear(), d_min.getMonth(), d_min.getDate())
|
||||
}
|
||||
|
||||
var WD_diff = getWDdiff(d_max, tmp) // get week, day difference
|
||||
return {Y: y_diff, W: WD_diff.W, D: WD_diff.D} // object
|
||||
}
|
||||
|
||||
function getYDdiff(d1, d2) { // year, day difference
|
||||
var d_min = new Date( Math.min(d1, d2) ) // earlier date
|
||||
var d_max = new Date( Math.max(d1, d2) ) // later date
|
||||
var y_diff = d_max.getFullYear() - d_min.getFullYear() // year difference
|
||||
|
||||
var tmp;
|
||||
// if month of earlier date is greater or if same month and earlier date has a greater day of month
|
||||
if ( d_min.getMonth() > d_max.getMonth() || (d_max.getMonth() == d_min.getMonth() && d_min.getDate() > d_max.getDate()) ) {
|
||||
y_diff-- // decrement year difference
|
||||
// same month, day as d_min - use prev year of d_max, since diff is less than a full year
|
||||
tmp = new Date(d_max.getFullYear()-1, d_min.getMonth(), d_min.getDate())
|
||||
} else {
|
||||
// same month, day as d_min - use year of d_max since diff is more than a full year
|
||||
tmp = new Date(d_max.getFullYear(), d_min.getMonth(), d_min.getDate())
|
||||
}
|
||||
|
||||
var d_diff = getDayDiff(d_max, tmp) // get day difference
|
||||
return {Y: y_diff, D: d_diff} // object
|
||||
}
|
||||
|
||||
function getMWDdiff(d1, d2) { // month, week, day difference
|
||||
var d_min = new Date( Math.min(d1, d2) ) // earlier date
|
||||
var d_max = new Date( Math.max(d1, d2) ) // later date
|
||||
var y_diff = d_max.getFullYear() - d_min.getFullYear() // year difference
|
||||
|
||||
m_diff = y_diff * 12 // month difference (full years)
|
||||
m_diff += d_max.getMonth() - d_min.getMonth() // partial year
|
||||
|
||||
var dPrevMonth = daysInMonth(d_max.getMonth()-1, d_max.getFullYear()) // prev month from d_max
|
||||
|
||||
var WD_diff; var tmp;
|
||||
var prev_date = d_min.getDate(); // last day of previous month
|
||||
|
||||
if ( d_min.getDate() > d_max.getDate() ) { // less than a month
|
||||
m_diff-- // last month is not full
|
||||
// if current day of month is greater than number of days in previous month, use max available day for prev month
|
||||
if ( d_min.getDate() > dPrevMonth ) prev_date = dPrevMonth
|
||||
tmp = new Date(d_max.getFullYear(), d_max.getMonth()-1, prev_date) // switch to previous month (d_max)
|
||||
} else { // more than a month
|
||||
tmp = new Date(d_max.getFullYear(), d_max.getMonth(), d_min.getDate()) // switch to d_min date for d_max
|
||||
}
|
||||
WD_diff = getWDdiff(d_max, tmp) // get remaining week, day difference
|
||||
|
||||
return {M: m_diff, W: WD_diff.W, D: WD_diff.D} // object
|
||||
}
|
||||
|
||||
function getMDdiff(d1, d2) { // month, day difference
|
||||
// console.clear()
|
||||
var d_min = new Date( Math.min(d1, d2) ) // earlier date
|
||||
var d_max = new Date( Math.max(d1, d2) ) // later date
|
||||
var y_diff = d_max.getFullYear() - d_min.getFullYear() // year difference
|
||||
|
||||
m_diff = y_diff * 12 // month difference (full years)
|
||||
m_diff += d_max.getMonth() - d_min.getMonth() // partial year
|
||||
|
||||
// console.log('d_max.getMonth()-1:'+(d_max.getMonth()-1)+' d_max.getFullYear():'+d_max.getFullYear())
|
||||
var dPrevMonth = daysInMonth(d_max.getMonth()-1, d_max.getFullYear()) // prev month from d_max
|
||||
|
||||
var d_diff; var tmp;
|
||||
var prev_date = d_min.getDate(); // last day of previous month
|
||||
|
||||
if ( d_min.getDate() > d_max.getDate() ) { // less than a month
|
||||
m_diff-- // last month is not full
|
||||
// if current day of month is greater than number of days in previous month, use max available day for prev month
|
||||
if ( d_min.getDate() > dPrevMonth ) prev_date = dPrevMonth
|
||||
tmp = new Date(d_max.getFullYear(), d_max.getMonth()-1, prev_date) // switch to previous month (d_max)
|
||||
// console.log('dPrevMonth:'+dPrevMonth)
|
||||
// console.log('tmp:'+tmp.toDateString()+' d_max:'+d_max.toDateString())
|
||||
} else { // more than a month
|
||||
tmp = new Date(d_max.getFullYear(), d_max.getMonth(), d_min.getDate()) // switch to d_min date for d_max
|
||||
}
|
||||
d_diff = getDayDiff(d_max, tmp) // get remaining day difference
|
||||
|
||||
return {M: m_diff, D: d_diff} // object
|
||||
}
|
||||
|
||||
function getWDdiff(d1, d2) { // week, day difference
|
||||
d_diff = Math.round( Math.abs(d2-d1) / 86400000 )
|
||||
w_diff = Math.floor(d_diff / 7)
|
||||
d_diff -= w_diff*7
|
||||
return {W: w_diff, D: d_diff} // object
|
||||
}
|
||||
|
||||
function getDayDiff(d1, d2) { // days
|
||||
return Math.round( Math.abs(d2-d1) / 86400000 )
|
||||
}
|
||||
|
||||
function compareDateArray(dArrRaw) { // array as input, e.g. ["09/30/2020", "09/15/2021"]
|
||||
var i, n, d_min, d_max, d_min_comment, d_max_comment
|
||||
var dArr = []; var tmp = ""; var tmp2 = []; var tmpComment = ""
|
||||
for (i = 0; i < dArrRaw.length; i++) { // parse dates
|
||||
tmpComment = "" // reset
|
||||
commentMatch = dArrRaw[i].match(/\[.+\]/g) // find comment
|
||||
if (commentMatch !== null) { tmpComment = commentMatch[0].slice(1,-1) } // remove brackets
|
||||
tmp = dArrRaw[i].replace(/\[.+\]/g, '').trim() // remove comment
|
||||
tmp2 = tmp.split('/') // split m/d/y "09/30/2020" into array
|
||||
dArr.push( [new Date(tmp2[2], tmp2[0]-1, tmp2[1]), tmpComment] ); // y,m,d - month is minus one, [0] - date, [1] - comment
|
||||
}
|
||||
var datePairs = []
|
||||
for (i = 0; i < dArr.length; i++) { // construct date pairs
|
||||
for (n = i+1; n < dArr.length; n++) { // start with the next index
|
||||
d_min = new Date( Math.min(dArr[i][0], dArr[n][0]) ) // earlier date
|
||||
d_max = new Date( Math.max(dArr[i][0], dArr[n][0]) ) // later date
|
||||
if (dArr[i][0] < dArr[n][0]) { // assign comments to each date
|
||||
d_min_comment = dArr[i][1]
|
||||
d_max_comment = dArr[n][1]
|
||||
} else {
|
||||
d_min_comment = dArr[n][1]
|
||||
d_max_comment = dArr[i][1]
|
||||
}
|
||||
if (d_min_comment == "") d_min_comment = "Start Date"
|
||||
if (d_max_comment == "") d_max_comment = "End Date"
|
||||
datePairs.push( [d_min, d_min_comment, d_max, d_max_comment] )
|
||||
}
|
||||
}
|
||||
|
||||
var o = ""
|
||||
var YMWD_arr, YMD_arr, YWD_arr, YD_arr, MWD_arr, MD_arr, WD_arr
|
||||
for (i = 0; i < datePairs.length; i++) { // for each date pair
|
||||
d_min = datePairs[i][0]
|
||||
d_max = datePairs[i][2]
|
||||
YMWD_arr = getYMWDdiff(d_min, d_max) // functions sort dates as well
|
||||
YMD_arr = getYMDdiff(d_min, d_max)
|
||||
YWD_arr = getYWDdiff(d_min, d_max)
|
||||
YD_arr = getYDdiff(d_min, d_max)
|
||||
MWD_arr = getMWDdiff(d_min, d_max)
|
||||
MD_arr = getMDdiff(d_min, d_max)
|
||||
WD_arr = getWDdiff(d_min, d_max)
|
||||
|
||||
// combine digits for date duration
|
||||
YMWD_all = concat_YMWD(YMWD_arr)
|
||||
YMD_all = concat_YMWD(YMD_arr)
|
||||
YWD_all = concat_YMWD(YWD_arr)
|
||||
YD_all = concat_YMWD(YD_arr)
|
||||
MWD_all = concat_YMWD(MWD_arr)
|
||||
MD_all = concat_YMWD(MD_arr)
|
||||
WD_all = concat_YMWD(WD_arr)
|
||||
|
||||
// -1 day (negative)
|
||||
d_max_n1 = new Date(d_max.getFullYear(), d_max.getMonth(), d_max.getDate()-1)
|
||||
YMWD_all_n1 = concat_YMWD(getYMWDdiff(d_min, d_max_n1))
|
||||
YMD_all_n1 = concat_YMWD(getYMDdiff(d_min, d_max_n1))
|
||||
YWD_all_n1 = concat_YMWD(getYWDdiff(d_min, d_max_n1))
|
||||
YD_all_n1 = concat_YMWD(getYDdiff(d_min, d_max_n1))
|
||||
MWD_all_n1 = concat_YMWD(getMWDdiff(d_min, d_max_n1))
|
||||
MD_all_n1 = concat_YMWD(getMDdiff(d_min, d_max_n1))
|
||||
WD_all_n1 = concat_YMWD(getWDdiff(d_min, d_max_n1))
|
||||
|
||||
// +1 day (positive)
|
||||
d_max_p1 = new Date(d_max.getFullYear(), d_max.getMonth(), d_max.getDate()+1)
|
||||
YMWD_all_p1 = concat_YMWD(getYMWDdiff(d_min, d_max_p1))
|
||||
YMD_all_p1 = concat_YMWD(getYMDdiff(d_min, d_max_p1))
|
||||
YWD_all_p1 = concat_YMWD(getYWDdiff(d_min, d_max_p1))
|
||||
YD_all_p1 = concat_YMWD(getYDdiff(d_min, d_max_p1))
|
||||
MWD_all_p1 = concat_YMWD(getMWDdiff(d_min, d_max_p1))
|
||||
MD_all_p1 = concat_YMWD(getMDdiff(d_min, d_max_p1))
|
||||
WD_all_p1 = concat_YMWD(getWDdiff(d_min, d_max_p1))
|
||||
|
||||
o += '=========================================================================\n'
|
||||
o += d_min.getMonth()+1 + '/' + d_min.getDate() + '/' + d_min.getFullYear() + ' | '
|
||||
o += monthNames(d_min.getMonth()) + ' ' + d_min.getDate() + ', ' + d_min.getFullYear() + ' (' + dayOfYear(d_min) + '/' + daysLeftInYear(d_min) + ') - ' + datePairs[i][1] + '\n' // date - comment
|
||||
o += d_max.getMonth()+1 + '/' + d_max.getDate() + '/' + d_max.getFullYear() + ' | '
|
||||
o += monthNames(d_max.getMonth()) + ' ' + d_max.getDate() + ', ' + d_max.getFullYear() + ' (' + dayOfYear(d_max) + '/' + daysLeftInYear(d_max) + ') - ' + datePairs[i][3] + '\n' // date - comment
|
||||
o += '-------------------------------------------------------------------------\n'
|
||||
if (YMWD_arr.Y !== 0) { // exclude durations if less than a year
|
||||
o += padStr((dFmt2(YMWD_arr.Y,0) + dFmt2(YMWD_arr.M,1) + dFmt2(MWD_arr.W,2) + dFmt2(YMWD_arr.D,3)).trim()) + '| '
|
||||
o += YMWD_all + '; '+ YMWD_all_n1 + ';(-1) ' + YMWD_all_p1 + ';(+1)\n'
|
||||
o += padStr((dFmt2(YMD_arr.Y,0) + dFmt2(YMD_arr.M,1) + dFmt2(YMD_arr.D,3)).trim()) + '| '
|
||||
o += YMD_all + '; '+ YMD_all_n1 + ';(-1) ' + YMD_all_p1 + ';(+1)\n'
|
||||
o += padStr((dFmt2(YWD_arr.Y,0) + dFmt2(YWD_arr.W,2) + dFmt2(YWD_arr.D,3)).trim()) + '| '
|
||||
o += YWD_all + '; '+ YWD_all_n1 + ';(-1) ' + YWD_all_p1 + ';(+1)\n'
|
||||
o += padStr((dFmt2(YD_arr.Y,0) + dFmt2(YD_arr.D,3)).trim()) + '| '
|
||||
o += YD_all + '; '+ YD_all_n1 + ';(-1) ' + YD_all_p1 + ';(+1)\n'
|
||||
}
|
||||
|
||||
o += padStr((dFmt2(MWD_arr.M,1) + dFmt2(MWD_arr.W,2) + dFmt2(MWD_arr.D,3)).trim()) + '| '
|
||||
o += MWD_all + '; '+ MWD_all_n1 + ';(-1) ' + MWD_all_p1 + ';(+1)\n'
|
||||
o += padStr((dFmt2(MD_arr.M,1) + dFmt2(MD_arr.D,3)).trim()) + '| '
|
||||
o += MD_all + '; '+ MD_all_n1 + ';(-1) ' + MD_all_p1 + ';(+1)\n'
|
||||
o += padStr((dFmt2(WD_arr.W,2) + dFmt2(WD_arr.D,3)).trim()) + '| '
|
||||
o += WD_all + '; '+ WD_all_n1 + ';(-1) ' + WD_all_p1 + ';(+1)\n'
|
||||
o += padStr((dFmt2(getDayDiff(d_max, d_min),3)).trim()) + '| '
|
||||
o += getDayDiff(d_max, d_min) + '; ' + parseInt(getDayDiff(d_max, d_min)-1) + ';(-1) ' + parseInt(getDayDiff(d_max, d_min)+1) + ';(+1)\n\n\n'
|
||||
}
|
||||
o = o.slice(0,-3) // remove last line breaks
|
||||
return o
|
||||
}
|
||||
|
||||
function concat_YMWD(obj) { // object .Y/M/W/D
|
||||
var str = ""
|
||||
if (obj.Y !== undefined) str += obj.Y
|
||||
if (obj.M !== undefined) str += obj.M
|
||||
if (obj.W !== undefined) str += obj.W
|
||||
if (obj.D !== undefined) str += obj.D
|
||||
str = str.replace(/(^0|0$)/g, "") // removes zeroes from both sides
|
||||
return str
|
||||
}
|
||||
|
||||
function padStr(str, chars = 40) { // add spaces to string to match length
|
||||
var i = 0
|
||||
n_sp = chars - str.length
|
||||
while (i < n_sp) { str += " "; i++ }
|
||||
return str
|
||||
}
|
||||
@@ -0,0 +1,251 @@
|
||||
// ========================== Edit Ciphers ==========================
|
||||
|
||||
function toggleEditCiphersMenu() {
|
||||
|
||||
if (!editCiphersMenuOpened) {
|
||||
|
||||
closeAllOpenedMenus()
|
||||
|
||||
editCiphersMenuOpened = true
|
||||
|
||||
var o = '<div class="editCiphersContainer">'
|
||||
o += '<input class="closeMenuBtn" type="button" value="×" onclick="closeAllOpenedMenus()">'
|
||||
|
||||
o += '<table class="custCipherMainTable"><tbody>'
|
||||
o += '<tr><td style="text-align: center; padding: 0em 1em 1em 0em;"><input id="custCipherNameInput" type="text" autocomplete="off" oninput="checkCustCipherName()" placeholder="Cipher Name"></td>'
|
||||
o += '<td style="text-align: center; padding: 0em 0em 1em 0em;"><input id="custCipherCatInput" type="text" autocomplete="off" placeholder="Category"></td></tr>'
|
||||
o += '<tr><td colspan=2><input id="custCipherAlphabet" type="text" autocomplete="off" oninput="createIndLetterControls()" placeholder="Characters (abc)"></td></tr>'
|
||||
o += '<tr><td colspan=2><textarea id="custCipherGlobVals" type="text" autocomplete="off" oninput="createIndLetterControls()" placeholder="Values (1,2,3)"></textarea></td></tr>'
|
||||
o += '</tbody></table>'
|
||||
|
||||
o += '<div>' // container for checkboxes
|
||||
var IDMstate = ""
|
||||
if (ignoreDiarciticsCustom) IDMstate = "checked" // checkbox state
|
||||
o += '<div id="diacrChkbox"><label class="chkLabel optionElementLabel">Ignore Diacritical Marks (é=e)<input type="checkbox" id="chkbox_IDM" onclick="conf_IDM()" '+IDMstate+'><span class="custChkBox"></span></label></div>'
|
||||
var CSstate = ""
|
||||
if (caseSensitiveCustom) CSstate = "checked" // checkbox state
|
||||
o += '<div id="caseSensChkbox"><label class="chkLabel optionElementLabel">Case Sensitive Cipher<input type="checkbox" id="chkbox_CS" onclick="conf_CS()" '+CSstate+'><span class="custChkBox"></span></label></div>'
|
||||
o += '</div>' // close
|
||||
|
||||
o += '<div id="custCipherIndCtrls"></div>' // individual characters controls
|
||||
o += '<div id="custCipherButtonArea"><input class="ciphEditBtn" type="button" value="Add New Cipher" onclick="addNewCipherAction()"></div>' // buttons
|
||||
o += '</div>'
|
||||
|
||||
document.getElementById("editCiphersMenuArea").innerHTML += o // add element to page
|
||||
} else {
|
||||
document.getElementById("editCiphersMenuArea").innerHTML = "" // clear
|
||||
editCiphersMenuOpened = false
|
||||
}
|
||||
}
|
||||
|
||||
function conf_IDM() { // ignore diacritical marks
|
||||
ignoreDiarciticsCustom = !ignoreDiarciticsCustom // toggle
|
||||
createIndLetterControls() // update
|
||||
}
|
||||
|
||||
function conf_CS() { // case sensitive cipher
|
||||
caseSensitiveCustom = !caseSensitiveCustom // toggle
|
||||
createIndLetterControls() // update
|
||||
}
|
||||
|
||||
function checkCustCipherName() { // redraw add/update cipher button
|
||||
var custName = document.getElementById("custCipherNameInput").value.trim() // remove spaces from both ends
|
||||
var updFlag = false
|
||||
for (i = 0; i < cipherList.length; i++) {
|
||||
if (cipherList[i].cipherName == custName) { updFlag = true; break; }
|
||||
}
|
||||
|
||||
var o = ""
|
||||
if (updFlag) { // cipher exists
|
||||
o += '<input class="ciphEditBtn" type="button" value="Update Existing Cipher" onclick="addNewCipherAction()">'
|
||||
o += '<input class="ciphEditBtn" type="button" value="New Random Color" onclick="addNewCipherAction(true)">'
|
||||
o += '<input class="ciphEditBtn" type="button" value="Delete Cipher" onclick="deleteCipherAction()">'
|
||||
document.getElementById("custCipherButtonArea").innerHTML = o
|
||||
} else {
|
||||
o += '<input class="ciphEditBtn" type="button" value="Add New Cipher" onclick="addNewCipherAction()">'
|
||||
document.getElementById("custCipherButtonArea").innerHTML = o
|
||||
}
|
||||
}
|
||||
|
||||
function createIndLetterControls() {
|
||||
var alphabet = document.getElementById("custCipherAlphabet").value
|
||||
alphabet = alphabet.replace(/\t/g,"").replace(/ /g,"") // to lowercase, remove tabs and spaces
|
||||
if (!caseSensitiveCustom) alphabet = alphabet.toLowerCase()
|
||||
if (ignoreDiarciticsCustom) alphabet = alphabet.normalize('NFD').replace(/[\u0300-\u036f]/g, "") // remove diacritics
|
||||
document.getElementById("custCipherAlphabet").value = alphabet
|
||||
|
||||
var customChars = alphabet.split("") // string to array
|
||||
// console.log(JSON.stringify(customChars))
|
||||
|
||||
var alphabetValues = document.getElementById("custCipherGlobVals").value
|
||||
alphabetValues = alphabetValues.replace(/\t/g,",").replace(/ /g,",") // replace tabs and spaces with comma
|
||||
document.getElementById("custCipherGlobVals").value = alphabetValues
|
||||
|
||||
var customVals = alphabetValues.split(",") // string to array
|
||||
if (customVals[0] == "" && customVals.length == 1) {
|
||||
customVals = [] // empty array
|
||||
} else {
|
||||
customVals = customVals.map(function (e) { return parseInt(e, 10); }) // parse string array as integer array to exclude quotes
|
||||
}
|
||||
|
||||
var cur_ciph_index = 0 // index of current of enabled cipher that will be added to the table (total # of ciphers added so far + 1)
|
||||
var new_row_opened = false // condition to open new row inside table
|
||||
var charsInCurRow = 0 // count ciphers in current row
|
||||
|
||||
var charsInRow = 10
|
||||
|
||||
var o = '<table class="custCipherTable"><tbody>'
|
||||
|
||||
// flip logic, if charsInRow is reached, switch to next row but use values from beginning, then flip back to chars
|
||||
var tmpValues = []
|
||||
var curCharVal = 0
|
||||
for (i = 0; i < customChars.length; i++) {
|
||||
|
||||
if (typeof customVals[i] !== 'undefined' && customVals[i] !== "") { // read from array if available
|
||||
curCharVal = customVals[i];
|
||||
} else {
|
||||
curCharVal = i+1 // use default values - 1,2,3...
|
||||
if (customVals.length > 0) { customVals.push(curCharVal); } else { customVals = [curCharVal]; } // add value
|
||||
tmpValues = JSON.stringify(customVals).slice(1,-1)
|
||||
document.getElementById("custCipherGlobVals").value = tmpValues // update box with new value
|
||||
}
|
||||
|
||||
cur_ciph_index++
|
||||
if (!new_row_opened) { // check if new row has to be opened
|
||||
o += '<tr>'
|
||||
new_row_opened = true
|
||||
}
|
||||
var chk = ""
|
||||
if (charsInCurRow < charsInRow) { // until number of ciphers in row equals number of columns
|
||||
o += '<td><table class="custCharIndTable"><tbody>'
|
||||
o += '<tr><td class="custCharIndLabel"><input id="custChar'+i+'" type="text" autocomplete="off" oninput="changeIndLetter('+i+')" class="custCharInd" value="'+customChars[i]+'"></input></td></tr>'
|
||||
o += '<tr><td><input id="chVal'+i+'" type="text" autocomplete="off" oninput="changeIndLetterValue('+i+')" class="custCharIndValue" value="'+curCharVal+'"></input></div></center></td></tr>'
|
||||
o += '</tbody></table></td>'
|
||||
charsInCurRow++
|
||||
}
|
||||
if (charsInCurRow == charsInRow) { // check if row needs to be closed
|
||||
o += '</tr>'
|
||||
charsInCurRow = 0 // reset character count
|
||||
new_row_opened = false
|
||||
}
|
||||
}
|
||||
o += '</tbody></table>'
|
||||
|
||||
document.getElementById("custCipherIndCtrls").innerHTML = o
|
||||
}
|
||||
|
||||
function changeIndLetterValue(id) { // update char value from individual input box
|
||||
var alphabetValues = document.getElementById("custCipherGlobVals").value
|
||||
var valArr = alphabetValues.split(",") // string to array
|
||||
valArr = valArr.map(function (e) { return parseInt(e, 10); }) // parse string array as integer array to exclude quotes
|
||||
|
||||
var curIdVal = document.getElementById("chVal"+id+"").value // get value for current char
|
||||
valArr[id] = parseInt(curIdVal) // update value for current char
|
||||
|
||||
tmpVal = JSON.stringify(valArr).slice(1,-1) // convert to string
|
||||
document.getElementById("custCipherGlobVals").value = tmpVal // update box with new values
|
||||
}
|
||||
|
||||
function changeIndLetter(id) { // update char from individual box
|
||||
var curIdChar = document.getElementById("custChar"+id+"").value.substring(0,1) // get current char, to lowercase, one char only
|
||||
if (!caseSensitiveCustom) curIdChar = curIdChar.toLowerCase()
|
||||
if (ignoreDiarciticsCustom) curIdChar = curIdChar.normalize('NFD').replace(/[\u0300-\u036f]/g, "") // remove diacritics
|
||||
|
||||
if (curIdChar !== "") { // if not empty
|
||||
document.getElementById("custChar"+id+"").value = curIdChar // replace box with first lowercase character
|
||||
|
||||
var alphabet = document.getElementById("custCipherAlphabet").value
|
||||
var customChars = alphabet.split("") // string to array
|
||||
|
||||
customChars[id] = curIdChar // update current char
|
||||
tmpChar = JSON.stringify(customChars).slice(1,-1).replace(/\"/g, "").replace(/,/g, "") // convert to string, remove brackets, remove quotes, commas
|
||||
document.getElementById("custCipherAlphabet").value = tmpChar // update box with new characters
|
||||
}
|
||||
}
|
||||
|
||||
function addNewCipherAction(updCiphCol = false) { // update existing cipher if ID is specified
|
||||
var custName = document.getElementById("custCipherNameInput").value.trim()
|
||||
// console.log(custName)
|
||||
var custCat = document.getElementById("custCipherCatInput").value
|
||||
// console.log(custCat)
|
||||
|
||||
var alphabet = document.getElementById("custCipherAlphabet").value
|
||||
var charsArr = []; var tmp = 0 // array with charcodes
|
||||
alphabet = alphabet.split("")
|
||||
|
||||
for (i = 0; i < alphabet.length; i++) {
|
||||
tmp = alphabet[i].replace(/\"/g, "").charCodeAt(0) // remove quotes, get charcode
|
||||
charsArr.push(tmp)
|
||||
}
|
||||
// console.log(charsArr)
|
||||
|
||||
var alphabetValues = document.getElementById("custCipherGlobVals").value
|
||||
var valArr = alphabetValues.split(",") // string to array
|
||||
valArr = valArr.map(function (e) { return parseInt(e, 10); }) // parse string array as integer array to exclude quotes
|
||||
valArr = valArr.splice(0, charsArr.length) // use assigned values only (remove all extra)
|
||||
// console.log(valArr)
|
||||
|
||||
// check if cipher has to be replaced/updated
|
||||
var replaceID = -1
|
||||
for (i = 0; i < cipherList.length; i++) {
|
||||
if (cipherList[i].cipherName == custName) { replaceID = i; break; } // if name matches existing cipher
|
||||
}
|
||||
|
||||
resetColorControls() // reset color changes (otherwise they become permanent)
|
||||
var custCipher
|
||||
if (replaceID > -1) { // cipher needs to be updated (retain colors)
|
||||
if (!updCiphCol) { custCipher = new cipher(custName, custCat, cipherList[replaceID].H, cipherList[replaceID].S, cipherList[replaceID].L, charsArr, valArr, ignoreDiarciticsCustom, true, caseSensitiveCustom) }
|
||||
else { custCipher = new cipher(custName, custCat, getRndIndex(rndCol.H), getRndIndex(rndCol.S), getRndIndex(rndCol.L), charsArr, valArr, ignoreDiarciticsCustom, true, caseSensitiveCustom) }
|
||||
if (cipherList[replaceID].cipherCategory == custCat) { // same category
|
||||
cipherList[replaceID] = custCipher // replace existing cipher
|
||||
} else if (cCat.indexOf(custCat) > -1) { // other existing category
|
||||
cipherList.splice(replaceID, 1) // remove original cipher first
|
||||
for (i = cipherList.length-1; i > -1; i--) { // go in reverse order
|
||||
// insert after last cipher in that category
|
||||
if (cipherList[i].cipherCategory == custCat) { cipherList.splice(i+1, 0, custCipher); break; }
|
||||
}
|
||||
} else if (cCat.indexOf(custCat) == -1) { // new category
|
||||
cipherList.splice(replaceID, 1) // remove original cipher first
|
||||
cipherList.push(custCipher) // add new cipher in the end of array
|
||||
}
|
||||
} else { // use random colors
|
||||
// custCipher = new cipher(custName, custCat, rndInt(0, 360), rndInt(0, 68), rndInt(53, 67), charsArr, valArr, ignoreDiarciticsCustom, true, caseSensitiveCustom)
|
||||
custCipher = new cipher(custName, custCat, getRndIndex(rndCol.H), getRndIndex(rndCol.S), getRndIndex(rndCol.L), charsArr, valArr, ignoreDiarciticsCustom, true, caseSensitiveCustom)
|
||||
if (cCat.indexOf(custCat) > -1) { // existing category
|
||||
for (i = cipherList.length-1; i > -1; i--) { // go in reverse order
|
||||
// insert after last cipher in that category
|
||||
if (cipherList[i].cipherCategory == custCat) { cipherList.splice(i+1, 0, custCipher); break; }
|
||||
}
|
||||
} else { // new category
|
||||
cipherList.push(custCipher) // add new cipher in the end of array
|
||||
}
|
||||
}
|
||||
|
||||
initCalcCustCiph() // update
|
||||
}
|
||||
|
||||
function deleteCipherAction() {
|
||||
var curCiphName = document.getElementById("custCipherNameInput").value.trim() // remove spaces
|
||||
resetColorControls() // reset color changes (otherwise they become permanent)
|
||||
for (i = 0; i < cipherList.length; i++) { // get cipher ID
|
||||
if (cipherList[i].cipherName == curCiphName) { cipherList.splice(i,1); break; } // remove cipher
|
||||
}
|
||||
initCalcCustCiph() // update
|
||||
}
|
||||
|
||||
function initCalcCustCiph(editorOpened = true) {
|
||||
document.getElementById("calcOptionsPanel").innerHTML = "" // clear menu panel
|
||||
// reinit, create menus
|
||||
initCiphers(false) // don't alter default ciphers
|
||||
createCalcMenus()
|
||||
// update tables
|
||||
updateTables()
|
||||
if (editorOpened) checkCustCipherName() // redraw add/update custom cipher button
|
||||
if (userDBlive.length !== 0) { // restore controls if live database is loaded
|
||||
$("#queryDBbtn").removeClass("hideValue") // display query button
|
||||
$("#clearDBqueryBtn").removeClass("hideValue") // clear button
|
||||
$("#unloadDBBtn").removeClass("hideValue") // unload database button
|
||||
$("#btn-export-db-query").removeClass("hideValue") // export button
|
||||
$("#liveDBOption").addClass("hideValue") // hide "Live Database Mode"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,287 @@
|
||||
// ======================== Encoding Ciphers ========================
|
||||
/*
|
||||
Types of ciphers:
|
||||
|
||||
- Ordinal +N offset, e.g. 36,37,38... (+35)
|
||||
- +N offset +M increment, e.g. 10,12,14... (+9 +2)
|
||||
- Kaye rotation, all +N offset, starts at different letter, increments may vary
|
||||
|
||||
(look weird)
|
||||
- 1st part of alphabet flipped
|
||||
- 2nd part of alphabet flipped
|
||||
- Both parts of alphabet flipped
|
||||
|
||||
(lots of matches)
|
||||
- Septenary 7-1-7 7-1-7 (not implemented)
|
||||
- Inverse Septenary 1-7-1 1-7-1 (not implemented)
|
||||
- "Sumerian" ciphers, e.g. Ordinal x6
|
||||
(included in +M-1 offset / +M increment, e.g. 6[1+5], 12, ...)
|
||||
|
||||
Reverse, "Sumerian" (R), Reduction (R) and Extended (R) can be derived for most ciphers
|
||||
*/
|
||||
|
||||
var enccDefAlph = ['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 enccFlipAlphArr = [] // store flipped versions of alphabet
|
||||
var enccAllCiph = [] // list of all combinations of ciphers
|
||||
var enccAllCiphGem = [] // gematria for current phrase in all ciphers
|
||||
var enccMCiphArr = [] // array of matching ciphers (phrase equal to a specific value)
|
||||
var enccAllowAlphRotation = false // allow alphabet rotation
|
||||
|
||||
function enc_SwitchAlphabet() {
|
||||
if (enccDefAlph.length == 26) {
|
||||
enccDefAlph = ['a','b','c','d','e','f','g','h','i','k','l','m','n','o','p','q','r','s','t','u','w','x','y','z']
|
||||
} else {
|
||||
enccDefAlph = ['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']
|
||||
}
|
||||
enc_BuildAllCiphers()
|
||||
}
|
||||
|
||||
function enc_ToggleAlphRotation() {
|
||||
enccAllowAlphRotation = !enccAllowAlphRotation
|
||||
enc_BuildAllCiphers()
|
||||
}
|
||||
|
||||
// flipped alphabet, offset (all +N), increment (next is previous +N), rotation (starting letter), reverse
|
||||
function enc_BuildCipher(alpH = 0, ofF = 0, inC = 1, roT = 0, reV = 0) {
|
||||
var chArray = []; var chValues = [];
|
||||
var curAlph = enccFlipAlphArr[alpH] // choose flipped alphabet variation
|
||||
for (var i = 0; i < curAlph.length; i++) {
|
||||
chArray.push(curAlph[roT]); roT = (roT + 1) % curAlph.length; // rotate alphabet
|
||||
chValues.push( 1+i+ofF + (i*(inC-1)) ) // calculate current char value
|
||||
}
|
||||
if (reV == 1) chValues.reverse() // reverse values
|
||||
return [chArray, chValues] // return alphabet and values
|
||||
}
|
||||
|
||||
function enc_BuildAllCiphers(firstRun = false) {
|
||||
enc_BuildFlippedAlphabets()
|
||||
var alpH, ofF, inC, roT, reV; var roTstate = ''
|
||||
// 4 x 100 x 25 x 26 x 1 = 260,000 (English 26, rotations, mirrored and swapped alphabet rows - 4 variations, no need to reverse, don't swap rows if rotation)
|
||||
if (enccAllowAlphRotation) { alpH = 3; ofF = 99; inC = 25; roT = enccDefAlph.length-1; reV = 0; roTstate = 'rotation'}
|
||||
// 8 x 100 x 25 x 1 x 1 = 20,000 (no rotations, mirrored and swapped alphabet rows - 8 variations, no need to reverse)
|
||||
else { alpH = 7; ofF = 99; inC = 25; roT = 0; reV = 0; roTstate = 'no rotation'}
|
||||
var a,o,i,r,R; enccAllCiph = [];
|
||||
if (!firstRun) console.log('Building ciphers for encoder, please wait...')
|
||||
for (a = 0; a <= alpH; a++) { // flipped alphabet variations (8 total)
|
||||
for (o = 0; o <= ofF; o++) { // all character value offset
|
||||
for (i = 1; i <= inC; i++) { // next character value increment
|
||||
for (r = 0; r <= roT; r++) { // alphabet rotation
|
||||
for (R = 0; R <= reV; R++) { // reversed values
|
||||
enccAllCiph.push(enc_BuildCipher(a,o,i,r,R))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!firstRun) console.log('Done! ('+enccAllCiph.length+' ciphers, '+enccDefAlph.length+' letter alphabet, '+roTstate+')')
|
||||
}
|
||||
|
||||
function enc_BuildFlippedAlphabets() { // flip rows in alphabet - 4 variations, swap rows - 4 variations, 8 total
|
||||
enccFlipAlphArr = []; var tmpAlph = []; var n, p;
|
||||
var hInd = Math.floor(enccDefAlph.length / 2) - 1 // index of the last char in the first half of alphabet
|
||||
var aLen = enccDefAlph.length // alphabet length
|
||||
// 0 = normal - normal
|
||||
enccFlipAlphArr.push(enccDefAlph); tmpAlph = [];
|
||||
// 1 = flipped - normal
|
||||
for (n = 0; n < enccDefAlph.length; n++) {
|
||||
if (n <= hInd) { tmpAlph.push(enccDefAlph[hInd-n]) }
|
||||
else { tmpAlph.push(enccDefAlph[n]) }
|
||||
}
|
||||
enccFlipAlphArr.push(tmpAlph); tmpAlph = [];
|
||||
// 2 = normal - flipped
|
||||
for (n = 0; n < enccDefAlph.length; n++) {
|
||||
if (n <= hInd) { tmpAlph.push(enccDefAlph[n]) }
|
||||
else { tmpAlph.push(enccDefAlph[ aLen-1 - (n%(hInd+1)) ]) } // hInd+1 because index is -1
|
||||
}
|
||||
enccFlipAlphArr.push(tmpAlph); tmpAlph = [];
|
||||
// 3 = flipped - flipped
|
||||
for (n = 0; n < enccDefAlph.length; n++) {
|
||||
if (n <= hInd) { tmpAlph.push(enccDefAlph[hInd-n]) }
|
||||
else { tmpAlph.push(enccDefAlph[ aLen-1 - (n%(hInd+1)) ]) }
|
||||
}
|
||||
enccFlipAlphArr.push(tmpAlph);
|
||||
// 4,5,6,7 = swap 1st and 2nd rows
|
||||
var fLen = enccFlipAlphArr.length
|
||||
for (n = 0; n < fLen; n++) {
|
||||
tmpAlph = [];
|
||||
for (p = 0; p < enccFlipAlphArr[0].length; p++) {
|
||||
if (p <= hInd) { tmpAlph.push(enccFlipAlphArr[n][p+hInd+1]) } // hInd+1 because index is -1
|
||||
else { tmpAlph.push(enccFlipAlphArr[n][p-hInd-1]) }
|
||||
}
|
||||
enccFlipAlphArr.push(tmpAlph);
|
||||
}
|
||||
}
|
||||
|
||||
function enc_CalcGemValue(wd, cIndex = 0) { // word, cipher index
|
||||
var i; var ans = 0; var ind = 0; // initialize variables
|
||||
for (i = 0; i < wd.length; i++) { // for each character in word
|
||||
ind = enccAllCiph[cIndex][0].indexOf(wd.substring(i,i+1))
|
||||
if (ind > -1) { // if current character (of word) is present in cipher array
|
||||
ans += enccAllCiph[cIndex][1][ind] // add corrensponding value to total
|
||||
}
|
||||
}
|
||||
return ans // returns value
|
||||
}
|
||||
|
||||
function enc_CalcAllGemValues(wd) {
|
||||
var i; enccAllCiphGem = [];
|
||||
for (i = 0; i < enccAllCiph.length; i++) enccAllCiphGem.push(enc_CalcGemValue(wd,i))
|
||||
}
|
||||
|
||||
function enc_CalcAllGemValuesArray(wdArr) {
|
||||
var i, n; var tArr = []; enccAllCiphGem = [];
|
||||
for (i = 0; i < enccAllCiph.length; i++) {
|
||||
for (n = 0; n < wdArr.length; n++) {
|
||||
tArr.push(enc_CalcGemValue(wdArr[n],i))
|
||||
}
|
||||
enccAllCiphGem.push(tArr); tArr = []
|
||||
}
|
||||
}
|
||||
|
||||
function enc_FindGemValue(num) {
|
||||
var i; enccMCiphArr = [];
|
||||
for (i = 0; i < enccAllCiphGem.length; i++) {
|
||||
if (enccAllCiphGem[i] == num) enccMCiphArr.push([i,enccAllCiph[i]])
|
||||
}
|
||||
}
|
||||
|
||||
function enc_FindMatchingCiphers(wd, num) {
|
||||
var i;
|
||||
var wdCalc = wd.toLowerCase().replace(/ /g, '') // convert word to lowercase, remove spaces
|
||||
enc_CalcAllGemValues(wdCalc)
|
||||
enc_FindGemValue(num)
|
||||
console.log('"'+wd+'" = '+num+' in '+enccMCiphArr.length+' ciphers (English '+enccDefAlph.length+'):') // insert J, V values for English 24 ciphers
|
||||
if (enccDefAlph.length == 24 && enccMCiphArr.length > 0 && enccMCiphArr[0][1][0].indexOf('j') == -1) enc_InsertJVto24Cipher()
|
||||
for (i = 0; i < enccMCiphArr.length; i++) {
|
||||
console.log(
|
||||
enccMCiphArr[i][0] + '\n' + // cipher index
|
||||
JSON.stringify(enccMCiphArr[i][1][0]).slice(1,-1).replace(/[,"\\]/g, '') + '\n' + // characters
|
||||
JSON.stringify(enccMCiphArr[i][1][1]).slice(1,-1).replace(/["\\]/g, '') +// values
|
||||
'\n')
|
||||
}
|
||||
}
|
||||
|
||||
function enc_FindCommonCiphers(wdArr, num = 0) { // wdArr - array of words, num - value for matching (optional)
|
||||
var i, n; var mVal = num; var mValArr = []; var mValUniqArr = []; enccMCiphArr = [];
|
||||
for (i = 0; i < wdArr.length; i++) { wdArr[i] = wdArr[i].toLowerCase().replace(/ /g, '') } // convert word to lowercase, remove spaces
|
||||
enc_CalcAllGemValuesArray(wdArr)
|
||||
commonCipherLoop:
|
||||
for (i = 0; i < enccAllCiphGem.length; i++) {
|
||||
if (num == 0) { mVal = enccAllCiphGem[i][0] } // find any equal numbers if zero
|
||||
for (n = 0; n < enccAllCiphGem[i].length; n++) {
|
||||
if (mVal !== enccAllCiphGem[i][n]) { continue commonCipherLoop }
|
||||
}
|
||||
enccMCiphArr.push([i,enccAllCiph[i]])
|
||||
mValArr.push(mVal) // store matching values separately (for export to work correctly)
|
||||
if (mValUniqArr.indexOf(mVal) == -1) { mValUniqArr.push(mVal) }
|
||||
}
|
||||
var wd = JSON.stringify(wdArr).slice(1,-1).replace(/"/g,'').replace(/,/g, ', ')
|
||||
console.log('"'+wd+'" have the same value in '+enccMCiphArr.length+' ciphers (English '+enccDefAlph.length+'):') // insert J, V values for English 24 ciphers
|
||||
if (enccDefAlph.length == 24 && enccMCiphArr.length > 0 && enccMCiphArr[0][1][0].indexOf('j') == -1) enc_InsertJVto24Cipher()
|
||||
for (i = 0; i < enccMCiphArr.length; i++) {
|
||||
console.log(
|
||||
'' + wd + ' = ' + mValArr[i] + '\n' + // matching value
|
||||
enccMCiphArr[i][0] + '\n' + // cipher index
|
||||
JSON.stringify(enccMCiphArr[i][1][0]).slice(1,-1).replace(/[,"\\]/g, '') + '\n' + // characters
|
||||
JSON.stringify(enccMCiphArr[i][1][1]).slice(1,-1).replace(/["\\]/g, '') +// values
|
||||
'\n')
|
||||
}
|
||||
if (mValUniqArr.length > 0 && num == 0 ) { // list all available values (unique)
|
||||
mValUniqArr.sort(function(a, b) { // sort ascending order
|
||||
return a - b; // b - a, for descending sort
|
||||
});
|
||||
console.log(JSON.stringify(mValUniqArr).slice(1,-1).replace(/,/g, ', '))
|
||||
}
|
||||
}
|
||||
|
||||
function enc_InsertJVto24Cipher() {
|
||||
var i, ind;
|
||||
for (i = 0; i < enccMCiphArr.length; i++) {
|
||||
ind = enccMCiphArr[i][1][0].indexOf('i')
|
||||
enccMCiphArr[i][1][0].splice(ind+1, 0, 'j')
|
||||
enccMCiphArr[i][1][1].splice(ind+1, 0, enccMCiphArr[i][1][1][ind])
|
||||
ind = enccMCiphArr[i][1][0].indexOf('u')
|
||||
enccMCiphArr[i][1][0].splice(ind+1, 0, 'v')
|
||||
enccMCiphArr[i][1][1].splice(ind+1, 0, enccMCiphArr[i][1][1][ind])
|
||||
}
|
||||
}
|
||||
|
||||
// ==================================================================
|
||||
|
||||
function enc_GetRedExtFromCipher(arr) {
|
||||
var outR = ''; var outE = ''; var i, rNum; var n = 1;
|
||||
for (i = 0; i < arr.length; i++) {
|
||||
if (i % 9 == 0 && i !== 0) n *= 10 // extended, x10 on each new loop
|
||||
rNum = arr[i]%9 // reduced number
|
||||
if (rNum == 0) rNum = 9
|
||||
outR += rNum + ','; outE += rNum*n + ',' // build string
|
||||
}
|
||||
console.log(outR.slice(0,-1)+'\n'+outE.slice(0,-1))
|
||||
}
|
||||
|
||||
function enc_ExportFoundCiphers() {
|
||||
var out =
|
||||
'// ciphers.js\n'+
|
||||
'\n'+
|
||||
'/*\n'+
|
||||
'new cipher(\n'+
|
||||
'\t"English Ordinal", // cipher name\n'+
|
||||
'\t"English", // category\n'+
|
||||
'\t120, 57, 36, // hue, saturation, lightness\n'+
|
||||
'\t[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], // lowercase characters\n'+
|
||||
'\t[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], // values\n'+
|
||||
'\ttrue, // characters with diacritic marks have the same value as regular ones, default is "true"\n'+
|
||||
'\ttrue // enabled state, default is "false"\n'+
|
||||
'\tfalse // case sensitive cipher, default is "false"\n'+
|
||||
')\n'+
|
||||
'*/\n\n'
|
||||
|
||||
out += "cipherList = [\n"
|
||||
for (i = 0; i < enccMCiphArr.length; i++) {
|
||||
|
||||
var cArr_ = []
|
||||
var vArr_ = []
|
||||
|
||||
// Read list of characters
|
||||
for (m = 0; m < enccMCiphArr[i][1][0].length; m++) {
|
||||
// cArr_.push(String.fromCharCode(cipherList[i].cArr[m])) // character
|
||||
cArr_.push(enccMCiphArr[i][1][0][m].charCodeAt(0)) // charcode
|
||||
vArr_.push(enccMCiphArr[i][1][1][m]) // value
|
||||
}
|
||||
|
||||
out +=
|
||||
'\tnew cipher(\n'+
|
||||
'\t\t"'+enccMCiphArr[i][0]+'",\n'+
|
||||
'\t\t"Encoding",\n'+
|
||||
'\t\t'+rndInt(0, 360)+', '+rndInt(0, 68)+', '+rndInt(53, 67)+',\n'+
|
||||
'\t\t'+JSON.stringify(cArr_)+',\n'+
|
||||
'\t\t'+JSON.stringify(vArr_)+',\n'+
|
||||
'\t\ttrue,\n'+
|
||||
'\t\ttrue,\n'+
|
||||
'\t\tfalse\n'+
|
||||
'\t),\n'
|
||||
}
|
||||
out = out.substring(0, out.length-2) + '\n]' // remove last comma and new line, close array
|
||||
// console.log(out)
|
||||
|
||||
out = 'data:text/js;charset=utf-8,'+encodeURIComponent(out) // format as text file
|
||||
// ciphers_2021-03-26_10-23-52.js
|
||||
download("ciphers_"+getTimestamp()+".js", out); // download file
|
||||
}
|
||||
|
||||
// ==================================================================
|
||||
|
||||
function enc_Help() {
|
||||
console.log(
|
||||
'----------------------------------------------------------------------------------------------------\n'+
|
||||
'enc_FindMatchingCiphers(\'phrase\', 222) - find ciphers for any phrase to match a specific value\n'+
|
||||
'enc_FindCommonCiphers(["word","phrase","text"], 222) - find common ciphers for multiple phrases to match a specific value (value is optional)\n'+
|
||||
'enc_SwitchAlphabet() - switch between 24/26 letter English ciphers\n'+
|
||||
'enc_ToggleAlphRotation() - allow alphabet rotation in ciphers\n'+
|
||||
'enc_ExportFoundCiphers() - export matching ciphers (JS format, can be loaded into Gematro)\n'+
|
||||
'enc_GetRedExtFromCipher([1,2,3]) - print Reduced and Extended variants of given cipher in console\n'+
|
||||
'enc_Help() - get a list of available commands with description\n'+
|
||||
'----------------------------------------------------------------------------------------------------')
|
||||
}
|
||||
|
||||
enc_BuildAllCiphers(true) // first run, no logs
|
||||
@@ -0,0 +1,689 @@
|
||||
// ============================ Encoding ============================
|
||||
|
||||
var encodingMode = 0 // 0 - syllables, 1 - use database (1 phrase), 2 - use database (2 phrases)
|
||||
var encOddLength = false // use odd letters for syllable mode
|
||||
var encSylMaxPhrases = 10 // max phrases to generate for syllable mode
|
||||
var encDefAlphArr = ["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 encDefVowArr = ["a","e","i","o","u","y"]
|
||||
var encDefExcLetArr = ["q","z","j","x"]
|
||||
var encPrevAlphStr = JSON.stringify(encDefAlphArr).replace(/"/g, "").slice(1,-1) // store previously defined alphabet
|
||||
var encPrevVowStr = JSON.stringify(encDefVowArr).replace(/"/g, "").slice(1,-1)
|
||||
var encPrevExcLetStr = JSON.stringify(encDefExcLetArr).replace(/"/g, "").slice(1,-1)
|
||||
|
||||
// ==================================================================
|
||||
|
||||
function toggleEncodingMenu(updateEncMenu = false, clearValues = false) {
|
||||
if (!encodingMenuOpened || updateEncMenu == true) {
|
||||
if (!updateEncMenu) closeAllOpenedMenus()
|
||||
encodingMenuOpened = true
|
||||
document.getElementById('queryDBbtn').disabled = true // disable Query button while menu is open
|
||||
if (userDBlive.length == 0) { // allow buttons for syllable mode
|
||||
document.getElementById('clearDBqueryBtn').classList.remove("hideValue")
|
||||
document.getElementById('btn-export-db-query').classList.remove("hideValue")
|
||||
}
|
||||
var cur_ciph_index = 0 // index of current of enabled cipher that will be added to the table (total # of ciphers added so far + 1)
|
||||
var new_row_opened = false // condition to open new row inside table
|
||||
var ciph_in_row = 0 // count ciphers in current row
|
||||
|
||||
var o = '<div class="colorControlsBG">'
|
||||
o += '<input class="closeMenuBtn" type="button" value="×" onclick="closeAllOpenedMenus()">'
|
||||
|
||||
o += '<table id="encCipherTable" class="ciphToggleContainer">'
|
||||
if (updateEncMenu) o = ''
|
||||
o += '<tbody>'
|
||||
|
||||
for (i = 0; i < cipherList.length; i++) {
|
||||
cur_ciph_index++
|
||||
if (!new_row_opened) { // check if new row has to be opened
|
||||
o += '<tr>'
|
||||
new_row_opened = true
|
||||
}
|
||||
var chkVal; var chk = "";
|
||||
if (ciph_in_row < encodingMenuColumns) { // until number of ciphers in row equals number of columns
|
||||
// if (cipherList[i].cArr.indexOf(97) > -1) { // all available English ciphers
|
||||
if (cipherList[i].enabled == true) { // for each enabled cipher
|
||||
chkVal = (document.getElementById('encCiphVal'+i) !== null) ? document.getElementById('encCiphVal'+i).value : 0
|
||||
chkVal = (clearValues) ? 0 : chkVal // clear values
|
||||
o += '<td><span class="ciphCheckboxLabel">'+cipherList[i].cipherName+'</span></td>'
|
||||
o += '<td><input type="text" value="'+chkVal+'" class="colSlider" id="encCiphVal'+i+'"></td>'
|
||||
o += '<td style="min-width: 16px;"></td>'
|
||||
ciph_in_row++
|
||||
}
|
||||
}
|
||||
if (ciph_in_row == encodingMenuColumns) { // check if row needs to be closed
|
||||
o += '</tr>'
|
||||
ciph_in_row = 0 // reset cipher count
|
||||
new_row_opened = false
|
||||
}
|
||||
}
|
||||
o += '</tbody>'
|
||||
if (updateEncMenu) { document.getElementById('encCipherTable').innerHTML = o; return; } // update available ciphers
|
||||
o += '</table>'
|
||||
|
||||
var prevAlphStr = (encPrevAlphStr.length > 0) ? encPrevAlphStr : JSON.stringify(encDefAlphArr).replace(/"/g, "").slice(1,-1)
|
||||
var prevVowStr = (encPrevVowStr.length > 0) ? encPrevVowStr : JSON.stringify(encDefVowArr).replace(/"/g, "").slice(1,-1)
|
||||
var prevExcStr = (encPrevExcLetStr.length > 0) ? encPrevExcLetStr : JSON.stringify(encDefExcLetArr).replace(/"/g, "").slice(1,-1)
|
||||
|
||||
var SylChkState = (encodingMode == 0) ? " checked" : "";
|
||||
var DBChkState = (encodingMode == 1) ? " checked" : "";
|
||||
var DBAltChkState = (encodingMode == 2) ? " checked" : "";
|
||||
var OddLetChkState = (encOddLength) ? " checked" : "";
|
||||
var SylParamChkState = (encodingMode > 0) ? " disabled" : "";
|
||||
|
||||
// controls
|
||||
o += '<center>'
|
||||
|
||||
o += '<div style="margin: 1em;"></div>'
|
||||
|
||||
o += '<table class="globColCtrlTable" style="padding: 0em 0em 0em 1em;">'
|
||||
o += '<tr>'
|
||||
o += '<td><label class="chkLabel colLabelSmallEnc">Use Database (1 phrase)<input type="checkbox" id="chkbox_useDB1Phr" onclick="setEncodingMode(1)"'+DBChkState+'><span class="custChkBox"></span></label></td>'
|
||||
o += '<td><label class="chkLabel colLabelSmallEnc">Use Database (2 phrases)<input type="checkbox" id="chkbox_useDB2Phr" onclick="setEncodingMode(2)"'+DBAltChkState+'><span class="custChkBox"></span></label></td>'
|
||||
o += '</tr>'
|
||||
o += '</table>'
|
||||
|
||||
o += '<div style="margin: 1em;"></div>'
|
||||
|
||||
o += '<table class="globColCtrlTable">'
|
||||
o += '<tr>'
|
||||
o += '<td><input id="resetEncButton" class="intBtn" type="button" value="Clear Values Only" style="margin: 0em 0.5em; font-size: 75%;" onclick="toggleEncodingMenu(true, true)"></td>'
|
||||
o += '<td><input id="resetEncButton" class="intBtn" type="button" value="Reset All Settings" style="margin: 0em 0.5em; font-size: 75%;" onclick="resetEncodingValues()"></td>'
|
||||
o += '</tr>'
|
||||
o += '</table>'
|
||||
|
||||
o += '<div style="margin: 1em;"></div>'
|
||||
|
||||
o += '<table class="globColCtrlTable">'
|
||||
o += '<tr>'
|
||||
o += '<td><label class="chkLabel colLabelSmallEnc">Use Syllables<input type="checkbox" id="chkbox_useSylEnc" onclick="setEncodingMode(0)"'+SylChkState+'><span class="custChkBox"></span></label></td>'
|
||||
o += '<td><label class="chkLabel colLabelSmallEnc">Odd Length<input type="checkbox" id="chkbox_encOddLength"'+OddLetChkState+SylParamChkState+' onclick="encOddLength = !encOddLength"><span class="custChkBox"></span></label></td>'
|
||||
o += '<td><input type="number" step="1" min="0" max="50" value="'+encSylMaxPhrases+'" id="encMaxPhrases" class="colSlider colLabelSmallEnc" style="margin-right: 0.5em;" oninput="encSylMaxPhrases = document.getElementById("encMaxPhrases").value"'+SylParamChkState+'><span class="colLabelSmall">Phrases</span></td>'
|
||||
o += '</tr>'
|
||||
o += '</table>'
|
||||
|
||||
o += '<table class="globColCtrlTable">'
|
||||
o += '<tr>'
|
||||
o += '<td><span class="colLabelSmall">Alphabet</span></td>'
|
||||
o += '<td><input type="text" autocomplete="off" placeholder="a,b,c,d,e,f" value="'+prevAlphStr+'" class="colSlider" id="encAlphabetBox" style="width: 300px;" oninput="encPrevAlphStr = document.getElementById("encAlphabetBox").value"'+SylParamChkState+'></td>'
|
||||
o += '</tr><tr>'
|
||||
o += '<td><span class="colLabelSmall">Vowels</span></td>'
|
||||
o += '<td><input type="text" autocomplete="off" placeholder="a,e,i,o,u,y" value="'+prevVowStr+'" class="colSlider" id="encVowelsBox" style="width: 300px;" oninput="encPrevVowStr = document.getElementById("encVowelsBox").value"'+SylParamChkState+'></td>'
|
||||
o += '</tr><tr>'
|
||||
o += '<td><span class="colLabelSmall">Exclude</span></td>'
|
||||
o += '<td><input type="text" autocomplete="off" placeholder="q,z,j,x,k,w,v,f" value="'+prevExcStr+'" class="colSlider" id="encExcludeBox" style="width: 300px;" oninput="encPrevExcLetStr = document.getElementById("encExcludeBox").value"'+SylParamChkState+'></td>'
|
||||
o += '</tr>'
|
||||
o += '</table>'
|
||||
|
||||
o += '<div style="margin: 1em;"></div>'
|
||||
|
||||
o += '<table class="globColCtrlTable">'
|
||||
o += '<tr>'
|
||||
o += '<td><input id="readValEncButton" class="intBtn" type="button" value="Read Values" style="margin: 0em 0.5em; font-size: 75%;" onclick="readEncodingValues()"></td>'
|
||||
o += '<td><input id="subtractEncButton" class="intBtn" type="button" value="Subtract Values" style="margin: 0em 0.5em; font-size: 75%;" onclick="subtractEncodingValues()"></td>'
|
||||
o += '<td><input id="startEncButton" class="intBtn" type="button" value="Find Phrases" style="margin: 0em 0.5em; font-size: 75%;" onclick="encodeGematria()"></td>'
|
||||
o += '</tr>'
|
||||
o += '</table>'
|
||||
|
||||
o += '</center>'
|
||||
|
||||
o += '</div>' // colorControlsBG
|
||||
document.getElementById("dateCalcMenuArea").innerHTML = o
|
||||
} else {
|
||||
document.getElementById("dateCalcMenuArea").innerHTML = "" // close Encoding menu
|
||||
if (userDBlive.length == 0) {
|
||||
document.getElementById('clearDBqueryBtn').classList.add("hideValue")
|
||||
document.getElementById('btn-export-db-query').classList.add("hideValue")
|
||||
}
|
||||
document.getElementById('queryDBbtn').disabled = false // enable Query button
|
||||
clearDatabaseQueryTable(); encodingMenuOpened = false
|
||||
}
|
||||
}
|
||||
|
||||
function setEncodingMode(val) {
|
||||
encodingMode = val
|
||||
if (val == 0) {
|
||||
document.getElementById('chkbox_useSylEnc').checked = true
|
||||
document.getElementById('chkbox_useDB1Phr').checked = false
|
||||
document.getElementById('chkbox_useDB2Phr').checked = false
|
||||
document.getElementById('chkbox_encOddLength').disabled = false
|
||||
document.getElementById('encMaxPhrases').disabled = false
|
||||
document.getElementById('encAlphabetBox').disabled = false
|
||||
document.getElementById('encVowelsBox').disabled = false
|
||||
document.getElementById('encExcludeBox').disabled = false
|
||||
} else if (val == 1) {
|
||||
document.getElementById('chkbox_useSylEnc').checked = false
|
||||
document.getElementById('chkbox_useDB1Phr').checked = true
|
||||
document.getElementById('chkbox_useDB2Phr').checked = false
|
||||
document.getElementById('chkbox_encOddLength').disabled = true
|
||||
document.getElementById('encMaxPhrases').disabled = true
|
||||
document.getElementById('encAlphabetBox').disabled = true
|
||||
document.getElementById('encVowelsBox').disabled = true
|
||||
document.getElementById('encExcludeBox').disabled = true
|
||||
} else if (val == 2) {
|
||||
document.getElementById('chkbox_useSylEnc').checked = false
|
||||
document.getElementById('chkbox_useDB1Phr').checked = false
|
||||
document.getElementById('chkbox_useDB2Phr').checked = true
|
||||
document.getElementById('chkbox_encOddLength').disabled = true
|
||||
document.getElementById('encMaxPhrases').disabled = true
|
||||
document.getElementById('encAlphabetBox').disabled = true
|
||||
document.getElementById('encVowelsBox').disabled = true
|
||||
document.getElementById('encExcludeBox').disabled = true
|
||||
}
|
||||
}
|
||||
|
||||
function resetEncodingValues() {
|
||||
var i, tmpBox
|
||||
setEncodingMode(0)
|
||||
encSylMaxPhrases = 10
|
||||
document.getElementById('encMaxPhrases').value = 10
|
||||
encOddLength = false
|
||||
document.getElementById('chkbox_encOddLength').checked = false
|
||||
encPrevAlphStr = ""; encPrevVowStr = ""; encPrevExcLetStr = ""
|
||||
document.getElementById('encAlphabetBox').value = JSON.stringify(encDefAlphArr).replace(/"/g, "").slice(1,-1)
|
||||
document.getElementById('encVowelsBox').value = JSON.stringify(encDefVowArr).replace(/"/g, "").slice(1,-1)
|
||||
document.getElementById('encExcludeBox').value = JSON.stringify(encDefExcLetArr).replace(/"/g, "").slice(1,-1)
|
||||
for (i = 0; i < cipherList.length; i++) { // reset values
|
||||
tmpBox = document.getElementById('encCiphVal'+i)
|
||||
if (tmpBox !== null) tmpBox.value = "0"
|
||||
}
|
||||
}
|
||||
|
||||
function subtractEncodingValues() {
|
||||
var i, elmt
|
||||
for (i = 0; i < cipherList.length; i++) {
|
||||
elmt = document.getElementById('encCiphVal'+i)
|
||||
if (elmt !== null) { // read value from encoding menu if available
|
||||
elmt.value = elmt.value - cipherList[i].calcGematria(sVal()) // gematria of text inside phrase box
|
||||
}
|
||||
}
|
||||
phraseBoxKeypress(46) // clear box
|
||||
}
|
||||
|
||||
function readEncodingValues() {
|
||||
var i, elmt
|
||||
for (i = 0; i < cipherList.length; i++) {
|
||||
elmt = document.getElementById('encCiphVal'+i)
|
||||
if (elmt !== null && cipherList[i].enabled) { // if element exists and cipher is enabled
|
||||
elmt.value = cipherList[i].calcGematria(sVal()) // get gematria of phrase box for that cipher
|
||||
}
|
||||
}
|
||||
phraseBoxKeypress(46) // clear box
|
||||
}
|
||||
|
||||
function displayEncodingResults() {
|
||||
$("#calcMain").addClass("splitInterface") // split screen
|
||||
|
||||
if (document.getElementById("queryArea") == null) { // create div if it doesn't exist
|
||||
var o = '<div id="queryArea"></div>'
|
||||
$(o).appendTo('body');
|
||||
}
|
||||
|
||||
gemArr = []; gemArrCiph = []
|
||||
for (i = 0; i < cipherList.length; i++) {
|
||||
if (cipherList[i].enabled) {
|
||||
curEncCiphVal = document.getElementById("encCiphVal"+i).value
|
||||
gemArr.push(curEncCiphVal) // load values from encoder for enabled ciphers
|
||||
gemArrCiph.push(i) // indices of enabled ciphers
|
||||
}
|
||||
}
|
||||
|
||||
var tWidth = 202 + 58*gemArrCiph.length // 2x1px outer borders + phrase cell and amount of ciphers
|
||||
$("#queryArea").css("min-width", tWidth) // set initial/minimal width for the table
|
||||
$("#queryArea").css("width", tWidth) // set initial/minimal width for the table
|
||||
updateDatabaseQueryTable(0,dbPageItems)
|
||||
}
|
||||
|
||||
// ==================================================================
|
||||
|
||||
function calcEncMatchProb(nOfMatches, dbSize, halfSize = true) { // calculate match probability
|
||||
var dbPairs = (halfSize) ? (1 + dbSize) * dbSize / 2 : dbSize * dbSize // number of paired phrases
|
||||
var prob = (nOfMatches / dbPairs).toFixed(8)
|
||||
return nOfMatches+'/'+dbPairs+' combinations; '+prob+'%'
|
||||
}
|
||||
|
||||
function getRandomInt(max) { // for 3 -> 0, 1 or 2
|
||||
return Math.floor(Math.random() * Math.floor(max));
|
||||
}
|
||||
|
||||
function encodeGematria(n_phr, encCiphValsArr, encCiphIndArr, exclude = []) {
|
||||
var i, n, encDB, solution
|
||||
queryResult = []
|
||||
queryResultInitial = []
|
||||
|
||||
if (encodingMode == 0) { // use syllables
|
||||
|
||||
if (document.getElementById("encMaxPhrases") !== null) {
|
||||
n_phr = document.getElementById("encMaxPhrases").value // element exists
|
||||
}
|
||||
|
||||
// encCiphValsArr, encCiphIndArr
|
||||
encCiphValsArr = []; encCiphIndArr = []
|
||||
for (i = 0; i < cipherList.length; i++) {
|
||||
curEncCiphVal = document.getElementById("encCiphVal"+i)
|
||||
if (curEncCiphVal !== null && curEncCiphVal.value !== '0') { // if element exists, non zero value
|
||||
encCiphIndArr.push(i) // add cipher index
|
||||
curVal = (curEncCiphVal.value == "-0") ? 0 : curEncCiphVal.value // use '-0' to match to zero
|
||||
encCiphValsArr.push(Number(curEncCiphVal.value)) // add cipher value
|
||||
}
|
||||
}
|
||||
|
||||
if (encCiphIndArr.length == 0) return // no values were specified
|
||||
|
||||
// exclude letters
|
||||
if (document.getElementById('encExcludeBox') !== null) { // exclude letters
|
||||
encPrevExcLetStr = document.getElementById('encExcludeBox').value.replace(/ /g, '').split(',')
|
||||
}
|
||||
encodingInitSyllables() // build syllables
|
||||
|
||||
// find solutions
|
||||
for (i = 0; i < n_phr; i++) {
|
||||
solution = encodingFindSylMatch(encCiphValsArr, encCiphIndArr)
|
||||
solution = (optGemSubstitutionMode) ? solution.trim()+' [<a href="/home.html'+solution.trim()+'&language=english&t=0&d=3&include=&exclude=&n=&m=&a=n&l=n&q=n&k=1&source=adv" target="_blank" rel="noopener noreferrer nofollow">anagram</a>]' : solution.trim()
|
||||
queryResult.push(solution) // add phrase, remove spaces
|
||||
}
|
||||
queryResultInitial = [...queryResult] // save matches
|
||||
displayEncodingResults()
|
||||
return
|
||||
}
|
||||
|
||||
if (encodingMode == 1) { // use live database for matching (1 phrase)
|
||||
|
||||
if (userDBlive.length == 0) {
|
||||
displayCalcNotification("Live Database is not loaded!", 2500)
|
||||
return
|
||||
}
|
||||
|
||||
encDB = [] // use database without comments
|
||||
for (i = 0; i < userDBlive.length; i++) encDB.push(userDBlive[i].replace(/\[.+\]/g, '').trim())
|
||||
|
||||
// prepare arrays with cipher indices and values to be matched
|
||||
var encCiphValsArr = []; var encCiphIndArr = []; var curVal
|
||||
for (i = 0; i < cipherList.length; i++) {
|
||||
curEncCiphVal = document.getElementById("encCiphVal"+i)
|
||||
if (curEncCiphVal !== null && curEncCiphVal.value !== '0') { // if element exists, non zero value
|
||||
encCiphIndArr.push(i) // add cipher index
|
||||
curVal = (curEncCiphVal.value == "-0") ? 0 : curEncCiphVal.value // use '-0' to match to zero
|
||||
encCiphValsArr.push(Number(curEncCiphVal.value)) // add cipher value
|
||||
}
|
||||
}
|
||||
|
||||
if (encCiphIndArr.length == 0) return // no values were specified
|
||||
|
||||
var word = sVal() // value in phrase box
|
||||
var wordDisp = word.split(';') // split phrase to insert in different positions
|
||||
while (wordDisp.length < 2) wordDisp.push('') // min length of 2
|
||||
wordDisp.slice(0,2) // leave 2 items (start, length)
|
||||
word = (wordDisp[0]+' ... '+wordDisp[1]).trim() // not used for calculation
|
||||
|
||||
var tmpPhr; var phrCount = 0
|
||||
dbPhrase:
|
||||
for (i = 0; i < encDB.length; i++) { // for each line in live database
|
||||
tmpPhr = wordDisp[0]+' '+encDB[i]+' '+wordDisp[1] // "start;end" -> "start phrase end"
|
||||
for (n = 0; n < encCiphIndArr.length; n++) { // for each specified cipher
|
||||
if ( cipherList[encCiphIndArr[n]].calcGematria(tmpPhr) !== encCiphValsArr[n]) continue dbPhrase // if phrase doesn't match value try next DB item
|
||||
}
|
||||
/*console.log(word+' '+tmpPhr[0]+'\n'+
|
||||
'encCiphIndArr: '+JSON.stringify(encCiphIndArr)+'\n'+
|
||||
'encCiphValsArr: '+JSON.stringify(encCiphValsArr)+'\n'+
|
||||
'tmpPhr: '+JSON.stringify(tmpPhr)+'\n'
|
||||
)*/
|
||||
queryResult.push(tmpPhr.trim()) // add phrase, remove spaces (start, end)
|
||||
phrCount++
|
||||
}
|
||||
|
||||
var o = ''
|
||||
for (n = 0; n < encCiphIndArr.length; n++) {
|
||||
o += encCiphValsArr[n] + ' ' + cipherList[encCiphIndArr[n]].cipherName + '\n'
|
||||
}
|
||||
o += ' ' + phrCount + ' results (Phrase Box: "' + word + '")'
|
||||
console.log(o)
|
||||
|
||||
displayCalcNotification(phrCount+" results", 2500)
|
||||
|
||||
queryResultInitial = [...queryResult] // save matches
|
||||
displayEncodingResults()
|
||||
return
|
||||
}
|
||||
|
||||
if (encodingMode == 2) { // use live database for matching (2 phrases)
|
||||
|
||||
if (userDBlive.length == 0) {
|
||||
displayCalcNotification("Live Database is not loaded!", 2500)
|
||||
return
|
||||
}
|
||||
|
||||
encDB = [] // use live database without comments
|
||||
for (i = 0; i < userDBlive.length; i++) encDB.push(userDBlive[i].replace(/\[.+\]/g, '').trim())
|
||||
|
||||
// prepare arrays with cipher indices and values to be matched
|
||||
var encCiphValsArr = ['-']; var encCiphIndArr = []
|
||||
for (i = 0; i < cipherList.length; i++) {
|
||||
curEncCiphVal = document.getElementById("encCiphVal"+i)
|
||||
if (curEncCiphVal !== null && curEncCiphVal.value !== '0') { // if element exists, non zero value
|
||||
encCiphIndArr.push(i) // add cipher index
|
||||
curVal = (curEncCiphVal.value == "-0") ? 0 : curEncCiphVal.value // use '-0' to match to zero
|
||||
encCiphValsArr.push(Number(curEncCiphVal.value)) // add cipher value
|
||||
}
|
||||
}
|
||||
|
||||
if (encCiphIndArr.length == 0) return
|
||||
|
||||
const negValMode = (() => { // allow temporary phrase value to exceed final value
|
||||
var i, n;
|
||||
for (i = 0; i < encCiphIndArr.length; i++) { // for specified ciphers
|
||||
for (n = 0; n < cipherList[encCiphIndArr[i]].vArr.length; n++) { // if any cipher has negative values
|
||||
if (cipherList[encCiphIndArr[i]].vArr[n] < 0) return true // const is true
|
||||
}
|
||||
}
|
||||
return false // no negative value ciphers
|
||||
})();
|
||||
|
||||
var word = sVal() // value in phrase box
|
||||
var wordDisp = word.split(';') // split phrase to insert in different positions
|
||||
while (wordDisp.length < 3) wordDisp.push('') // min length of 3
|
||||
wordDisp.slice(0,3)
|
||||
word = (wordDisp[0]+' '+wordDisp[1]+' '+wordDisp[2]).trim() // leave 3 items (beginning, middle, end)
|
||||
|
||||
// calculate live database only for matched ciphers
|
||||
var tmpArr = []
|
||||
userDB = [] // reset database values
|
||||
|
||||
if (negValMode) { // calculate final value only then return (no performance optimizations)
|
||||
var p; var phrCount = 0
|
||||
if (optGemSubstitutionMode) {
|
||||
for (i = 0; i < encDB.length; i++) { // for each phrase in database
|
||||
secondPhraseNS:
|
||||
for (p = i; p < encDB.length; p++) { // second phrase from database (next only)
|
||||
for (n = 1; n < encCiphValsArr.length; n++) {
|
||||
if (cipherList[encCiphIndArr[n-1]].calcGematria(wordDisp[0] + encDB[i] + wordDisp[1] + encDB[p] + wordDisp[2]) == encCiphValsArr[n]) { // exact match
|
||||
// keep checking values for other ciphers
|
||||
} else {
|
||||
continue secondPhraseNS // try next second phrase
|
||||
}
|
||||
}
|
||||
queryResult.push((wordDisp[0]+' '+encDB[i]+' '+wordDisp[1]+' '+encDB[p]+' '+wordDisp[2]).trim().replace(/ +/g, ' ')) // exact match, add phrase (phrase box, first phrase, second phrase)
|
||||
phrCount++
|
||||
}
|
||||
}
|
||||
} else { // multiplicative mode, no n/2 optimization
|
||||
var p; var phrCount = 0
|
||||
for (i = 0; i < encDB.length; i++) { // for each phrase in database
|
||||
secondPhraseNM:
|
||||
for (p = 0; p < encDB.length; p++) { // second phrase from database
|
||||
for (n = 1; n < encCiphValsArr.length; n++) {
|
||||
if (cipherList[encCiphIndArr[n-1]].calcGematria(wordDisp[0] + encDB[i] + wordDisp[1] + encDB[p] + wordDisp[2]) == encCiphValsArr[n]) { // exact match
|
||||
// keep checking values for other ciphers
|
||||
} else {
|
||||
continue secondPhraseNM // try next second phrase
|
||||
}
|
||||
}
|
||||
queryResult.push((wordDisp[0]+' '+encDB[i]+' '+wordDisp[1]+' '+encDB[p]+' '+wordDisp[2]).trim().replace(/ +/g, ' ')) // exact match, add phrase (phrase box, first phrase, second phrase)
|
||||
phrCount++
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var o = ''
|
||||
for (n = 0; n < encCiphIndArr.length; n++) {
|
||||
o += encCiphValsArr[n+1] + ' ' + cipherList[encCiphIndArr[n]].cipherName + '\n'
|
||||
}
|
||||
o += ' ' + phrCount + ' results (Phrase Box: "' + word + '"; ' + calcEncMatchProb(phrCount, userDBlive.length, false) + ')'
|
||||
console.log(o)
|
||||
|
||||
displayCalcNotification(phrCount+" results", 2500)
|
||||
|
||||
queryResultInitial = [...queryResult] // save matches
|
||||
displayEncodingResults()
|
||||
return // ignore the code below
|
||||
}
|
||||
|
||||
if (optGemSubstitutionMode || wordDisp[0] == "") { // if substitution mode or first manual word not defined
|
||||
for (i = 0; i < encDB.length; i++) {
|
||||
tmpArr = [] // reset
|
||||
tmpArr.push(encDB[i]) // add phrase
|
||||
for (n = 0; n < encCiphIndArr.length; n++) { // for each matched cipher
|
||||
tmpArr.push(cipherList[encCiphIndArr[n]].calcGematria(encDB[i])) // calculate gematria value
|
||||
}
|
||||
userDB.push(tmpArr) // add row with phrase and gematria for enabled ciphers
|
||||
}
|
||||
var wordGemArr = [word] // calculate phrase box value (substitution mode only)
|
||||
for (i = 0; i < encCiphIndArr.length; i++) {
|
||||
wordGemArr.push( cipherList[encCiphIndArr[i]].calcGematria(word) ) // ["encoding", 71, 44]
|
||||
}
|
||||
}
|
||||
|
||||
if (optGemSubstitutionMode) {
|
||||
var curGem, curGem2, p; var phrCount = 0
|
||||
firstPhrase:
|
||||
for (i = 0; i < userDB.length; i++) { // for each phrase in database
|
||||
curGem = [...userDB[i]] // load gematria of phrase
|
||||
for (n = 1; n < wordGemArr.length; n++) {
|
||||
if (curGem[n] + wordGemArr[n] < encCiphValsArr[n]) { // if total is less than matched value
|
||||
curGem[n] += wordGemArr[n] // add gematria of phrase box to current phrase for each matched cipher
|
||||
} else {
|
||||
continue firstPhrase // mismatch, check next phrase
|
||||
}
|
||||
}
|
||||
secondPhrase:
|
||||
for (p = i; p < userDB.length; p++) { // for each next phrase in database (total of two phrases)
|
||||
curGem2 = [...curGem] // copy of first phrase + phrase box gematria
|
||||
for (n = 1; n < userDB[p].length; n++) { // for all gematria values for that phrase
|
||||
if (curGem2[n] + userDB[p][n] == encCiphValsArr[n]) { // if total is equal to matched value
|
||||
curGem2[n] += userDB[p][n] // add gematria of 2nd phrase to current gematria array
|
||||
} else {
|
||||
continue secondPhrase // mismatch, check next 2nd phrase
|
||||
}
|
||||
}
|
||||
queryResult.push((wordDisp[0]+' '+curGem[0]+' '+wordDisp[1]+' '+userDB[p][0]+' '+wordDisp[2]).trim().replace(/ +/g, ' ')) // exact match, add phrase (phrase box, first phrase, second phrase)
|
||||
phrCount++
|
||||
}
|
||||
}
|
||||
} else if (!optGemSubstitutionMode && wordDisp[0] == "") { // multiplication mode, first manual word not defined
|
||||
var p; var phrCount = 0
|
||||
firstStep:
|
||||
for (i = 0; i < userDB.length; i++) { // for each phrase in database
|
||||
for (n = 1; n < encCiphValsArr.length; n++) {
|
||||
if (userDB[i][n] < encCiphValsArr[n]) {
|
||||
// just continue if first phrase is less that matched value
|
||||
} else {
|
||||
continue firstStep // start with a different word
|
||||
}
|
||||
}
|
||||
if (wordDisp[1] !== "") { // if second manual word is not empty
|
||||
for (n = 1; n < encCiphValsArr.length; n++) {
|
||||
if (cipherList[encCiphIndArr[n-1]].calcGematria(userDB[i][0] + wordDisp[1]) < encCiphValsArr[n]) {
|
||||
// just continue if phrase is less that matched value
|
||||
} else {
|
||||
continue firstStep // next word
|
||||
}
|
||||
}
|
||||
}
|
||||
secondStep:
|
||||
for (p = 0; p < userDB.length; p++) { // second phrase from database
|
||||
for (n = 1; n < encCiphValsArr.length; n++) {
|
||||
if (cipherList[encCiphIndArr[n-1]].calcGematria(userDB[i][0] + wordDisp[1] + userDB[p][0] + wordDisp[2]) == encCiphValsArr[n]) { // exact match
|
||||
// just continue if first phrase is less that matched value
|
||||
} else {
|
||||
continue secondStep // start with a different second phrase
|
||||
}
|
||||
}
|
||||
queryResult.push((wordDisp[0]+' '+userDB[i][0]+' '+wordDisp[1]+' '+userDB[p][0]+' '+wordDisp[2]).trim().replace(/ +/g, ' ')) // exact match, add phrase (phrase box, first phrase, second phrase)
|
||||
phrCount++
|
||||
}
|
||||
}
|
||||
} else if (!optGemSubstitutionMode && wordDisp[0] !== "") { // multiplication mode, first manual word defined
|
||||
var p; var phrCount = 0
|
||||
firstStepF:
|
||||
for (i = 0; i < encDB.length; i++) { // for each phrase in database
|
||||
for (n = 1; n < encCiphValsArr.length; n++) {
|
||||
if (cipherList[encCiphIndArr[n-1]].calcGematria(wordDisp[0] + encDB[i]) < encCiphValsArr[n]) {
|
||||
// just continue if first phrase is less that matched value
|
||||
} else {
|
||||
continue firstStepF // start with a different word
|
||||
}
|
||||
}
|
||||
secondStepF:
|
||||
for (p = 0; p < encDB.length; p++) { // second phrase from database
|
||||
for (n = 1; n < encCiphValsArr.length; n++) {
|
||||
if (cipherList[encCiphIndArr[n-1]].calcGematria(wordDisp[0] + encDB[i] + wordDisp[1] + encDB[p] + wordDisp[2]) == encCiphValsArr[n]) { // exact match
|
||||
// just continue if first phrase is less that matched value
|
||||
} else {
|
||||
continue secondStepF // start with a different second phrase
|
||||
}
|
||||
}
|
||||
queryResult.push((wordDisp[0]+' '+encDB[i]+' '+wordDisp[1]+' '+encDB[p]+' '+wordDisp[2]).trim().replace(/ +/g, ' ')) // exact match, add phrase (phrase box, first phrase, second phrase)
|
||||
phrCount++
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var o = ''
|
||||
for (n = 0; n < encCiphIndArr.length; n++) {
|
||||
o += encCiphValsArr[n+1] + ' ' + cipherList[encCiphIndArr[n]].cipherName + '\n'
|
||||
}
|
||||
o += (optGemSubstitutionMode) ? ' ' + phrCount + ' results (Phrase Box: "' + word + '"; ' + calcEncMatchProb(phrCount, userDB.length) + ')' : ' ' + phrCount + ' results (Phrase Box: "' + word + '"; ' + calcEncMatchProb(phrCount, userDBlive.length, false) + ')'
|
||||
console.log(o)
|
||||
|
||||
displayCalcNotification(phrCount+" results", 2500)
|
||||
|
||||
queryResultInitial = [...queryResult] // save matches
|
||||
displayEncodingResults()
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// =========================== Syllables ============================
|
||||
|
||||
var encAllSyl = []; var encConSyl = []; var encVowSyl = []; var alph = [];
|
||||
|
||||
function encodingInitSyllables() {
|
||||
|
||||
alph = document.getElementById("encAlphabetBox").value.split(',')
|
||||
var vowels = document.getElementById("encVowelsBox").value.split(',')
|
||||
var cons = []; for (var i = 0; i < alph.length; i++) { if (vowels.indexOf(alph[i]) == -1) { cons.push(alph[i]) } }
|
||||
|
||||
for (i = 0; i < encPrevExcLetStr.length; i++) {
|
||||
if (alph.indexOf(encPrevExcLetStr[i]) > -1) alph.splice(alph.indexOf(encPrevExcLetStr[i]),1)
|
||||
if (cons.indexOf(encPrevExcLetStr[i]) > -1) cons.splice(cons.indexOf(encPrevExcLetStr[i]),1)
|
||||
if (vowels.indexOf(encPrevExcLetStr[i]) > -1) vowels.splice(vowels.indexOf(encPrevExcLetStr[i]),1)
|
||||
}
|
||||
// console.log("vowels:"+vowels.length+" consonants:"+cons.length+" alphabet:"+alph.length)
|
||||
|
||||
var syl = "" // syllable
|
||||
|
||||
encVowSyl = [] // vowel syllables
|
||||
encConSyl = [] // consonant syllables
|
||||
var encStartVowSyl = [] // starts with vowel syllables
|
||||
|
||||
for (var v = 0; v < vowels.length; v++) {
|
||||
for (a = 0; a < alph.length; a++) {
|
||||
//syl += vowels[v]+alph[a]+"\n"
|
||||
syl = vowels[v]+alph[a]
|
||||
if (encVowSyl.indexOf(syl) == -1) encVowSyl.push(syl) // push if not found
|
||||
}
|
||||
for (a = 0; a < alph.length; a++) {
|
||||
//syl += alph[a]+vowels[v]+"\n"
|
||||
syl = alph[a]+vowels[v]
|
||||
if (encVowSyl.indexOf(syl) == -1) encVowSyl.push(syl) // push if not found
|
||||
}
|
||||
}
|
||||
|
||||
// exclude "uu", "yy", total of 274
|
||||
if (encVowSyl.indexOf("uu") > -1) encVowSyl.splice(encVowSyl.indexOf("uu"),1)
|
||||
if (encVowSyl.indexOf("yy") > -1) encVowSyl.splice(encVowSyl.indexOf("yy"),1)
|
||||
|
||||
//console.log(encVowSyl)
|
||||
|
||||
for (var v = 0; v < vowels.length; v++) {
|
||||
for (a = 0; a < alph.length; a++) {
|
||||
//syl += vowels[v]+alph[a]+"\n"
|
||||
syl = vowels[v]+alph[a]
|
||||
if (encStartVowSyl.indexOf(syl) == -1) encStartVowSyl.push(syl) // push if not found
|
||||
}
|
||||
}
|
||||
// exclude "uu", "yy", total of 154
|
||||
if (encVowSyl.indexOf("uu") > -1) encStartVowSyl.splice(encVowSyl.indexOf("uu"),1)
|
||||
if (encVowSyl.indexOf("yy") > -1) encStartVowSyl.splice(encVowSyl.indexOf("yy"),1)
|
||||
|
||||
//console.log(encStartVowSyl)
|
||||
//copy(JSON.stringify(encVowSyl).replace(/","/g, "\n"))
|
||||
|
||||
for (var c = 0; c < cons.length; c++) {
|
||||
for (c2 = 0; c2 < cons.length; c2++) {
|
||||
syl = cons[c]+cons[c2]
|
||||
encConSyl.push(syl)
|
||||
}
|
||||
}
|
||||
// total of 400
|
||||
|
||||
//copy(JSON.stringify(encConSyl).replace(/","/g, "\n"))
|
||||
|
||||
encAllSyl = []
|
||||
for (i = 0; i < encVowSyl.length; i++) {
|
||||
encAllSyl.push(encVowSyl[i]) // add more weight
|
||||
encAllSyl.push(encVowSyl[i])
|
||||
encAllSyl.push(encVowSyl[i])
|
||||
encAllSyl.push(encVowSyl[i])
|
||||
}
|
||||
for (i = 0; i < encConSyl.length; i++) {
|
||||
encAllSyl.push(encConSyl[i])
|
||||
}
|
||||
}
|
||||
|
||||
function encodingFindSylMatch(encCiphValsArr, encCiphIndArr, encSylLimitSteps = 1000000, encSylLenLimit = 50) {
|
||||
var i
|
||||
var word = sVal()+" " // value in phrase box
|
||||
if (encOddLength) {
|
||||
if (word.length == 1) word.trim() // trim spaces
|
||||
word += alph[Math.floor(Math.random() * alph.length)] // random alphabet letter
|
||||
}
|
||||
var prev_syl = "" // previous syllable
|
||||
var first_syl = true
|
||||
var valid_match = true
|
||||
var n_count = 0 // iterations
|
||||
|
||||
while (n_count < encSylLimitSteps) {
|
||||
prev_syl = word.substring(word.length-2,word.length) // previous syllable
|
||||
|
||||
// first syllable
|
||||
if (first_syl) {
|
||||
word += encAllSyl[getRandomInt(encAllSyl.length)] // any syllable
|
||||
first_syl = false
|
||||
}
|
||||
// ends in 2 consonants, not first syllable
|
||||
else if (encConSyl.indexOf(prev_syl) > -1 && !first_syl) { // st -> stea, stem, stre
|
||||
word += encVowSyl[getRandomInt(encVowSyl.length)] // vowel syllable
|
||||
}
|
||||
// doesn't end in two consonants, not first syllable
|
||||
else if (encConSyl.indexOf(prev_syl) == -1 && !first_syl) { // sa -> sach, sami, said, sayo
|
||||
word += encAllSyl[getRandomInt(encAllSyl.length)] // any syllable
|
||||
}
|
||||
|
||||
valid_match = true
|
||||
curGem = 0
|
||||
for (i = 0; i < encCiphValsArr.length; i++) {
|
||||
curGem = cipherList[encCiphIndArr[i]].calcGematria(word)
|
||||
if (curGem < encCiphValsArr[i] && word.length <= encSylLenLimit) { // simple calculation
|
||||
valid_match = false // continue building word
|
||||
} else if (curGem > encCiphValsArr[i] || word.length > encSylLenLimit) { // reset word
|
||||
valid_match = false
|
||||
var word = sVal()+" " // value in phrase box
|
||||
if (encOddLength) {
|
||||
if (word.length == 1) word.trim() // trim spaces
|
||||
word += alph[Math.floor(Math.random() * alph.length)] // random alphabet letter
|
||||
}
|
||||
first_syl = true
|
||||
n_count++
|
||||
break
|
||||
}
|
||||
}
|
||||
if (valid_match) {
|
||||
n_count++
|
||||
console.log(word+" ("+n_count+' iterations)')
|
||||
return word
|
||||
}
|
||||
}
|
||||
displayCalcNotification('No matches were found after '+encSylLimitSteps.toLocaleString('en')+' steps!', 2500)
|
||||
|
||||
return null
|
||||
}
|
||||
@@ -0,0 +1,337 @@
|
||||
// =========================== Export CSV ===========================
|
||||
|
||||
function dropHandler(ev) {
|
||||
// console.log('File(s) dropped')
|
||||
dragCounter = 0 // reset counter
|
||||
$("#phraseBox").removeClass("dragOver")
|
||||
|
||||
ev.preventDefault() // prevent default behavior (Prevent file from being opened)
|
||||
|
||||
if (ev.dataTransfer.items) {
|
||||
// use DataTransferItemList interface to access the file(s)
|
||||
for (var i = 0; i < ev.dataTransfer.items.length; i++) {
|
||||
// if dropped items aren't files, reject them
|
||||
if (ev.dataTransfer.items[i].kind === 'file') {
|
||||
var file = ev.dataTransfer.items[i].getAsFile()
|
||||
console.log('... "FILE" file[' + i + '].name = ' + file.name)
|
||||
//console.log(file)
|
||||
//console.log(ev)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// use DataTransfer interface to access the file(s)
|
||||
for (var i = 0; i < ev.dataTransfer.files.length; i++) {
|
||||
console.log('... file[' + i + '].name = ' + ev.dataTransfer.files[i].name)
|
||||
}
|
||||
}
|
||||
|
||||
var file = ev.dataTransfer.files[0] // first file
|
||||
importFileAction(file)
|
||||
}
|
||||
|
||||
function processDateFile(userHist) { // calculated date durations for imported file
|
||||
var t = compareDateArray(userHist) // get durations for each pair
|
||||
t = 'data:text/plain;charset=utf-8,'+encodeURIComponent(t) // format as text file
|
||||
download(getTimestamp()+"_GEMATRO_DATES.txt", t); // download file
|
||||
}
|
||||
|
||||
function importFileAction(file, hasLocalFile) {
|
||||
var reader = new FileReader();
|
||||
var sb = ""; // string builder
|
||||
|
||||
var execute = function() {
|
||||
var userHist = file.split(/\r\n|\n/) // to string array, line break as separator
|
||||
|
||||
//console.log('test');
|
||||
|
||||
//userHist.forEach((line) => { // print line by line
|
||||
// console.log(line)
|
||||
//})
|
||||
|
||||
var uCiph = [] // user saved ciphers
|
||||
uCiph = userHist[0].split(";") // table header to array (user ciphers from CSV), semicolon separator
|
||||
|
||||
// detect database export mode
|
||||
if (uCiph[0] == "CREATE_GEMATRO_DB") {
|
||||
userHist.splice(0,1) // remove the first line
|
||||
if (liveDatabaseMode == false) { // precompiled database mode
|
||||
expCiphers = exportCiphersDB() // export enabled ciphers
|
||||
exportHistoryCSV(userHist, true, expCiphers) // export database with enabled ciphers
|
||||
} else {
|
||||
userDBlive = [...userHist] // live database mode
|
||||
$("#queryDBbtn").removeClass("hideValue") // display query button
|
||||
$("#clearDBqueryBtn").removeClass("hideValue") // clear button
|
||||
$("#unloadDBBtn").removeClass("hideValue") // unload database button
|
||||
$("#btn-export-db-query").removeClass("hideValue") // export button
|
||||
$("#liveDBOption").addClass("hideValue") // hide "Live Database Mode"
|
||||
closeAllOpenedMenus() // close menus
|
||||
|
||||
console.log("Live Database loaded! ("+userDBlive.length+" entries)")
|
||||
displayCalcNotification("Live Database loaded!", 1500)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// detect file with dates
|
||||
if (uCiph[0] == "GEMATRO_DATES") {
|
||||
userHist.splice(0,1) // remove the first line
|
||||
processDateFile(userHist) // compare dates
|
||||
return
|
||||
}
|
||||
|
||||
// detect cipher.js, load user ciphers
|
||||
if (uCiph[0] == "// ciphers.js") {
|
||||
optShowExtraCiphers = false // clear "Show Extra Ciphers" option
|
||||
document.getElementById('chkbox_SEC').checked = false
|
||||
|
||||
if (precalcDBLoaded) { // return if precalculated database is loaded
|
||||
displayCalcNotification("Cipher import is disabled for CSV Databases!", 3000)
|
||||
return
|
||||
}
|
||||
var calcOpt = file.match(/(?<=calcOptions = )[\s\S]*?\]/m) // array values
|
||||
if (calcOpt !== null) {
|
||||
calcOptMatch = calcOpt[0].replace(/(\t| +|\r|\n)/g, "") // remove tabs, consequtive spaces, line breaks
|
||||
if (isJsonString(calcOptMatch)) importCalcOptions(JSON.parse(calcOptMatch)) // load user options
|
||||
}
|
||||
|
||||
var ciph = file.match(/(?<=cipherList = \[)[\s\S]+/m) // match after "cipherList = [" till end of file, multiple line regex - [\s\S]+
|
||||
file = ciph[0].replace(/(\t| +|\r|\n)/g, "").slice(10,-1) // remove tabs, consequtive spaces, line breaks - "new cipher" at start, last bracket
|
||||
ciph = file.split(",new cipher") // split string into array
|
||||
|
||||
cipherList = []; cCat = []; defaultCipherArray = [] // clear arrays with previously defined ciphers, categories, default ciphers
|
||||
for (n = 0; n < ciph.length; n++) {
|
||||
cipherList.push(eval("new cipher("+ciph[n].slice(1,-1)+")")) // remove parethesis, evaluate string as javascript code
|
||||
}
|
||||
document.getElementById("calcOptionsPanel").innerHTML = "" // clear menu panel
|
||||
initCalc() // reinit
|
||||
updateTables() // update tables
|
||||
updateInterfaceColor(true) // update interface color (first run)
|
||||
if (userDBlive.length !== 0) { // restore controls if live database is loaded
|
||||
$("#queryDBbtn").removeClass("hideValue") // display query button
|
||||
$("#clearDBqueryBtn").removeClass("hideValue") // clear button
|
||||
$("#unloadDBBtn").removeClass("hideValue") // unload database button
|
||||
$("#btn-export-db-query").removeClass("hideValue") // export button
|
||||
$("#liveDBOption").addClass("hideValue") // hide "Live Database Mode"
|
||||
}
|
||||
|
||||
displayCalcNotification("Ciphers loaded!", 1000)
|
||||
return
|
||||
}
|
||||
|
||||
// detect previously exported matches
|
||||
if ( uCiph[0] == '======= Same Cipher Match =======' || uCiph[0] == '============ Cross Cipher Match ============' ) {
|
||||
var phrMatch
|
||||
for (i = 0; i < userHist.length; i++) {
|
||||
phrMatch = userHist[i].match(/^\".+\"/) // grab phrase between a quote in the beginning and the last quote found in line (with quotes)
|
||||
if (phrMatch !== null) {
|
||||
addPhraseToHistory(phrMatch[0].slice(1,-1), false) // remove quotes, load extracted phrase (first item), false flag doesn't update history
|
||||
}
|
||||
}
|
||||
updateTables() // update tables after all lines are added
|
||||
return
|
||||
}
|
||||
|
||||
// detect database import
|
||||
if ( uCiph[0] == 'GEMATRO_DB' ) {
|
||||
liveDatabaseMode = false // disable live database mode
|
||||
|
||||
// import ciphers from database
|
||||
var calcOpt = file.match(/(?<=calcOptions = )[\s\S]*?\]/m) // array values
|
||||
if (calcOpt !== null) {
|
||||
calcOptMatch = calcOpt[0].replace(/(\t| +|\r|\n)/g, "") // remove tabs, consequtive spaces, line breaks
|
||||
if (isJsonString(calcOptMatch)) importCalcOptions(JSON.parse(calcOptMatch)) // load user options
|
||||
}
|
||||
|
||||
var ciph = file.match(/(?<=cipherList = \[)[\s\S]+/m) // match after "cipherList = [" till end of file, multiple line regex - [\s\S]+
|
||||
file = ciph[0].replace(/(\t| +|\r|\n)/g, "").slice(10,-1) // remove tabs, consequtive spaces, line breaks - "new cipher" at start, last bracket
|
||||
ciph = file.split(",new cipher") // split string into array
|
||||
|
||||
cipherList = []; cCat = []; defaultCipherArray = [] // clear arrays with previously defined ciphers, categories, default ciphers
|
||||
for (n = 0; n < ciph.length; n++) {
|
||||
cipherList.push(eval("new cipher("+ciph[n].slice(1,-1)+")")) // remove parethesis, evaluate string as javascript code
|
||||
}
|
||||
document.getElementById("calcOptionsPanel").innerHTML = "" // clear menu panel
|
||||
initCalc() // reinit
|
||||
updateTables() // update tables
|
||||
updateInterfaceColor() // update interface color
|
||||
|
||||
ciphersPos = userHist.indexOf("// ciphers.js") // line number where cipher definition starts
|
||||
userDB = [] // clear previous DB
|
||||
var tmp = []
|
||||
for (i = 1; i < ciphersPos; i++) { // ignore first line (cipher names), ignore lines after "// ciphers.js"
|
||||
tmp = userHist[i].split(";") // current line to array, phrase at index 0
|
||||
// for (n = 1; n < tmp.length; n++) { tmp[n] = Number(tmp[n]) } // parse as numbers
|
||||
// it takes some 5 seconds instead of 1s, maybe better to convert number to string when search is performed
|
||||
userDB.push(tmp) // add phrase (no check for duplicates)
|
||||
}
|
||||
$("#queryDBbtn").removeClass("hideValue") // display query button
|
||||
$("#clearDBqueryBtn").removeClass("hideValue") // clear button
|
||||
$("#unloadDBBtn").removeClass("hideValue") // unload database button
|
||||
$("#btn-export-db-query").removeClass("hideValue") // export button
|
||||
$("#edCiphBtn").addClass("hideValue") // hide "Edit Ciphers"
|
||||
$("#liveDBOption").addClass("hideValue") // hide "Live Database Mode"
|
||||
closeAllOpenedMenus() // close "Edit Ciphers"
|
||||
precalcDBLoaded = true // precalculated database loaded, disable cipher rearrangement
|
||||
|
||||
optShowExtraCiphers = false // disable and hide "Show Extra Ciphers" option
|
||||
document.getElementById('chkbox_SEC').checked = false
|
||||
$('#showExtraCiphOption').addClass('hideValue')
|
||||
|
||||
console.log("CSV Database loaded! ("+userDB.length+" entries)")
|
||||
displayCalcNotification("CSV Database loaded!", 1500)
|
||||
return
|
||||
}
|
||||
|
||||
// continue import of file as CSV history or plain text file
|
||||
if (optLoadUserHistCiphers && uCiph[0] == "Word or Phrase") { // switch to ciphers from imported CSV file
|
||||
disableAllCiphers()
|
||||
for (z = 0; z < cipherList.length; z++) { // enable cipher if it is available
|
||||
if (uCiph.indexOf(cipherList[z].cipherName) > -1) {
|
||||
cipherList[z].enabled = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var uPhr = ''; var plainTxt = true
|
||||
var a = 0 // i = 0 to add all phrases, i = 1 to ignore first line (table header)
|
||||
if (uCiph[0] == "Word or Phrase") {
|
||||
a = 1 // ignore table header if present
|
||||
plainTxt = false // use substring to extract phrase from CSV later
|
||||
}
|
||||
|
||||
for (i = a; i < userHist.length; i++) {
|
||||
uPhr = userHist[i] // load line, phrase with gematria
|
||||
if (!plainTxt) uPhr = uPhr.substring(0, uPhr.indexOf(';')) // CSV, get text before the first semicolon (faster)
|
||||
addPhraseToHistory(uPhr, false) // load phrase (first item), false flag doesn't update history
|
||||
}
|
||||
|
||||
updateTables() // update tables after all lines are added
|
||||
}
|
||||
|
||||
if (hasLocalFile) {
|
||||
execute();
|
||||
} else {
|
||||
reader.onload = (event) => { // actions to perform after file is read
|
||||
file = event.target.result // full file contents
|
||||
execute();
|
||||
}
|
||||
|
||||
reader.onerror = (event) => {
|
||||
alert(event.target.error.name)
|
||||
};
|
||||
|
||||
reader.readAsText(file) // issue command to start reading file
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
function isJsonString(str) {
|
||||
try {
|
||||
JSON.parse(str);
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function importCalcOptions(calcOpt) { // load user options
|
||||
if (typeof calcOpt !== 'undefined' && calcOpt !== null) {
|
||||
for (var i = 0; i < calcOpt.length; i++) eval(calcOpt[i])
|
||||
}
|
||||
toggleCodeRain() // update coderain
|
||||
}
|
||||
|
||||
function dragOverHandler(ev) {
|
||||
//console.log('File(s) in drop zone')
|
||||
ev.preventDefault() // Prevent default drag behavior (Prevent file from being opened)
|
||||
}
|
||||
|
||||
function exportHistoryCSV(arr, dbMode = false, addCiphers = '') {
|
||||
if (arr.length == 0) return
|
||||
|
||||
var t = ""
|
||||
updateEnabledCipherCount()
|
||||
|
||||
// table header (csv format, semicolon as separator)
|
||||
if (enabledCiphCount > 0) {
|
||||
t = "Word or Phrase"
|
||||
if (dbMode) t = "GEMATRO_DB"
|
||||
for (i = 0; i < cipherList.length; i++) {
|
||||
if (cipherList[i].enabled) {
|
||||
t += ";"+cipherList[i].cipherName // list of enabled ciphers
|
||||
}
|
||||
}
|
||||
t += "\n" // line break
|
||||
}
|
||||
|
||||
// table contents
|
||||
for (i = 0; i < arr.length; i++) {
|
||||
t += arr[i].replace(";", "") // add phrase, remove semicolons (it is a separator)
|
||||
for (n = 0; n < cipherList.length; n++) {
|
||||
if (cipherList[n].enabled) {
|
||||
t += ";"+cipherList[n].calcGematria(arr[i]) // gematria value for each enabled cipher
|
||||
}
|
||||
}
|
||||
if (i+1 < arr.length) t += "\n" // line break, exclude last line
|
||||
}
|
||||
if (dbMode) t += "\n"+addCiphers // include ciphers inside database
|
||||
|
||||
t = 'data:text/plain;charset=utf-8,'+encodeURIComponent(t) // format as text file
|
||||
if (dbMode) {
|
||||
download(getTimestamp()+"_GEMATRO_DB.txt", t); // download database
|
||||
} else {
|
||||
download(getTimestamp()+"_gematria.txt", t); // download file
|
||||
}
|
||||
}
|
||||
|
||||
function exportCurrentDBquery(arr) {
|
||||
var i, n
|
||||
if (arr.length == 0) return
|
||||
|
||||
var t = ""
|
||||
|
||||
// table header (csv format, semicolon as separator)
|
||||
t = "Word or Phrase"
|
||||
for (i = 0; i < gemArrCiph.length; i++) {
|
||||
t += ";"+cipherList[gemArrCiph[i]].cipherName // list of ciphers used in query
|
||||
}
|
||||
t += "\n" // line break
|
||||
|
||||
if (encodingMenuOpened) {
|
||||
var tLine = ''
|
||||
for (i = 0; i < arr.length; i++) {
|
||||
tLine = arr[i] + ';'
|
||||
for (n = 0; n < gemArrCiph.length; n++) {
|
||||
tLine += cipherList[gemArrCiph[n]].calcGematria(arr[i]) + ';'
|
||||
}
|
||||
t += tLine.slice(0,-1) + '\n'
|
||||
}
|
||||
} else { // table contents
|
||||
for (i = 0; i < arr.length; i++) {
|
||||
t += arr[i][1].replace(";", "") // add phrase[1], remove semicolons (it is a separator)
|
||||
for (n = 2; n < arr[i].length; n++) { // values start at [2]
|
||||
t += ";"+arr[i][n] // retrieve gematria value for each cipher
|
||||
}
|
||||
t += "\n"
|
||||
}
|
||||
}
|
||||
|
||||
t = 'data:text/plain;charset=utf-8,'+encodeURIComponent(t.slice(0,-1)) // format as text file
|
||||
download(getTimestamp()+"_gematria_DB_query.txt", t); // download file
|
||||
}
|
||||
|
||||
function download(fileName, fileData) {
|
||||
var element = document.createElement('a'); // create invisible <a> element
|
||||
//element.setAttribute('href', 'data:text/plain;charset=utf-8, '+encodeURIComponent(filedata));
|
||||
|
||||
element.setAttribute('href', fileData)
|
||||
element.setAttribute('download', fileName) // <a href=fileData download=fileName>
|
||||
|
||||
document.body.appendChild(element) // add element
|
||||
element.click() // click on element to start download
|
||||
document.body.removeChild(element) // remove element
|
||||
}
|
||||
@@ -0,0 +1,423 @@
|
||||
// ============================= Export =============================
|
||||
|
||||
function openImageWindow(element, imgName = "", sRatio = window.devicePixelRatio, refresh = false) { // sRatio is scaling, refresh - update the image only
|
||||
var imageDataURL, wnd, scl
|
||||
if ( $(element).length ) { // if specified element exists
|
||||
// if browser zoom level is more than passed value, use current zoom level
|
||||
if (typeof sRatio !== 'undefined' && sRatio < window.devicePixelRatio) { sRatio = window.devicePixelRatio}
|
||||
// html2canvas($(element)[0], {allowTaint: false, backgroundColor: window.getComputedStyle(document.querySelector('body')).getPropertyValue('background-color'), width: $(element).outerWidth()+2, height: $(element).outerHeight()+2, scale: sRatio} ).then((canvas) => { // e.g. html2canvas($("#ChartTable")[0]).then ...
|
||||
html2canvas($(element)[0], {allowTaint: false, backgroundColor: "rgba(0,0,0,0)", width: $(element).outerWidth()+10, height: $(element).outerHeight()+10, scale: sRatio} ).then((canvas) => { // e.g. html2canvas($("#ChartTable")[0]).then ...
|
||||
//allowTaint: true, backgroundColor: "rgba(22,26,34,1.0)" - render white bg as transparent
|
||||
//backgroundColor: calcBGhtml2canvas()
|
||||
//width: $(element).width(), height: $(element).height() - get proper element dimensions
|
||||
//console.log("done ... ");
|
||||
//$("#previewImage").append(canvas);
|
||||
|
||||
// imageDataURL = canvas.toDataURL("image/png"); // canvas to "data:image/png;base64, ..."
|
||||
imageDataURL = trimCanvas(canvas); // canvas to "data:image/png;base64, ..."
|
||||
|
||||
if (element == '.dateCalcTable2') { // restore date labels as input
|
||||
$('#dateDesc1Area').html('<input class="dateDescription" id="dateDesc1" value="'+dateDesc1Saved+'">')
|
||||
$('#dateDesc2Area').html('<input class="dateDescription" id="dateDesc2" value="'+dateDesc2Saved+'">')
|
||||
$('.dateCalcTable2').removeClass('elemBorderScr') // add outline
|
||||
}
|
||||
|
||||
if (element == '#BreakdownDetails') { // restore chart style, remove outline
|
||||
$('#BreakdownDetails').removeClass('elemBorderScr') // remove outline for breakdown area
|
||||
updateWordBreakdown() // redraw cipher chart
|
||||
}
|
||||
|
||||
imgName = imgName.replace(/'/g, '')
|
||||
if (imgName == "" || imgName.length >= 200) imgName = getTimestamp()+".png"; // filename for download button (200 char limit)
|
||||
|
||||
// add download button and image data inside centered <div>
|
||||
//wnd = window.open(""); // open new window
|
||||
//wnd.document.body.innerHTML = "<div style='max-height: 100%; max-width: 100%; position: absolute; top: 50%; left: 50%; -webkit-transform: translate(-50%,-50%); transform: translate(-50%,-50%);'><center><br><a href='"+imageDataURL+"' download='"+imgName+"' style='font-family: arial, sans-serif; color: #dedede' >Download</a></center><br><img src="+canvas.toDataURL("image/png")+"></div>";
|
||||
//wnd.document.body.style.backgroundColor = "#000000"; // black background
|
||||
if (!refresh) {
|
||||
showPrintImagePreview(imageDataURL, imgName, element, sRatio) // show preview panel
|
||||
} else {
|
||||
$('#imgData').attr("src", imageDataURL) // update image only
|
||||
$('#downImgBtn').attr("onclick", "download('"+imgName+"', '"+imageDataURL+"')")
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function trimCanvas(c) { // remove transparent pixels
|
||||
var ctx = c.getContext('2d'),
|
||||
copy = document.createElement('canvas'),
|
||||
copyCtx = copy.getContext('2d'),
|
||||
pixels = ctx.getImageData(0, 0, c.width, c.height),
|
||||
l = pixels.data.length,
|
||||
i,
|
||||
bound = {
|
||||
top: null,
|
||||
left: null,
|
||||
right: null,
|
||||
bottom: null
|
||||
},
|
||||
x, y;
|
||||
|
||||
for (i = 0; i < l; i += 4) {
|
||||
if (pixels.data[i+3] !== 0) {
|
||||
x = (i / 4) % c.width;
|
||||
y = ~~((i / 4) / c.width);
|
||||
|
||||
if (bound.top === null) {
|
||||
bound.top = y;
|
||||
}
|
||||
|
||||
if (bound.left === null) {
|
||||
bound.left = x;
|
||||
} else if (x < bound.left) {
|
||||
bound.left = x;
|
||||
}
|
||||
|
||||
if (bound.right === null) {
|
||||
bound.right = x;
|
||||
} else if (bound.right < x) {
|
||||
bound.right = x;
|
||||
}
|
||||
|
||||
if (bound.bottom === null) {
|
||||
bound.bottom = y;
|
||||
} else if (bound.bottom < y) {
|
||||
bound.bottom = y;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var trimHeight = bound.bottom - bound.top,
|
||||
trimWidth = bound.right - bound.left,
|
||||
trimmed = ctx.getImageData(bound.left, bound.top, trimWidth, trimHeight);
|
||||
|
||||
copyCtx.canvas.width = trimWidth;
|
||||
copyCtx.canvas.height = trimHeight;
|
||||
copyCtx.putImageData(trimmed, 0, 0);
|
||||
|
||||
// open new window with trimmed image:
|
||||
// return copyCtx.canvas;
|
||||
return copy.toDataURL("image/png");
|
||||
}
|
||||
|
||||
function showPrintImagePreview(imageDataURL, imgName, element, sRatio) {
|
||||
$('<div id="darkOverlay" onclick="closePrintImagePreview()"></div>').appendTo('body'); // overlay
|
||||
|
||||
var o = '<div class="printImageContainer">'
|
||||
o += '<center><div class="prevBtnArea">'
|
||||
o += '<input id="downImgBtn" type="button" value="Save Image" onclick="download(''+imgName+'', ''+imageDataURL+'')">' // ' - single quote
|
||||
o += '<input class="refreshImgBtn" type="button" value="Refresh" onclick="openImageWindow(''+element+'', ''+imgName+'', +''+sRatio+'', true);">'
|
||||
o += '</div></center>'
|
||||
o += '<div class="imgDataArea"><img id="imgData" src="'+imageDataURL+'"></div>'
|
||||
o += '</div>'
|
||||
|
||||
$(o).appendTo('body'); // preview image
|
||||
$('body').addClass('noScroll') // prevent scrolling
|
||||
|
||||
btnH = Math.ceil( $('.prevBtnArea').outerHeight() )
|
||||
o = 'height: calc(100% - '+btnH+'px);'
|
||||
$('.imgDataArea').attr("style", o)
|
||||
}
|
||||
|
||||
function closePrintImagePreview() {
|
||||
$('#darkOverlay').remove();
|
||||
$('.printImageContainer').remove();
|
||||
$('body').removeClass('noScroll') // restore scrolling
|
||||
$('#ChartSpotScroll').removeClass('ChartSpotScrollStop'); // reset chart table for mobile devices
|
||||
}
|
||||
|
||||
function getTimestamp() { // 2022-05-03_16-37-11
|
||||
var d = new Date()
|
||||
var ts = d.getFullYear()+'-'+pad((d.getMonth()+1))+'-'+pad(d.getDate())+'_'+
|
||||
pad(d.getHours())+'-'+pad(d.getMinutes())+'-'+pad(d.getSeconds())
|
||||
return ts
|
||||
}
|
||||
|
||||
function pad(str, len = 2) { // add leading zeroes
|
||||
str = str.toString()
|
||||
while (str.length < len) str = "0" + str
|
||||
return str
|
||||
}
|
||||
|
||||
function listAllCiphers() { // print cipher names/index to console
|
||||
for (i = 0; i < cipherList.length; i++) {
|
||||
console.log(i+": "+cipherList[i].cipherName)
|
||||
}
|
||||
}
|
||||
|
||||
function exportCiphers() {
|
||||
var out =
|
||||
'// ciphers.js\n'+
|
||||
'\n'+
|
||||
'/*\n'+
|
||||
'new cipher(\n'+
|
||||
'\t"English Ordinal", // cipher name\n'+
|
||||
'\t"English", // category\n'+
|
||||
'\t120, 57, 36, // hue, saturation, lightness\n'+
|
||||
'\t[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], // lowercase characters\n'+
|
||||
'\t[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], // values\n'+
|
||||
'\ttrue, // characters with diacritic marks have the same value as regular ones, default is "true"\n'+
|
||||
'\ttrue // enabled state, default is "false"\n'+
|
||||
'\tfalse // case sensitive cipher, default is "false"\n'+
|
||||
')\n'+
|
||||
'*/\n\n'
|
||||
|
||||
out += exportCalcOptions()
|
||||
out += "cipherList = [\n"
|
||||
for (i = 0; i < cipherList.length; i++) {
|
||||
|
||||
var cArr_ = []
|
||||
var vArr_ = []
|
||||
|
||||
// Read list of characters
|
||||
for (m = 0; m < cipherList[i].cArr.length; m++) {
|
||||
// cArr_.push(String.fromCharCode(cipherList[i].cArr[m])) // character
|
||||
cArr_.push(cipherList[i].cArr[m]) // charcode
|
||||
}
|
||||
|
||||
// Read values for each character
|
||||
for (m = 0; m < cipherList[i].vArr.length; m++) {
|
||||
vArr_.push(cipherList[i].vArr[m])
|
||||
}
|
||||
|
||||
out +=
|
||||
'\tnew cipher(\n'+
|
||||
'\t\t"'+cipherList[i].cipherName+'",\n'+
|
||||
'\t\t"'+cipherList[i].cipherCategory+'",\n'+
|
||||
'\t\t'+cipherList[i].H+', '+cipherList[i].S+', '+cipherList[i].L+',\n'+
|
||||
'\t\t'+JSON.stringify(cArr_)+',\n'+
|
||||
'\t\t'+JSON.stringify(vArr_)+',\n'+
|
||||
'\t\t'+cipherList[i].diacriticsAsRegular+',\n'+
|
||||
'\t\t'+cipherList[i].enabled+',\n'+
|
||||
'\t\t'+cipherList[i].caseSensitive+'\n'+
|
||||
'\t),\n'
|
||||
}
|
||||
out = out.substring(0, out.length-2) + '\n]' // remove last comma and new line, close array
|
||||
console.log(out)
|
||||
|
||||
out = 'data:text/js;charset=utf-8,'+encodeURIComponent(out) // format as text file
|
||||
// ciphers_2021-03-26_10-23-52.js
|
||||
download("ciphers_"+getTimestamp()+".js", out); // download file
|
||||
}
|
||||
|
||||
function exportCiphersDB(expAllCiph = false) {
|
||||
var out = '// ciphers.js\n'
|
||||
out += exportCalcOptions()
|
||||
out += "cipherList = [\n"
|
||||
for (i = 0; i < cipherList.length; i++) {
|
||||
if (cipherList[i].enabled || expAllCiph) { // export only enabled ciphers
|
||||
var cArr_ = []
|
||||
var vArr_ = []
|
||||
|
||||
// Read list of characters
|
||||
for (m = 0; m < cipherList[i].cArr.length; m++) {
|
||||
// cArr_.push(String.fromCharCode(cipherList[i].cArr[m])) // character
|
||||
cArr_.push(cipherList[i].cArr[m]) // charcode
|
||||
}
|
||||
|
||||
// Read values for each character
|
||||
for (m = 0; m < cipherList[i].vArr.length; m++) {
|
||||
vArr_.push(cipherList[i].vArr[m])
|
||||
}
|
||||
|
||||
out +=
|
||||
'\tnew cipher(\n'+
|
||||
'\t\t"'+cipherList[i].cipherName+'",\n'+
|
||||
'\t\t"'+cipherList[i].cipherCategory+'",\n'+
|
||||
'\t\t'+cipherList[i].H+', '+cipherList[i].S+', '+cipherList[i].L+',\n'+
|
||||
'\t\t'+JSON.stringify(cArr_)+',\n'+
|
||||
'\t\t'+JSON.stringify(vArr_)+',\n'+
|
||||
'\t\t'+cipherList[i].diacriticsAsRegular+',\n'+
|
||||
'\t\t'+cipherList[i].enabled+',\n'+
|
||||
'\t\t'+cipherList[i].caseSensitive+'\n'+
|
||||
'\t),\n'
|
||||
}
|
||||
}
|
||||
out = out.substring(0, out.length-2) + '\n]' // remove last comma and new line, close array
|
||||
return out
|
||||
}
|
||||
|
||||
function exportCalcOptions() {
|
||||
var o = "calcOptions = [\n\t"
|
||||
for (var i = 0; i < calcOptionsArr.length; i++) {
|
||||
o += "\x22"+eval(calcOptionsArr[i])+"\x22,\n\t" // quotes - \x22
|
||||
}
|
||||
o = o.slice(0,-3) + "\n]\n" // remove comma, new line, tab; new line, close array, new line
|
||||
return o
|
||||
}
|
||||
|
||||
function exportHighlighterMatches(histArr) { // highlighter mode controls export mode
|
||||
if (histArr.length == 0) return
|
||||
if (optFiltCrossCipherMatch) {
|
||||
exportCrossCipherMatches(histArr)
|
||||
} else if (optFiltSameCipherMatch) {
|
||||
exportSameCipherMatches(histArr)
|
||||
}
|
||||
}
|
||||
|
||||
function exportSameCipherMatches(histArr) {
|
||||
var pVal = [] // 2d array, all phrase values in one cipher for each existing cipher (use index to get cipher name, use index to get phrase)
|
||||
var tmp = [] // gematria values for one phrase (all ciphers)
|
||||
var g
|
||||
|
||||
for (n = 0; n < cipherList.length; n++) { // for each enabled cipher
|
||||
tmp = [] // reset array
|
||||
for (i = 0; i < histArr.length; i++) { // for each phrase
|
||||
if (cipherList[n].enabled) {
|
||||
g = cipherList[n].calcGematria(histArr[i]) // gematria for current phrase in one cipher
|
||||
} else {
|
||||
g = 0 // value for disabled ciphers
|
||||
}
|
||||
tmp.push(g) // separate phrase array
|
||||
}
|
||||
pVal.push(tmp) // add cipher with gematria, pVal[0][1] is cipherList[0], histArr[1]
|
||||
}
|
||||
|
||||
var searchArr = [] // list of numbers that occur twice or more
|
||||
var matchArr = [] // array with matches within one cipher
|
||||
var o = '======= Same Cipher Match =======\n\n\n' // build string for output
|
||||
|
||||
for (p = 0; p < pVal.length; p++) { // for each cipher
|
||||
searchArr = [] // reset
|
||||
matchArr = countMatches(pVal[p]) // 2d array, number/amount of matches in one cipher
|
||||
|
||||
for (i = 0; i < matchArr.length; i++) { // for all available matches
|
||||
if (matchArr[i][1] >= 2) searchArr.push(matchArr[i][0]) // add those that occur twice or more
|
||||
}
|
||||
|
||||
searchArr.sort(function(a, b) { // sort ascending order
|
||||
return a - b; // b - a, for descending sort
|
||||
});
|
||||
if (searchArr[0] == 0) searchArr.splice(0,1) // remove zero (value for disabled ciphers)
|
||||
|
||||
for (i = 0; i < searchArr.length; i++) { // for each valid match
|
||||
o += searchArr[i] + ' (' + cipherList[p].cipherName + ')' // 30 (English Ordinal)
|
||||
o += '\n================================='
|
||||
for (n = 0; n < pVal[p].length; n++) { // for each value in current cipher
|
||||
if (pVal[p][n] == searchArr[i]) { // if gematria equals current searched number
|
||||
o += '\n"' + histArr[n] + '"' // add "phrase"
|
||||
}
|
||||
}
|
||||
o += '\n\n\n' // number added, new lines
|
||||
}
|
||||
}
|
||||
|
||||
o = o.substring(0, o.length-3) // remove last new lines
|
||||
|
||||
o = 'data:text/plain;charset=utf-8,'+encodeURIComponent(o) // format as text file
|
||||
download(getTimestamp()+"_Same_Cipher_Match_gematria.txt", o); // download file
|
||||
}
|
||||
|
||||
function exportCrossCipherMatches(histArr) { // maybe use highlighter mode to control behavior
|
||||
var allVal = [] // all gematria in one array
|
||||
var pVal = [] // 2d array, phrase [0], gematria value in cipher
|
||||
var tmp = [] // gematria values for one phrase (all ciphers)
|
||||
var g
|
||||
|
||||
for (i = 0; i < histArr.length; i++) { // for each phrase
|
||||
tmp = [histArr[i]] // reset array, add phrase at index 0
|
||||
for (n = 0; n < cipherList.length; n++) { // for each existing cipher
|
||||
if (cipherList[n].enabled) {
|
||||
g = cipherList[n].calcGematria(histArr[i]) // gematria for current cipher
|
||||
} else {
|
||||
g = 0 // zero value for disabled ciphers
|
||||
}
|
||||
tmp.push(g) // separate phrase array
|
||||
allVal.push(g) // all gematria array
|
||||
}
|
||||
pVal.push(tmp) // add phrase with gematria, cipher indices are offset +1
|
||||
}
|
||||
|
||||
var matchArr = countMatches(allVal) // 2d array, number/amount of matches
|
||||
var searchArr = [] // list of numbers that occur twice or more
|
||||
|
||||
for (i = 0; i < matchArr.length; i++) { // for all available matches
|
||||
if (matchArr[i][1] >= 2) searchArr.push(matchArr[i][0]) // add those that occur twice or more
|
||||
}
|
||||
|
||||
searchArr.sort(function(a, b) { // sort ascending order
|
||||
return a - b; // b - a, for descending sort
|
||||
});
|
||||
if (searchArr[0] == 0) searchArr.splice(0,1) // remove zero (value for disabled ciphers)
|
||||
|
||||
var nP = true // new phrase flag (used to add cipher names to existing matches)
|
||||
var o = '============ Cross Cipher Match ============\n\n\n' // build string for output
|
||||
for (i = 0; i < searchArr.length; i++) { // for each valid match
|
||||
o += searchArr[i] // number
|
||||
o += '\n============================================'
|
||||
for (n = 0; n < pVal.length; n++) { // for each phrase
|
||||
nP = true // new phrase
|
||||
for (m = 0; m < pVal[n].length; m++) { // for each gematria value
|
||||
if (pVal[n][m] == searchArr[i] && nP) { // if gematria equals searched number
|
||||
o += '\n"' + pVal[n][0] + '" (' + cipherList[m-1].cipherName + ')' // "phrase" (English Ordinal)
|
||||
nP = false // current phrase was added
|
||||
} else if (pVal[n][m] == searchArr[i] && !nP) { // same phrase, different cipher match
|
||||
o += ', (' + cipherList[m-1].cipherName + ')' // , (Reverse Ordinal)
|
||||
}
|
||||
}
|
||||
}
|
||||
o += '\n\n\n' // number added, new lines
|
||||
}
|
||||
o = o.substring(0, o.length-3) // remove last new lines
|
||||
|
||||
o = 'data:text/plain;charset=utf-8,'+encodeURIComponent(o) // format as text file
|
||||
download(getTimestamp()+"_Cross_Cipher_Match_gematria.txt", o); // download file
|
||||
}
|
||||
|
||||
// ======================== Color Conversion ========================
|
||||
// ------------ html2canvas has no support of HSL values ------------
|
||||
|
||||
function calcBGhtml2canvas() { // not used
|
||||
var element = document.querySelector('body')
|
||||
var compStyles = window.getComputedStyle(element)
|
||||
var bodyBg = compStyles.getPropertyValue('--body-bg-accent') // ' hsl(222 22% 16%)'
|
||||
var colArr = bodyBg.trim().split(" ") // remove leading/trailing spaces, split to array, space as delimiter
|
||||
for (i = 0; i < colArr.length; i++) {
|
||||
colArr[i] = Number( colArr[i].replace(/[^\d|^\.]/g, '') ) // remove anything that is not a digit or a literal dot, parse as number
|
||||
}
|
||||
return HSLtoRGB(colArr[0], colArr[1], colArr[2]) // rgb(32,37,50)
|
||||
}
|
||||
|
||||
function HSLtoRGB(h, s, l) {
|
||||
var hsv = HSLtoHSV(h, s, l)
|
||||
return HSVtoRGB(hsv.h, hsv.s, hsv.v)
|
||||
}
|
||||
|
||||
function HSLtoHSV(h, s, l) {
|
||||
h = h / 360, s = s / 100, l = l / 100;
|
||||
var _h = h,
|
||||
_s,
|
||||
_v;
|
||||
|
||||
l *= 2;
|
||||
s *= (l <= 1) ? l : 2 - l;
|
||||
_v = (l + s) / 2;
|
||||
_s = (2 * s) / (l + s);
|
||||
|
||||
return {
|
||||
h: _h * 360,
|
||||
s: _s * 100,
|
||||
v: _v * 100
|
||||
};
|
||||
}
|
||||
|
||||
function HSVtoRGB(h, s, v) {
|
||||
var r, g, b, i, f, p, q, t;
|
||||
h = h / 360, s = s / 100, v = v / 100;
|
||||
|
||||
i = Math.floor(h * 6);
|
||||
f = h * 6 - i;
|
||||
p = v * (1 - s);
|
||||
q = v * (1 - f * s);
|
||||
t = v * (1 - (1 - f) * s);
|
||||
switch (i % 6) {
|
||||
case 0: r = v, g = t, b = p; break;
|
||||
case 1: r = q, g = v, b = p; break;
|
||||
case 2: r = p, g = v, b = t; break;
|
||||
case 3: r = p, g = q, b = v; break;
|
||||
case 4: r = t, g = p, b = v; break;
|
||||
case 5: r = v, g = p, b = q; break;
|
||||
}
|
||||
return 'rgb('+Math.round(r * 255)+','+Math.round(g * 255)+','+Math.round(b * 255)+')'
|
||||
}
|
||||
@@ -0,0 +1,219 @@
|
||||
// ========================== Cipher Class ==========================
|
||||
|
||||
class cipher { // cipher constructor class
|
||||
constructor(ciphName, ciphCategory, col_H, col_S, col_L, ciphCharacterSet, ciphValues, diacriticsAsRegular = true, ciphEnabled = false, caseSensitive = false) {
|
||||
this.cipherName = ciphName // cipher name
|
||||
this.cipherCategory = ciphCategory // cipher category
|
||||
this.H = col_H // hue
|
||||
this.S = col_S // saturation
|
||||
this.L = col_L // lightness
|
||||
this.cArr = ciphCharacterSet // character array
|
||||
this.vArr = ciphValues // value array
|
||||
this.diacriticsAsRegular = diacriticsAsRegular // if true, characters with diactritic marks have the same value as regular ones
|
||||
this.caseSensitive = caseSensitive // capital letters have different values
|
||||
this.enabled = ciphEnabled // cipher state on/off
|
||||
this.cp = []; this.cv = []; this.sumArr = [] // cp - character position, cv - character value, sumArr - phrase gematria value
|
||||
}
|
||||
|
||||
calcGematria(gemPhrase) { // calculate gematria of a phrase
|
||||
var i, ch_pos, cur_char
|
||||
var gemValue = 0
|
||||
var n = 0
|
||||
|
||||
if (optAllowPhraseComments == true) { gemPhrase = gemPhrase.replace(/\[.+\]/g, '').trim() } // remove [...], leading/trailing spaces
|
||||
if (this.diacriticsAsRegular) gemPhrase = gemPhrase.normalize('NFD').replace(/[\u0300-\u036f]/g, "")
|
||||
if (this.caseSensitive == false) gemPhrase = gemPhrase.toLowerCase()
|
||||
|
||||
if (optGemSubstitutionMode) { // each character is substituted with a correspondent value
|
||||
for (i = 0; i < gemPhrase.length; i++) {
|
||||
cur_char = gemPhrase.charCodeAt(i)
|
||||
ch_pos = this.cArr.indexOf(cur_char)
|
||||
if (ch_pos > -1) { // append value for each found character
|
||||
gemValue += this.vArr[ch_pos]
|
||||
}
|
||||
}
|
||||
} else if (optGemMultCharPos) { // multiply each charater value based on character index
|
||||
for (i = 0; i < gemPhrase.length; i++) {
|
||||
cur_char = gemPhrase.charCodeAt(i)
|
||||
ch_pos = this.cArr.indexOf(cur_char)
|
||||
if (ch_pos > -1) { // append value for each found character
|
||||
n++
|
||||
gemValue += this.vArr[ch_pos] * n
|
||||
}
|
||||
}
|
||||
} else if (optGemMultCharPosReverse) { // multiply each charater value (reverse index)
|
||||
for (i = gemPhrase.length; i >= 0; i--) {
|
||||
cur_char = gemPhrase.charCodeAt(i)
|
||||
ch_pos = this.cArr.indexOf(cur_char)
|
||||
if (ch_pos > -1) { // append value for each found character
|
||||
n++
|
||||
gemValue += this.vArr[ch_pos] * n
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.cArr.indexOf(49) == -1) { // if cipher doesn't contain "1"
|
||||
if (optNumCalcMethod == 1) { // Full, treat consecutive digits as one number
|
||||
var cur_num = ""
|
||||
var digitArr = [48,49,50,51,52,53,54,55,56,57] // 0-9
|
||||
var nArr = [0,1,2,3,4,5,6,7,8,9]
|
||||
for (i = 0; i < gemPhrase.length; i++) {
|
||||
cur_char = gemPhrase.charCodeAt(i)
|
||||
if (digitArr.indexOf(cur_char) > -1) {
|
||||
cur_num += String(nArr[digitArr.indexOf(cur_char)]) // append consecutive digits
|
||||
} else if (cur_num.length > 0 && cur_char !== 44) { // exclude comma as number separator
|
||||
gemValue += Number(cur_num) // add value of the number
|
||||
cur_num = "" // reset
|
||||
}
|
||||
}
|
||||
if (cur_num.length > 0) {
|
||||
gemValue += Number(cur_num) // add last number if present
|
||||
}
|
||||
} else if (optNumCalcMethod == 2) { // Reduced, add each digit separately
|
||||
for (i = 0; i < gemPhrase.length; i++) {
|
||||
cur_char = gemPhrase.charCodeAt(i)
|
||||
if (cur_char > 47 && cur_char < 58) { // 48 to 57, 0-9
|
||||
gemValue += cur_char - 48
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return gemValue
|
||||
}
|
||||
|
||||
calcBreakdown(gemPhrase) { // character breakdown table
|
||||
var i, cIndex, wordSum //
|
||||
var lastSpace = true
|
||||
var n, nv // n - character for display, nv - charcode for calculation
|
||||
|
||||
// remove [...], separate brackets, leading/trailing spaces
|
||||
if (optAllowPhraseComments == true) { gemPhrase = gemPhrase.replace(/\[.+\]/g, '').replace(/\[/g, '').replace(/\]/g, '').trim() }
|
||||
|
||||
// character positions, character values, current number (if char is a digit)
|
||||
this.cp = []; this.cv = []; this.curNum = ""; this.LetterCount = 0
|
||||
|
||||
this.sumArr = []; wordSum = 0
|
||||
for (i = 0; i < gemPhrase.length; i++) {
|
||||
|
||||
n = gemPhrase.charCodeAt(i); // get charcode for each character in phrase
|
||||
|
||||
if (this.diacriticsAsRegular) { // if characters with diacritic marks are treated as regular characters
|
||||
nv = gemPhrase.substring(i,i+1).normalize('NFD').replace(/[\u0300-\u036f]/g, "")
|
||||
// console.log(gemPhrase.substring(i,i+1)+" ("+gemPhrase.substring(i,i+1).charCodeAt(0)+
|
||||
// ") -> "+String.fromCharCode(n).normalize('NFD').replace(/[\u0300-\u036f]/g, "")+" ("+String.fromCharCode(n).normalize('NFD').replace(/[\u0300-\u036f]/g, "").charCodeAt(0)+
|
||||
// ") -> "+String.fromCharCode(n).normalize('NFD').replace(/[\u0300-\u036f]/g, "").toLowerCase()+" -> "+String.fromCharCode(n).normalize('NFD').replace(/[\u0300-\u036f]/g, "").toLowerCase().charCodeAt(0) )
|
||||
} else {
|
||||
nv = gemPhrase.substring(i,i+1) // formatted charcode (lowercase) - for calculation
|
||||
// console.log(gemPhrase.substring(i,i+1)+" ("+gemPhrase.substring(i,i+1).charCodeAt(0)+
|
||||
// ") -> "+String.fromCharCode(n).toLowerCase()+" -> "+String.fromCharCode(n).toLowerCase().charCodeAt(0) )
|
||||
}
|
||||
if (this.caseSensitive == false) nv = nv.toLowerCase()
|
||||
nv = nv.charCodeAt(0)
|
||||
|
||||
if (n > 47 && n < 58 && this.cArr.indexOf(49) == -1) { // 0-9 digits, cipher doesn't contain "1"
|
||||
if (optNumCalcMethod == 1) { // Full
|
||||
this.curNum = String(this.curNum) + String(n - 48) // append digits
|
||||
if (lastSpace == false) {
|
||||
this.cp.push(" ")
|
||||
this.cv.push(" ")
|
||||
this.sumArr.push(wordSum)
|
||||
wordSum = 0
|
||||
lastSpace = true
|
||||
}
|
||||
} else if (optNumCalcMethod == 2) { // Reduced
|
||||
this.cp.push("num" + String(n - 48))
|
||||
this.cv.push(n - 48)
|
||||
this.curNum = String(n - 48)
|
||||
wordSum += n - 48
|
||||
lastSpace = false
|
||||
}
|
||||
|
||||
} else {
|
||||
if (optNumCalcMethod == 1) { // Full
|
||||
if (this.curNum.length > 0 & n !== 44) { // character is not "44" comma (digit separator)
|
||||
this.cp.push("num" + String(this.curNum), " ")
|
||||
this.cv.push(Number(this.curNum), " ")
|
||||
this.sumArr.push(Number(this.curNum))
|
||||
this.curNum = ""
|
||||
}
|
||||
}
|
||||
|
||||
cIndex = this.cArr.indexOf(nv) // index of current character in phrase inside all character arrays available for current cipher
|
||||
if (cIndex > -1) {
|
||||
lastSpace = false
|
||||
wordSum += this.vArr[cIndex]
|
||||
this.cp.push(n)
|
||||
this.LetterCount++
|
||||
this.cv.push(this.vArr[cIndex])
|
||||
} else if (n !== 39 && lastSpace == false) {
|
||||
this.sumArr.push(wordSum)
|
||||
wordSum = 0
|
||||
this.cp.push(" ")
|
||||
this.cv.push(" ")
|
||||
lastSpace = true
|
||||
}
|
||||
}
|
||||
}
|
||||
if (lastSpace == false) {this.sumArr.push(wordSum)} // add number value to phrase gematria
|
||||
if (this.curNum !== "") {
|
||||
if (optNumCalcMethod == 1) { // Full
|
||||
this.cp.push("num" + String(this.curNum))
|
||||
this.cv.push(Number(this.curNum))
|
||||
this.sumArr.push(Number(this.curNum)) // value of full number
|
||||
if (this.sumArr.length > 1) {
|
||||
this.cp.push(" ")
|
||||
this.cv.push(" ")
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.sumArr.length > 1 && lastSpace == false) {
|
||||
this.cp.push(" ")
|
||||
this.cv.push(" ")
|
||||
}
|
||||
|
||||
this.WordCount = this.sumArr.length // word count
|
||||
|
||||
if (optGemMultCharPos) { // multiply each charater value based on character index
|
||||
this.sumArr = [] // clear word sums
|
||||
wordSum = 0
|
||||
n = 0 // vaild character index (defined in cipher)
|
||||
for (i = 0; i < this.cp.length; i++) {
|
||||
if (typeof(this.cp[i]) == "number") { // character value, not "numXX"
|
||||
n++
|
||||
this.cv[i] *= n // multiply character value by position
|
||||
wordSum += this.cv[i]
|
||||
} else if (this.cp[i] == " ") { // space
|
||||
this.sumArr.push(wordSum)
|
||||
wordSum = 0 // reset
|
||||
} else if (typeof(this.cp[i]) == "string") { // numerical value "numXX"
|
||||
this.sumArr.push(this.cv[i]) // push number itself
|
||||
wordSum = 0 // reset
|
||||
}
|
||||
}
|
||||
if (wordSum !== 0) this.sumArr.push(wordSum) // last word value
|
||||
} else if (optGemMultCharPosReverse) { // multiply each charater value (reverse index)
|
||||
this.sumArr = [] // clear word sums
|
||||
wordSum = 0
|
||||
n = 0 // vaild character index (defined in cipher)
|
||||
var count = this.cp.length-1 // array index is one less
|
||||
if (this.cp[this.cp.length - 1] == " ") count = this.cp.length-2 // exclude last character if a space
|
||||
|
||||
for (i = count; i >= 0; i--) {
|
||||
if (typeof(this.cp[i]) == "number") { // character value, not "numXX"
|
||||
n++
|
||||
this.cv[i] *= n // multiply character value by position
|
||||
wordSum += this.cv[i]
|
||||
} else if (this.cp[i] == " ") { // space
|
||||
this.sumArr.unshift(wordSum) // insert in the beginning of array
|
||||
wordSum = 0 // reset
|
||||
} else if (typeof(this.cp[i]) == "string") { // numerical value "numXX"
|
||||
this.sumArr.unshift(this.cv[i]) // number itself
|
||||
wordSum = 0 // reset
|
||||
}
|
||||
}
|
||||
if (wordSum !== 0) this.sumArr.unshift(wordSum) // last word value
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,512 @@
|
||||
// ========================== Highlighter ===========================
|
||||
|
||||
function removeZeroHlt(arr) {
|
||||
for (p = 0; p < arr.length; p++) {
|
||||
if (arr[p] == 0) arr.splice(p,1) // remove zero
|
||||
}
|
||||
return arr
|
||||
}
|
||||
|
||||
function removeNotMatchingPhrases() {
|
||||
// highlight box values to array
|
||||
highlt = document.getElementById("highlightBox").value.replace(/ +/g," ") // get value, remove double spaces
|
||||
highlt_num = highlt.split(" ") // create array from string, space as delimiter
|
||||
highlt_num = highlt_num.map(function (x) { return parseInt(x, 10); }) // parse string array as integer array to exclude quotes
|
||||
highlt_num = removeZeroHlt(highlt_num)
|
||||
|
||||
// create a copy of history, since matching is destructive
|
||||
if (userHistory.length == 0) userHistory = [...sHistory] // don't make new copies until filter is reset
|
||||
|
||||
var phr_values = []
|
||||
var match = false
|
||||
var x = 0
|
||||
|
||||
// remove not matching phrases first
|
||||
while (x < sHistory.length) { // for each phrase in history
|
||||
|
||||
phr_values = [] // reinit
|
||||
match = false
|
||||
|
||||
for (i = 0; i < cipherList.length; i++) { // for each enabled cipher
|
||||
if (cipherList[i].enabled) {
|
||||
gemVal = cipherList[i].calcGematria(sHistory[x]) // value only
|
||||
phr_values.push(gemVal) // build an array of all gematria values of current phrase
|
||||
}
|
||||
}
|
||||
//console.log(phr_values)
|
||||
for (z = 0; z < highlt_num.length; z++) { // for each value to be highlighted
|
||||
if (phr_values.indexOf(highlt_num[z]) > -1 && !match) { // if value is present in any gematria cipher
|
||||
match = true // if match is found
|
||||
}
|
||||
}
|
||||
//console.log(match)
|
||||
if (!match) { // if no match is found, don't do x++ as array indices shift
|
||||
//console.log("removed: '"+sHistory[x]+"'")
|
||||
sHistory.splice(x,1) // remove phrase
|
||||
} else {
|
||||
x++ // check next item if match is found
|
||||
}
|
||||
}
|
||||
|
||||
if (optFiltCrossCipherMatch) {
|
||||
// make a copy of user's choice of ciphers
|
||||
if (userOpenCiphers.length == 0) { // don't make new copies until filter is reset
|
||||
//userOpenCiphers = [...openCiphers]
|
||||
// tmp
|
||||
for (i = 0; i < cipherList.length; i++) {
|
||||
//tmp = Object.assign({}, cipherList[i]);
|
||||
userOpenCiphers.push(cipherList[i].enabled); // save state for each cipher
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < cipherList.length; i++) { // for each enabled cipher
|
||||
if (cipherList[i].enabled) {
|
||||
var ciph_values = [] // init
|
||||
match = false
|
||||
|
||||
for (x = 0; x < sHistory.length; x++) { // for each phrase
|
||||
ciph_values.push(cipherList[i].calcGematria(sHistory[x]))
|
||||
}
|
||||
|
||||
for (z = 0; z < highlt_num.length; z++) { // for each value to be highlighted
|
||||
if (ciph_values.indexOf(highlt_num[z]) > -1 && !match) { // if any value is found for that cipher
|
||||
match = true // match is found
|
||||
}
|
||||
}
|
||||
|
||||
if (!match) { // if no match is found
|
||||
//console.log(" disabled: '"+ciphersOn[i].Nickname+"'")
|
||||
valueToRemove = cipherList[i].cipherName
|
||||
//openCiphers = openCiphers.filter(function(item) { // list of active ciphers
|
||||
// return item !== valueToRemove // remove current cipher
|
||||
//})
|
||||
for (n = 0; n < cipherList.length; n++) {
|
||||
if (cipherList[n].enabled) {
|
||||
//console.log(cipherList[n].cipherName+" == "+valueToRemove)
|
||||
if (cipherList[n].cipherName == valueToRemove) {
|
||||
cipherList[n].enabled = false // disable cipher
|
||||
cur_chkbox = document.getElementById("cipher_chkbox"+n)
|
||||
if (cur_chkbox !== null) { cur_chkbox.checked = !cur_chkbox.checked; } // update checkbox if visible
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
updateEnabledCipherTable() // update ciphers
|
||||
}
|
||||
|
||||
if (optFiltSameCipherMatch) {
|
||||
|
||||
// mark all phrases to false
|
||||
// search each column for unique
|
||||
// for each unique, if more than 1 match mark phrases as true, if none are found remove cipher
|
||||
// build new history with phrases marked as true
|
||||
|
||||
// check each entered value for each cipher column (all phrases)
|
||||
// if number matches in that column twice or more mark XY coordinates for highlighter
|
||||
// if number is found only once ignore it in that column, repeat for all columns
|
||||
// openHistory table and adjust alpha channel color for each cell based on XY
|
||||
// it will be a 2D array of true/false, true are bright, false are darkened
|
||||
|
||||
// make a copy of user's choice of ciphers
|
||||
if (userOpenCiphers.length == 0) { // don't make new copies until filter is reset
|
||||
for (i = 0; i < cipherList.length; i++) {
|
||||
userOpenCiphers.push(cipherList[i].enabled); // save state for each cipher
|
||||
}
|
||||
}
|
||||
|
||||
var phrase_match = Array(sHistory.length).fill(false); // mark phrases that match in same cipher, same value
|
||||
//console.log("phrase_match:"+JSON.stringify(phrase_match))
|
||||
|
||||
for (var i = 0; i < cipherList.length; i++) { // for each enabled cipher, var i - so it can be referenced later
|
||||
if (cipherList[i].enabled) {
|
||||
|
||||
var ciph_values = [] // values for each phrase in one cipher
|
||||
var ciph_matches = [] // frequency of matches in one cipher
|
||||
|
||||
for (x = 0; x < sHistory.length; x++) { // for each phrase
|
||||
ciph_values.push(cipherList[i].calcGematria(sHistory[x])) // add value for that phrase
|
||||
}
|
||||
|
||||
ciph_matches = countMatches(ciph_values) // number of occurrences of values
|
||||
//console.log("ciph_values:"+JSON.stringify(ciph_values))
|
||||
//console.log("ciph_matches:"+JSON.stringify(ciph_matches))
|
||||
|
||||
var cipher_has_no_matches = true
|
||||
for (n = 0; n < ciph_matches.length; n++) { // for each value in cipher column
|
||||
if (ciph_matches[n][1] > 1) { // if 2 or more matches are available
|
||||
for (x = 0; x < sHistory.length; x++) { // for each phrase
|
||||
if (cipherList[i].calcGematria(sHistory[x]) == ciph_matches[n][0] &&
|
||||
highlt_num.indexOf(cipherList[i].calcGematria(sHistory[x])) > -1) { // if gematria for phrase matches given number and number is in highlight box
|
||||
phrase_match[x] = true // mark phrase as matching
|
||||
cipher_has_no_matches = false // cipher doesn't need to be disabled
|
||||
//console.log(sHistory[x]+" ("+ciphersOn[i].Nickname+") = "+ciphersOn[i].Gematria(sHistory[x], 2, false, true)+" - marked as 'true'")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (cipher_has_no_matches) { // remove current cipher if no phrases match with same value
|
||||
valueToRemove = cipherList[i].cipherName
|
||||
for (n = 0; n < cipherList.length; n++) {
|
||||
if (cipherList[n].cipherName == valueToRemove) {
|
||||
cipherList[n].enabled = false // disable cipher
|
||||
cur_chkbox = document.getElementById("cipher_chkbox"+n)
|
||||
if (cur_chkbox !== null) cur_chkbox.checked = !cur_chkbox.checked // update checkbox if visible
|
||||
}
|
||||
}
|
||||
//console.log("'"+cipherList[i].cipherName+"' was disabled")
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
var matchingPhrases = []
|
||||
for (m = 0; m < phrase_match.length; m++) { // for each phrase checked
|
||||
if (phrase_match[m] == true) { // add if matching
|
||||
matchingPhrases.push(sHistory[m])
|
||||
}
|
||||
}
|
||||
|
||||
sHistory = matchingPhrases // switch sHistory to set of phrases that match
|
||||
// console.log("sHistory:")
|
||||
// console.log(sHistory)
|
||||
|
||||
// columns of cipher values
|
||||
v_grid_col = [] // 2D array, columns of gematria values for enabled ciphers for all matching phrases
|
||||
tmp_arr = [] // all gematria values for one phrase
|
||||
for (n = 0; n < cipherList.length; n++) { // for each enabled cipher
|
||||
if (cipherList[n].enabled) {
|
||||
tmp_arr = [] // reset
|
||||
for (z = 0; z < sHistory.length; z++) { // for each phrase
|
||||
tmp_arr.push(cipherList[n].calcGematria(sHistory[z])) // add each gematria value for that phrase
|
||||
}
|
||||
v_grid_col.push(tmp_arr) // add row with all values for current phrase
|
||||
}
|
||||
}
|
||||
// console.log("v_grid_col:")
|
||||
// console.log(v_grid_col)
|
||||
|
||||
updateEnabledCipherCount() // get number of enabled ciphers
|
||||
|
||||
hltBoolArr = [] // highlight boolean array [phrase][cipher]
|
||||
tmpArr = []
|
||||
for (n = 0; n < sHistory.length; n++) { // for each phrase
|
||||
tmpArr = new Array(enabledCiphCount).fill(false) // for each cipher
|
||||
hltBoolArr.push(tmpArr) // add to array
|
||||
}
|
||||
|
||||
// n - cipher, m/z - phrase
|
||||
for (n = 0; n < v_grid_col.length; n++) { // for each column (cipher)
|
||||
for (m = 0; m < v_grid_col[n].length; m++) { // for each value in column (phrase)
|
||||
if (highlt_num.indexOf(v_grid_col[n][m]) > -1) { // if value is in highlight box
|
||||
for (z = m+1; z < v_grid_col[n].length; z++) { // compare vs other values in same column
|
||||
if (v_grid_col[n][m] == v_grid_col[n][z]) { // if value matches another value
|
||||
hltBoolArr[m][n] = true // mark both as values to be highlighted
|
||||
hltBoolArr[z][n] = true // [phrase][cipher]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// console.log("hltBoolArr:")
|
||||
// console.log(hltBoolArr)
|
||||
|
||||
updateEnabledCipherTable() // update ciphers
|
||||
}
|
||||
|
||||
var o = '<input id="btn-clear-active-filter" type="button" value="X" onclick="removeActiveFilter();displayCipherCatDetailed(cCat[0]);"/>'
|
||||
$("#clearFilterButton").html(o) // clear active filter button
|
||||
|
||||
autoHistoryTableLayout()
|
||||
if (optFiltSameCipherMatch) {
|
||||
updateHistoryTable(hltBoolArr) // rebuild table, pass boolean array for highlighting
|
||||
} else if (optFiltCrossCipherMatch) {
|
||||
updateHistoryTable()
|
||||
}
|
||||
}
|
||||
|
||||
function updateHistoryTableSameCiphMatch() {
|
||||
|
||||
highlt = document.getElementById("highlightBox").value.replace(/ +/g," ") // get value of Highlight textbox, remove double spaces
|
||||
|
||||
highlt_num = highlt.split(" "); // create array, space delimited numbers
|
||||
highlt_num = highlt_num.map(function (e) { return parseInt(e, 10); }) // parse string array as integer array to exclude quotes
|
||||
highlt_num = removeZeroHlt(highlt_num)
|
||||
// console.log("highlt_num:")
|
||||
// console.log(highlt_num)
|
||||
|
||||
// columns of cipher values
|
||||
v_grid_col = [] // 2D array, columns of gematria values for enabled ciphers for all matching phrases
|
||||
tmp_arr = [] // all gematria values for one phrase
|
||||
for (n = 0; n < cipherList.length; n++) { // for each enabled cipher
|
||||
if (cipherList[n].enabled) {
|
||||
tmp_arr = [] // reset
|
||||
for (z = 0; z < sHistory.length; z++) { // for each phrase
|
||||
tmp_arr.push(cipherList[n].calcGematria(sHistory[z])) // add each gematria value for that phrase
|
||||
}
|
||||
v_grid_col.push(tmp_arr) // add row with all values for current phrase
|
||||
}
|
||||
}
|
||||
// console.log("v_grid_col:")
|
||||
// console.log(v_grid_col)
|
||||
|
||||
hltBoolArr = [] // highlight boolean array [phrase][cipher]
|
||||
tmpArr = []
|
||||
for (n = 0; n < sHistory.length; n++) { // for each phrase
|
||||
tmpArr = new Array(enabledCiphCount).fill(false) // for each cipher
|
||||
hltBoolArr.push(tmpArr) // add to array
|
||||
}
|
||||
|
||||
// n - cipher, m/z - phrase
|
||||
for (n = 0; n < v_grid_col.length; n++) { // for each column (cipher)
|
||||
for (m = 0; m < v_grid_col[n].length; m++) { // for each value in column (phrase)
|
||||
if (highlt_num.indexOf(v_grid_col[n][m]) > -1) { // if value is in highlight box
|
||||
for (z = m+1; z < v_grid_col[n].length; z++) { // compare vs other values in same column
|
||||
// if value matches another value in the same column and is present in highlight box
|
||||
if (v_grid_col[n][m] == v_grid_col[n][z]) {
|
||||
hltBoolArr[m][n] = true // mark both as values to be highlighted
|
||||
hltBoolArr[z][n] = true // [phrase][cipher]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// console.log("hltBoolArr:")
|
||||
// console.log(hltBoolArr)
|
||||
|
||||
updateHistoryTable(hltBoolArr) // rebuild table, same cipher match
|
||||
}
|
||||
|
||||
function removeActiveFilter() {
|
||||
$("#clearFilterButton").html("") // remove clear button
|
||||
$("#highlightBox").val("") // clear highlightBox box
|
||||
|
||||
for (i = 0; i < userOpenCiphers.length; i++) {
|
||||
cipherList[i].enabled = userOpenCiphers[i];
|
||||
}
|
||||
|
||||
sHistory = [...userHistory] // restore user history table
|
||||
userHistory = [] // clear snapshot of user history
|
||||
userOpenCiphers = [] // clear snapshot of user ciphers
|
||||
|
||||
updateEnabledCipherTable() // update ciphers
|
||||
autoHistoryTableLayout()
|
||||
updateHistoryTable() // update history
|
||||
}
|
||||
|
||||
// number of items in array
|
||||
function countMatches(arr) {
|
||||
var values = []
|
||||
var counts = []
|
||||
var index = 0
|
||||
|
||||
for (i = 0; i < arr.length; i++) {
|
||||
index = values.indexOf(arr[i])
|
||||
if (index == -1) { // new value
|
||||
values.push(arr[i]) // add entry
|
||||
counts.push(1) // first occurrence
|
||||
} else { // if same value found again
|
||||
counts[index] += 1 // increment number of matches
|
||||
}
|
||||
}
|
||||
|
||||
var result = [] // frequency of matches
|
||||
var tmp = []
|
||||
|
||||
for (i = 0; i < values.length; i++) { // join values and counts
|
||||
tmp = new Array(values[i], counts[i])
|
||||
result.push(tmp)
|
||||
}
|
||||
|
||||
return result // 2D array [number, frequency]
|
||||
}
|
||||
|
||||
function updateHistoryTableAutoHlt() {
|
||||
var x, y, aCipher, gemVal
|
||||
|
||||
var rows_arr = [] // array of arrays, each array (row) has gematria values for a single phrase
|
||||
var phrase_values = [] // array of gematria values for a single phrase
|
||||
avail_match = [] // reinit (var declared in highlighter.js)
|
||||
avail_match_freq = [] // var declared in highlighter.js
|
||||
|
||||
if (sHistory.length == 0) {return}
|
||||
|
||||
if (optFiltSameCipherMatch) { // phrases that have the same value in the same cipher
|
||||
|
||||
var cols_arr = [] // array of arrays, each array (COLUMN) has gematria values for a each phrase in one cipher
|
||||
var cipher_values = [] // values for each phrase in one cipher
|
||||
|
||||
for (y = 0; y < cipherList.length; y++) {
|
||||
if (cipherList[y].enabled) { // for each enabled cipher
|
||||
for (x = 0; x < sHistory.length; x++) { // calculate gematria for all phrases
|
||||
gemVal = cipherList[y].calcGematria(sHistory[x]) // value only
|
||||
cipher_values.push(gemVal) // append all values of this phrase
|
||||
}
|
||||
cols_arr.push(cipher_values) // append all values of each phrase
|
||||
cipher_values = [] // reinit
|
||||
}
|
||||
}
|
||||
// console.log("cols_arr:")
|
||||
// console.log(cols_arr)
|
||||
|
||||
var col_matches = [] // frequency of values within one cipher for all phrases
|
||||
for (q = 0; q < cols_arr.length; q++) { // for each enabled cipher (column), using "i" created some impossible infinte loop bug
|
||||
col_matches = []
|
||||
col_matches = countMatches(cols_arr[q]) // find matches within the same cipher
|
||||
// console.log(col_matches)
|
||||
for (n = 0; n < col_matches.length; n++) { // for each value in match array
|
||||
if (col_matches[n][1] > 1) { // if 2 or more matches are available
|
||||
if (avail_match.indexOf(col_matches[n][0]) == -1) avail_match.push(col_matches[n][0]) // add new value to list of valid matches
|
||||
}
|
||||
}
|
||||
}
|
||||
// console.log("avail_match:")
|
||||
// console.log(avail_match)
|
||||
|
||||
avail_match.sort(function(a, b) { // sort ascending order
|
||||
return a - b; // b - a, for descending sort
|
||||
});
|
||||
if (avail_match[0] == 0) avail_match.splice(0,1) // remove zero
|
||||
|
||||
console.log(JSON.stringify(avail_match).replace(/,/g, " ").slice(1, -1)) // print available matches
|
||||
//console.log(JSON.stringify(freq).replace(/\],\[/g, "\n").slice(2, -2)) // print frequency of available matches
|
||||
|
||||
// paste available values inside Highlight textbox
|
||||
str = JSON.stringify(avail_match).replace(/,/g, " ") // replace comma with space
|
||||
substr = str.substring(1, str.length - 1) // remove brackets
|
||||
|
||||
document.getElementById("highlightBox").value = substr // populate highlight box
|
||||
|
||||
updateHistoryTableSameCiphMatch() // update table
|
||||
|
||||
//freq = [] // frequency of matches found with auto highlighter
|
||||
// freq needs different logic for same cipher match
|
||||
return
|
||||
|
||||
}
|
||||
|
||||
for (x = 0; x < sHistory.length; x++) { // calculate gematria for all phrases
|
||||
for (y = 0; y < cipherList.length; y++) {
|
||||
if (cipherList[y].enabled) {
|
||||
aCipher = cipherList[y]
|
||||
gemVal = aCipher.calcGematria(sHistory[x]) // value only
|
||||
phrase_values.push(gemVal) // append all values of this phrase
|
||||
}
|
||||
}
|
||||
rows_arr.push(phrase_values) // append all values of each phrase
|
||||
phrase_values = [] // reinit
|
||||
}
|
||||
|
||||
//auto highlighter, all available values
|
||||
var this_row = [] // match this row
|
||||
var against_row = [] // against another row
|
||||
var val = 0 // value that is checked (try "")
|
||||
|
||||
var p = 0 // position (column) in against_row
|
||||
var index = 0 // index of val in array of previously found matches
|
||||
|
||||
var n_rows = rows_arr.length // number of phrases
|
||||
var n_cols = rows_arr[0].length // number of values (ciphers) for each phrase (same value)
|
||||
|
||||
var steps = 0 // number of steps taken
|
||||
|
||||
for (i = 0; i < n_rows; i++) { // loop array
|
||||
this_row = rows_arr[i] // select row with phrase values
|
||||
for (n = 0; n < n_cols; n++) {
|
||||
val = this_row[n] // take the first value of the first phrase
|
||||
if (val > 0 && avail_match.indexOf(val) == -1) { // ignore zero, take value that hasn't been checked
|
||||
//console.log("# row:"+(i+1)+" column:"+(n+1)+" value:"+val)
|
||||
for (m = i+1; m < n_rows; m++) { // loop array again to find matches, start check from the next row
|
||||
against_row = rows_arr[m] // select another row
|
||||
p = 0 // reset position in row
|
||||
while (p < n_cols) { // loop values in that row
|
||||
steps++
|
||||
if (val == against_row[p]) { // if matching value is found in other rows (phrases)
|
||||
index = avail_match.indexOf(val) // save index
|
||||
//console.log(" matches with:"+against_row[p]+" at "+(m+1)+":"+(p+1)) // at row/column
|
||||
if (index == -1) { // if value is not in array of available matches yet
|
||||
avail_match.push(val) // push to array, so number is not selected again during the first (selection) loop of the array
|
||||
avail_match_freq.push(2) // first match means 2 values were found
|
||||
//console.log(" new value found, making a new array to count "+against_row[p])
|
||||
//console.log(" "+against_row[p]+" has position "+avail_match.indexOf(val)+" in "+JSON.stringify(avail_match))
|
||||
} else { // if value already exists in array of matches
|
||||
avail_match_freq[index] += 1 // increment number of occurrencies found at correspondent index
|
||||
//console.log(" found match at "+(m+1)+":"+(p+1)+" incrementing "+against_row[p]+" to "+avail_match_freq[index])
|
||||
}
|
||||
if (m+1 < n_rows) { // switch to next row (if possible) after match is found
|
||||
m++
|
||||
against_row = rows_arr[m] // against_row = rows_arr[m+1] - gets stuck in an infinite increment loop
|
||||
p = 0 // switch to first value in next row
|
||||
} else {
|
||||
break // break infinite loop on the last row check
|
||||
}
|
||||
} else {
|
||||
p++ // if no match is found, check next value of the same row
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
console.log("rows:"+n_rows+" columns:"+n_cols+" values:"+(n_rows*n_cols)+" steps_taken:"+steps)
|
||||
|
||||
freq = [] // frequency of matches found with auto highlighter (var declared in ijavaNGG.js)
|
||||
var tmp = []
|
||||
for (i = 0; i < avail_match.length; i++) { // join values and frequency
|
||||
tmp = new Array(avail_match[i],avail_match_freq[i])
|
||||
freq.push(tmp)
|
||||
}
|
||||
|
||||
freq.sort(function(a, b) {
|
||||
return a[1] - b[1]; // sort based on index 1 values ("freq" is array of arrays), (b-a) descending order, (a-b) ascending
|
||||
});
|
||||
|
||||
avail_match.sort(function(a, b) { // sort ascending order
|
||||
return a - b; // b - a, for descending sort
|
||||
});
|
||||
|
||||
console.log(JSON.stringify(avail_match).replace(/,/g, " ").slice(1, -1)) // print available matches
|
||||
console.log(JSON.stringify(freq).replace(/\],\[/g, "\n").slice(2, -2)) // print frequency of available matches
|
||||
|
||||
// paste available values inside Highlight textbox
|
||||
str = JSON.stringify(avail_match).replace(/,/g, " ") // replace comma with space
|
||||
substr = str.substring(1, str.length - 1) // remove brackets
|
||||
document.getElementById("highlightBox").value = substr
|
||||
|
||||
updateHistoryTable() // update table
|
||||
}
|
||||
|
||||
// add number to Highlight box (history table is rebuilt)
|
||||
function tdToggleHighlight(val){ // click on value in history table to toggle highlighter
|
||||
//console.log('Clicked on: '+val)
|
||||
highlt = document.getElementById("highlightBox").value.replace(/ +/g," ") // get value, remove double spaces
|
||||
lastchar = highlt.substring(highlt.length-1,highlt.length)
|
||||
|
||||
highlt_num = highlt.split(" ") // create array, space delimited numbers
|
||||
highlt_num = highlt_num.map(function (x) { return parseInt(x, 10); }) // parse string array as integer array to exclude quotes
|
||||
highlt_num = removeZeroHlt(highlt_num)
|
||||
|
||||
var ind = highlt_num.indexOf(val) // val needs to be an integer
|
||||
//console.log("val:"+val+" ind:"+ind+" highlt_num:"+JSON.stringify(highlt_num))
|
||||
|
||||
// disable
|
||||
var hlt_val
|
||||
if (ind > -1) { // if value is present
|
||||
highlt_num.splice(ind,1) // remove value
|
||||
hlt_val = JSON.stringify(highlt_num).replace(/,/g, " ") // to string
|
||||
hlt_val = hlt_val.substring(1, hlt_val.length-1) // remove brackets
|
||||
document.getElementById("highlightBox").value = hlt_val // update values inside textbox
|
||||
if (optFiltCrossCipherMatch) { updateHistoryTable(); } else { updateHistoryTableSameCiphMatch(); }
|
||||
return
|
||||
}
|
||||
|
||||
// enable
|
||||
if (lastchar !== " " && highlt.length > 0) {
|
||||
document.getElementById("highlightBox").value += " " // append space if necessary
|
||||
}
|
||||
document.getElementById("highlightBox").value += val // append clicked value to Highlight textbox
|
||||
if (optFiltCrossCipherMatch) { updateHistoryTable(); } else { updateHistoryTableSameCiphMatch(); }
|
||||
};
|
||||
@@ -0,0 +1,5 @@
|
||||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>Hyperdope Gematria Calculator</title>
|
||||
<meta http-equiv="refresh" content="0; URL=https://www.hyperdope.com">
|
||||
<link rel="canonical" href="https://www.hyperdope.com">
|
||||
@@ -0,0 +1,708 @@
|
||||
// ==================================================================
|
||||
// breakdown.js
|
||||
|
||||
var breakCipher = "English Ordinal" // current cipher for breakdown
|
||||
var bgCol = "var(--breakdown-bg-accent)" // breakdown table background color
|
||||
var chLimit = 30 // character limit, used to switch to a long breakdown style
|
||||
var maxRowWidth = 36 // one row character limit (long breakdown)
|
||||
|
||||
$(document).ready(function(){
|
||||
// update breakdown on mouse enter/leave/click events
|
||||
$("body").on("mouseenter", ".phraseGemCiphName", function () {
|
||||
updateWordBreakdown($(this).text(), false);
|
||||
});
|
||||
$("body").on("mouseleave", ".phraseGemCiphName", function () {
|
||||
updateWordBreakdown();
|
||||
});
|
||||
$("body").on("click", ".phraseGemCiphName", function () {
|
||||
updateWordBreakdown($(this).text(), true);
|
||||
});
|
||||
});
|
||||
|
||||
// ==================================================================
|
||||
// coderain.js
|
||||
|
||||
var code_rain; // var to clear interval
|
||||
var height_html, canvas, ctx
|
||||
var w, h, ypos
|
||||
|
||||
// ==================================================================
|
||||
// database.js
|
||||
|
||||
var pArr = [] // used to match numerical values
|
||||
var mArr = [] // phrases returned by the match function
|
||||
var gemArr = [] // phrase values for enabled ciphers
|
||||
var gemArrCiph = [] // enabled ciphers indices
|
||||
var numericalMode // boolean flag, match numbers instead of phrase gematria
|
||||
|
||||
var userDB = [] // imported database
|
||||
var userDBlive = [] // imported live database (phrases only)
|
||||
var queryResult = [] // matching phrases
|
||||
var queryResultInitial = [] // matching phrases (used to reset search bar results)
|
||||
var precalcDBLoaded = false // if precalculated database is loaded, disable cipher rearrangement
|
||||
var searchBarValue = '' // search bar value
|
||||
|
||||
$(document).ready(function(){
|
||||
// Scroll inside table
|
||||
$("body").on("wheel", "#QueryTable", function (event) {
|
||||
st = $("#QueryTable").data("startpos")
|
||||
n = $("#QueryTable").data("dispitems")
|
||||
|
||||
if (event.originalEvent.deltaY < 0) { // down -100, up 100
|
||||
if (st-dbScrollItems >= 0) {
|
||||
$("#queryArea").html() // clear previous table
|
||||
updateDatabaseQueryTable(st-dbScrollItems, n) // redraw table at new position
|
||||
}
|
||||
} else { // scroll up
|
||||
if (st+dbPageItems < queryResult.length) {
|
||||
$("#queryArea").html() // clear previous table
|
||||
updateDatabaseQueryTable(st+dbScrollItems, n) // redraw table at new position
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Up and Down arrow keys, List table
|
||||
$("body").on("keydown", "#queryPosInput", function (e) {
|
||||
// step="'+dbPageItems+'" min="0" max="'+queryResult.length+'"
|
||||
if (e.which == 38) queryShowPrevPage() // Up
|
||||
if (e.which == 40) queryShowNextPage() // Down
|
||||
});
|
||||
|
||||
// Enter query starting position
|
||||
$("body").on("change", "#queryPosInput", function () {
|
||||
st = Number( $(this).val().replace(/[^\d]/g, '') ) // remove anything that is not a digit
|
||||
if ( isNaN(st) ) return // non numerical input
|
||||
if (st < 0) {
|
||||
st = 0
|
||||
$(this).val(0)
|
||||
} else if (st >= queryResult.length) {
|
||||
st = queryResult.length - (queryResult.length % dbPageItems) // last page
|
||||
if (queryResult.length % dbPageItems == 0) st -= dbPageItems // if total is divisible, no pagination for last element
|
||||
$(this).val(st);
|
||||
}
|
||||
n = $("#QueryTable").data("dispitems")
|
||||
$("#queryArea").html() // clear previous table
|
||||
updateDatabaseQueryTable(st, n) // redraw table at new position
|
||||
});
|
||||
|
||||
// Change of scrollbar position
|
||||
$("body").on("input", "#queryScrollbar", function () {
|
||||
st = $(this).val() * dbPageItems
|
||||
n = $("#QueryTable").data("dispitems")
|
||||
$("#queryArea").html() // clear previous table
|
||||
updateDatabaseQueryTable(st, n, true) // update only the table at new position
|
||||
});
|
||||
$("body").on("change", "#queryScrollbar", function () {
|
||||
document.getElementById("queryPosInput").focus() // restore focus after using scrollbar
|
||||
});
|
||||
|
||||
// Search bar
|
||||
$("body").on("keydown", "#querySearchInput", function () {
|
||||
if ( event.which == 46 ) { // "Delete" - clear box
|
||||
searchBarDBQuery('');
|
||||
return;
|
||||
}
|
||||
if ( event.which == 13 ) { // "Enter" - search
|
||||
searchBarDBQuery($(this).val());
|
||||
}
|
||||
});
|
||||
|
||||
// Click on minimize button
|
||||
$("body").on("click", "#queryMinBtn", function () {
|
||||
$("#queryArea").toggleClass("minimizeQuery")
|
||||
});
|
||||
});
|
||||
|
||||
// ==================================================================
|
||||
// date-calc.js
|
||||
|
||||
$(document).ready(function(){
|
||||
$("body").on("input", ".dateInput, .dateInputYear", function () {
|
||||
// id = $(this).attr('id');
|
||||
// val = $(this).val();
|
||||
// console.log('id:'+id+' value:'+val);
|
||||
offsetYMWD = [0,0,0,0] // reset offset controls
|
||||
$('#offsetY').val(0)
|
||||
$('#offsetM').val(0)
|
||||
$('#offsetW').val(0)
|
||||
$('#offsetD').val(0)
|
||||
endChkEnabled = true // allow to toggle checkbox
|
||||
$('#chkbox_incEndDate').prop("disabled", "")
|
||||
$('#chkbox_excStartDate').prop("disabled", "")
|
||||
if ( $(this).val().length > 0 ) updDates(false, $(this).attr('class')); // if input not empty
|
||||
});
|
||||
$("body").on("input", ".offsetDateInput", function () { // if input from add/subtract controls
|
||||
offY = Number( $('#offsetY').val() );
|
||||
offM = Number( $('#offsetM').val() );
|
||||
offW = Number( $('#offsetW').val() );
|
||||
offD = Number( $('#offsetD').val() );
|
||||
offsetYMWD[0] = offY; // store offset values
|
||||
offsetYMWD[1] = offM;
|
||||
offsetYMWD[2] = offW;
|
||||
offsetYMWD[3] = offD;
|
||||
// calculate offset from date 1, years and months first
|
||||
saved_d2 = new Date( saved_d1.getFullYear() + offY, saved_d1.getMonth() + offM, saved_d1.getDate());
|
||||
if (saved_d2.getDate() !== saved_d1.getDate()) {
|
||||
// if January 31st translated to March 3/2, subtract date from itself (3-3 or 2-2) to get February 28/29
|
||||
saved_d2 = new Date(saved_d2.getFullYear(), saved_d2.getMonth(), saved_d2.getDate() - saved_d2.getDate())
|
||||
}
|
||||
// calculate offset for weeks and days
|
||||
saved_d2 = new Date( saved_d2.getFullYear(), saved_d2.getMonth(), saved_d2.getDate() + (offW*7) + offD );
|
||||
|
||||
endDate = 0 // exclude end date from calculation (makes no sense for offset mode)
|
||||
$('#chkbox_incEndDate').prop("checked", "") // uncheck box
|
||||
$('#chkbox_excStartDate').prop("checked", "") // uncheck box
|
||||
endChkEnabled = false // don't allow to toggle checkbox
|
||||
$('#chkbox_incEndDate').prop("disabled", "disabled")
|
||||
$('#chkbox_excStartDate').prop("disabled", "disabled")
|
||||
|
||||
updDates(true); // date offset mode
|
||||
});
|
||||
$("body").on("click", ".dateDurLine", function () { // left click - toggle highlight
|
||||
$(this).toggleClass('highlightDurLine');
|
||||
});
|
||||
$("body").on("contextmenu", ".dateDurLine", function () { // right click - remove line
|
||||
$(this).parent().remove();
|
||||
return false; // don't show menus
|
||||
});
|
||||
$("body").on("input", "#dateDesc1, #dateDesc2", function () { // store user date descriptions
|
||||
dateDesc1Saved = document.getElementById("dateDesc1").value
|
||||
dateDesc2Saved = document.getElementById("dateDesc2").value
|
||||
});
|
||||
});
|
||||
|
||||
var saved_d1 = new Date() // initial value - current system time (today)
|
||||
var saved_d2 = new Date(saved_d1) // initial value
|
||||
|
||||
var reset_d1 = new Date(saved_d1) // values for date reset
|
||||
var reset_d2 = new Date(saved_d2)
|
||||
|
||||
var dateDesc1Saved = "From" // date descriptions
|
||||
var dateDesc2Saved = "to"
|
||||
|
||||
var offsetYMWD = [0,0,0,0] // store values for date offset controls
|
||||
|
||||
var endDate = 0 // set to 1 to include end date, -1 to exclude start date
|
||||
var endChkEnabled = true // can checkbox be toggled or not
|
||||
|
||||
// ==================================================================
|
||||
// edit-ciphers.js
|
||||
|
||||
var ignoreDiarciticsCustom = true // diacritical marks flag for custom cipher
|
||||
var caseSensitiveCustom = false // case sensitivity flag for custom cipher
|
||||
|
||||
$(document).ready(function(){
|
||||
|
||||
// click on cipher name in enabled ciphers table to load existing cipher
|
||||
$("body").on("click", ".phraseGemCiphName", function () {
|
||||
if (editCiphersMenuOpened) { // if menu is opened
|
||||
var curCiphName = $(this).text();
|
||||
var cID = 0; // current cipher ID
|
||||
for (i = 0; i < cipherList.length; i++) { // get cipher ID
|
||||
if (cipherList[i].cipherName == curCiphName) { cID = i; break; }
|
||||
}
|
||||
document.getElementById("custCipherNameInput").value = cipherList[cID].cipherName;
|
||||
document.getElementById("custCipherCatInput").value = cipherList[cID].cipherCategory;
|
||||
|
||||
var charsArr = cipherList[cID].cArr; // get cipher charcodes
|
||||
var tmp = "";
|
||||
for (i = 0; i < charsArr.length; i++) {
|
||||
tmp += String.fromCharCode(charsArr[i]);
|
||||
}
|
||||
document.getElementById("custCipherAlphabet").value = tmp;
|
||||
|
||||
var valsArr = cipherList[cID].vArr; // get cipher values
|
||||
tmp = "";
|
||||
for (i = 0; i < valsArr.length; i++) {
|
||||
tmp += valsArr[i]+",";
|
||||
}
|
||||
document.getElementById("custCipherGlobVals").value = tmp.slice(0,-1); // remove last comma
|
||||
|
||||
var IDMstate = ""; // ignore diacritical marks state
|
||||
if (cipherList[cID].diacriticsAsRegular == true) { // check diacritics flag
|
||||
IDMstate = "checked"; // checkbox state
|
||||
ignoreDiarciticsCustom = true;
|
||||
} else {
|
||||
ignoreDiarciticsCustom = false;
|
||||
}
|
||||
var o = '<label class="chkLabel optionElementLabel">Ignore Diacritical Marks (é=e)<input type="checkbox" id="chkbox_IDM" onclick="conf_IDM()" '+IDMstate+'><span class="custChkBox"></span></label>'
|
||||
document.getElementById("diacrChkbox").innerHTML = o; // update element
|
||||
|
||||
var CSstate = ""; // case sensitive state
|
||||
if (cipherList[cID].caseSensitive == true) { // check case sensitive flag
|
||||
CSstate = "checked"; // checkbox state
|
||||
caseSensitiveCustom = true;
|
||||
} else {
|
||||
caseSensitiveCustom = false;
|
||||
}
|
||||
o = '<label class="chkLabel optionElementLabel">Case Sensitive Cipher<input type="checkbox" id="chkbox_CS" onclick="conf_CS()" '+CSstate+'><span class="custChkBox"></span></label>'
|
||||
document.getElementById("caseSensChkbox").innerHTML = o; // update element
|
||||
|
||||
createIndLetterControls(); // update
|
||||
checkCustCipherName(); // redraw button (add/update)
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
// ==================================================================
|
||||
// export-csv.js
|
||||
|
||||
var dragCounter = 0 // Firefox drag over style fix
|
||||
$(document).ready(function(){
|
||||
// change element style on drag-enter event
|
||||
$("body").on("dragenter", "#phraseBox", function () {
|
||||
dragCounter++
|
||||
$(this).addClass("dragOver");
|
||||
});
|
||||
$("body").on("dragleave", "#phraseBox", function () {
|
||||
dragCounter--
|
||||
if (dragCounter == 0) $(this).removeClass("dragOver");
|
||||
});
|
||||
});
|
||||
|
||||
// ==================================================================
|
||||
// export.js
|
||||
|
||||
$(document).ready(function(){
|
||||
|
||||
$("body").on("click", "#btn-print-cipher-png", function () { // for future elements
|
||||
// English-Ordinal_cipher.png
|
||||
var fileName = breakCipher.replace(/ /g, "-")+"_cipher.png";
|
||||
openImageWindow("#ChartSpot", fileName, 2.0);
|
||||
});
|
||||
|
||||
$("body").on("click", "#btn-print-history-png", function () {
|
||||
// phrase-with-spaces_2021-03-26_10-23-52_table.png
|
||||
var fileName = sHistory[0].normalize('NFD').replace(/[\u0300-\u036f]/g, "").replace(/ /g, "-").replace(/["|']/g, "")+
|
||||
"_"+getTimestamp()+"_table.png";
|
||||
openImageWindow(".HistoryTable", fileName, 2.0);
|
||||
});
|
||||
$("body").on("click", "#btn-date-calc-png", function () {
|
||||
$('#dateDesc1Area').html('<span class="dateDescription">'+dateDesc1Saved+'</span>') // input to fixed text
|
||||
$('#dateDesc2Area').html('<span class="dateDescription">'+dateDesc2Saved+'</span>')
|
||||
$('.dateCalcTable2').addClass('elemBorderScr') // add outline
|
||||
// phrase-with-spaces_2021-03-26_10-23-52_table.png
|
||||
var fileName = (saved_d1.getMonth()+1)+'-'+saved_d1.getDate()+'-'+saved_d1.getFullYear()+'_'+
|
||||
(saved_d2.getMonth()+1)+'-'+saved_d2.getDate()+'-'+saved_d2.getFullYear()+"_date_durations.png";
|
||||
openImageWindow(".dateCalcTable2", fileName, 2.0);
|
||||
});
|
||||
|
||||
$("body").on("click", "#btn-print-word-break-png", function () {
|
||||
// phrase-with-spaces_English-Ordinal_190_breakdown.png
|
||||
for (var i = 0; i < cipherList.length; i++) { if (cipherList[i].cipherName == breakCipher) break; } // get current cipher index
|
||||
var fileName = sVal().normalize('NFD').replace(/[\u0300-\u036f]/g, "").replace(/ /g, "-").replace(/["|']/g, "")+
|
||||
"_"+breakCipher.replace(/ /g, "-")+"_"+cipherList[i].calcGematria(sVal())+"_breakdown.png";
|
||||
openImageWindow("#BreakTableContainer", fileName, 2.0);
|
||||
});
|
||||
|
||||
$("body").on("click", "#btn-print-breakdown-details-png", function () {
|
||||
var o = $(".LetterCounts").text();
|
||||
var i, c_h, c_s, c_l = 0;
|
||||
for (i = 0; i < cipherList.length; i++) {
|
||||
if (cipherList[i].cipherName == breakCipher) { // current active cipher
|
||||
c_h = cipherList[i].H;
|
||||
c_s = cipherList[i].S;
|
||||
c_l = cipherList[i].L;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// $(".LetterCounts").html('<span style="color: hsl('+c_h+' '+c_s+'% '+c_l+'% / 1); font-weight: 500; font-size: 200%;">Gematria</span><br><hr style="background-color: rgb(105,105,105); height: 2px; border: none;">');
|
||||
//$("#BreakdownDetails").attr("style", "padding-top: 1.25em;"); // more padding
|
||||
// $(".LetterCounts").html('<br><hr style="background-color: rgb(105,105,105); height: 2px; border: none;">');
|
||||
$(".LetterCounts").html('');
|
||||
updateCipherChartGemCard(); // redraw cipher chart for current cipher (with borders)
|
||||
$('#ChartSpotScroll').addClass('ChartSpotScrollStop'); // full size chart table for mobile devices
|
||||
$('#BreakdownDetails').addClass('elemBorderScr'); // add outline for breakdown area
|
||||
if (optCompactBreakdown) { $("#BreakdownDetails").attr("style", "padding-top: 0.9em; background-color:"+window.getComputedStyle(document.querySelector('body')).getPropertyValue('background-color')+";"); } // more padding
|
||||
else { $("#BreakdownDetails").attr("style", "padding-top: 0.9em; background-color:"+window.getComputedStyle(document.querySelector('body')).getPropertyValue('background-color')+";"); }
|
||||
|
||||
// phrase-with-spaces_English-Ordinal_190_card.png
|
||||
var fileName = sVal().normalize('NFD').replace(/[\u0300-\u036f]/g, "").replace(/ /g, "-").replace(/["|']/g, "")+
|
||||
"_"+breakCipher.replace(/ /g, "-")+"_"+cipherList[i].calcGematria(sVal())+"_card.png";
|
||||
openImageWindow("#BreakdownDetails", fileName, 2.0);
|
||||
});
|
||||
|
||||
$("body").on("click", "#btn-num-props-png", function () {
|
||||
// 123_number_properties.png OR 123_alt_number_properties.png
|
||||
var curNum = document.querySelector('.numPropTooltip').dataset.number // current number
|
||||
var fileName = curNum+"_number_properties.png";
|
||||
openImageWindow(".numPropTooltip", fileName, 2.0);
|
||||
});
|
||||
|
||||
function loadFile(filePath) {
|
||||
var result = null;
|
||||
var xmlhttp = new XMLHttpRequest();
|
||||
xmlhttp.open("GET", filePath, false);
|
||||
xmlhttp.send();
|
||||
if (xmlhttp.status==200) {
|
||||
result = xmlhttp.responseText;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
//Autoload DB
|
||||
var file = loadFile('db.txt');
|
||||
importFileAction(file, true);
|
||||
|
||||
$("body").on("change", "#importFileDummy", function(){
|
||||
var file = document.querySelector("#importFileDummy").files[0];
|
||||
console.log('upload');
|
||||
importFileAction(file);
|
||||
});
|
||||
$("body").on("click", "#btn-export-history-png", function () {
|
||||
exportHistoryCSV(sHistory);
|
||||
});
|
||||
$("body").on("click", "#btn-export-matches-txt", function () {
|
||||
exportHighlighterMatches(sHistory);
|
||||
});
|
||||
$("body").on("click", "#btn-export-db-query", function () {
|
||||
exportCurrentDBquery(queryResult);
|
||||
});
|
||||
$("body").on("change", "#importFileDummyDict", function () {
|
||||
var file = document.querySelector("#importFileDummyDict").files[0];
|
||||
createDictFromFile(file);
|
||||
});
|
||||
$("body").on("click", "#btn-export-ciphers", function () {
|
||||
exportCiphers();
|
||||
});
|
||||
$("body").on("click", "#btn-save-settings", function () {
|
||||
saveCalcSettingsLocalStorage();
|
||||
});
|
||||
$("body").on("click", "#btn-restore-settings", function () {
|
||||
restoreCalcSettingsLocalStorage();
|
||||
});
|
||||
$("body").on("click", "#btn-reset-settings", function () {
|
||||
clearCalcSettingsLocalStorage();
|
||||
});
|
||||
});
|
||||
|
||||
// ==================================================================
|
||||
// highlighter.js
|
||||
|
||||
var userHistory = [] // a copy of user's history before filtering is applied
|
||||
var userOpenCiphers = [] // a copy of user's choice of ciphers
|
||||
var ctrlIsPressed = false; // allow Ctrl modifier key
|
||||
var shiftIsPressed = false; // allow Shift modifier key
|
||||
|
||||
// used inside highlighter.js
|
||||
var avail_match = []; // all matches found with auto highligher
|
||||
var avail_match_freq = []; // frequency of matches found with auto highligher
|
||||
var freq = []; // frequency of matches found with auto highlighter (combined)
|
||||
|
||||
var prevPhrID = -1 // index of previously selected phrase in history table
|
||||
var prevCiphIndex = -1 // index of previously selected cipher in enabled ciphers table
|
||||
|
||||
$(document).ready(function(){
|
||||
|
||||
// Ctrl key modifier
|
||||
$(document).keydown(function(event){
|
||||
if(event.which=="17")
|
||||
ctrlIsPressed = true;
|
||||
});
|
||||
$(document).keyup(function(){
|
||||
ctrlIsPressed = false;
|
||||
});
|
||||
|
||||
// Shift key modifier
|
||||
$(document).keydown(function(event){
|
||||
if(event.which=="16")
|
||||
shiftIsPressed = true;
|
||||
});
|
||||
$(document).keyup(function(){
|
||||
shiftIsPressed = false;
|
||||
});
|
||||
|
||||
// Disable text selection (elements) while Shift is pressed
|
||||
["keyup","keydown"].forEach((event) => {
|
||||
window.addEventListener(event, (e) => {
|
||||
document.onselectstart = function() {
|
||||
return !(e.key == "Shift" && e.shiftKey);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$("#highlightBox").keyup(function(event){ // inside Highlight box
|
||||
if ( event.which == 46 ) { // "Delete" - clear box
|
||||
if(ctrlIsPressed) { // "Ctrl + Delete"
|
||||
removeActiveFilter(); // clear filter
|
||||
} else { // "Delete" only
|
||||
freq = []; // reset previously found matches statistics
|
||||
document.getElementById("highlightBox").value = "";
|
||||
updateHistoryTable();
|
||||
}
|
||||
return;
|
||||
}
|
||||
if ( event.which == 13 ) { // "Enter" - show only phrases that match
|
||||
if (document.getElementById("highlightBox").value !== "") removeNotMatchingPhrases(); // no action if empty
|
||||
return; // don't update history as function is different
|
||||
}
|
||||
if ( event.which == 45 ) { // "Insert" - auto highlighter, find all available matches
|
||||
updateHistoryTableAutoHlt();
|
||||
return; // don't update history
|
||||
}
|
||||
if (optFiltCrossCipherMatch) { autoHistoryTableLayout(); updateHistoryTable(); } else { updateHistoryTableSameCiphMatch(); }
|
||||
});
|
||||
|
||||
$("body").on("click", "td.hC", function () { // Cipher Name in history table (normal mode)
|
||||
if(shiftIsPressed) { // Shift + Left Click
|
||||
var val = $(this).html(); // cipher name
|
||||
//console.log(" disabled: "+valueToRemove);
|
||||
//openCiphers = openCiphers.filter(function(item) { // list of active ciphers
|
||||
// return item !== valueToRemove; // remove selected cipher
|
||||
//})
|
||||
for (i = 0; i < cipherList.length; i++) {
|
||||
if (cipherList[i].cipherName == val) {
|
||||
toggleCipher(i, true) // update checkbox
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$("body").on("click", "td.hCV", function () { // Cipher Name in history table (compact mode)
|
||||
if(shiftIsPressed) { // Shift + Left Click
|
||||
var val = $(this).find(".hCV2").html(); // cipher name
|
||||
for (i = 0; i < cipherList.length; i++) {
|
||||
if (cipherList[i].cipherName == val) {
|
||||
toggleCipher(i, true) // update checkbox
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// breakdown or cipher table letter/number clicked
|
||||
$("body").on("click", ".ChartChar, .ChartVal, .BreakChar, .BreakVal, .BreakValDark, .BreakWordSum", function () {
|
||||
$(this).toggleClass('highlightCipherTable');
|
||||
});
|
||||
|
||||
// history table value clicked (right mouse button)
|
||||
// disable context menu for the element so right click works
|
||||
$(".tC").live('contextmenu', function() { // ".bind" for existing elements, ".live" for future
|
||||
$(this).find(".gV").toggleClass('hideValue'); // <b> "style="display: none;"
|
||||
return false; // don't show menu
|
||||
})
|
||||
|
||||
// history table value clicked (left mouse button)
|
||||
// trick is that ".gV" is " 12 ", not "12", so td:contains can't match it to " 112 "
|
||||
$("body").on("click", ".tC", function (e) { // tC - history table cell
|
||||
//console.log($(this).find(".gV").html()); // inner html of .gV found in "this"
|
||||
var val = $(this).find(".gV").html(); // get gematria value from element
|
||||
if(ctrlIsPressed) { // Ctrl + Left Click - toggle value inside highlight box
|
||||
tdToggleHighlight(parseInt(val.trim(), 10)); // remove spaces, parse as integer and add (remove) to highlight box
|
||||
} else { // Left Click only - temporary blinking effect
|
||||
$( "table.HistoryTable td.tC > span:contains('"+val+"')" ).toggleClass('highlightValueBlink'); // add blinking effect
|
||||
}
|
||||
});
|
||||
|
||||
// Right click on cipher name in enabled cipher table
|
||||
$("body").on("contextmenu", ".phraseGemCiphName", function (e) { // tC - history table cell
|
||||
var val = $(this).text(); // get cipher name from element
|
||||
if (ctrlIsPressed && !precalcDBLoaded) { // if no precalculated database is loaded
|
||||
if (prevCiphIndex == -1) { // no previous selection
|
||||
$(this).addClass("selectedPhrase") // highlight
|
||||
for (i = 0; i < cipherList.length; i++) {
|
||||
if (cipherList[i].cipherName == val) prevCiphIndex = i // select cipher
|
||||
}
|
||||
} else { // previous selection exists
|
||||
var curCiphIndex
|
||||
for (i = 0; i < cipherList.length; i++) {
|
||||
if (cipherList[i].cipherName == val) curCiphIndex = i // get current index
|
||||
}
|
||||
var curCiph = cipherList[curCiphIndex]
|
||||
var prevCiph = cipherList[prevCiphIndex]
|
||||
|
||||
if (curCiphIndex == prevCiphIndex) {
|
||||
$(this).removeClass("selectedPhrase") // clear selection
|
||||
prevCiphIndex = -1 // reset
|
||||
} else { // different indices
|
||||
cipherList.splice(prevCiphIndex, 1) // remove previous cipher, shifts array
|
||||
origColors.splice(prevCiphIndex, 1) // update cipher colors
|
||||
cipherList.splice(curCiphIndex, 0, prevCiph) // insert previous at the index of current
|
||||
origColors.splice(curCiphIndex, 0, prevCiph)
|
||||
|
||||
document.getElementById("calcOptionsPanel").innerHTML = "" // clear menu panel
|
||||
initCiphers(false) // don't update default ciphers, recalculate order of categories
|
||||
createCiphersMenu() // recreate menus
|
||||
createOptionsMenu()
|
||||
createFeaturesMenu()
|
||||
createExportMenu()
|
||||
createAboutMenu()
|
||||
|
||||
if (userDBlive.length !== 0) { // restore controls if live database is loaded
|
||||
$("#queryDBbtn").removeClass("hideValue") // display query button
|
||||
$("#clearDBqueryBtn").removeClass("hideValue") // clear button
|
||||
$("#unloadDBBtn").removeClass("hideValue") // unload database button
|
||||
$("#btn-export-db-query").removeClass("hideValue") // export button
|
||||
$("#liveDBOption").addClass("hideValue") // hide "Live Database Mode"
|
||||
}
|
||||
updateTables() // index is reset by update
|
||||
}
|
||||
}
|
||||
} else { // right click
|
||||
for (i = 0; i < cipherList.length; i++) {
|
||||
if (cipherList[i].cipherName == val) {
|
||||
toggleCipher(i, true) // update checkbox
|
||||
}
|
||||
}
|
||||
}
|
||||
return false; // don't show menu
|
||||
});
|
||||
|
||||
// Click on phrase in history table
|
||||
$("body").on("click", ".hP", function (e) {
|
||||
if(shiftIsPressed) { // Shift + Left Click - remove phrase from history table
|
||||
//var val = $(this).html(); // get gematria value from element
|
||||
var ii = $(this).data("ind") // get phrase index
|
||||
if (sHistory.length == 1) {
|
||||
sHistory = [] // reinitialize array if there is only one entry
|
||||
tArea = document.getElementById("HistoryTableArea")
|
||||
tArea.innerHTML = "" // clear table
|
||||
updateTables()
|
||||
return
|
||||
}
|
||||
//sHistory.splice(sHistory.indexOf(val),1)
|
||||
sHistory.splice(ii,1)
|
||||
updateTables()
|
||||
} else if (ctrlIsPressed) { // Ctrl + Left Click - select phrase and load into phrase box
|
||||
//console.log($(this).html()); // inner html of "this"
|
||||
//var val = $(this).html(); // get gematria value from element
|
||||
//document.getElementById("phraseBox").value = val; // insert phrase into search box
|
||||
var ii = $(this).data("ind") // get phrase index
|
||||
document.getElementById("phraseBox").value = sHistory[ii]; // insert phrase into search box
|
||||
updateWordBreakdown() // update breakdown for current phrase
|
||||
updateEnabledCipherTable() // update enabled cipher values
|
||||
document.getElementById("phraseBox").focus(); // focus input
|
||||
}
|
||||
});
|
||||
|
||||
// Ctrl + Right click on phrase in history table
|
||||
$("body").on("contextmenu", ".hP", function (e) { // tC - history table cell
|
||||
if (ctrlIsPressed) {
|
||||
var curPhrID = $(this).data("ind") // get phrase index
|
||||
if (prevPhrID == -1) { // no previous selection
|
||||
$(this).addClass("selectedPhrase")
|
||||
prevPhrID = curPhrID // save selection
|
||||
} else { // previous selection exists
|
||||
var curPhr = sHistory[curPhrID]
|
||||
var prevPhr = sHistory[prevPhrID]
|
||||
if (curPhrID == prevPhrID) { // clear selection
|
||||
$(this).removeClass("selectedPhrase")
|
||||
} else { // different ids
|
||||
sHistory.splice(prevPhrID, 1) // remove previous phrase, shifts array
|
||||
sHistory.splice(curPhrID, 0, prevPhr) // insert previous at the index of current
|
||||
updateHistoryTable()
|
||||
}
|
||||
prevPhrID = -1 // reset
|
||||
}
|
||||
return false; // don't show menu
|
||||
}
|
||||
});
|
||||
|
||||
// Ctrl + Click on phrase in query table
|
||||
$("body").on("click", ".hPQ", function (e) {
|
||||
if (ctrlIsPressed) { // Ctrl + Left Click - select phrase and load into phrase box
|
||||
var ii = $(this).data("ind") // get phrase index
|
||||
var phr = (encodingMenuOpened) ? queryResult[ii] : queryResult[ii][1] // phrase[1]
|
||||
document.getElementById("phraseBox").value = phr; // insert into search box
|
||||
updateWordBreakdown() // update breakdown for current phrase
|
||||
updateEnabledCipherTable() // update enabled cipher values
|
||||
document.getElementById("queryPosInput").focus(); // focus input
|
||||
if (!optNewPhrasesGoFirst) { addPhraseToHistory(phr, true) } // enter as single phrase
|
||||
else { addPhraseToHistoryUnshift(phr, true) } // insert in the beginning
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
// ==================================================================
|
||||
// num-prop.js - prime sieve variables stored separately
|
||||
var primeNums; var triangularNums; var fibonacciNums; var starNums;
|
||||
|
||||
// ======================= Number Properties ========================
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
var showTooltip = function(event) {
|
||||
// if (ctrlIsPressed || navigator.maxTouchPoints > 1) { // support for mobile devices
|
||||
if (ctrlIsPressed) { // desktop only
|
||||
$('div.numPropTooltip').remove(); // old tooltip
|
||||
val = $(this).text().trim() // remove spaces
|
||||
$('<div class="numPropTooltip" data-number="'+val+'">'+listNumberProperties(val)+'</div>').appendTo('body');
|
||||
changeTooltipPosition(event);
|
||||
}
|
||||
if (shiftIsPressed) { // additional properties
|
||||
$('div.numPropTooltip').remove(); // old tooltip
|
||||
val = $(this).text().trim() // remove spaces
|
||||
$('<div class="numPropTooltip" data-number="'+val+'_alt" style="max-width: unset;">'+listNumberPropertiesAlt(val)+'</div>').appendTo('body');
|
||||
changeTooltipPosition(event);
|
||||
}
|
||||
};
|
||||
|
||||
var changeTooltipPosition = function(event, wasClicked = false) {
|
||||
if (ctrlIsPressed || shiftIsPressed || wasClicked == true) { // if modifier keys were used or opened with click
|
||||
var tW = $('div.numPropTooltip').outerWidth() // tooltip dimensions
|
||||
var tH = $('div.numPropTooltip').outerHeight()
|
||||
var wndW = $(window).width() // viewport dimensions
|
||||
var wndH = $(window).height()
|
||||
var viewportW = $(document).scrollLeft() // window scroll position
|
||||
var viewportH = $(document).scrollTop()
|
||||
var coordX = event.pageX // cursor coordinates
|
||||
var coordY = event.pageY
|
||||
var tooltipX = 0; var tooltipY = 0; // final tooltip coordinates
|
||||
//console.log("X:"+coordX+" Y:"+coordY)
|
||||
|
||||
if (coordX + tW + 8 + 35 < viewportW + wndW) { // X position
|
||||
tooltipX = coordX + 8; // follow cursor position
|
||||
} else { // if outside of visible viewport
|
||||
tooltipX = viewportW + wndW - tW - 35 // display at furthest visible position
|
||||
}
|
||||
|
||||
if (coordY + tH + 8 + 35 < viewportH + wndH) { // Y position
|
||||
tooltipY = coordY + 8;
|
||||
} else {
|
||||
tooltipY = viewportH + wndH - tH - 35
|
||||
}
|
||||
|
||||
// bottom right corner, out of viewport
|
||||
if (coordX + tW + 8 + 35 > viewportW + wndW && coordY + tH + 8 + 35 > viewportH + wndH) {
|
||||
tooltipX = event.pageX - tW - 27 // display to the left and above of cursor
|
||||
tooltipY = event.pageY - tH - 27
|
||||
}
|
||||
|
||||
$('div.numPropTooltip').css({top: tooltipY, left: tooltipX});
|
||||
}
|
||||
if (navigator.maxTouchPoints > 1 && mobileUserAgent) { // for mobile devices
|
||||
var tooltipX = event.pageX - 8;
|
||||
var tooltipY = event.pageY + 8;
|
||||
$('div.numPropTooltip').css({top: tooltipY, left: tooltipX});
|
||||
}
|
||||
};
|
||||
|
||||
var hideTooltip = function() {
|
||||
$('div.numPropTooltip').remove();
|
||||
};
|
||||
|
||||
// numbers inside enabled ciphers and history tables
|
||||
$("body").on("mouseenter", ".numProp, .gV, .gVQ", showTooltip);
|
||||
$("body").on("mousemove", ".numProp, .gV, .gVQ", changeTooltipPosition);
|
||||
// $("body").on("mouseleave", ".numProp, .gV", hideTooltip)
|
||||
$("body").on("mouseleave", "div.numPropTooltip", hideTooltip);
|
||||
|
||||
var showTooltipClick = function(event) {
|
||||
$('div.numPropTooltip').remove(); // old tooltip
|
||||
val = $(this).text().trim() // remove spaces
|
||||
$('<div class="numPropTooltip" data-number="'+val+'">'+listNumberProperties(val)+'</div>').appendTo('body');
|
||||
changeTooltipPosition(event, true); // a click was issued
|
||||
}
|
||||
var showTooltipClickAlt = function(event) {
|
||||
$('div.numPropTooltip').remove(); // old tooltip
|
||||
val = $(this).text().trim() // remove spaces
|
||||
$('<div class="numPropTooltip" data-number="'+val+'_alt" style="max-width: unset;">'+listNumberPropertiesAlt(val)+'</div>').appendTo('body');
|
||||
changeTooltipPosition(event, true);
|
||||
return false; // no context menu
|
||||
};
|
||||
|
||||
$("body").on("click", ".numProp", showTooltipClick);
|
||||
$("body").on("contextmenu", ".numProp", showTooltipClickAlt);
|
||||
|
||||
});
|
||||
@@ -0,0 +1,66 @@
|
||||
// ========================= Local Storage ==========================
|
||||
|
||||
function saveCalcSettingsLocalStorage(saveDef = false) {
|
||||
var calcSetStr = exportCiphersDB(true) // export all ciphers
|
||||
if (!saveDef) {
|
||||
window.localStorage.setItem('userCalcSettings', calcSetStr);
|
||||
displayCalcNotification("Settings were saved!", 1500)
|
||||
} else {
|
||||
if (window.localStorage.getItem('defCalcSettings') === null) {
|
||||
window.localStorage.setItem('defCalcSettings', calcSetStr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function restoreCalcSettingsLocalStorage(silentMode = false) {
|
||||
if (window.localStorage.getItem('userCalcSettings') === null) {
|
||||
if (window.localStorage.getItem('defCalcSettings').length > 0) {
|
||||
sItem = "defCalcSettings" // restore default settings if no user settings found
|
||||
} else { return }
|
||||
} else {
|
||||
sItem = "userCalcSettings" // restore user settings
|
||||
}
|
||||
var file = window.localStorage.getItem(sItem);
|
||||
|
||||
var calcOpt = file.match(/(?<=calcOptions = )[\s\S]*?\]/m) // array values
|
||||
if (calcOpt !== null) {
|
||||
calcOptMatch = calcOpt[0].replace(/(\t| +|\r|\n)/g, "") // remove tabs, consequtive spaces, line breaks
|
||||
if (isJsonString(calcOptMatch)) importCalcOptions(JSON.parse(calcOptMatch)) // load user options
|
||||
}
|
||||
|
||||
var ciph = file.match(/(?<=cipherList = \[)[\s\S]+/m) // match after "cipherList = [" till end of file, multiple line regex - [\s\S]+
|
||||
file = ciph[0].replace(/(\t| +|\r|\n)/g, "").slice(10,-1) // remove tabs, consequtive spaces, line breaks - "new cipher" at start, last bracket
|
||||
ciph = file.split(",new cipher") // split string into array
|
||||
|
||||
cipherList = []; cCat = []; defaultCipherArray = [] // clear arrays with previously defined ciphers, categories, default ciphers
|
||||
for (n = 0; n < ciph.length; n++) {
|
||||
cipherList.push(eval("new cipher("+ciph[n].slice(1,-1)+")")) // remove parethesis, evaluate string as javascript code
|
||||
}
|
||||
document.getElementById("calcOptionsPanel").innerHTML = "" // clear menu panel
|
||||
initCalc() // reinit
|
||||
updateTables() // update tables
|
||||
updateInterfaceColor(true) // update interface color (first run)
|
||||
if (userDBlive.length !== 0) { // restore controls if live database is loaded
|
||||
$("#queryDBbtn").removeClass("hideValue") // display query button
|
||||
$("#clearDBqueryBtn").removeClass("hideValue") // clear button
|
||||
$("#unloadDBBtn").removeClass("hideValue") // unload database button
|
||||
$("#btn-export-db-query").removeClass("hideValue") // export button
|
||||
$("#liveDBOption").addClass("hideValue") // hide "Live Database Mode"
|
||||
}
|
||||
|
||||
if (!silentMode) {
|
||||
displayCalcNotification("Settings were restored!", 1500)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
function clearCalcSettingsLocalStorage() {
|
||||
if (window.localStorage.getItem('userCalcSettings') === null) {
|
||||
window.localStorage.clear() // clear all localStorage
|
||||
displayCalcNotification("localStorage was cleared!", 1500)
|
||||
return
|
||||
}
|
||||
window.localStorage.removeItem('userCalcSettings');
|
||||
displayCalcNotification("Settings were cleared!", 1500)
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,410 @@
|
||||
// ======================= Number Properties ========================
|
||||
|
||||
initNumberPropArrays();
|
||||
|
||||
function initNumberPropArrays() {
|
||||
if (window.localStorage.getItem('primeNumsStorage') === null ||
|
||||
window.localStorage.getItem('triangularNumsStorage') === null ||
|
||||
window.localStorage.getItem('fibonacciNumsStorage') === null ||
|
||||
window.localStorage.getItem('starNumsStorage') === null)
|
||||
{
|
||||
populatePrimeNumbers(1000000) // 10 million is ~4.98MB, ~300ms
|
||||
window.localStorage.setItem('primeNumsStorage', JSON.stringify(primeNums))
|
||||
triangularNums = populateTriangularNumbers(10000000)
|
||||
window.localStorage.setItem('triangularNumsStorage', JSON.stringify(triangularNums))
|
||||
fibonacciNums = populateFibonacciNumbers(10000000)
|
||||
window.localStorage.setItem('fibonacciNumsStorage', JSON.stringify(fibonacciNums))
|
||||
starNums = populateStarNumbers(10000000)
|
||||
window.localStorage.setItem('starNumsStorage', JSON.stringify(starNums))
|
||||
} else {
|
||||
primeNums = JSON.parse(window.localStorage.getItem('primeNumsStorage'))
|
||||
triangularNums = JSON.parse(window.localStorage.getItem('triangularNumsStorage'))
|
||||
fibonacciNums = JSON.parse(window.localStorage.getItem('fibonacciNumsStorage'))
|
||||
starNums = JSON.parse(window.localStorage.getItem('starNumsStorage'))
|
||||
}
|
||||
}
|
||||
|
||||
function listNumberProperties(val) {
|
||||
var dv = getNumDivisors(val) // divisors
|
||||
var pf = getNumFactorization(val) // prime factorization
|
||||
|
||||
var o = '<table class="numPropTable"><tbody>'
|
||||
|
||||
o += '<tr><td class="numValLabel">'+val+'</td></tr>'
|
||||
o += '<tr><td><hr class="numPropSeparator"></td></tr>'
|
||||
|
||||
o += '<tr><td class="numPropLabel">Prime</td></tr>'
|
||||
o += '<tr><td class="npLine">'+getNumProp(val, primeNums)+'</td></tr>'
|
||||
o += '<tr><td class="numPropLabel">Fibonacci</td></tr>'
|
||||
o += '<tr><td class="npLine">'+getNumProp(val, fibonacciNums)+'</td></tr>'
|
||||
o += '<tr><td class="numPropLabel">Triangular</td></tr>'
|
||||
o += '<tr><td class="npLine">'+getNumProp(val, triangularNums)+'</td></tr>'
|
||||
o += '<tr><td class="numPropLabel">Star</td></tr>'
|
||||
o += '<tr><td class="npLine">'+getNumProp(val, starNums)+'</td></tr>'
|
||||
|
||||
o += '<tr><td><hr class="numPropSeparator"></td></tr>'
|
||||
|
||||
o += '<tr><td class="numPropLabel">Numerology</td></tr>'
|
||||
o += '<tr><td>'+val+' ➤ '+reduceNumber(val)+'</td></tr>'
|
||||
|
||||
o += '<tr><td><hr class="numPropSeparator"></td></tr>'
|
||||
|
||||
o += '<tr><td class="numPropLabel">Factorization</td></tr>'
|
||||
o += '<tr><td>'+pf[0]
|
||||
for (n = 1; n < pf.length; n++) {
|
||||
o += ' x '+pf[n]
|
||||
}
|
||||
o += '</td></tr>'
|
||||
o += '<tr><td class="numPropLabel">Divisors</td></tr>'
|
||||
o += '<tr><td>'+dv[1]
|
||||
for (n = 2; n < dv.length; n++) {
|
||||
o += ', '+dv[n]
|
||||
}
|
||||
o += '</tr><td><b>'+'Σ'+'</b>'+' '+dv[0]+' ('+(dv.length-1)+')</td></tr>'
|
||||
|
||||
o += '</tbody></table>'
|
||||
|
||||
return o
|
||||
}
|
||||
|
||||
function listNumberPropertiesAlt(val) {
|
||||
var pm = getNumPermutations(val) // number permutations
|
||||
|
||||
var o = '<table class="numPropTable"><tbody>'
|
||||
|
||||
o += '<tr><td colspan=2 class="numValLabel">'+val+'</td></tr>'
|
||||
o += '<tr><td colspan=2><hr class="numPropSeparator"></td></tr>'
|
||||
|
||||
o += '<tr><td colspan=2 class="numPropLabel">Number Bases</td><tr>'
|
||||
o += '<tr><td><span class="numPropBaseLabel">base2</span></td><td class="numPropBaseValue"><span class="numPropValPad">'+numBaseXtoY(val, 10, 2)+'</span></td></tr>'
|
||||
// o += '<tr><td><span class="numPropBaseLabel">base3</span></td><td class="numPropBaseValue"><span class="numPropValPad">'+numBaseXtoY(val, 10, 3)+'</span></td></tr>'
|
||||
o += '<tr><td><span class="numPropBaseLabel">base8</span></td><td class="numPropBaseValue"><span class="numPropValPad">'+numBaseXtoY(val, 10, 8)+'</span></td></tr>'
|
||||
o += '<tr><td><span class="numPropBaseLabel">base16</span></td><td class="numPropBaseValue"><span class="numPropValPad">'+numBaseXtoY(val, 10, 16)+'</span></td></tr>'
|
||||
o += '<tr><td><span class="numPropBaseLabel">base36</span></td><td class="numPropBaseValue"><span class="numPropValPad">'+numBaseXtoY(val, 10, 36)+'</span></td></tr>'
|
||||
o += '<tr><td><span class="numPropBaseLabel">base60</span></td><td class="numPropBaseValue"><span class="numPropValPad">'+fmtBaseY(numBaseXtoY(val, 10, 60, ":"), 60)+'</span></td></tr>'
|
||||
// o += '<tr><td><span class="numPropBaseLabel">base7 (+1)</span></td><td class="numPropBaseValue"><span class="numPropValPad">'+incEachDigit(numBaseXtoY(val, 10, 7), 1, "-")+'</span></td></tr>'
|
||||
|
||||
o += '<tr><td colspan=2><hr class="numPropSeparator"></td></tr>'
|
||||
|
||||
o += '<tr><td colspan=2 class="numPropLabel">Permutations</td></tr>'
|
||||
o += '<tr><td colspan=2 style="max-width: 200px">'+pm[0][0]
|
||||
for (n = 1; n < pm[0].length; n++) {
|
||||
o += ', '+pm[0][n]
|
||||
}
|
||||
o += '</td></tr>'
|
||||
o += '<tr><td colspan=2><b>'+'Σ'+'</b>'+'<span class="numPropValPad">'+pm[1]+'</span></td></tr>'
|
||||
|
||||
o += '<tr><td colspan=2><hr class="numPropSeparator"></td></tr>'
|
||||
|
||||
o += '<tr><td colspan=2 class="numPropLabel">Tic Xenotation</td></tr>'
|
||||
o += '<tr><td colspan=2 class="numTicXeno">'+getNumXenotation(val)+'</td></tr>'
|
||||
o += '<tr><td colspan=2 class="numTicXeno">'+getNumNullXenotation(val)+'</td></tr>'
|
||||
|
||||
o += '<tr><td colspan=2><hr class="numPropSeparator"></td></tr>'
|
||||
|
||||
o += '<tr><td colspan=2 class="numPropLabel">Roman Numerals</td></tr>'
|
||||
o += '<tr><td colspan=2>'+getRomanNumerals(val)+'</td></tr>'
|
||||
|
||||
o += '</tbody></table>'
|
||||
|
||||
return o
|
||||
}
|
||||
|
||||
// =========================== Xenotation ===========================
|
||||
|
||||
const getNumXenotation = n => { if (n == 1) { return '(-P)•' } else if (n == 0) { return '((-P))•' }; return n2x(n).map(stringify).join('') }
|
||||
const getNumNullXenotation = n => { if (n == 1) { return '(-P)()' } else if (n == 0) { return '((-P))()' }; return n2x(n).map(stringify).join('').replace(/•/g, '()') }
|
||||
const stringify = a => { if (Array.isArray(a)) { return '(' + a.reduce((a, b) => a + stringify(b), '') + ')' } else { return a } }
|
||||
const shuffle = a => { a.sort((b, c) => Math.round(Math.random()) ? 1 : -1); return a }
|
||||
const n2x = n => { // 3 -> (:), middle dot - ·
|
||||
const factors = getNumFactorization(n)
|
||||
return shuffle(factors).map(f => f == 2 ? '•' : n2x(primeNums.indexOf(f)+1))
|
||||
// return factors.map(f => f == 2 ? ':' : n2x(primeNums.indexOf(f)+1))
|
||||
};
|
||||
|
||||
function strToXenotation(str, nullXeno = false) {
|
||||
var out = ''
|
||||
var sArr = str.split(',')
|
||||
for (var i = 0; i < sArr.length; i++) {
|
||||
if (nullXeno) { out += getNumNullXenotation(sArr[i]) + ',' }
|
||||
else { out += getNumXenotation(sArr[i]) + ',' }
|
||||
}
|
||||
console.log(out.slice(0,-1))
|
||||
copy(out.slice(0,-1))
|
||||
}
|
||||
|
||||
// ==================================================================
|
||||
|
||||
function getNumProp(val, searchArr) {
|
||||
var out = ''; var cur = ''; var prev = 'n/a - '; var next = ' - n/a'; var n_th = '<br><span class="npSmall">❯ n/a ❮</span>'
|
||||
var ind = searchArr.indexOf(parseInt(val)) // integer value
|
||||
|
||||
if (ind > -1) {
|
||||
cur = searchArr[ind]+' ('+(ind+1)+')' // find current value in array, display position
|
||||
} else {
|
||||
cur = 'n/a'
|
||||
}
|
||||
|
||||
if (ind > 0) { // use previous item in array if index is valid
|
||||
prev = searchArr[ind-1]+' ('+ind+') - '
|
||||
} else if (ind !== 0) { // can't be first element
|
||||
for (i = 0; i < searchArr.length; i++) { // find number below "val" in array
|
||||
if (searchArr[i] > val) {
|
||||
if (searchArr[i-1] !== undefined) prev = searchArr[i-1]+' ('+i+') - ' // use previous index if within bounds
|
||||
break // end loop
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ind !== -1 && searchArr[ind+1] !== undefined) {
|
||||
next = ' - '+searchArr[ind+1]+' ('+(ind+2)+')' // use next item in array if match was found
|
||||
} else {
|
||||
for (i = 0; i < searchArr.length; i++) { // find number above "val" in array
|
||||
if (searchArr[i] > val) {
|
||||
next = ' - '+searchArr[i]+' ('+(i+1)+')'
|
||||
break // end loop
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (searchArr[parseInt(val)-1] !== undefined) {
|
||||
n_th = '<br><span class="npSmall">'+searchArr[parseInt(val)-1]+' ('+parseInt(val)+')</span>'
|
||||
}
|
||||
|
||||
out = prev+cur+next+n_th
|
||||
return out
|
||||
}
|
||||
|
||||
// ========================== Calculation ===========================
|
||||
|
||||
function populateTriangularNumbers(n) { // inclusive - 1,3,6,10
|
||||
var arr = []; var tmp = 0; var count = 0
|
||||
for (i = 0; i < n-1; i++) {
|
||||
tmp = 0; count = 0
|
||||
while (count < i+1) { count++; tmp += count; }
|
||||
if (tmp <= n) { arr.push(tmp) } else { return arr }
|
||||
}
|
||||
return arr
|
||||
}
|
||||
|
||||
function populateFibonacciNumbers(n) { // inclusive - 1,1,2,3
|
||||
var arr = [1,1]; var tmp = 0
|
||||
for (i = 2; i < n; i++) {
|
||||
tmp = arr[i-1]+arr[i-2]
|
||||
if (tmp <= n) { arr.push(tmp) } else { return arr }
|
||||
}
|
||||
return arr
|
||||
}
|
||||
|
||||
function populateStarNumbers(n) { // inclusive - 1,13,37,73
|
||||
var arr = []; var tmp = 0
|
||||
for (i = 1; i < n; i++) {
|
||||
tmp = 6*i*(i-1)+1
|
||||
if (tmp <= n) { arr.push(tmp) } else { return arr }
|
||||
}
|
||||
return arr
|
||||
}
|
||||
|
||||
function getNumDivisors(val) { // first element is sum of all divisors
|
||||
var i
|
||||
if (val == 0 || val >= 10000000) return ["n/a","n/a"]
|
||||
var arr = [1]; var sum = 1
|
||||
for (i = 2; i <= val; i++) {
|
||||
if (val%i == 0) { arr.push(i); sum += i; } // if remainder is zero
|
||||
}
|
||||
arr.unshift(sum) // sum of all divisors goes first
|
||||
return arr
|
||||
}
|
||||
|
||||
function getNumFactorization(val, xeno = false) {
|
||||
var i
|
||||
if (val < 2 || val >= 10000000) { if (!xeno) { return ["n/a"] } else { return [] } }
|
||||
var arr = []; var p = 0
|
||||
for (i = 0; i < primeNums.length; i++) {
|
||||
p = primeNums[i] // prime
|
||||
if (p <= val) {
|
||||
while (val%p == 0) {
|
||||
arr.push(p) // add prime factor
|
||||
val /= p // continue division
|
||||
}
|
||||
} else {
|
||||
break
|
||||
}
|
||||
}
|
||||
return arr
|
||||
}
|
||||
|
||||
// ======================= Prime Calculation ========================
|
||||
|
||||
var sieve = [] // boolen array for sieving method
|
||||
var sieve_len = 0 // sieve size
|
||||
var nextstartindex = 2 // start with wirst prime number 2, sieve[2] represents state of number 2
|
||||
var currentfalseindex = 0
|
||||
|
||||
function populatePrimeNumbers(n) { // inclusive - 2,3,5,7
|
||||
sieve = []; primeNums = [] // reinit
|
||||
nextstartindex = 2 // start with the first prime number 2, sieve[2] represents state of number 2
|
||||
currentfalseindex = 0
|
||||
|
||||
sieve = new Array(n).fill(false) // initialize number sieve, "true" means number was checked and is composite
|
||||
sieve[0] = sieve[1] = true // boolean array sieve[x] represents number "x" itself, we start check from first prime "2" or sieve[2]
|
||||
sieve_len = n // set sieve length
|
||||
|
||||
// prime seeking function, starts with 2 as prime, checks all 2n, the first number from the start which was not checked is the new prime
|
||||
while (getFirstFalseIndexSieve() > -1){ // while "false" (not checked) is found in sieve
|
||||
var x = currentfalseindex // x = 2, sieve[x] represents number "x"
|
||||
primeNums.push(x) // "x" is prime
|
||||
var y = x
|
||||
while (y+x <= n){ // while all numbers divisible by "x" are less or equal than "n", mark them as checked,
|
||||
y+=x // 2 -> 4,6,8... ; 3 -> 6,9,12...
|
||||
sieve[y] = true // mark number as checked (composite)
|
||||
}
|
||||
}
|
||||
sieve = [] // clear sieve
|
||||
}
|
||||
|
||||
function getFirstFalseIndexSieve() { // for prime search
|
||||
for (i = nextstartindex; i <= sieve_len; i++) {
|
||||
if (!sieve[i]) {
|
||||
currentfalseindex = i // save current index, not to check again
|
||||
nextstartindex = i + 1 // save nextstartindex, no need to check every time from the start of array
|
||||
return i
|
||||
}
|
||||
}
|
||||
return -1 // if cycle is finished and no false values are found
|
||||
}
|
||||
|
||||
// ==================================================================
|
||||
|
||||
function numBaseXtoY (num, x, y, separator = "") { // convert number from one base to another (x <= 16, y = any integer)
|
||||
|
||||
if (num == 0) return num
|
||||
|
||||
var i
|
||||
var baseDigits = ['0','1','2','3','4','5','6','7','8','9','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 newBase = [] // array for new base digits
|
||||
|
||||
if (x !== 10) { // convert to base10 if necessary
|
||||
num_str = num.toString()
|
||||
len = num_str.length
|
||||
pow = 0 // raise to power
|
||||
num = 0
|
||||
for (i = 0; i < len; i++) {
|
||||
// choose last digit, replace with decimal equivalent from array, multiply result by base raised to power
|
||||
num += baseDigits.indexOf(num_str.substring(len-i-1,len-i).toLowerCase()) * Math.pow(x, pow)
|
||||
pow++ // increment power for tens, hundrends, etc.
|
||||
}
|
||||
}
|
||||
|
||||
var remainder = 0
|
||||
while (num > 0) { // convert to a different base
|
||||
remainder = num%y // modular division by new base
|
||||
num = Math.floor(num/y) // round down division result to integer
|
||||
newBase.unshift(remainder) // add to the beginning of array
|
||||
}
|
||||
|
||||
var out = ""
|
||||
if ( (y > 16 && y !== 36) && separator == "") separator = ":" // if no separator was specified for base16+, use colon
|
||||
|
||||
for (i = 0; i < newBase.length; i++) { // join digits (characters)
|
||||
if (y <= 16 || y == 36) {
|
||||
out += baseDigits[newBase[i]].toUpperCase() + separator
|
||||
} else if (y > 16 && y <= 99) {
|
||||
out += ("00" + newBase[i]).slice(-2) + separator // leading zeroes
|
||||
} else if (y > 100 && y <= 999) {
|
||||
out += ("000" + newBase[i]).slice(-3) + separator
|
||||
} else {
|
||||
out += newBase[i] + separator // no leading zeroes for other cases
|
||||
}
|
||||
}
|
||||
if (separator !== "") out = out.slice(0,-1) // remove last separator if separators were used
|
||||
return out
|
||||
}
|
||||
|
||||
function incEachDigit(num, inc, separator = "") { // 314 + 1 -> 425
|
||||
var i; var res = ""
|
||||
num = num.toString()
|
||||
for (i = 0; i < num.length; i++) { // increment each digit
|
||||
res += (parseInt(num.substring(i,i+1)) + inc).toString() + separator
|
||||
}
|
||||
if (separator !== "") res = res.slice(0,-1) // remove last separator if present
|
||||
return res
|
||||
}
|
||||
|
||||
function fmtBaseY(num, base = 60) {
|
||||
if (!isNaN(num) && Number(num) < base) {
|
||||
if (Number(num) == 0) return '00:00'
|
||||
else return '00:' + num
|
||||
} else return num
|
||||
}
|
||||
|
||||
function reduceNumber(num) { // digital root of a number
|
||||
num = parseInt(num), 10
|
||||
var droot = num; var d = 0; var i
|
||||
while (num > 9 && num !== 11 && num !== 22 && num !== 33) { // not single digit and not a master number
|
||||
droot = 0 // reset droot
|
||||
for (i = 0; i < String(num).length; i++) {
|
||||
d = Number(String(num).slice(i, i+1))
|
||||
droot += d // add all digits one by one
|
||||
}
|
||||
num = droot
|
||||
}
|
||||
return droot
|
||||
}
|
||||
|
||||
function getRomanNumerals(num) {
|
||||
var i; var res = ""
|
||||
if (num == 0 || num >= 4000) return "n/a"
|
||||
var roman = [[1000, 'M'],[900, 'CM'],[500, 'D'],
|
||||
[400, 'CD'],[100, 'C'],[90, 'XC'],
|
||||
[50, 'L'],[40, 'XL'],[10, 'X'],
|
||||
[9, 'IX'],[5, 'V'],[4, 'IV'],[1, 'I']]
|
||||
for (i = 0; i < roman.length; i++) {
|
||||
while ( num >= roman[i][0] ) {
|
||||
res += roman[i][1] // append character
|
||||
num -= roman[i][0] // subtract found value
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
var permutator = (inputArr) => { // list all possible permutations
|
||||
let result = [];
|
||||
const permute = (arr, m = []) => {
|
||||
if (arr.length === 0) {
|
||||
result.push(m)
|
||||
} else {
|
||||
for (let i = 0; i < arr.length; i++) {
|
||||
let curr = arr.slice();
|
||||
let next = curr.splice(i, 1);
|
||||
permute(curr.slice(), m.concat(next))
|
||||
}
|
||||
}
|
||||
}
|
||||
permute(inputArr)
|
||||
return result;
|
||||
}
|
||||
|
||||
function getNumPermutations(n) {
|
||||
if (n == 0 || n >= 10000) return [["n/a"],"n/a"]
|
||||
var i, m
|
||||
var num = ""; var sum = 0
|
||||
var tmp = n.toString().split("") // number to array with separate digits
|
||||
tmp = permutator(tmp) // get permutations
|
||||
|
||||
var permArr = [] // unique permutations
|
||||
for (i = 0; i < tmp.length; i++) {
|
||||
num = "" // reset
|
||||
for (m = 0; m < tmp[i].length; m++) {
|
||||
num += tmp[i][m] // array to string
|
||||
}
|
||||
if (permArr.indexOf(num) == -1) {
|
||||
permArr.push(num) // add unique permutation
|
||||
sum += parseInt(num) // add to total
|
||||
}
|
||||
}
|
||||
permArr = permArr.map(function (e) { return parseInt(e, 10); }) // parse string array as integer array to exclude quotes
|
||||
permArr.sort(function(a, b) { return a - b; }) // sort ascending order, "b - a" for descending sort
|
||||
return [permArr, sum] // [0] - array with permutations, [1] - total
|
||||
}
|
||||
@@ -0,0 +1,160 @@
|
||||
// ======================== Quickstart Guide ========================
|
||||
|
||||
function closePanel(el) {
|
||||
$('#darkOverlay').remove();
|
||||
$(el).remove();
|
||||
$('body').removeClass('noScroll') // restore scrolling
|
||||
}
|
||||
|
||||
function displayQuickstartGuide() {
|
||||
$('<div id="darkOverlay" onclick="closePanel(".quickGuide")"></div>').appendTo('body'); // overlay
|
||||
|
||||
var o = '<div class="quickGuide">'
|
||||
o += '<p><span class="qgBold2">Quickstart Guide</p>'
|
||||
|
||||
o += '<hr class="numPropSeparator">'
|
||||
|
||||
o += '<ul><li><a class="qgLink" href="https://gematriaresearch.blogspot.com/">Gematria Research (Luís Gonçalves)</a><br><span class="qgNote">History of neglected ciphers and methods used in the practice of gematria</span></li></ul>'
|
||||
|
||||
o += '<hr class="numPropSeparator">'
|
||||
|
||||
o += '<p class="qgMedium">Phrase Box - enter any word, phrase or number</p>\n<ul><li><span class="qgBold">"Enter"</span> - add phrase to history table</li><li><span class="qgBold">"Up"</span> and <span class="qgBold">"Down"</span> arrow keys - select phrase from history table<br>Press <span class="qgBold">"Down"</span> to select previously entered phrase</li><li><span class="qgBold">"Delete"</span> - delete current phrase from history table</li><li>Additional Shortcuts:<br><span class="qgBold">"Home"</span> - clear history table<br><span class="qgBold">"End"</span> - shortcut for <span class="qgBold">"Enter As Words"</span> function</li></ul>'
|
||||
|
||||
o += '<p class="qgMedium">Highlight Box - enter space delimited numbers</p>\n<ul><li><span class="qgBold">"Enter"</span> - activate filter (remove nonmatching phrases and ciphers)</li><li><span class="qgBold">"Delete"</span> - clear box contents (does not reset filter)<br><span class="qgNote">Note: Reset filter with an "X" button near the box</span></li><li>Additional Shortcuts:<br><span class="qgBold">"Insert"</span> - find all available matches<br><span class="qgBold">"Ctrl + Delete"</span> - reset filter and revert to initial history state<br><span class="qgNote">Note: Type "0 0" or "Ctrl + Left Click" on "0" cell twice to highlight zero<br>History table is recalculated on each keystroke</span></li></ul>'
|
||||
|
||||
o += '<p class="qgMedium">Enabled Ciphers Table</p>\n<ul><li><span class="qgBold">"Left Click"</span> on cipher name - choose cipher, display detailed word breakdown</li><li><span class="qgBold">"Right Click"</span> on cipher name - disable cipher</li><li><span class="qgBold">"Ctrl + Right Click"</span> on cipher name - reorder ciphers, select the same cipher to cancel</li><li><span class="qgBold">"Left Click"</span> on number - show number properties</li><li><span class="qgBold">"Right Click"</span> on number - show additional number properties</li></ul>'
|
||||
|
||||
o += '<p class="qgMedium">Number Properties</p>\n<ul><li><span class="qgBold">"Ctrl"</span> key pressed, mouse over number - show number properties</li><li><span class="qgBold">"Shift"</span> key pressed, mouse over number - show additional number properties</li><li>All properties are supported only for values up to 10 million</li><li>Drag cursor across the tooltip to close it<br>Mobile devices - click on the tooltip first, then click outside to close<br><span class="qgNote">Note: Number Properties are available inside Enabled Ciphers Table, History Table and Query Table</span></li></ul>'
|
||||
|
||||
o += '<p class="qgMedium">Cipher/Breakdown Chart</p>\n<ul><li><span class="qgBold">"Left Click"</span> on letters/values to highlight cells</li></ul>'
|
||||
|
||||
o += '<p class="qgMedium">History Table</p><ul><li><span class="qgBold">"Left Click"</span> on value - toggle blinking effect (temporary)</li><li><span class="qgBold">"Right Click"</span> on value - toggle cell visibility (temporary)</li><li><span class="qgBold">"Shift + Left Click"</span> on cipher name - disable cipher</li><li><span class="qgBold">"Shift + Left Click"</span> on phrase - delete phrase from history</li><li><span class="qgBold">"Ctrl + Left Click"</span> on phrase - load phrase into <span class="qgBold">Phrase Box</span></li><li><span class="qgBold">"Ctrl + Right Click"</span> on phrase - reorder phrases, select the same phrase to cancel</li><li><span class="qgBold">"Ctrl + Left Click"</span> on value (cell) - toggle highlighting for number<br>Highlighter always recalculates table, temporary effects are removed<br><span class="qgNote">Note: Click on cell, not on the number itself, otherwise you will open number properties</span></li></ul>'
|
||||
|
||||
o += '<hr class="numPropSeparator">'
|
||||
o += '<p><span class="qgBold2">Options</p>'
|
||||
|
||||
o += '<ul><li><span class="qgBold">"Number Calculation"</span><ul><li>Full (123 = 123) - <span class="qgBold">default</span></li><li>Reduced (123 = 1+2+3 = 6)</li><li>Off</li></ul></li>'
|
||||
|
||||
o += '<li><span class="qgBold">"Matrix Code Rain"</span> - use dynamic background</li>'
|
||||
|
||||
o += '<li><span class="qgBold">Highlighter</span> has two different modes:<ul><li><span class="qgBold">"Cross Cipher Match"</span></li><li><span class="qgBold">"Same Cipher Match"</span><br><span class="qgNote">Note: If there is just one value, only "Cross Cipher Match" will pick that</span></li></ul></li>'
|
||||
|
||||
o += '<li><span class="qgBold">"Show Only Matching"</span> - when highlighter is active, sets opacity of nonmatching values to zero</li>'
|
||||
|
||||
o += '<li><span class="qgBold">"Show Extra Ciphers"</span> - toggle <span class="qgBold">"Extra"</span> category with experimental ciphers</li>'
|
||||
o += '<li><span class="qgBold">"Ignore Comments [...]"</span> - exclude any text inside square brackets from gematria calculation<br><span class="qgNote">Note: Comments are preserved on export/import</span></li>'
|
||||
o += '<li><span class="qgBold">"Live Database Mode"</span> - disable this option to generate a precalculated database on file import<br><span class="qgNote">Note: More information is available in the "Databases" section of this guide</span></li>'
|
||||
|
||||
o += '<li><span class="qgBold">"New Phrases Go First"</span> - new phrases are inserted at the beginning of <span class="qgBold">History Table</span></li>'
|
||||
|
||||
o += '<li><span class="qgBold">"Phrases on DB page"</span> - specify the amount of phrases on one page of <span class="qgBold">Database</span> query results</span></li>'
|
||||
o += '<li><span class="qgBold">"Scroll DB by lines"</span> - set scrolling speed inside <span class="qgBold">Database</span> query results</span></li>'
|
||||
|
||||
o += '<li><span class="qgBold">"Letter/Word Count"</span> - show number of recognized (by current cipher) letters and words</li>'
|
||||
o += '<li><span class="qgBold">"Word Breakdown"</span> - show detailed breakdown for current phrase</li>'
|
||||
o += '<li><span class="qgBold">"Compact Breakdown"</span> - do not show full phrase (plain text) inside breakdown table</li>'
|
||||
o += '<li><span class="qgBold">"Cipher Chart"</span> - show a table of correspondences between letters and values for current cipher</li>'
|
||||
|
||||
o += '<li><span class="qgBold">"Gradient Charts"</span> - toggle fill style for <span class="qgBold">"Word Breakdown"</span> and <span class="qgBold">"Cipher Chart"</span></li>'
|
||||
|
||||
o += '<li><span class="qgBold">"Switch Ciphers (CSV)"</span> - enable previously selected ciphers on history file import</li></ul>'
|
||||
|
||||
o += '<hr class="numPropSeparator">'
|
||||
o += '<p><span class="qgBold2">Features</p>'
|
||||
|
||||
o += '<p class="qgMedium">Gematria Calculation</p>\n<ul><li><span class="qgBold">Standard (default)</span> - each character is substituted with a corresponding value and values for all characters in phrase are simply added together</li><li><span class="qgBold">Multiplication</span> - each character value is multiplied by its position in a phrase (based on Mispar Ha'achor)</li><li><span class="qgBold">Reversed Multiplication</span> - each character value is multiplied by its position in a phrase counting from the last character (based on Mispar Bone'eh)<br><span class="qgNote">More information on these methods - <a class="qgNote" href="https://torahcalc.com/info/gematria/">https://torahcalc.com/info/gematria/</a></span></li></ul>'
|
||||
|
||||
o += '<p class="qgMedium">Date Calculator</p>\n<ul><li>Calculate interval between two dates according to Gregorian calendar, supports <span class="qgBold">Add/Subtract</span> mode<br><span class="qgNote">Note: Make sure to consult timeanddate.com or other websites for precise calculations for old dates or other calendars (e.g. Julian)</span></li><li><span class="qgBold">Left Click</span> on <span class="qgBold">"From"</span> or <span class="qgBold">"to"</span> label to set a custom date description</li><li><span class="qgBold">Left Click</span> to highlight line with date durations</li><li><span class="qgBold">Right Click</span> to remove line with date durations</li><span class="qgNote">Note: Toggle "Include End Date" checkbox to bring the removed lines back</span></li><li>You can <span class="qgBold">import</span> a text file to calculate durations between multiple dates at once.<br>One date per line, <span class="qgBold">M/D/YYYY</span> format, comments are optional:<br><br>GEMATRO_DATES<br>1/28/2006 [comment]<br>11/7/1968 [comment]</li></ul>'
|
||||
|
||||
o += '<p class="qgMedium">Color Controls</p>\n<ul><li>Change interface, font or cipher colors (<span class="qgBold">HSL</span> - Hue, Saturation, Lightness)</li><li>Make sure to <span class="qgBold">"Save Settings"</span> or <span class="qgBold">"Export Settings (JS)"</span> before you make any modifications inside <span class="qgBold">"Edit Ciphers"</span> menu</li></ul>'
|
||||
|
||||
o += '<p class="qgMedium">Edit Ciphers</p>\n<ul><li><span class="qgBold">"Left Click"</span> on cipher name in Enabled Ciphers Table to edit existing cipher or make a new one based on existing one</li><li>Cipher names are unique; if name matches, it means an existing cipher is modified</li><li>Existing cipher can be moved to a different category (it will be added as last item in that category)</li><li>Any cipher category can be created</li><li>Cells with individual letters or values can be modified</li><li><span class="qgBold">Unicode</span> characters are supported</li><li>Color controls are reset on any change in <span class="qgBold">"Edit Ciphers"</span> menu</li></ul>'
|
||||
|
||||
o += '<p class="qgMedium">Encoding</p>\n<ul><p>Encoder supports <span class="qgBold">3 different modes</span>, all of which can work with Normal or Multiplicative <span class="qgBold">Gematria Calculation</span> modes.<br>Positive values are supported; use <span class="qgBold">-0</span> as a matching value for zero.<br>Read section about <span class="qgBold">Databases</span> for additional information and <span class="qgBold">Query Table</span> tips.\n</p>\n<ul><li><span class="qgBold">Syllables (default)</span> - syllables generated from <span class="qgBold">"Alphabet"</span> and <span class="qgBold">"Vowels"</span> fields (excluding letters from <span class="qgBold">"Exclude"</span> field) are used to create a matching phrase. You can type <span class="qgBold">start;end</span> or <span class="qgBold">start;</span> or <span class="qgBold">;end</span> inside <span class="qgBold">Phrase Box</span> to construct a complex phrase<br><span class="qgNote">Note: Anagrams are available for Normal gematria calculation mode only. Use "Odd letters" option to switch between even/odd phrase length</span></li><li><span class="qgBold">Database (1 phrase)</span> - uses a single phrase from currently loaded <span class="qgBold">Live Database</span>. You can use <span class="qgBold">start;end</span> constructor (and its variations) in the <span class="qgBold">Phrase Box</span><br><span class="qgNote">Note: Make sure that gematria value of current (additional) text in the Phrase Box is less than matching value, otherwise no results will be found</span></li><li><span class="qgBold">Database (2 phrases)</span> - uses two phrases from currently loaded <span class="qgBold">Live Database</span>. You can use <span class="qgBold">start;middle;end</span> constructor (and its variations, e.g. <span class="qgBold">;;end</span>) in the <span class="qgBold">Phrase Box</span><br><span class="qgNote">Note: This mode is very computationally expensive and can be really slow on some devices (Firefox can be ~7x slower compared to Chrome, try different browsers). It is not recommended to use a database with more than 20,000 entries (n^2 combinations). If this mode is used with Multiplicative gematria calculation mode, it becomes even slower. Encoding (2 phrases) for ciphers with negative values is the slowest mode, it can take minutes, so use a smaller database or one phrase mode</span></li></ul></ul>'
|
||||
|
||||
o += '<p><span class="qgBold">"Find Matches"</span> - populate <span class="qgBold">Highlight Box</span> with numbers that match at least twice inside <span class="qgBold">History Table</span><br><span class="qgNote">Note: Cipher filter is not applied, you can press "Enter" inside Highlight Box to show matching ciphers only</span></p>'
|
||||
o += '<p><span class="qgBold">"Enter As Words"</span> - read text from <span class="qgBold">Phrase Box</span> one word at a time until a certain phrase length is reached, then move on to the next starting word, process is repeated until all words are entered into <span class="qgBold">History Table</span><br><span class="qgNote">Note: Change "Word limit" value to specify maximum phrase length</span></p>'
|
||||
o += '<p><span class="qgBold">"Clear History"</span> - remove all entries from <span class="qgBold">History Table</span></p>'
|
||||
|
||||
o += '<hr class="numPropSeparator">'
|
||||
o += '<p><span class="qgBold2">Export</p>'
|
||||
|
||||
o += '<ul><li><span class="qgBold">"Print Cipher Chart", etc</span> - render correspondent element as an image (PNG), image preview is opened first<br><span class="qgNote">Note: If text or table are misaligned, click "Refresh" button to generate a new image</span></li>'
|
||||
|
||||
o += '<li><span class="qgBold">"Import File"</span> - import a <span class="qgBold">.txt</span> file (one phrase per line), previously exported CSV history, exported matches or user ciphers<br><span class="qgNote">Note: You can also drag and drop file into Phrase Box</span></li>'
|
||||
|
||||
o += '<li><span class="qgBold">"Create Database (TXT)"</span> - convert a <span class="qgBold">.txt</span> file into <span class="qgBold">Live Database</span> format<br><span class="qgNote">Note: Database contains unique words which are sorted by alphabetical order</span></li>'
|
||||
|
||||
o += '<li><span class="qgBold">"Export History (CSV)"</span> - export phrases from current history table as a CSV file, semicolon is used as separator, first row contains cipher names</li>'
|
||||
|
||||
o += '<li><span class="qgBold">"Export Matches (TXT)"</span> - export all available matches from current history table as a text file, current highlighter mode (<span class="qgBold">"Cross Cipher Match"</span> or <span class="qgBold">"Same Cipher Match"</span>) is used during export<br><span class="qgNote">Note: Matches can be imported back into calculator</span></li>'
|
||||
|
||||
o += '<li><span class="qgBold">"Save/Load/Reset"</span> - save, load or reset current calculator and ciphers settings for this browser (localStorage)<br><span class="qgNote">Note: Use "Reset" twice to clear all localStorage. Saved settings do not persist if you clear cache, use Incognito mode or a different browser on the same device</span></li>'
|
||||
|
||||
o += '<li><span class="qgBold">"Export Settings (JS)"</span> - export current calculator settings and ciphers as a separate file. Ciphers active at the moment of export become the new default ones<br><span class="qgNote">Note: You can edit file manually with a text editor, make sure to keep formatting<br>Any changes made to options or menu settings are saved as well<br>If you want to permanently change settings, you can download an offline version of the calculator from GitHub repository and replace "ciphers.js" file inside "calc" directory<br>Online and offline versions are identical</span></li></ul>'
|
||||
|
||||
o += '<hr class="numPropSeparator">'
|
||||
o += '<p><span class="qgBold2">Databases</p>'
|
||||
|
||||
o += '<ul><li>Import a properly formatted TXT file to activate database query mode. <span class="qgBold">Live Database Mode</span> is used by default, however <span class="qgBold">GEMATRO</span> can generate a precalculated database as well<br><span class="qgNote">Note: File should contain one phrase per line, the first line must be<br>CREATE_GEMATRO_DB</span></li>'
|
||||
|
||||
o += '<li><span class="qgBold">"Ignore Comments [...]"</span> flag affects database generation<br><span class="qgNote">Note: When database is loaded, calculator should use the same mode of "Ignore Comments [...]" as at the moment of database generation, otherwise values inside database and calculator will differ. The same is valid for number calculation settings</span></li>'
|
||||
|
||||
o += '<li>Precalculated (CSV) database can be generated when <span class="qgBold">"Live Database Mode"</span> is disabled. Database will have values only for currently selected ciphers. Those ciphers (and calculator options) are stored inside the database as well (at the end of file).<br><span class="qgNote">Note: When precalculated database is loaded, calculator will allow to use only those ciphers which are available inside that database<br>For example, if you load a database that contains values only for English Ordinal cipher, English Ordinal becomes the only available cipher for any calculations until you unload the database. "Live Database Mode" calculates all values on the fly and can work with any ciphers, however this mode is slower and there is no separate file with precalculated gematria values</span></li>'
|
||||
|
||||
o += '<li>After you import a properly formatted text file for database generation, calculation will start immediately and a dialogue that offers to save new precalculated database will appear<br><span class="qgNote">Note: Process may take some time, please be patient</span></li>'
|
||||
|
||||
o += '<li>When a database is imported, new elements become available:<ul><li><span class="qgBold">"Query"</span> - match current phrase or number against database</li><li><span class="qgBold">"Clear DB Query" (Features)</span> - close current <span class="qgBold">Query Table</span> and switch back to centered interface</li><li><span class="qgBold">"Unload Database" (Features)</span> - unload database and restore initial ciphers; <span class="qgBold">History Table</span> is preserved</li><li><span class="qgBold">"Export DB Query (CSV)" (Export)</span> - save matching phrases from database as a CSV file</li></ul>'
|
||||
|
||||
o += '<li><span class="qgBold">"Cipher Edit"</span> (and rearrangement) is not available when a precalculated database is loaded</li>'
|
||||
|
||||
o += '<li>Current highlighter mode (<span class="qgBold">"Cross Cipher Match"</span> or <span class="qgBold">"Same Cipher Match"</span>) controls database query<br><span class="qgNote">Note: "Show Only Matching" option hides nonmatching values as well</span></li>'
|
||||
|
||||
o += '<li>Query is based on current cipher selection; there is no limit for the amount of enabled ciphers</li>'
|
||||
|
||||
o += '<li>Input any phrase into the <span class="qgBold">"Phrase Box"</span> and press <span class="qgBold">"Query"</span> button to match against currently loaded database</li><li>Numerical input is supported, several numbers are recognized as well:<br><span class="qgBold">74 0 142</span><br><span class="qgNote">Note: In the example above, the first enabled cipher will be matched against 74 and the third cipher will be matched against 142</span></li></ul>'
|
||||
|
||||
o += '<p class="qgMedium">Query Table</p>\n'
|
||||
|
||||
o += '<ul><li>Use <span class="qgBold">Search Bar</span> to filter results<ul><li><span class="qgBold">"Enter"</span> - apply filter<br><span class="qgNote">Note: If box is empty, filter is cleared</span></li><li><span class="qgBold">"Delete"</span> - clear filter</li></ul><span class="qgNote">Note: Search Bar supports regular expressions</span>'
|
||||
|
||||
o += '<li>Use <span class="qgBold">"Up"</span> and <span class="qgBold">"Down"</span> arrow keys to scroll one page at a time or use the mouse wheel<br><span class="qgNote">Note: Up/Down arrow keys work only when input is focused inside textbox with current index</span></li><li>A horizontal scroll bar above the table can be used for navigation as well or you can input the exact position inside the box with index</li>'
|
||||
|
||||
o += '<li>Drag the bottom-right corner of the <span class="qgBold">Query Table</span> to resize it<br><span class="qgNote">Hint: Extend the table in case if long phrases do not fit on one line</span></li>'
|
||||
|
||||
o += '<li><span class="qgBold">"Ctrl + Left Click"</span> on phrase - load phrase from <span class="qgBold">Query Table</span> into <span class="qgBold">Phrase Box</span> and add it to <span class="qgBold">History Table</span></li>'
|
||||
|
||||
o += '<li><span class="qgBold">"Left Click"</span> on button in the top right corner to temporarily minimize the table if it obstructs the interface (left click again to bring the table back)<br><span class="qgNote">Hint: You can zoom the page out if too many ciphers are active</span></ul>'
|
||||
|
||||
o += '</div>'
|
||||
|
||||
$(o).appendTo('body'); // guide
|
||||
$('body').addClass('noScroll') // prevent scrolling
|
||||
}
|
||||
|
||||
// function displayContactInfo() {
|
||||
// $('<div id="darkOverlay" onclick="closePanel(".contactInfo")"></div>').appendTo('body'); // overlay
|
||||
|
||||
// var o = '<div class="contactInfo">'
|
||||
// o += '<p><span class="qgBold2">Contacts</p>'
|
||||
|
||||
// o += '<div style="margin-bottom: 1.25em;">Send your feedback, suggestions or requests to <a class="qgLink" href="mailto:gematro@hotmail.com">gematro@hotmail.com</a></div>'
|
||||
|
||||
// o += '<hr class="numPropSeparator">'
|
||||
|
||||
// o += '<div style="margin-top: 1em;">If you like <span class="qgBold">Gematro</span> and want to show some support, please consider one of the options:</div>'
|
||||
|
||||
// o += '<div class="qgBoldCoin">Bitcoin</div>\n<span class="qgAddr">bc1qp7lz0036ax4skja0gthskff46ycy79v9089jtg</span>'
|
||||
// o += '<div class="qrImg"><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQwAAAEMCAYAAAAxjIiTAAAgAElEQVR4nO2dC5AkR3nn/1Xd0z3PnZld7c6+WSFpkYQQQth6LAYJ8ZB5CPEw2Dg422H7HLbg7DBwF1iHDY6zLDsCy2c7kO7AB6cLMLYAy4CMDEhIgMASYAkJ9BbsSrur3Z19znumH1UXWV2zO9Od/687c3Kqe2bzFzEhbXV3fpWP+irz+zK/LxgdHX0eQD88Ho9HZjIPYJP4FY/H46kxEAKY8I3h8XhaYCL0reTxeFrFKwyPx9MyefLFGMBU+t+VQBFAQXOfJQBzDVftYDI6EZv+Y/VjZQUA+tL/LrXdpbIYLvvWFNZWDNaGnQrtD6YwVOV2KqtowyedyR+lf/X8FYAbG67awWR0Ijb9x+rHylKetaeIh8203aWyGC771hTWVgzWhp0K7Q+mMCIABxqudi7j5M7GHRp1mYxOxKb/WP1YWRPpZzpM210qi+Gyb01hbcVgbdip0P5gNgw1FRlouNq5dJM7Y9dtcFnWcmPTf6x+rKwB3ZS1SVkMqSxGO/vDVDZrw06F9gdTGB6Px9OAVxirk9jhdH2AlDXh0IjnsizPMsJsGAxqPc0Al5ZmVg+XMlx6KphHgNUjTHfwmhrZdIpB1WFj+t+F9Fu8cAppHeuxKcsU1lZSP7H7BWkrJkNCkrHczKVjq2VMFUYfs55mwKRDSzOrh0sZLj0VzCPArNnz9dM9BIybAGzRfKbKeij970ICzbVmfBDAhzTfsSnLFJs+Z/fL2or1hwSTkQV/AeDPTeSYKoywjWdPBhy+hVg9XMpw6algHgFmzQ4slTqTsbHhqh1r2mj8s+lz6X5ZW+n6Q0KSsdysMS2fNRTD5drYFJfrXFYPlzJceirYdWrNdgizYdgwu8z3KmHT56b3a9Mf7WwTY9ne6OnxeFpmtSsMpkHZW4W9hToVl/59Novp1D0E7H4ZrM9tMB1XqwZTGwZDsjSb4tITw9aHzCrfzLugUybMs5EF83YSF0ZoZj9hMrLwmEnjit0v8zqwPrfBdFzZwDxjNjgbo64Uhsu98jaWZsYHALxP8xmzykveBWYZZ56NLJhvdxcPLRucTIbLfmJI44rdL/M6sD63wXRc2cA8YzY4G6OuFIbLvfI2lmZGwVCzNvMu6GYY7E2XBTF5mFzCZLjsJ4bNuGJvf5eYjisbmGfMtiwnuJo+uVznZmH5d8lKOmPikiz6yWZcMfvCSqMjz0F5L4nH42kZrzA8Hk/LeIXROqPkm+y6DRvaWD+XuGoTl5vGGNJOT08droyencq3ANyrubdCauk2MVy9izzQVzZcsec24WH7aMOVmqfgJo3HQLnR3k/ci6YwGRKsrRR/2nBFRldvpP2q61tGKfU81B+2mrOwe7gcVyuK1a4w1AN4c8PVGtcZduwV6d9ywh4C9dB8pOFqjZs1D3O36aGiJuhkSLC2+lNBATB0Lm6kCknXVowZANeTz0xxOa5WFKt9KsbecqtlGspcm5HDqTyTkQXSkoTNxBihQ0/eah9XFL9283g8LeMVhsfjaZnTVWG4nJ4ypOm0KaZTYJf1Y/WYyKANbZZDUlvp6mEDWw61c/mWCavd6MmYTQ1gJl6EK4khj1nMYWHgY0ZP5j1hFn6b+kmwejCPB2srBvPqKONhD/kNg7UVSD1ceoFs7ndFcboqjDmLgz3XkYdAspgzCz+DWf6ZImHY1E+C1YNtDWdtxXDp1ZHaitXDlRdo1aObznr06N4oEK7bTIHZm7GdsHpISxLWJgyXXh2GVI9VvYxwiVcYHo+nZbzC8Hg8LeNKYbgMbbfSwpzpjI5oMmVnsLLaSVah7bLwuOhksKVKu2FtZYOzslwZPW0T5+jIIqmNS1jAFhV56aAmApMU2o6VZZpwRpJhShah7WzaisFC9DEZLFHTPCbKJIvwkrZlOcGVwpBC25mSRVIbl7BwbWoAvkwzEKXQdqws04QzLGmPDVmEtrNpKwYL0cdksERNEMIyMrIIL2mDToFa4Uph2CbOWQ2wcG0D6RutHskqz8oyfUOwpD3thtXPpq0Y7M0syZASNZnMMNoZXjITvNFz+ZDWzMud7GalpUvIoq0kGS4TV6+k8JLGeIXh8XhaxlRhtDOpzUrT3uzNxd50LslChkuyaKt29odEO4NIG8s2tWGwpDZZMOlwfcis2VLiHAZLOMOs78xaD4uEM6weNjJYPZgMG5gMm7aC8KDrFINLGaZeKwmX6QRsZBthqjBYUpssiDWdbQvzIkip/xks4QyzvjNrPSwSzrB62Mhg9XBp+WcybNpKeRH2N1zlng2XMky9VhIfA/B3wufLiU55i5gqDJbUZqXBvAjsuLgEe0Mw6zuz1sNC40v1MJUh1cPVzE6SYdpWIG9/ZCDD2b6GdKbiaray7JyuRk/mRbDZ1cjWgTZrZlYWQ6qHqQx23aXtSJKxkmwYzBOz6vFeEo/H0zJeYXg8npZhCiOL+AQuYXEk2HW2LpfqzcpyCYsjwa5nAQv3Z2PvYW3IlgVsGSHB2kqqB5PB7tcUaVx1Iuz5oEbPntQKvFKMMSyZkGkoNaneTIZLWHg5FkEqC1i4PxYeUIL1B4Rwf7qwetJvWFuxekgyXPW5NK46EfZ8UIVRIK63lYZpKLV211sKL9cuXIb7k/qDGVaZEdo0KZJUDybDFavlefI2DE9H0M5YFZ0aD6Mj8QrD4/G0jFcYHo+nZbzCWDrMiGdjlTdFmsq78mDY4Kos1oYuoR4BAVY/n8jIASzRj2myG5au33VZpujqBkurPDN6XilY7HWeAtceDFPYvZoitSGEdjSBegQEWFvZlMWeD5t6fIAcLDSVQcsKRkdHx5dZi7+XJPpRyW4+3nCVMwZgiHzqsqwsYFb5W9K61KPa7/cartZg3gWGesg+Qj5rFxPpgTGTmVcn1sMG9nzYcALAoOZ3NjJ0ZU1ksSTRaWLpOkOanrosa7mRliRsqsuusyWJZ+XgalYnLUNNZdCytBc9Ho9Hh1cYHo+nZbJQGK6OArOj3CsNKcwhO/7NrkvLGwYrq53Y1OO0PWJuwbInMjINVSeFcWNh30EGCSurWbIkXVksHB2DyZYwDdcmhTk0DW7Dws5J/cfKYti0CQvFx2D1kDANYsPaJIv6NYM9HzpYPSTYM2gcapB5SUxD1Ulh3Fjj3pS6NlstS2ooVhYLR8es8ky2hGm4NmmAsg6Usnnpws5J/cfKYti0yY3CuQ0drB4Spi8D1iZZ1E9CuS/fL3xeD6vHQBpOUKcY2DPIxi4ra4LNMObfgq0ibViRErLo3nSsrGbJknRlsTc2g4W8k7B50+keZAkWxk0KO8eWm6wsBusPCdNZDKuHS9iYzqJ+zdA95AypbxnsGTQONcgES+tsHS7DuGUREo5hYydp51qarf1dJlC26Q/Tdmf1cAkb01nUzyVZJMemMIXh8Xg8DbRTYbjU0lkEz2V0oteB1c8G9mZ2icu3pik29XPZ5+2coTLZtD+YDcMlzOBial+QjJ62top6W0KzpDY6mGxm3JTq4QpWPwiGVYbk1ZEweQj7yctLaitToyfDpn6szxlsLMBxygJTmPeE9UcmCoMlr9EpEYkpYh22KWs+AVD9QJSS2jCYbJZkiFm5XcLqB8EyzrBJXsUSADECoqSlPmceMFNs6sf6nMHGAgw9Vq5R/fQ+TZmsPzJRGK4syszKbQPzuDRLamMC87jYWLlNYfVDRl4dkDeXKVKfG6f5I2SRnIuNhXbDvCeULGwYrtZ7Wa2lXclgdgS6PswItm7tRKQ+70TbEYONhRWH95J4PJ6W8QrD4/G0DFMYpolXsogvYZMMxiYOgKupI2sTlzYMJmO14LI/VloyIQarRyaxUdhZEhbCbi49t1FvJS6m++FNLL4sHB3bx87uSSpLCm1nCpPBYG3C2tAGJuN0hoVrZONH6g82fkzHAhvTEMLnmdbDBiaDMcEUhsRQGuKuVVgoNRaOTmpcBivLBmaQdCmjnbD+cIlpkiEJ1h9Mhmm4RghjmoVGNB0L0phm4fNs6mG6xd1UhnGIPpdRkVnYuXaWJU2Bs8it6lmM1B8M02WoNKZZn7PrNrD7ZdcZNksS4/CA3ujp8XhaxisMj8fTMlkoDDZ9Y9fbGQlb8jq4iu7saR2b5YIpWRytz2JcMe+JU1xtDZes9TorM4RkMCDJeZqhM4CZWrOlxDmusqpLbcXIIqs7s9YzaLIbC1ibSImBXI4f3dhpVpbuN8zjksW46knPCJl6T3T1o33rSmF0Gx5ogmXqfwaz/G8w7JA5clDOJTZtZVoPG24j1nqJ63SDygKX44d5TyRMPTFsvCFtw3qFkcW4KlgcxmP1A+tbV0sSl9Mhl0uSTvRs2LRVFvVgb2uGyw1o7dxU5TrXLVtCrSRo32ovejwejw6vMDweT8uYKgx2TLfdQWfZkW12vZ20Ox8qaxN2neGyzzs1RyxrE3Z9tUD71tToyUK/0ZBeQog+xiRZB9qEOWMhyBhSSDiWz4OFvGP3axMGEA4fKFdtJfU5g7UhaxPWhmgyrnT1kPqWwdqEtSFDqgcbP6bYhn7U1Y/2ranCYKHfaEgvIUQfIyYh8mzCnLEQZAwpfN4HAXyo4SoPecfu1yYMoGnIOwlXbSX1OYO1IWsTKckQG1esraS+ZbA2YW3IYGMBwvgxRQpnyGBtRfvWVGFIod8YrkL02YQ5Mw1BRq3DFm8bdr+2YQB1sl1iHK7NAtaGrE0kr4M0rpgM1rcMV23CxgKE8WOKFM5QQtdWlJUUoo/ZT1xC127CupVdZ/fbqev1LGBtxdpEsmeZjiupb5cbNhYgtIkpUjhDZ3gvicfjaRkfBHgx0iYe9iZg16W3JpPBYDI6lXYG6GWyWbuzfrJBmhExWN+y6y5hbUVxtTVcstCycPDMYs7Kskk4w5LdMBlTaVJgnUGSrTXZup
Line truncated
|
||||
// o += '<div class="qgBoldCoin">Ethereum</div>\n<span class="qgAddr">0x5dB95ac533664E96196a10BB0fc90c5526Ec5517</span>'
|
||||
// o += '<div class="qrImg"><img src="data:image/png;base64,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
Line truncated
|
||||
// o += '<div class="qgBoldCoin">Bitcoin Cash</div>\n<span class="qgAddr">qrmcqw292q3844uwvl47tgvr2v2cmakjsu02vpvxuv</span>'
|
||||
// o += '<div class="qrImg"><img src="data:image/png;base64,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
Line truncated
|
||||
// o += '<div class="qgBoldCoin">Dogecoin</div>\n<span class="qgAddr">DQ7RojngFqqfW4xUCxkNz1es2bfcdd5QwL</span>'
|
||||
// o += '<div class="qrImg"><img src="data:image/png;base64,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
Line truncated
|
||||
|
||||
// o += '</div>'
|
||||
|
||||
// $(o).appendTo('body'); // guide
|
||||
// $('body').addClass('noScroll') // prevent scrolling
|
||||
// }
|
||||
@@ -0,0 +1,94 @@
|
||||
<!DOCTYPE html>
|
||||
<head>
|
||||
<title>Hyperdope Gematria Calculator</title>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=520, maximum-scale=1, user-scalable=no">
|
||||
<link rel="shortcut icon" type="image/x-icon" href="res/favicon.png">
|
||||
|
||||
<!-- Android Web App - Add to Home Screen -->
|
||||
<link rel="manifest" href="manifest.json">
|
||||
|
||||
<script src="lib/jquery.min.js"></script>
|
||||
<!-- html2canvas v1.0.0-alpha.12 -->
|
||||
|
||||
<script src="calc/gematria.js"></script>
|
||||
<script src="calc/calc.js"></script>
|
||||
<script src="calc/init-variables.js"></script>
|
||||
<script src="calc/ciphers.js"></script>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="calc/styles.css">
|
||||
|
||||
<script>
|
||||
window.onpaint = function() {
|
||||
updateInterfaceColor(true); // update interface color (first run)
|
||||
}
|
||||
$(window).load(function(){
|
||||
$("#loader").delay(287).fadeOut("fast");
|
||||
});
|
||||
</script>
|
||||
|
||||
</head>
|
||||
|
||||
<body onload="initCalc(true)">
|
||||
|
||||
<div id="loader"></div>
|
||||
<canvas id="canv"></canvas>
|
||||
|
||||
<!-- preload font -->
|
||||
<span style="font-family: 'Roboto Mono';"></span>
|
||||
|
||||
<div id="calcMain">
|
||||
<center>
|
||||
<div id="mainLogo">Hyperdope Gematria Calculator</div>
|
||||
</center>
|
||||
|
||||
<center>
|
||||
|
||||
<div id="calcOptionsPanel"></div>
|
||||
|
||||
<div id="colorControlsMenuArea"></div>
|
||||
<div id="editCiphersMenuArea"></div>
|
||||
<div id="dateCalcMenuArea"></div>
|
||||
|
||||
<div id="inputArea">
|
||||
<input id="queryDBbtn" class="hideValue" type="button" onclick="queryDatabase()" value="Query">
|
||||
<input id="phraseBox" autofocus type="text" spellcheck="false" autocomplete="off" oninput="updateEnabledCipherTable(); updateWordBreakdown(breakCipher,false,false);" onkeydown="phraseBoxKeypress(event.keyCode)" ondrop="dropHandler(event)" ondragover="dragOverHandler(event)">
|
||||
<input id="enterPhraseBtn" class="hideValue" type="button" onclick="phraseBoxKeypress(13);document.getElementById('phraseBox').focus()" value="✎">
|
||||
<input id="highlightBox" type="text" spellcheck="false" autocomplete="off"><span id="clearFilterButton"></span>
|
||||
</div>
|
||||
|
||||
<div id="enabledCiphTable"></div>
|
||||
|
||||
<div id="BreakdownDetails">
|
||||
<div id="BreakdownSpot"></div>
|
||||
<div id="ChartSpotScroll"><div id="ChartSpot"></div></div>
|
||||
</div>
|
||||
</center>
|
||||
|
||||
|
||||
<center>
|
||||
<div id="HistoryTableArea"></div>
|
||||
</center>
|
||||
</div>
|
||||
|
||||
<span id="loadPanel"></span>
|
||||
|
||||
<script src="calc/breakdown.js"></script>
|
||||
|
||||
<script src="calc/highlighter.js"></script>
|
||||
<script src="calc/export.js"></script>
|
||||
<script src="calc/export-csv.js"></script>
|
||||
<script src="calc/num-prop.js"></script>
|
||||
<script src="calc/edit-ciphers.js"></script>
|
||||
<script src="calc/date-calc.js"></script>
|
||||
<script src="calc/database.js"></script>
|
||||
<script src="calc/quick-guide.js"></script>
|
||||
|
||||
<script src="calc/localstorage.js"></script>
|
||||
<script src="calc/encoding.js"></script>
|
||||
<script src="calc/encoding-ciphers.js"></script>
|
||||
|
||||
<script src="calc/coderain.js"></script>
|
||||
<script src="lib/html2canvas.min.js"></script>
|
||||
|
||||
</body>
|
||||
@@ -0,0 +1,6 @@
|
||||
/*!
|
||||
* html2canvas 1.0.0-alpha.11 <https://html2canvas.hertzen.com>
|
||||
* Copyright (c) 2018 Niklas von Hertzen <https://hertzen.com>
|
||||
* Released under MIT License
|
||||
*/
|
||||
!function(A,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.html2canvas=e():A.html2canvas=e()}(this,function(){return function(A){var e={};function t(r){if(e[r])return e[r].exports;var n=e[r]={i:r,l:!1,exports:{}};return A[r].call(n.exports,n,n.exports,t),n.l=!0,n.exports}return t.m=A,t.c=e,t.d=function(A,e,r){t.o(A,e)||Object.defineProperty(A,e,{configurable:!1,enumerable:!0,get:r})},t.n=function(A){var e=A&&A.__esModule?function(){return A.default}:function(){return A};return t.d(e,"a",e),e},t.o=function(A,e){return Object.prototype.hasOwnProperty.call(A,e)},t.p="",t(t.s=27)}([function(A,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(){return function(A,e){if(Array.isArray(A))return A;if(Symbol.iterator in Object(A))return function(A,e){var t=[],r=!0,n=!1,B=void 0;try{for(var a,s=A[Symbol.iterator]();!(r=(a=s.next()).done)&&(t.push(a.value),!e||t.length!==e);r=!0);}catch(A){n=!0,B=A}finally{try{!r&&s.return&&s.return()}finally{if(n)throw B}}return t}(A,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),n=function(){function A(A,e){for(var t=0;t<e.length;t++){var r=e[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(A,r.key,r)}}return function(e,t,r){return t&&A(e.prototype,t),r&&A(e,r),e}}();var B=/^#([a-f0-9]{3})$/i,a=function(A){var e=A.match(B);return!!e&&[parseInt(e[1][0]+e[1][0],16),parseInt(e[1][1]+e[1][1],16),parseInt(e[1][2]+e[1][2],16),null]},s=/^#([a-f0-9]{6})$/i,o=function(A){var e=A.match(s);return!!e&&[parseInt(e[1].substring(0,2),16),parseInt(e[1].substring(2,4),16),parseInt(e[1].substring(4,6),16),null]},i=/^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/,c=function(A){var e=A.match(i);return!!e&&[Number(e[1]),Number(e[2]),Number(e[3]),null]},l=/^rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d?\.?\d+)\s*\)$/,u=function(A){var e=A.match(l);return!!(e&&e.length>4)&&[Number(e[1]),Number(e[2]),Number(e[3]),Number(e[4])]},Q=function(A){return[Math.min(A[0],255),Math.min(A[1],255),Math.min(A[2],255),A.length>3?A[3]:null]},w=function(A){var e=g[A.toLowerCase()];return e||!1},U=function(){function A(e){!function(A,e){if(!(A instanceof e))throw new TypeError("Cannot call a class as a function")}(this,A);var t=Array.isArray(e)?Q(e):a(e)||c(e)||u(e)||w(e)||o(e)||[0,0,0,null],n=r(t,4),B=n[0],s=n[1],i=n[2],l=n[3];this.r=B,this.g=s,this.b=i,this.a=l}return n(A,[{key:"isTransparent",value:function(){return 0===this.a}},{key:"toString",value:function(){return null!==this.a&&1!==this.a?"rgba("+this.r+","+this.g+","+this.b+","+this.a+")":"rgb("+this.r+","+this.g+","+this.b+")"}}]),A}();e.default=U;var g={transparent:[0,0,0,0],aliceblue:[240,248,255,null],antiquewhite:[250,235,215,null],aqua:[0,255,255,null],aquamarine:[127,255,212,null],azure:[240,255,255,null],beige:[245,245,220,null],bisque:[255,228,196,null],black:[0,0,0,null],blanchedalmond:[255,235,205,null],blue:[0,0,255,null],blueviolet:[138,43,226,null],brown:[165,42,42,null],burlywood:[222,184,135,null],cadetblue:[95,158,160,null],chartreuse:[127,255,0,null],chocolate:[210,105,30,null],coral:[255,127,80,null],cornflowerblue:[100,149,237,null],cornsilk:[255,248,220,null],crimson:[220,20,60,null],cyan:[0,255,255,null],darkblue:[0,0,139,null],darkcyan:[0,139,139,null],darkgoldenrod:[184,134,11,null],darkgray:[169,169,169,null],darkgreen:[0,100,0,null],darkgrey:[169,169,169,null],darkkhaki:[189,183,107,null],darkmagenta:[139,0,139,null],darkolivegreen:[85,107,47,null],darkorange:[255,140,0,null],darkorchid:[153,50,204,null],darkred:[139,0,0,null],darksalmon:[233,150,122,null],darkseagreen:[143,188,143,null],darkslateblue:[72,61,139,null],darkslategray:[47,79,79,null],darkslategrey:[47,79,79,null],darkturquoise:[0,206,209,null],darkviolet:[148,0,211,null],deeppink:[255,20,147,null],deepskyblue:[0,191,255,null],dimgray:[105,105,105,null],dimgrey:[105,105,105,null],dodgerblue:[30,144,255,null],firebrick:[178,34,34,null],floralwhite:[255,250,240,null],forestgreen:[34,139,34,null],fuchsia:[255,0,255,null],gainsboro:[220,220,220,null],ghostwhite:[248,248,255,null],gold:[255,215,0,null],goldenrod:[218,165,32,null],gray:[128,128,128,null],green:[0,128,0,null],greenyellow:[173,255,47,null],grey:[128,128,128,null],honeydew:[240,255,240,null],hotpink:[255,105,180,null],indianred:[205,92,92,null],indigo:[75,0,130,null],ivory:[255,255,240,null],khaki:[240,230,140,null],lavender:[230,230,250,null],lavenderblush:[255,240,245,null],lawngreen:[124,252,0,null],lemonchiffon:[255,250,205,null],lightblue:[173,216,230,null],lightcoral:[240,128,128,null],lightcyan:[224,255,255,null],lightgoldenrodyellow:[250,250,210,null],lightgray:[211,211,211,null],lightgreen:[144,238,144,null],lightgrey:[211,211,211,null],lightpink:[255,182,193,null],lightsalmon:[255,160,122,null],lightseagreen:[32,178,170,null],lightskyblue:[135,206,250,null],Line truncated
|
||||
@@ -0,0 +1,2 @@
|
||||
/*! jQuery v1.8.3 jquery.com | jquery.org/license */
|
||||
(function(e,t){function _(e){var t=M[e]={};return v.each(e.split(y),function(e,n){t[n]=!0}),t}function H(e,n,r){if(r===t&&e.nodeType===1){var i="data-"+n.replace(P,"-$1").toLowerCase();r=e.getAttribute(i);if(typeof r=="string"){try{r=r==="true"?!0:r==="false"?!1:r==="null"?null:+r+""===r?+r:D.test(r)?v.parseJSON(r):r}catch(s){}v.data(e,n,r)}else r=t}return r}function B(e){var t;for(t in e){if(t==="data"&&v.isEmptyObject(e[t]))continue;if(t!=="toJSON")return!1}return!0}function et(){return!1}function tt(){return!0}function ut(e){return!e||!e.parentNode||e.parentNode.nodeType===11}function at(e,t){do e=e[t];while(e&&e.nodeType!==1);return e}function ft(e,t,n){t=t||0;if(v.isFunction(t))return v.grep(e,function(e,r){var i=!!t.call(e,r,e);return i===n});if(t.nodeType)return v.grep(e,function(e,r){return e===t===n});if(typeof t=="string"){var r=v.grep(e,function(e){return e.nodeType===1});if(it.test(t))return v.filter(t,r,!n);t=v.filter(t,r)}return v.grep(e,function(e,r){return v.inArray(e,t)>=0===n})}function lt(e){var t=ct.split("|"),n=e.createDocumentFragment();if(n.createElement)while(t.length)n.createElement(t.pop());return n}function Lt(e,t){return e.getElementsByTagName(t)[0]||e.appendChild(e.ownerDocument.createElement(t))}function At(e,t){if(t.nodeType!==1||!v.hasData(e))return;var n,r,i,s=v._data(e),o=v._data(t,s),u=s.events;if(u){delete o.handle,o.events={};for(n in u)for(r=0,i=u[n].length;r<i;r++)v.event.add(t,n,u[n][r])}o.data&&(o.data=v.extend({},o.data))}function Ot(e,t){var n;if(t.nodeType!==1)return;t.clearAttributes&&t.clearAttributes(),t.mergeAttributes&&t.mergeAttributes(e),n=t.nodeName.toLowerCase(),n==="object"?(t.parentNode&&(t.outerHTML=e.outerHTML),v.support.html5Clone&&e.innerHTML&&!v.trim(t.innerHTML)&&(t.innerHTML=e.innerHTML)):n==="input"&&Et.test(e.type)?(t.defaultChecked=t.checked=e.checked,t.value!==e.value&&(t.value=e.value)):n==="option"?t.selected=e.defaultSelected:n==="input"||n==="textarea"?t.defaultValue=e.defaultValue:n==="script"&&t.text!==e.text&&(t.text=e.text),t.removeAttribute(v.expando)}function Mt(e){return typeof e.getElementsByTagName!="undefined"?e.getElementsByTagName("*"):typeof e.querySelectorAll!="undefined"?e.querySelectorAll("*"):[]}function _t(e){Et.test(e.type)&&(e.defaultChecked=e.checked)}function Qt(e,t){if(t in e)return t;var n=t.charAt(0).toUpperCase()+t.slice(1),r=t,i=Jt.length;while(i--){t=Jt[i]+n;if(t in e)return t}return r}function Gt(e,t){return e=t||e,v.css(e,"display")==="none"||!v.contains(e.ownerDocument,e)}function Yt(e,t){var n,r,i=[],s=0,o=e.length;for(;s<o;s++){n=e[s];if(!n.style)continue;i[s]=v._data(n,"olddisplay"),t?(!i[s]&&n.style.display==="none"&&(n.style.display=""),n.style.display===""&&Gt(n)&&(i[s]=v._data(n,"olddisplay",nn(n.nodeName)))):(r=Dt(n,"display"),!i[s]&&r!=="none"&&v._data(n,"olddisplay",r))}for(s=0;s<o;s++){n=e[s];if(!n.style)continue;if(!t||n.style.display==="none"||n.style.display==="")n.style.display=t?i[s]||"":"none"}return e}function Zt(e,t,n){var r=Rt.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function en(e,t,n,r){var i=n===(r?"border":"content")?4:t==="width"?1:0,s=0;for(;i<4;i+=2)n==="margin"&&(s+=v.css(e,n+$t[i],!0)),r?(n==="content"&&(s-=parseFloat(Dt(e,"padding"+$t[i]))||0),n!=="margin"&&(s-=parseFloat(Dt(e,"border"+$t[i]+"Width"))||0)):(s+=parseFloat(Dt(e,"padding"+$t[i]))||0,n!=="padding"&&(s+=parseFloat(Dt(e,"border"+$t[i]+"Width"))||0));return s}function tn(e,t,n){var r=t==="width"?e.offsetWidth:e.offsetHeight,i=!0,s=v.support.boxSizing&&v.css(e,"boxSizing")==="border-box";if(r<=0||r==null){r=Dt(e,t);if(r<0||r==null)r=e.style[t];if(Ut.test(r))return r;i=s&&(v.support.boxSizingReliable||r===e.style[t]),r=parseFloat(r)||0}return r+en(e,t,n||(s?"border":"content"),i)+"px"}function nn(e){if(Wt[e])return Wt[e];var t=v("<"+e+">").appendTo(i.body),n=t.css("display");t.remove();if(n==="none"||n===""){Pt=i.body.appendChild(Pt||v.extend(i.createElement("iframe"),{frameBorder:0,width:0,height:0}));if(!Ht||!Pt.createElement)Ht=(Pt.contentWindow||Pt.contentDocument).document,Ht.write("<!doctype html><html><body>"),Ht.close();t=Ht.body.appendChild(Ht.createElement(e)),n=Dt(t,"display"),i.body.removeChild(Pt)}return Wt[e]=n,n}function fn(e,t,n,r){var i;if(v.isArray(t))v.each(t,function(t,i){n||sn.test(e)?r(e,i):fn(e+"["+(typeof i=="object"?t:"")+"]",i,n,r)});else if(!n&&v.type(t)==="object")for(i in t)fn(e+"["+i+"]",t[i],n,r);else r(e,t)}function Cn(e){return function(t,n){typeof t!="string"&&(n=t,t="*");var r,i,s,o=t.toLowerCase().split(y),u=0,a=o.length;if(v.isFunction(n))for(;u<a;u++)r=o[u],s=/^\+/.test(r),s&&(r=r.substr(1)||"*"),i=e[r]=e[r]||[],i[s?"unshift":"push"](n)}}function kn(e,n,r,i,s,o){s=s||n.dataTypes[0],o=o||{},o[s]=!0;var u,a=e[s],f=0,l=a?a.length:0,c=e===Sn;for(;f<l&&(c||!u);f++)u=a[f](n,r,i),typeof u=="string"&&(!c||o[u]?u=t:(n.dataTypes.unshift(u),u=kn(e,n,r,i,u,o)));return(c||!u)&&!o["*"]&&(u=kn(e,n,r,i,"*",o)),u}function Ln(e,n){var r,i,s=v.ajaxSettings.flatOptions||{};for(r in n)n[r]Line truncated
|
||||
@@ -0,0 +1,45 @@
|
||||
{
|
||||
"short_name": "Hyperdope Gematria Calculator",
|
||||
"name": "Hyperdope Gematria Calculator",
|
||||
"background_color": "#202631",
|
||||
"icons": [
|
||||
{
|
||||
"src": "res/calc-logo-36.png",
|
||||
"sizes": "36x36",
|
||||
"type": "image/png",
|
||||
"density": 0.75
|
||||
},
|
||||
{
|
||||
"src": "res/calc-logo-36.png",
|
||||
"sizes": "48x48",
|
||||
"type": "image/png",
|
||||
"density": 1.0
|
||||
},
|
||||
{
|
||||
"src": "res/calc-logo-72.png",
|
||||
"sizes": "72x72",
|
||||
"type": "image/png",
|
||||
"density": 1.5
|
||||
},
|
||||
{
|
||||
"src": "res/calc-logo-96.png",
|
||||
"sizes": "96x96",
|
||||
"type": "image/png",
|
||||
"density": 2.0
|
||||
},
|
||||
{
|
||||
"src": "res/calc-logo-144.png",
|
||||
"sizes": "144x144",
|
||||
"type": "image/png",
|
||||
"density": 3.0
|
||||
},
|
||||
{
|
||||
"src": "res/calc-logo-192.png",
|
||||
"sizes": "192x192",
|
||||
"type": "image/png",
|
||||
"density": 4.0
|
||||
}
|
||||
],
|
||||
"start_url": "index.html",
|
||||
"display": "fullscreen"
|
||||
}
|
||||
|
After Width: | Height: | Size: 35 KiB |
|
After Width: | Height: | Size: 3.0 KiB |
|
After Width: | Height: | Size: 5.9 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 3.0 KiB |
|
After Width: | Height: | Size: 718 KiB |