-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpopup.js
38 lines (23 loc) · 777 Bytes
/
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
$(function() {
var bck = chrome.extension.getBackgroundPage();
//set saved values
$('input[type="checkbox"]').attr('checked', bck.options.enabled);
$('.word_count').text(bck.options.words_shown-1);
$('.page_views').text(bck.options.max_word_exposure - bck.options.word_exposure);
if (bck.options.blocked)
$('.exclude').show();
chrome.tabs.getSelected(null, function(tab) {
$('.exclude_url').val(tab.url);
});
//events
$('input[type="checkbox"]').change(function(){
bck.options.enabled = this.checked;
bck.save();
chrome.tabs.reload();
});
$('.options').click(function(){chrome.tabs.create({url: 'options.html'});});
$('button.add').click(function(){
bck.options.excluded_sites.push($(".exclude_url").val());
bck.save();
});
});