Skip to content

Commit

Permalink
Create main.js
Browse files Browse the repository at this point in the history
  • Loading branch information
zNotChill authored Mar 20, 2022
1 parent 2699af9 commit c605188
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions main/public/js/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
$(document).ready(function(){
$("#enter").click(function(){
if (document.getElementById('input').value.length === 0) {
document.getElementById('output').innerHTML = "Please enter some text!"
return
}
document.getElementById('output').innerHTML = ""
const split = document.getElementById('input').value.split(' ')
const length = split.length;
const list = []
for (let l = 0; l < length; l++) {
list.push(`"${l + 1}": {
"split": "${split[l]}",
"md5": "${md5(split[l])}"
`) // l + 1 bc who the hell wants to use arrays that begin at 0 lets be honest

}
document.getElementById('output').innerHTML = `{${list.join(',')}}}`
fetch('./createTempJSON/' + `{${list.join('},')}}}`)
})
})

0 comments on commit c605188

Please sign in to comment.