2020-07-06 01:00:06 +00:00
|
|
|
let windowName = 1
|
2020-07-09 03:23:17 +00:00
|
|
|
|
2020-07-06 01:00:06 +00:00
|
|
|
function appendRow(data) {
|
|
|
|
let dateNow = new Date()
|
|
|
|
let table = document.getElementById("logDisplayTable")
|
|
|
|
let newRow = document.createElement('tr')
|
|
|
|
newRow.innerHTML = `
|
|
|
|
<td style="font-size: 12px;">${dateNow.getHours()}:${dateNow.getMinutes()} | ${data.url} [${data.count}] BLOCKED</td>
|
|
|
|
`
|
|
|
|
table.appendChild(newRow)
|
|
|
|
document.getElementById('logContainer').scrollTo(0, document.getElementById('logContainer').scrollHeight)
|
|
|
|
}
|
|
|
|
|
|
|
|
onload = () => {
|
2020-07-09 03:23:17 +00:00
|
|
|
// Display logs sent from logLoad.js
|
2020-07-06 01:00:06 +00:00
|
|
|
window.addEventListener(
|
|
|
|
"message",
|
|
|
|
event => {
|
|
|
|
if (event.origin === "file://" && event.source === window) {
|
|
|
|
if (event.data.type === 'blockUpdate') {
|
|
|
|
console.log(event.data.payload)
|
|
|
|
appendRow(event.data.payload)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
false
|
|
|
|
)
|
|
|
|
}
|