-
Notifications
You must be signed in to change notification settings - Fork 2
/
initialer.js
96 lines (82 loc) · 2.49 KB
/
initialer.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
topics = {};
background_retry_count = 1;
focus_climb_clock = "show";
focus_climb_push_pin = false;
focusClimbPexelsToken = "";
focusClimbSearchTerm = "";
focus_climb_clock = "";
focusClimbPushPin = "";
focusClimbNotePad = "";
topsites_setting = "";
background_setting = "";
$(document).ready(function() {
// Loading custom CSS first, we don't want users see the delay!
chrome.storage.local.get(["focusClimbCustomCSS"]).then((result) => {
if (result.focusClimbCustomCSS) {
$("head").append(result.focusClimbCustomCSS);
$("#customcss_textarea").val(result.focusClimbCustomCSS);
}
});
keyboardManager();
initiateSettings();
clockUpdate();
setInterval(clockUpdate, 1000);
//changeButtonsStatus();
getTopSites();
loadWeatherOptions();
loadBookmarks();
main_menu_actions();
// Listen for messages from the background script
chrome.runtime.onMessage.addListener(function(message, sender, sendResponse) {
if (message.action === "updateNotes") {
// Update the content in this instance (new tab page)
$("#popup_note_textarea").val(message.notes);
}
});
});
function initiateSettings() {
chrome.storage.local.get(
["focusClimbSearchTerm",
"focusClimbPexelsToken",
"focus_climb_clock",
"focusClimbPushPin",
"focusClimbNotePad",
"topsites_setting",
"background_setting",
"jumps_textarea"
]
).then((result) => {
if (result.focusClimbSearchTerm) {
$("#focusClimbSearchTerm").val(result.focusClimbSearchTerm);
}
if (result.focusClimbPexelsToken) {
focusClimbPexelsToken = result.focusClimbPexelsToken;
$("#focusClimbPexelsToken").val(focusClimbPexelsToken);
} else {
focusClimbPexelsToken = '563492ad6f917000010000010b883213d49b45daaa804a8854ad452c';
}
if (result.focus_climb_clock && result.focus_climb_clock == "hide") {
$("#digital-clock").hide();
} else {
$("#digital-clock").show();
}
if (result.focusClimbPushPin) {
try {
focus_climb_push_pin = result.focusClimbPushPin;
} catch {
console.log("There was a problem with pinned image!");
}
}
if (result.focusClimbNotePad) {
$("#popup_note_textarea").val(result.focusClimbNotePad);
}
if (result.topsites_setting) {
topsites(result.topsites_setting);
}
backgroundController(result.background_setting);
if (result.jumps_textarea) {
$("#jumps_textarea").val(result.jumps_textarea);
}
changeButtonsStatus();
});
}