atcheck/lsscanner/new_ubuntu/index.html

58 lines
1.3 KiB
HTML
Executable File

<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0-beta/css/materialize.min.css">
<meta charset="UTF-8">
<title>Student counter</title>
</head>
<body>
<nav>
<div class="nav-wrapper">
<a class="brand-logo center">Student counter</a>
</div>
</nav>
<ul>
</ul>
<script>
const electron = require('electron');
const {ipcRenderer} = electron;
const ul = document.querySelector("ul");
ipcRenderer.on("item:add",function(e,item) {
console.log(item);
ul.className = "collection";
const li = document.createElement('li');
li.className = "collection-item";
var date = item[3] ? item[3] : Date.now();
const itemText = document.createTextNode(item[0] + " " + item[1] + " " + item[2] + " " + date);
li.appendChild(itemText);
li.id = item[2];
ul.appendChild(li);
});
ul.addEventListener('dblclick',removeItem);
function removeItem(item) {
ipcRenderer.send("item:delete",item.target.id);
item.target.remove();
if (ul.children.length == 0) {
ul.className = "";
}
}
</script>
</html>