-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.c16edda7.js.map
1 lines (1 loc) · 4.17 KB
/
index.c16edda7.js.map
1
{"mappings":"aAAA,IAAMA,OAASC,SAASC,cAAT,WACTC,QAAO,+FACPC,eAAiB,YAEdC,cAAcC,GACrB,IACMC,EAAOD,EAAOE,aAET,IAAOC,OAHN,GAGmBF,GAElBG,OAAOJ,YAGbK,OAAOL,GACd,IAEMM,EAAcC,SAASP,EAAOQ,OAAO,EAAG,GAAI,GAC5CC,EAAYF,SAASP,EAAOQ,OAAO,EAAG,IAAK,GAHvB,cAIpBE,EAAaH,SAASP,EAAOQ,OAAO,GAAI,GAAI,GAC5CG,EAAeJ,SAASP,EAAOQ,OAAO,GAAI,GAAI,GAC9CI,EAAiBL,SAASP,EAAOQ,OAAO,GAAI,IAAK,GAEjDK,EAAM,UAEZA,EAAOP,YAAcA,EACrBO,EAAOJ,UAAYA,EACnBI,EAAOH,WAAaA,EACpBG,EAAOF,aAAeA,EACtBE,EAAOD,eAAiBA,EACxBC,EAAOC,YAAc,IAAIC,KAAKN,GAAWO,cACzCH,EAAOI,aAAe,IAAIF,KAAKN,GAAWS,kBAEnCL,WAGAM,cACOxB,SAASC,cAAT,SACRwB,kBAGCC,cAAcC,GACrB,IAAMC,EAAY5B,SAASC,cAAT,SAEd2B,EAAUC,KAAKtB,QAAUJ,gBAC3ByB,EAAUE,WAAU,GAGtB,IAAMC,EAAM/B,SAASgC,cAAT,UAEP,IAAMC,KAAK/B,QAAS,CACvB,IAAMgC,EAAUlC,SAASgC,cAAT,MAEhBE,EAAQC,UAAYR,EAAOzB,QAAQ+B,IACnCC,EAAQE,UAAR,sBAEAL,EAAIM,YAAYH,GAGlBN,EAAUU,QAAQP,OAEb,IAAWA,EAAPQ,EAAI,EAAQR,EAAMH,EAAUC,KAAKU,GAAIA,IAE1CR,EAAIK,UADFG,EAAI,GAAK,EACX,cAEA,GAKN,IAAMC,UAAS,WACb,IAAMC,EAAQC,OAAO1C,SAASC,cAAT,SAAgC0C,OAEjDC,EAAUH,EAAMI,SAAS,GAEzBC,EAAUpC,OADdkC,EAAUxC,cAAcwC,IAGxBE,EAAQC,GAAKN,EAEbf,cAAcoB,IAehB/C,OAAOiD,iBAAP,QAAiCR","sources":["src/js/index.js"],"sourcesContent":["const button = document.querySelector(\"#button\");\nconst COLUMNS = [\"id\", \"dateTwitter\", \"milliseconds\", \"reservedBit\", \"dataCenter\", \"workerThread\", \"sequenceNumber\"];\nconst MAX_TABLE_ROWS = 10;\n\nfunction fillWithZeros(string) {\n const MAX = 64;\n const size = string.length;\n\n const zeros = \"0\".repeat(MAX - size);\n\n return zeros.concat(string);\n}\n\nfunction divide(string) {\n const TWITTER_TIMESTAMP = 1288834974675;\n\n const reservedBit = parseInt(string.substr(0, 1), 2);\n const timestamp = parseInt(string.substr(1, 41), 2) + TWITTER_TIMESTAMP;\n const dataCenter = parseInt(string.substr(42, 5), 2);\n const workerThread = parseInt(string.substr(47, 5), 2);\n const sequenceNumber = parseInt(string.substr(52, 12), 2);\n\n const result = {};\n\n result.reservedBit = reservedBit;\n result.timestamp = timestamp;\n result.dataCenter = dataCenter;\n result.workerThread = workerThread;\n result.sequenceNumber = sequenceNumber;\n result.dateTwitter = new Date(timestamp).toGMTString();\n result.milliseconds = new Date(timestamp).getMilliseconds();\n\n return result;\n};\n\nfunction deleteTable() {\n const table = document.querySelector(\"table\");\n table.remove();\n};\n\nfunction addRowToTable(values) {\n const tableBody = document.querySelector(\"tbody\");\n\n if (tableBody.rows.length == MAX_TABLE_ROWS) {\n tableBody.deleteRow(-1);\n };\n\n const row = document.createElement(\"tr\");\n\n for (const v in COLUMNS) {\n const element = document.createElement(\"td\");\n\n element.innerText = values[COLUMNS[v]];\n element.className = \"text-left py-3 px-4\";\n \n row.appendChild(element);\n };\n\n tableBody.prepend(row);\n\n for (let t = 0, row; row = tableBody.rows[t]; t++) {\n if (t % 2 == 0) {\n row.className = \"bg-gray-100\";\n } else {\n row.className = \"\";\n };\n }; \n};\n\nconst calculate = function() {\n const input = BigInt(document.querySelector(\"input\").value);\n\n let baseBin = input.toString(2);\n baseBin = fillWithZeros(baseBin);\n let results = divide(baseBin);\n\n results.id = input;\n\n addRowToTable(results);\n\n /*\n for (let r in results) {\n console.log(r, results[r]);\n const divText = document.createElement(\"p\");\n\n divText.className = r;\n divText.innerText = r + ' ' + results[r];\n\n result.appendChild(divText);\n };\n */ \n};\n\nbutton.addEventListener(\"click\", calculate);"],"names":["button","document","querySelector","COLUMNS","MAX_TABLE_ROWS","fillWithZeros","string","size","length","repeat","concat","divide","reservedBit","parseInt","substr","timestamp","dataCenter","workerThread","sequenceNumber","result","dateTwitter","Date","toGMTString","milliseconds","getMilliseconds","deleteTable","remove","addRowToTable","values","tableBody","rows","deleteRow","row","createElement","v","element","innerText","className","appendChild","prepend","t","calculate","input","BigInt","value","baseBin","toString","results","id","addEventListener"],"version":3,"file":"index.c16edda7.js.map"}