-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
修改匹配及注入方式,添加设定选项方便自行添加需要启用的网站
- Loading branch information
Showing
7 changed files
with
96 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head><meta charset="UTF-8"><title>设定匹配地址</title></head> | ||
<body> | ||
|
||
<p>填入需要加载插件的域名或ip地址: 一行一个</p> | ||
<p>例如:只用ip访问的自己家内网的nas输入 192.168.0.111<br /> | ||
或者用域名访问的签到平台 qiandao.today</p> | ||
<textarea id="tgurl" rows="6"> | ||
</textarea> | ||
<div><button id="save">Save</button><span id="status"></span></div> | ||
<button id="reset" style="display: none;">Reset</button> | ||
|
||
<script src="options.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// 通过 chrome.storage 保存 | ||
function saveOptions() { | ||
var tgurl = document.getElementById('tgurl').value; | ||
//console.log(tgurl,typeof tgurl); | ||
chrome.storage.sync.set({ | ||
targeturl: tgurl, | ||
}, () => { | ||
// 更新状态文本 | ||
var status = document.getElementById('status'); | ||
status.textContent = '已保存'; | ||
// 隐藏状态文本 | ||
setTimeout(() => { | ||
status.textContent = ''; | ||
}, 500); | ||
}) | ||
} | ||
function resetOptions() { | ||
chrome.storage.sync.remove('targeturl',() => { | ||
var status = document.getElementById('status'); | ||
status.textContent = '已重置'; | ||
setTimeout(() => { | ||
status.textContent = ''; | ||
}, 500); | ||
}) | ||
} | ||
// 加载数据 | ||
function loadOptions() { | ||
chrome.storage.sync.get( | ||
'targeturl',(items) => { | ||
document.getElementById('tgurl').value = (items.targeturl||"192.168.0.111");//console.log(items.targeturl,typeof items.targeturl); | ||
}); | ||
} | ||
document.addEventListener('DOMContentLoaded', loadOptions); | ||
document.getElementById('save').addEventListener('click', saveOptions); | ||
document.getElementById('reset').addEventListener('click', resetOptions); |