-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathoptions.js
More file actions
26 lines (23 loc) · 773 Bytes
/
Copy pathoptions.js
File metadata and controls
26 lines (23 loc) · 773 Bytes
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
// 加载保存的设置
function loadSettings() {
chrome.storage.sync.get('showBoth', function(data) {
document.getElementById('showBoth').checked = data.showBoth || false;
});
}
// 保存设置
function saveSettings() {
const showBoth = document.getElementById('showBoth').checked;
chrome.storage.sync.set({ showBoth: showBoth }, function() {
// 显示保存成功消息
const statusMessage = document.getElementById('statusMessage');
statusMessage.style.display = 'block';
setTimeout(function() {
statusMessage.style.display = 'none';
}, 2000);
});
}
// 初始化
document.addEventListener('DOMContentLoaded', function() {
loadSettings();
document.getElementById('saveButton').addEventListener('click', saveSettings);
});