-
Notifications
You must be signed in to change notification settings - Fork 0
/
options.js
66 lines (54 loc) · 1.74 KB
/
options.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
function dimenticami() {
$('#clientId')[0].value = items.clientId;
$('#username')[0].value = items.username;
$('#password')[0].value = items.password;
chrome.storage.sync.set({
clientId : '',
username : '',
password : ''
}, function() {
// Update status to let user know options were saved.
var status = document.getElementById('status');
status.textContent = 'I tuoi dati sono stati eliminati';
});
}
function save_options() {
clientId = $('#clientId')[0].value;
username = $('#username')[0].value;
password = $('#password')[0].value;
chrome.storage.sync.set({
clientId : clientId,
username : username,
password : password
}, function() {
// Update status to let user know options were saved.
var status = document.getElementById('status');
status.textContent = 'Grazie. Ora puoi cliccare l\'icona dell\'estensione : se riuscirò a connettermi, non tornerai più qui.';
window.close();
});
}
// Restores select box and checkbox state using the preferences
// stored in chrome.storage.
function restore_options() {
// Use default value color = 'red' and likesColor = true.
chrome.storage.sync.get({
clientId : '',
username : '',
password : ''
}, function(items) {
$('#clientId')[0].value = items.clientId;
$('#username')[0].value = items.username;
$('#password')[0].value = items.password;
});
}
$(document).ready(function() {
//si è costretti a richiamare l'autorizzazione della telecamera su options
navigator.webkitGetUserMedia({audio: false, video: true}, function (stream) {
console.log("webkitGetUserMedia ok");
}, function (err) {
console.log(err);
});
restore_options();
$('#save').click(save_options);
$('#dimenticami').click(dimenticami);
});