-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpopup.js
50 lines (45 loc) · 1.2 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
46
47
48
49
50
function onKeywordChange() {
chrome.storage.sync.set({
keywords: $('.keyword').val()
}, function () {
console.log("keyword change suc ");
});
}
function onUsernameChange() {
chrome.storage.sync.set({
usernames: $('.username').val()
}, function () {
console.log("username change suc ");
});
}
$('.keyword').tagsInput({
'height': '78px',
'width': '300px',
'interactive': true,
'defaultText': 'add keyword...',
'removeWithBackspace': true,
'minChars': 0,
'maxChars': 10, // if not provided there is no limit
'placeholderColor': '#666666',
'onAddTag': onKeywordChange,
'onRemoveTag': onKeywordChange
});
$('.username').tagsInput({
'height': '78px',
'width': '300px',
'interactive': true,
'defaultText': 'add user...',
'removeWithBackspace': true,
'minChars': 0,
'maxChars': 10, // if not provided there is no limit
'placeholderColor': '#666666',
'onAddTag': onUsernameChange,
'onRemoveTag': onUsernameChange
});
chrome.storage.sync.get({
keywords: '',
usernames: ''
}, (result) => {
$('.keyword').importTags(result.keywords);
$('.username').importTags(result.usernames);
});