forked from glwhappen/QuickRequest
-
Notifications
You must be signed in to change notification settings - Fork 0
/
options.js
23 lines (19 loc) · 837 Bytes
/
options.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// 页面加载时,获取并设置已保存的配置
document.addEventListener('DOMContentLoaded', function() {
chrome.storage.local.get(['requestTemplate', 'menuTitle', 'iconUrl'], function(data) {
if (data.requestTemplate) {
document.getElementById('requestTemplate').value = data.requestTemplate;
}
if (data.menuTitle) {
document.getElementById('menuTitle').value = data.menuTitle;
}
});
});
document.getElementById('settings-form').addEventListener('submit', function(e) {
e.preventDefault();
var requestTemplate = document.getElementById('requestTemplate').value;
var menuTitle = document.getElementById('menuTitle').value;
chrome.storage.local.set({requestTemplate, menuTitle}, function() {
console.log('设置已保存。');
});
});