init
This commit is contained in:
BIN
img/logo.png
Normal file
BIN
img/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 183 KiB |
10872
js/jquery-3.5.1.js
vendored
Normal file
10872
js/jquery-3.5.1.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
2
js/jquery-3.5.1.min.js
vendored
Normal file
2
js/jquery-3.5.1.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
38
js/popup.js
Normal file
38
js/popup.js
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
$(function () {
|
||||||
|
alert("加载中")
|
||||||
|
chrome.tabs.query({ active: true, lastFocusedWindow: true }, tabs => {
|
||||||
|
let url = tabs[0].url;
|
||||||
|
console.log(tabs[0]);
|
||||||
|
$('#total').val(url);
|
||||||
|
// use `url` here inside the callback because it's asynchronous!
|
||||||
|
})
|
||||||
|
})
|
||||||
|
// $(function(){
|
||||||
|
// chrome.tabs.query({active: true, lastFocusedWindow: true}, tabs => {
|
||||||
|
// let url = tabs[0].url;
|
||||||
|
// $('#total').text(url);
|
||||||
|
// // use `url` here inside the callback because it's asynchronous!
|
||||||
|
// });
|
||||||
|
// //在第一次运行时,如果总金额为0,也不会留空,而是有值显示
|
||||||
|
// chrome.storage.sync.get('total',function(budget){
|
||||||
|
// $('#total').text(budget.total);
|
||||||
|
// });
|
||||||
|
// $('#add').click(function(){
|
||||||
|
// //1、从浏览器获取存储的金额
|
||||||
|
// chrome.storage.sync.get('total',function(budget){
|
||||||
|
// var totalAmount = 0;
|
||||||
|
// if(budget.total){
|
||||||
|
// totalAmount = parseFloat(budget.total);
|
||||||
|
// }
|
||||||
|
// //2、将本次金额加到总金额中
|
||||||
|
// var amount = $('#amount').val();
|
||||||
|
// if(amount){
|
||||||
|
// totalAmount += parseFloat(amount);
|
||||||
|
// chrome.storage.sync.set({'total':totalAmount});
|
||||||
|
// }
|
||||||
|
// //3、更新显示ui
|
||||||
|
// $('#total').text(totalAmount);
|
||||||
|
// $('#amount').val('');
|
||||||
|
// })
|
||||||
|
// })
|
||||||
|
// })
|
||||||
20
manifest.json
Normal file
20
manifest.json
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"manifest_version":2,
|
||||||
|
"name": "x-develop",
|
||||||
|
"version":"1.0",
|
||||||
|
"description":"谢银路的开发插件",
|
||||||
|
"icons":{
|
||||||
|
"128":"img/logo.png",
|
||||||
|
"48":"img/logo.png",
|
||||||
|
"16":"img/logo.png"
|
||||||
|
},
|
||||||
|
"browser_action":{
|
||||||
|
"default_icon":"img/logo.png",
|
||||||
|
"default_popup":"popup.html"
|
||||||
|
},
|
||||||
|
"permissions": [
|
||||||
|
"storage",
|
||||||
|
"tabs"
|
||||||
|
]
|
||||||
|
|
||||||
|
}
|
||||||
11
popup.html
Normal file
11
popup.html
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>谢银路的开发插件</title>
|
||||||
|
<meta charset="utf-8"/>
|
||||||
|
<script src="js/jquery-3.5.1.min.js"></script>
|
||||||
|
<script src="js/popup.js"></script>
|
||||||
|
</head>
|
||||||
|
<body style="width: 400px;height: 400px;">
|
||||||
|
<input type="text" id="total" value="">
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Reference in New Issue
Block a user