-
Notifications
You must be signed in to change notification settings - Fork 0
/
background.js
40 lines (35 loc) · 1.21 KB
/
background.js
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
33
34
35
36
37
38
39
40
console.log('background scripts running....');
// chrome.browserAction.onClicked.addListener(function(tab) {
// chrome.tabs.executeScript(null, {file: "jquery-3.3.1.min.js"});
// });
let params = {
active: true,
currentWindow: true
}
console.log('test');
$(document).on('change', 'input[name=choice]:checked', function (){
console.log(this.value + ' changed');
chrome.tabs.query(params, gotTabs);
});
function gotTabs(tabs){
console.log("got tabs");
let selectedPercent = $('#selectedPercent').is(':checked')
let goalsScored = $('#goalsScored').is(':checked');
let cleanSheets = $('#cleanSheets').is(':checked');
let yellowCards = $('#yellowCards').is(':checked');
let redCards = $('#redCards').is(':checked');
let totalPoints = $('#totalPoints').is(':checked');
let assists = $('#assists').is(':checked');
let none = $('#clear').is(':checked');
let message = {
selectedPercent: selectedPercent,
goalsScored: goalsScored,
cleanSheets: cleanSheets,
yellowCards: yellowCards,
redCards: redCards,
totalPoints: totalPoints,
assists: assists,
clear: clear
}
chrome.tabs.sendMessage(tabs[0].id, message);
}