forked from encrypt-to/encrypt-to.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaudit.js
More file actions
32 lines (30 loc) · 1.41 KB
/
audit.js
File metadata and controls
32 lines (30 loc) · 1.41 KB
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
// start audit after page load
$(document).ready(function () {
var worker = new Worker('worker.js');
worker.addEventListener('message', function(e) {
var data = e.data;
switch (data.cmd) {
case 'audit':
if (data.valid === 'true') {
$('#resultTable > tbody:last').append('<tr><td>' + data.name + '</td><td style="background-color:green;color:white;">=</td><td>' + data.name + '</td><td>' + data.size / 1000 + ' kb</td></tr>');
} else {
$('#resultTable > tbody:last').append('<tr><td>' + data.name + '</td><td style="background-color:red;color:white;">!=</td><td>' + data.name + '</td><td>' + data.size / 1000 + ' kb</td></tr>');
}
break;
case 'commit':
$('#commit').append("<a href='https://github.com/hackenproof/report_encryption/commit/" + data.lastCommit.sha + "'>" + "Last commit from " + data.lastCommit.commit.author.date + ", " + data.lastCommit.commit.message + "</a>");
break;
case 'done':
$('#running').text("Test finished.");
worker.terminate();
break
case 'error':
$('#running').text(data.msg);
break
default:
$('#resultTable > tbody:last').append('<tr style="background-color:blue;color:white;"><td>' + data.name + ' unavailable</td><td>!=</td><td>' + data.name + ' unavailable</td></tr>');
};
}, false);
// start worker
worker.postMessage({'cmd': 'start'});
});