-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbackground.html
More file actions
45 lines (41 loc) · 1.05 KB
/
background.html
File metadata and controls
45 lines (41 loc) · 1.05 KB
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
<html>
<head>
<script>
function get_favorite_style(){
return localStorage["favorite_style"] || "native";
}
function in_list(list, val){
for (var idx in list){
if (list[idx] && val.indexOf(list[idx])>=0){
return true;
}
}
return false;
}
function is_defered_page(url){
if (in_list((localStorage["defered_pages"] || "").split("\n"), url)){
return true;
}
return /[\w\d-]+\.ya\.ru/.test(url);
}
function is_disabled_page(url){
if (in_list((localStorage["disabled_pages"] || "").split("\n"), url)){
return true;
}
return false;
}
chrome.extension.onRequest.addListener(
function(request, sender, sendResponse) {
if (request.ask == "page_settings"){
return sendResponse({
no_highlight: is_disabled_page(sender.tab.url),
defered_highlight: is_defered_page(sender.tab.url),
favorite_style: get_favorite_style()
});
}
return sendResponse({});
});
</script>
</head>
<!-- vim: set syntax=javascript: -->
</html>