-
Notifications
You must be signed in to change notification settings - Fork 5
/
popup.js
39 lines (35 loc) · 1.49 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
// 取得 storage
var getStorage = () => {
return new Promise(function(resolve, reject){
chrome.storage.sync.get(null, function(storage) {
if (chrome.runtime.error) {
reject(chrome.runtime.error);
} else {
resolve(storage);
}
});
});
};
// 初始化
document.body.onload = function() {
getStorage()
.then(function(storage){
var keyBindings = storage.keyBindings;
var shortcutText = document.getElementById('shortcut').innerHTML;
shortcutText = shortcutText.replace("{addBookmark}", String.fromCharCode(keyBindings.addBookmark));
shortcutText = shortcutText.replace("{jumpToPrevBookmark}", String.fromCharCode(keyBindings.jumpToPrevBookmark));
shortcutText = shortcutText.replace("{jumpToNextBookmark}", String.fromCharCode(keyBindings.jumpToNextBookmark));
shortcutText = shortcutText.replace("{setRepeatStart}", String.fromCharCode(keyBindings.setRepeatStart));
shortcutText = shortcutText.replace("{setRepeatEnd}", String.fromCharCode(keyBindings.setRepeatEnd));
document.getElementById('shortcut').innerHTML = shortcutText;
});
document.getElementById("options").addEventListener('click', (e) => {
window.open(chrome.runtime.getURL("options.html"));
});
document.getElementById("feedback").addEventListener('click', (e) => {
window.open("https://github.com/chiubeta/video_bookmarker/issues");
});
document.getElementById("about").addEventListener('click', (e) => {
window.open("https://github.com/chiubeta/video_bookmarker");
});
}