diff options
Diffstat (limited to 'pages/bitset.php')
-rw-r--r-- | pages/bitset.php | 261 |
1 files changed, 185 insertions, 76 deletions
diff --git a/pages/bitset.php b/pages/bitset.php index c3cdf0a..11031e2 100644 --- a/pages/bitset.php +++ b/pages/bitset.php @@ -3,7 +3,7 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.php"; global $isLoggedIn; if (!$isLoggedIn) header("Location: /login") and die(); -$title = "Bitset Calculator"; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; +$title = "Bitset calculator"; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; ?> @@ -11,47 +11,68 @@ $title = "Bitset Calculator"; require_once $_SERVER['DOCUMENT_ROOT'] . '/include <div class="container"> <div id="page-content"> <h2>Bitset Calculator</h2> - <!--<div class="alert alert-dark"> - <details> - <summary>About the 24bit integer-based metadata system</summary> - </details> - </div>--> </div> - <div style="display:grid; grid-template-columns: repeat(24, 1fr);"> - <div data-bs-toggle="tooltip" title="Shared memory access" id="binary-bit-1" class="font-monospace tooltip-nohelp" style="text-align: center;cursor: pointer;color:#fa77ef;">0</div> - <div data-bs-toggle="tooltip" title="Shared memory access" id="binary-bit-2" class="font-monospace tooltip-nohelp" style="text-align: center;cursor: pointer;color:#fa77ef;">0</div> - <div data-bs-toggle="tooltip" title="Median system" id="binary-bit-3" class="font-monospace tooltip-nohelp" style="text-align: center;cursor: pointer;color: #a14700;">0</div> - <div data-bs-toggle="tooltip" title="Little/age regressor" id="binary-bit-4" class="font-monospace tooltip-nohelp" style="text-align: center;cursor: pointer;color:#b277fa;">0</div> - <div data-bs-toggle="tooltip" title="Little/age regressor" id="binary-bit-5" class="font-monospace tooltip-nohelp" style="text-align: center;cursor: pointer;color:#b277fa;">0</div> - <div data-bs-toggle="tooltip" title="Protector" id="binary-bit-6" class="font-monospace tooltip-nohelp" style="text-align: center;cursor: pointer;color:#77faab;">0</div> - <div data-bs-toggle="tooltip" title="Fictive" id="binary-bit-7" class="font-monospace tooltip-nohelp text-info" style="text-align: center;cursor: pointer;">0</div> - <div data-bs-toggle="tooltip" title="Not talking" id="binary-bit-8" class="font-monospace tooltip-nohelp text-danger" style="text-align: center;cursor: pointer;">0</div> - <div data-bs-toggle="tooltip" title="Host" id="binary-bit-9" class="font-monospace tooltip-nohelp text-primary" style="text-align: center;cursor: pointer;">0</div> - <div data-bs-toggle="tooltip" title="1st species" id="binary-bit-10" class="font-monospace tooltip-nohelp" style="text-align: center;cursor: pointer;color:#fab277;">0</div> - <div data-bs-toggle="tooltip" title="1st species" id="binary-bit-11" class="font-monospace tooltip-nohelp" style="text-align: center;cursor: pointer;color:#fab277;">0</div> - <div data-bs-toggle="tooltip" title="1st species" id="binary-bit-12" class="font-monospace tooltip-nohelp" style="text-align: center;cursor: pointer;color:#fab277;">0</div> - <div data-bs-toggle="tooltip" title="1st species" id="binary-bit-13" class="font-monospace tooltip-nohelp" style="text-align: center;cursor: pointer;color:#fab277;">1</div> - <div data-bs-toggle="tooltip" title="2nd species" id="binary-bit-14" class="font-monospace tooltip-nohelp" style="text-align: center;cursor: pointer;color:#faf377;">0</div> - <div data-bs-toggle="tooltip" title="2nd species" id="binary-bit-15" class="font-monospace tooltip-nohelp" style="text-align: center;cursor: pointer;color:#faf377;">0</div> - <div data-bs-toggle="tooltip" title="2nd species" id="binary-bit-16" class="font-monospace tooltip-nohelp" style="text-align: center;cursor: pointer;color:#faf377;">0</div> - <div data-bs-toggle="tooltip" title="2nd species" id="binary-bit-17" class="font-monospace tooltip-nohelp" style="text-align: center;cursor: pointer;color:#faf377;">0</div> - <div data-bs-toggle="tooltip" title="Value reserved for future use" id="binary-bit-18" class="font-monospace tooltip-nohelp text-muted" style="text-align: center;cursor: pointer;">0</div> - <div data-bs-toggle="tooltip" title="Value reserved for future use" id="binary-bit-19" class="font-monospace tooltip-nohelp text-muted" style="text-align: center;cursor: pointer;">0</div> - <div data-bs-toggle="tooltip" title="Value reserved for future use" id="binary-bit-20" class="font-monospace tooltip-nohelp text-muted" style="text-align: center;cursor: pointer;">0</div> - <div data-bs-toggle="tooltip" title="Value reserved for future use" id="binary-bit-21" class="font-monospace tooltip-nohelp text-muted" style="text-align: center;cursor: pointer;">0</div> - <div data-bs-toggle="tooltip" title="Robot" id="binary-bit-22" class="font-monospace tooltip-nohelp" style="text-align: center;cursor: pointer;">0</div> - <div data-bs-toggle="tooltip" title="Value reserved for future use" id="binary-bit-23" class="font-monospace tooltip-nohelp text-muted" style="text-align: center;cursor: pointer;">0</div> - <div data-bs-toggle="tooltip" title="Value reserved for future use" id="binary-bit-24" class="font-monospace tooltip-nohelp text-muted" style="text-align: center;cursor: pointer;">0</div> + <div style="display:grid; grid-template-columns: repeat(48, 1fr);"> + <div data-bs-toggle="tooltip" title="Value reserved for future use" id="binary-bit-1" class="font-monospace tooltip-nohelp text-muted" style="text-align: center;cursor: pointer;">0</div> + <div data-bs-toggle="tooltip" title="Value reserved for future use" id="binary-bit-2" class="font-monospace tooltip-nohelp text-muted" style="text-align: center;cursor: pointer;">0</div> + <div data-bs-toggle="tooltip" title="Value reserved for future use" id="binary-bit-3" class="font-monospace tooltip-nohelp text-muted" style="text-align: center;cursor: pointer;">0</div> + <div data-bs-toggle="tooltip" title="Value reserved for future use" id="binary-bit-4" class="font-monospace tooltip-nohelp text-muted" style="text-align: center;cursor: pointer;">0</div> + <div data-bs-toggle="tooltip" title="Value reserved for future use" id="binary-bit-5" class="font-monospace tooltip-nohelp text-muted" style="text-align: center;cursor: pointer;">0</div> + <div data-bs-toggle="tooltip" title="Value reserved for future use" id="binary-bit-6" class="font-monospace tooltip-nohelp text-muted" style="text-align: center;cursor: pointer;">0</div> + <div data-bs-toggle="tooltip" title="Value reserved for future use" id="binary-bit-7" class="font-monospace tooltip-nohelp text-muted" style="text-align: center;cursor: pointer;">0</div> + <div data-bs-toggle="tooltip" title="Value reserved for future use" id="binary-bit-8" class="font-monospace tooltip-nohelp text-muted" style="text-align: center;cursor: pointer;">0</div> + <div data-bs-toggle="tooltip" title="Value reserved for future use" id="binary-bit-9" class="font-monospace tooltip-nohelp text-muted" style="text-align: center;cursor: pointer;">0</div> + <div data-bs-toggle="tooltip" title="Value reserved for future use" id="binary-bit-10" class="font-monospace tooltip-nohelp text-muted" style="text-align: center;cursor: pointer;">0</div> + <div data-bs-toggle="tooltip" title="Value reserved for future use" id="binary-bit-11" class="font-monospace tooltip-nohelp text-muted" style="text-align: center;cursor: pointer;">0</div> + <div data-bs-toggle="tooltip" title="Value reserved for future use" id="binary-bit-12" class="font-monospace tooltip-nohelp text-muted" style="text-align: center;cursor: pointer;">0</div> + <div data-bs-toggle="tooltip" title="Value reserved for future use" id="binary-bit-13" class="font-monospace tooltip-nohelp text-muted" style="text-align: center;cursor: pointer;">0</div> + <div data-bs-toggle="tooltip" title="Value reserved for future use" id="binary-bit-14" class="font-monospace tooltip-nohelp text-muted" style="text-align: center;cursor: pointer;">0</div> + <div data-bs-toggle="tooltip" title="Value reserved for future use" id="binary-bit-15" class="font-monospace tooltip-nohelp text-muted" style="text-align: center;cursor: pointer;">0</div> + <div data-bs-toggle="tooltip" title="Value reserved for future use" id="binary-bit-16" class="font-monospace tooltip-nohelp text-muted" style="text-align: center;cursor: pointer;">0</div> + <div data-bs-toggle="tooltip" title="Eatable food" id="binary-bit-17" class="font-monospace tooltip-nohelp" style="color: #d63384;text-align: center;cursor: pointer;">0</div> + <div data-bs-toggle="tooltip" title="Eatable food" id="binary-bit-18" class="font-monospace tooltip-nohelp" style="color: #d63384;text-align: center;cursor: pointer;">0</div> + <div data-bs-toggle="tooltip" title="Ability to use magic" id="binary-bit-19" class="font-monospace tooltip-nohelp" style="color: #fd7e14;text-align: center;cursor: pointer;">0</div> + <div data-bs-toggle="tooltip" title="Ability to use magic" id="binary-bit-20" class="font-monospace tooltip-nohelp" style="color: #fd7e14;text-align: center;cursor: pointer;">0</div> + <div data-bs-toggle="tooltip" title="Ability to use magic" id="binary-bit-21" class="font-monospace tooltip-nohelp" style="color: #fd7e14;text-align: center;cursor: pointer;">0</div> + <div data-bs-toggle="tooltip" title="Affectionative or sexual sensitivity" id="binary-bit-22" class="font-monospace tooltip-nohelp" style="color:#ffc107; text-align: center;cursor: pointer;">0</div> + <div data-bs-toggle="tooltip" title="Affectionative or sexual sensitivity" id="binary-bit-23" class="font-monospace tooltip-nohelp" style="color:#ffc107; text-align: center;cursor: pointer;">0</div> + <div data-bs-toggle="tooltip" title="Affectionative or sexual sensitivity" id="binary-bit-24" class="font-monospace tooltip-nohelp" style="color:#ffc107; text-align: center;cursor: pointer;">0</div> + <div data-bs-toggle="tooltip" title="Shared memory access" id="binary-bit-25" class="font-monospace tooltip-nohelp" style="text-align: center;cursor: pointer;color:#fa77ef;">0</div> + <div data-bs-toggle="tooltip" title="Shared memory access" id="binary-bit-26" class="font-monospace tooltip-nohelp" style="text-align: center;cursor: pointer;color:#fa77ef;">0</div> + <div data-bs-toggle="tooltip" title="Median system" id="binary-bit-27" class="font-monospace tooltip-nohelp" style="text-align: center;cursor: pointer;color: #a14700;">0</div> + <div data-bs-toggle="tooltip" title="Little/age regressor" id="binary-bit-28" class="font-monospace tooltip-nohelp" style="text-align: center;cursor: pointer;color:#b277fa;">0</div> + <div data-bs-toggle="tooltip" title="Little/age regressor" id="binary-bit-29" class="font-monospace tooltip-nohelp" style="text-align: center;cursor: pointer;color:#b277fa;">0</div> + <div data-bs-toggle="tooltip" title="Protector" id="binary-bit-30" class="font-monospace tooltip-nohelp" style="text-align: center;cursor: pointer;color:#77faab;">0</div> + <div data-bs-toggle="tooltip" title="Fictive" id="binary-bit-31" class="font-monospace tooltip-nohelp text-info" style="text-align: center;cursor: pointer;">0</div> + <div data-bs-toggle="tooltip" title="Not talking" id="binary-bit-32" class="font-monospace tooltip-nohelp text-danger" style="text-align: center;cursor: pointer;">0</div> + <div data-bs-toggle="tooltip" title="Host" id="binary-bit-33" class="font-monospace tooltip-nohelp text-primary" style="text-align: center;cursor: pointer;">0</div> + <div data-bs-toggle="tooltip" title="1st species" id="binary-bit-34" class="font-monospace tooltip-nohelp" style="text-align: center;cursor: pointer;color:#fab277;">0</div> + <div data-bs-toggle="tooltip" title="1st species" id="binary-bit-35" class="font-monospace tooltip-nohelp" style="text-align: center;cursor: pointer;color:#fab277;">0</div> + <div data-bs-toggle="tooltip" title="1st species" id="binary-bit-36" class="font-monospace tooltip-nohelp" style="text-align: center;cursor: pointer;color:#fab277;">0</div> + <div data-bs-toggle="tooltip" title="1st species" id="binary-bit-37" class="font-monospace tooltip-nohelp" style="text-align: center;cursor: pointer;color:#fab277;">1</div> + <div data-bs-toggle="tooltip" title="2nd species" id="binary-bit-38" class="font-monospace tooltip-nohelp" style="text-align: center;cursor: pointer;color:#faf377;">0</div> + <div data-bs-toggle="tooltip" title="2nd species" id="binary-bit-39" class="font-monospace tooltip-nohelp" style="text-align: center;cursor: pointer;color:#faf377;">0</div> + <div data-bs-toggle="tooltip" title="2nd species" id="binary-bit-40" class="font-monospace tooltip-nohelp" style="text-align: center;cursor: pointer;color:#faf377;">0</div> + <div data-bs-toggle="tooltip" title="2nd species" id="binary-bit-41" class="font-monospace tooltip-nohelp" style="text-align: center;cursor: pointer;color:#faf377;">0</div> + <div data-bs-toggle="tooltip" title="3rd species" id="binary-bit-42" class="font-monospace tooltip-nohelp" style="text-align: center;cursor: pointer;color:#abfa77;">0</div> + <div data-bs-toggle="tooltip" title="3rd species" id="binary-bit-43" class="font-monospace tooltip-nohelp" style="text-align: center;cursor: pointer;color:#abfa77;">0</div> + <div data-bs-toggle="tooltip" title="3rd species" id="binary-bit-44" class="font-monospace tooltip-nohelp" style="text-align: center;cursor: pointer;color:#abfa77;">0</div> + <div data-bs-toggle="tooltip" title="3rd species" id="binary-bit-45" class="font-monospace tooltip-nohelp" style="text-align: center;cursor: pointer;color:#abfa77;">0</div> + <div data-bs-toggle="tooltip" title="Robot" id="binary-bit-46" class="font-monospace tooltip-nohelp" style="text-align: center;cursor: pointer;">0</div> + <div data-bs-toggle="tooltip" title="Plush" id="binary-bit-47" class="font-monospace tooltip-nohelp" style="text-align: center;cursor: pointer;color:#6610f2;">0</div> + <div data-bs-toggle="tooltip" title="Affected by age spells" id="binary-bit-48" class="font-monospace tooltip-nohelp" style="color:#6f42c1;text-align: center;cursor: pointer;">0</div> </div> <br> <p> - <b>Input:</b> <input onchange="calculateInput();" onkeydown="calculateInput()" onkeyup="calculateInput()" value="2048" id="input" type="number" class="form-control" style="width:256px;display: inline-block;color:white;background:#111;border-color:#222;" maxlength="8" max="16777215" min="16777215"><br> - <b>Output:</b> <span id="output-color" style="border-radius:5px;display:inline-block;width:16px;height:16px;background-color:black;vertical-align:middle;"></span> <span style="vertical-align:middle;"><code id="output-bin">0b000000000000100000000000</code>, <code id="output-hex">0x000800</code>, <code id="output-dec">2048</code></span> + <b>Input:</b> <input onchange="calculateInput();" onkeydown="calculateInput()" onkeyup="calculateInput()" value="2048" id="input" type="number" class="form-control" style="width:256px;display: inline-block;color:white;background:#111;border-color:#222;" maxlength="10" max="4294967295" min="2048"><br> + <b>Output:</b> <code id="output-bin">0b000000000000000000000000000000000000100000000000</code>, <code id="output-hex">0x000008000000</code>, <code id="output-dec">2048</code> </p> <script> - for (let i = 1; i <= 24; i++) { + for (let i = 1; i <= 48; i++) { document.getElementById("binary-bit-" + i).onclick = (event) => { let el = event.target; + console.log(el, el.innerText); + if (el.innerText === "0") { el.innerText = "1"; } else { @@ -60,10 +81,10 @@ $title = "Bitset Calculator"; require_once $_SERVER['DOCUMENT_ROOT'] . '/include calculateOutput(); - let binString = ("0".repeat(24 - parseInt(document.getElementById("input").value).toString(2).length)) + parseInt(document.getElementById("input").value).toString(2); + let binString = ("0".repeat(48 - parseInt(document.getElementById("input").value).toString(2).length)) + parseInt(document.getElementById("input").value).toString(2); let bin = binString.split("").map((i) => parseInt(i)); - for (let i = 1; i <= 24; i++) { + for (let i = 1; i <= 48; i++) { if (bin[i - 1]) { document.getElementById("binary-bit-" + i).innerText = bin[i - 1].toString(); } else { @@ -71,16 +92,22 @@ $title = "Bitset Calculator"; require_once $_SERVER['DOCUMENT_ROOT'] . '/include } } - let sharedMemory = parseInt(binString.substring(0, 2), 2); - let median = binString.substring(2, 3) !== "0"; - let little = parseInt(binString.substring(3, 5), 2); - let protector = binString.substring(5, 6) !== "0"; - let fictive = binString.substring(6, 7) !== "0"; - let notTalking = binString.substring(7, 8) !== "0"; - let host = binString.substring(8, 9) !== "0"; - let robot = binString.substring(21, 22) !== "0"; - let species1 = binString.substring(9, 13); - let species2 = binString.substring(13, 17); + let sharedMemory = parseInt(binString.substring(8 + 16, 10 + 16), 2); + let median = binString.substring(10 + 16, 11 + 16) !== "0"; + let little = parseInt(binString.substring(11 + 16, 13 + 16), 2); + let protector = binString.substring(13 + 16, 14 + 16) !== "0"; + let fictive = binString.substring(14 + 16, 15 + 16) !== "0"; + let notTalking = binString.substring(15 + 16, 16 + 16) !== "0"; + let host = binString.substring(16 + 16, 17 + 16) !== "0"; + let robot = binString.substring(29 + 16, 30 + 16) !== "0"; + let plush = binString.substring(30 + 16, 31 + 16) !== "0"; + let species1 = binString.substring(17 + 16, 21 + 16); + let species2 = binString.substring(21 + 16, 25 + 16); + let species3 = binString.substring(25 + 16, 29 + 16); + let food = parseInt(binString.substring(16, 2 + 16), 2); + let magic = parseInt(binString.substring(2 + 16, 5 + 16), 2); + let sensitivity = parseInt(binString.substring(5 + 16, 8 + 16), 2); + let ageSpells = binString.substring(31 + 16, 32 + 16) !== "0"; document.getElementById("value-0").value = sharedMemory; document.getElementById("value-1").value = little; @@ -92,11 +119,17 @@ $title = "Bitset Calculator"; require_once $_SERVER['DOCUMENT_ROOT'] . '/include document.getElementById("value-7").checked = notTalking; document.getElementById("value-8").checked = host; document.getElementById("value-9").checked = robot; + document.getElementById("value-10").checked = plush; + document.getElementById("value-11").value = food; + document.getElementById("value-12").value = magic; + document.getElementById("value-13").value = sensitivity; + document.getElementById("value-14").value = species3; + document.getElementById("value-15").checked = ageSpells; } } function calculateOutput() { - let bin = [null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null].map((_, i) => { + let bin = [null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null].map((_, i) => { let e = i + 1; return document.getElementById("binary-bit-" + e).innerText; }).join(""); @@ -105,19 +138,18 @@ $title = "Bitset Calculator"; require_once $_SERVER['DOCUMENT_ROOT'] . '/include let hex = parseInt(bin, 2).toString(16); - document.getElementById("output-hex").innerText = "0x" + "0".repeat(6 - hex.length) + hex; - document.getElementById("output-color").style.backgroundColor = "#" + "0".repeat(6 - hex.length) + hex; + document.getElementById("output-hex").innerText = "0x" + "0".repeat(12 - hex.length) + hex; document.getElementById("output-dec").innerText = parseInt(bin, 2).toString(); document.getElementById("input").value = parseInt(bin, 2).toString(); } function calculateInput() { - if (parseInt(document.getElementById("input").value).toString().length > 8) return; + if (parseInt(document.getElementById("input").value).toString().length > 10) return; - let binString = ("0".repeat(24 - parseInt(document.getElementById("input").value).toString(2).length)) + parseInt(document.getElementById("input").value).toString(2); + let binString = ("0".repeat(48 - parseInt(document.getElementById("input").value).toString(2).length)) + parseInt(document.getElementById("input").value).toString(2); let bin = binString.split("").map((i) => parseInt(i)); - for (let i = 1; i <= 24; i++) { + for (let i = 1; i <= 48; i++) { if (bin[i - 1]) { document.getElementById("binary-bit-" + i).innerText = bin[i - 1].toString(); } else { @@ -125,27 +157,39 @@ $title = "Bitset Calculator"; require_once $_SERVER['DOCUMENT_ROOT'] . '/include } } - let sharedMemory = parseInt(binString.substring(0, 2), 2); - let median = binString.substring(2, 3) !== "0"; - let little = parseInt(binString.substring(3, 5), 2); - let protector = binString.substring(5, 6) !== "0"; - let fictive = binString.substring(6, 7) !== "0"; - let notTalking = binString.substring(7, 8) !== "0"; - let host = binString.substring(8, 9) !== "0"; - let robot = binString.substring(21, 22) !== "0"; - let species1 = binString.substring(9, 13); - let species2 = binString.substring(13, 17); + let sharedMemory = parseInt(binString.substring(8 + 16, 10 + 16), 2); + let median = binString.substring(10 + 16, 11 + 16) !== "0"; + let little = parseInt(binString.substring(11 + 16, 13 + 16), 2); + let protector = binString.substring(13 + 16, 14 + 16) !== "0"; + let fictive = binString.substring(14 + 16, 15 + 16) !== "0"; + let notTalking = binString.substring(15 + 16, 16 + 16) !== "0"; + let host = binString.substring(16 + 16, 17 + 16) !== "0"; + let robot = binString.substring(29 + 16, 30 + 16) !== "0"; + let plush = binString.substring(30 + 16, 31 + 16) !== "0"; + let ageSpells = binString.substring(31 + 16, 32 + 16) !== "0"; + let species1 = binString.substring(17 + 16, 21 + 16); + let species2 = binString.substring(21 + 16, 25 + 16); + let species3 = binString.substring(25 + 16, 29 + 16); + let food = parseInt(binString.substring(16, 2 + 16), 2); + let magic = parseInt(binString.substring(2 + 16, 5 + 16), 2); + let sensitivity = parseInt(binString.substring(5 + 16, 8 + 16), 2); document.getElementById("value-0").value = sharedMemory; document.getElementById("value-1").value = little; document.getElementById("value-2").value = species1; document.getElementById("value-3").value = species2; + document.getElementById("value-11").value = food; + document.getElementById("value-12").value = magic; + document.getElementById("value-13").value = sensitivity; document.getElementById("value-4").checked = median; document.getElementById("value-5").checked = protector; document.getElementById("value-6").checked = fictive; document.getElementById("value-7").checked = notTalking; document.getElementById("value-8").checked = host; document.getElementById("value-9").checked = robot; + document.getElementById("value-10").checked = plush; + document.getElementById("value-14").value = species3; + document.getElementById("value-15").checked = ageSpells; calculateOutput(); @@ -163,6 +207,12 @@ $title = "Bitset Calculator"; require_once $_SERVER['DOCUMENT_ROOT'] . '/include let val7 = document.getElementById("value-7").checked; let val8 = document.getElementById("value-8").checked; let val9 = document.getElementById("value-9").checked; + let val10 = document.getElementById("value-10").checked; + let val11 = document.getElementById("value-11").value; + let val12 = document.getElementById("value-12").value; + let val13 = document.getElementById("value-13").value; + let val14 = document.getElementById("value-14").value; + let val15 = document.getElementById("value-15").checked; let val0bin = parseInt(val0).toString(2); val0bin = val0bin.length === 1 ? "0" + val0bin : val0bin; @@ -170,8 +220,18 @@ $title = "Bitset Calculator"; require_once $_SERVER['DOCUMENT_ROOT'] . '/include let val1bin = parseInt(val1).toString(2); val1bin = val1bin.length === 1 ? "0" + val1bin : val1bin; + let val11bin = parseInt(val11).toString(2); + val11bin = val11bin.length === 1 ? "0" + val11bin : val11bin; + + let val12bin = parseInt(val12).toString(2); + val12bin = val12bin.length === 1 ? "00" + val12bin : (val12bin.length === 2 ? "0" + val12bin : val12bin); + + let val13bin = parseInt(val13).toString(2); + val13bin = val13bin.length === 1 ? "00" + val13bin : (val13bin.length === 2 ? "0" + val13bin : val13bin); + let val2bin = val2; let val3bin = val3; + let val14bin = val14; let val4bin = val4 ? "1" : "0"; let val5bin = val5 ? "1" : "0"; @@ -179,14 +239,16 @@ $title = "Bitset Calculator"; require_once $_SERVER['DOCUMENT_ROOT'] . '/include let val7bin = val7 ? "1" : "0"; let val8bin = val8 ? "1" : "0"; let val9bin = val9 ? "1" : "0"; + let val10bin = val10 ? "1" : "0"; + let val15bin = val15 ? "1" : "0"; - let bin = val0bin + val4bin + val1bin + val5bin + val6bin + val7bin + val8bin + val2bin + val3bin + "0000" + val9bin + "00"; + let bin = "0000000000000000" + val11bin + val12bin + val13bin + val0bin + val4bin + val1bin + val5bin + val6bin + val7bin + val8bin + val2bin + val3bin + val14bin + val9bin + val10bin + val15bin; console.log(bin, parseInt(bin, 2)); let parts = bin.split("").map((i) => parseInt(i)); - for (let i = 1; i <= 24; i++) { + for (let i = 1; i <= 48; i++) { if (parts[i - 1]) { document.getElementById("binary-bit-" + i).innerText = parts[i - 1].toString(); } else { @@ -204,6 +266,15 @@ $title = "Bitset Calculator"; require_once $_SERVER['DOCUMENT_ROOT'] . '/include <option value="1">Partial direct access</option> <option value="0" selected>No direct access</option> </select> + <img alt="" src="/assets/icons/visibility-public.svg" style="filter:invert(1);width:24px;margin-left:5px;margin-top:-5px;" title="This information will be shown publicly" data-bs-toggle="tooltip"> + <br> + <b>Food: </b><select class="tooltip-nohelp form-select" style='display:inline-block;width:max-content;color:white;background-color:#111;border-color:#222;background-image:url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23ffffff' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");' id="value-11" onchange="updateFromSelection();"> + <option value="0" selected>Doesn't need to eat</option> + <option value="1">Can't eat fish or meat</option> + <option value="2">Can't eat meat</option> + <option value="3">Can eat everything</option> + </select> + <img alt="" src="/assets/icons/visibility-public.svg" style="filter:invert(1);width:24px;margin-left:5px;margin-top:-5px;" title="This information will be shown publicly" data-bs-toggle="tooltip"> <br> <b>Little/age regressor: </b><select class="tooltip-nohelp form-select" style='display:inline-block;width:max-content;color:white;background-color:#111;border-color:#222;background-image:url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23ffffff' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");' id="value-1" onchange="updateFromSelection();"> <option value="0" selected>None</option> @@ -211,6 +282,7 @@ $title = "Bitset Calculator"; require_once $_SERVER['DOCUMENT_ROOT'] . '/include <option value="3">Younger</option> <option value="1">Age regressor</option> </select> + <img alt="" src="/assets/icons/visibility-public.svg" style="filter:invert(1);width:24px;margin-left:5px;margin-top:-5px;" title="This information will be shown publicly" data-bs-toggle="tooltip"> <br> <b>Species: </b><select class="tooltip-nohelp form-select" style='display:inline-block;width:max-content;color:white;background-color:#111;border-color:#222;background-image:url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23ffffff' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");' id="value-2" onchange="updateFromSelection();"> <option value="0000" disabled>None</option> @@ -230,32 +302,69 @@ $title = "Bitset Calculator"; require_once $_SERVER['DOCUMENT_ROOT'] . '/include <option value="0101">Bat pony</option> <option value="0110">Crystal pony</option> </select> + <select class="tooltip-nohelp form-select" style='display:inline-block;width:max-content;color:white;background-color:#111;border-color:#222;background-image:url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23ffffff' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");' id="value-14" onchange="updateFromSelection();"> + <option value="0000">None</option> + <option value="0001">Earth pony</option> + <option value="0010">Unicorn</option> + <option value="0011">Pegasus</option> + <option value="0100">Alicorn</option> + <option value="0101">Bat pony</option> + <option value="0110">Crystal pony</option> + </select> + <img alt="" src="/assets/icons/visibility-public.svg" style="filter:invert(1);width:24px;margin-left:5px;margin-top:-5px;" title="This information will be shown publicly" data-bs-toggle="tooltip"> + <br> + <b>Magic: </b><select class="tooltip-nohelp form-select" style='display:inline-block;width:max-content;color:white;background-color:#111;border-color:#222;background-image:url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23ffffff' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");' id="value-12" onchange="updateFromSelection();"> + <option value="0" selected>Can't use magic</option> + <option value="1">Can use magic in some cases</option> + <option value="2">Can use magic with a horn</option> + <option value="3">Can use magic with wings</option> + <option value="4">Can use magic with wings and a horn</option> + <option value="5">Can use magic with another part of the body</option> + </select> + <img alt="" src="/assets/icons/visibility-public.svg" style="filter:invert(1);width:24px;margin-left:5px;margin-top:-5px;" title="This information will be shown publicly" data-bs-toggle="tooltip"> + <br> + <b>Sensitivity: </b><select class="tooltip-nohelp form-select" style='display:inline-block;width:max-content;color:white;background-color:#111;border-color:#222;background-image:url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23ffffff' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");' id="value-13" onchange="updateFromSelection();"> + <option value="0" selected>None</option> + <option value="1">May be sensitive</option> + <option value="2">Affectionately sensitive</option> + <option value="3">Sexually sensitive</option> + <option value="4">Sensitive in both ways</option> + </select> + <img alt="" src="/assets/icons/visibility-private.svg" style="filter:invert(1);width:24px;margin-left:5px;margin-top:-5px;" title="This information will remain private" data-bs-toggle="tooltip"> </p> <p> - <label> + <label style="margin-bottom:5px;"> <input type="checkbox" id="value-4" onchange="updateFromSelection();"> Part of a median system - </label><br> - <label> + </label><img alt="" src="/assets/icons/visibility-public.svg" style="filter:invert(1);width:24px;margin-left:5px;margin-top:-5px;" title="This information will be shown publicly" data-bs-toggle="tooltip"><br> + <label style="margin-bottom:5px;"> <input type="checkbox" id="value-5" onchange="updateFromSelection();"> Protector - </label><br> - <label> + </label><img alt="" src="/assets/icons/visibility-public.svg" style="filter:invert(1);width:24px;margin-left:5px;margin-top:-5px;" title="This information will be shown publicly" data-bs-toggle="tooltip"><br> + <label style="margin-bottom:5px;"> <input type="checkbox" id="value-6" onchange="updateFromSelection();"> Fictive - </label><br> - <label> + </label><img alt="" src="/assets/icons/visibility-public.svg" style="filter:invert(1);width:24px;margin-left:5px;margin-top:-5px;" title="This information will be shown publicly" data-bs-toggle="tooltip"><br> + <label style="margin-bottom:5px;"> <input type="checkbox" id="value-7" onchange="updateFromSelection();"> Not talking - </label><br> - <label> + </label><img alt="" src="/assets/icons/visibility-public.svg" style="filter:invert(1);width:24px;margin-left:5px;margin-top:-5px;" title="This information will be shown publicly" data-bs-toggle="tooltip"><br> + <label style="margin-bottom:5px;"> <input type="checkbox" id="value-8" onchange="updateFromSelection();"> Host - </label><br> - <label> + </label><img alt="" src="/assets/icons/visibility-public.svg" style="filter:invert(1);width:24px;margin-left:5px;margin-top:-5px;" title="This information will be shown publicly" data-bs-toggle="tooltip"><br> + <label style="margin-bottom:5px;"> <input type="checkbox" id="value-9" onchange="updateFromSelection();"> Robot - </label> + </label><img alt="" src="/assets/icons/visibility-public.svg" style="filter:invert(1);width:24px;margin-left:5px;margin-top:-5px;" title="This information will be shown publicly" data-bs-toggle="tooltip"><br> + <label style="margin-bottom:5px;"> + <input type="checkbox" id="value-10" onchange="updateFromSelection();"> + Plush + </label><img alt="" src="/assets/icons/visibility-public.svg" style="filter:invert(1);width:24px;margin-left:5px;margin-top:-5px;" title="This information will be shown publicly" data-bs-toggle="tooltip"><br> + <label style="margin-bottom:5px;"> + <input type="checkbox" id="value-15" onchange="updateFromSelection();"> + Affected by age spells + </label><img alt="" src="/assets/icons/visibility-private.svg" style="filter:invert(1);width:24px;margin-left:5px;margin-top:-5px;" title="This information will remain private" data-bs-toggle="tooltip"> </p> </div> |