-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.c16edda7.js
2 lines (2 loc) · 1.24 KB
/
index.c16edda7.js
1
2
"use strict";var button=document.querySelector("#button"),COLUMNS=["id","dateTwitter","milliseconds","reservedBit","dataCenter","workerThread","sequenceNumber"],MAX_TABLE_ROWS=10;function fillWithZeros(e){var t=e.length;return"0".repeat(64-t).concat(e)}function divide(e){var t=parseInt(e.substr(0,1),2),r=parseInt(e.substr(1,41),2)+1288834974675,n=parseInt(e.substr(42,5),2),a=parseInt(e.substr(47,5),2),o=parseInt(e.substr(52,12),2),s={};return s.reservedBit=t,s.timestamp=r,s.dataCenter=n,s.workerThread=a,s.sequenceNumber=o,s.dateTwitter=new Date(r).toGMTString(),s.milliseconds=new Date(r).getMilliseconds(),s}function deleteTable(){document.querySelector("table").remove()}function addRowToTable(e){var t=document.querySelector("tbody");t.rows.length==MAX_TABLE_ROWS&&t.deleteRow(-1);var r=document.createElement("tr");for(var n in COLUMNS){var a=document.createElement("td");a.innerText=e[COLUMNS[n]],a.className="text-left py-3 px-4",r.appendChild(a)}t.prepend(r);for(var o,s=0;o=t.rows[s];s++)o.className=s%2==0?"bg-gray-100":""}var calculate=function(){var e=BigInt(document.querySelector("input").value),t=e.toString(2),r=divide(t=fillWithZeros(t));r.id=e,addRowToTable(r)};button.addEventListener("click",calculate);
//# sourceMappingURL=index.c16edda7.js.map