-
Notifications
You must be signed in to change notification settings - Fork 19
/
background.html
68 lines (62 loc) · 2.32 KB
/
background.html
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
66
67
68
<script>
// Creates options defaults in case user hasn't set them yet
if (!localStorage["scroll_speed"]) {
localStorage["scroll_speed"] = 1000;
}
if (!localStorage["scroll_speed2"]) {
localStorage["scroll_speed2"] = localStorage["scroll_speed"];
}
if (!localStorage["distance_length"]) {
localStorage["distance_length"] = 400;
}
if (!localStorage["size"]) {
localStorage["size"] = "50px";
}
if (!localStorage["arrow"]) {
localStorage["arrow"] = "arrow_blue";
}
if (!localStorage["location"]) {
localStorage["location"] = "TR";
}
if (!localStorage["stbb"]) {
localStorage["stbb"] = "off";
}
if (!localStorage["transparency"]) {
localStorage["transparency"] = "0.5";
}
if (!localStorage["contextmenu"]) {
localStorage["contextmenu"] = "on";
}
if (!localStorage["shortcuts"]) {
localStorage["shortcuts"] = "arrows";
}
if (!localStorage["loadcount"]) {
localStorage["loadcount"] = "0";
}
if ((localStorage["loadcount"]=="40") && (localStorage["bothered"]!="1")) {
localStorage["bothered"]="1";
chrome.tabs.create({url:'http://scrolltotopbutton.com/STTBdonate',selected:false});
}
if (localStorage["stbb"]=="on") {
localStorage["stbb"] = "flip";
}
if (localStorage["latest"]!="2"){
localStorage["latest"]="2";
chrome.tabs.create({url:'/options.html',selected:false});
}
// Counts number of times Chrome has been opened to load donation message after certain amount
loadcount=localStorage["loadcount"];
loadcount++;
localStorage["loadcount"]=loadcount;
// Message passer to give [LocalStorage] settings to content_script.js because it is not allowed access to [LocalStorage]
chrome.extension.onRequest.addListener(
function(request, sender, sendResponse) {
if (request.greeting == "settings")
sendResponse({speed: localStorage["scroll_speed"], speed2: localStorage["scroll_speed2"], distance: localStorage["distance_length"], size: localStorage["size"], arrow: localStorage["arrow"], scroll:"jswing", location: localStorage["location"], stbb: localStorage["stbb"], transparency: localStorage["transparency"], shortcuts: localStorage["shortcuts"]});
else if (request.greeting == "donated")
localStorage["donated"] = "1";
else
sendResponse({}); // snub them.
});
</script>
<script src="context_menu.js"></script>