-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpopup.js
More file actions
32 lines (29 loc) · 739 Bytes
/
popup.js
File metadata and controls
32 lines (29 loc) · 739 Bytes
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
var chess = new Chess();
$('document').ready(function(){
$('#status').empty();
chrome.tabs.executeScript(null, { file: "inject.js" }, function(res) {
res[0].forEach(function(m) {
chess.move(m);
});
var fen = chess.fen();
$('#status').append(fen + '\n\n');
$('#status').append(chess.ascii());
chrome.runtime.sendMessage({ message: 'get_move', fen });
});
});
chrome.runtime.onMessage.addListener(
(request, sender, senderResponse) => {
switch (request.message) {
case 'got_move': {
$('#strength').empty().append(request.move);
break;
}
default:
}
}
);
$(function() {
$('#calculate').click(function() {
$('#strength').empty().append('+1');
});
});