-
Notifications
You must be signed in to change notification settings - Fork 8
/
resultpage.js
45 lines (39 loc) · 1.55 KB
/
resultpage.js
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
const redactedResult = document.getElementById("redacted-result");
const messageWordNumber = document.getElementById("messageWordNumber");
const redactedWordNumber = document.getElementById("redactedWordNumber");
const sendbackBtn = document.getElementById("sendback-btn");
const matchWord = document.getElementById("matchword");
const sendBtn = document.getElementById("send-btn");
const sendContainer = document.getElementById("sendContainer");
sendbackBtn?.addEventListener("click", sendBackFunc);
sendBtn?.addEventListener("click", sendBtnFunc);
function getData() {
const getItemData = localStorage.getItem("redactResult");
const getMessageWordNumber = localStorage.getItem("messageCount");
const getredactedWordNumber = localStorage.getItem("redactedCount");
redactedResult.value = getItemData;
messageWordNumber.innerText = getMessageWordNumber;
redactedWordNumber.innerText = getredactedWordNumber;
const patternsDataFromLocalStorage = localStorage.getItem("patternsData");
const matchwordData = getItemData.split(" ");
let matchwordarray = [];
matchwordData.filter((word) => {
if (word === patternsDataFromLocalStorage) {
matchwordarray.push(word);
}
});
const matchwordarrayLength = matchwordarray.length;
matchWord.innerText = matchwordarrayLength;
}
getData();
function sendBackFunc() {
window.location.assign("index.html");
}
// send message function
function sendBtnFunc() {
sendContainer.style.display = "grid";
// take the modal out after 2sec
setTimeout(() => {
sendContainer.style.display = "none";
}, 2000);
}