atcheck/lsscanner/new_ubuntu/index.html

58 lines
1.3 KiB
HTML
Raw Normal View History

2019-12-16 18:42:21 +01:00
<!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">
2020-01-13 17:29:37 +01:00
<title>Student counter</title>
2019-12-16 18:42:21 +01:00
</head>
<body>
<nav>
<div class="nav-wrapper">
2020-01-13 17:29:37 +01:00
<a class="brand-logo center">Student counter</a>
2019-12-16 18:42:21 +01:00
</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>