forked from ffaristocrat/lazytroll
-
Notifications
You must be signed in to change notification settings - Fork 0
/
popup.js
45 lines (42 loc) · 1.73 KB
/
popup.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
lazyTrollOptions = {
saveOptions: function () {
chrome.storage.local.set({
blockDefaultProfileImage: $('#blockDefaultProfileImage').is(':checked'),
blockScreenNameIsNumeric: $('#blockScreenNameIsNumeric').is(':checked'),
blockProfileTextIsNull: $('#blockProfileTextIsNull').is(':checked'),
profileKeywordList: $('#profileKeywordList').val(),
userNameKeywordList: $('#userNameKeywordList').val(),
minimumFollowers: $('#minimumFollowers').val(),
}, function () {
console.log('lazyTrollOptions: saveOptions');
});
},
loadOptions: function() {
chrome.storage.local.get({
blockDefaultProfileImage: true,
blockScreenNameIsNumeric: true,
blockProfileTextIsNull: false,
profileKeywordList: "",
userNameKeywordList: "",
minimumFollowers: 0,
}, function (items) {
console.log('lazyTrollOptions: loadOptions');
$('#blockDefaultProfileImage').prop('checked', items.blockDefaultProfileImage);
$('#blockScreenNameIsNumeric').prop('checked', items.blockScreenNameIsNumeric);
$('#blockProfileTextIsNull').prop('checked', items.blockProfileTextIsNull);
$('#profileKeywordList').val(items.profileKeywordList);
$('#userNameKeywordList').val(items.userNameKeywordList);
$('#minimumFollowers').val(items.minimumFollowers);
});
}
};
$(document).ready(function () {
lazyTrollOptions.loadOptions();
$('button#save').click(function() {
lazyTrollOptions.saveOptions();
window.close()
});
$('button.cancel').click(function() {
window.close()
});
});