|
@@ -0,0 +1,50 @@
|
|
|
|
+
|
|
|
|
+$(function(){
|
|
|
|
+ $('#spendAmount').click(function(){
|
|
|
|
+ // chrome.tabs.getSelected(null, function (tab) {//获取当前tab
|
|
|
|
+ // //向tab发送请求
|
|
|
|
+ // window.alert(tab.id)
|
|
|
|
+ // chrome.runtime.sendMessage('你好');
|
|
|
|
+ // });
|
|
|
|
+ chrome.tabs.query({ active: true, currentWindow: true }, function (tabs) {
|
|
|
|
+ chrome.tabs.sendMessage(tabs[0].id, {}, function (response) {
|
|
|
|
+ console.log(response, 'content.js回传过来的信息');
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ // var notifications = {
|
|
|
|
+ // type:'basic',
|
|
|
|
+ // iconUrl:'icon48.png',
|
|
|
|
+ // title:'123',
|
|
|
|
+ // message:'1234'
|
|
|
|
+ // }
|
|
|
|
+ // chrome.notifications.create('limitNotif',notifications)
|
|
|
|
+ })
|
|
|
|
+ // chrome.storage.get('total',function(budget){
|
|
|
|
+ // $('#total').text(budget.total);
|
|
|
|
+ // })
|
|
|
|
+ // $('#spendAmount').click(function(){
|
|
|
|
+ // chrome.storage.sync.get('total',function(budget){//浏览器存储
|
|
|
|
+ // var newTotal = 0;
|
|
|
|
+ // if(budget.total){
|
|
|
|
+ // newTotal += perseInt(budget.total)
|
|
|
|
+ // }
|
|
|
|
+ // var amount = $('#amount').val()
|
|
|
|
+ // if(amount){
|
|
|
|
+ // newTotal += parseInt(amount)
|
|
|
|
+ // }
|
|
|
|
+
|
|
|
|
+ // chrome.storage.sync.set({
|
|
|
|
+ // 'total': newTotal
|
|
|
|
+ // });
|
|
|
|
+
|
|
|
|
+ // $('#total').text(newTotal);
|
|
|
|
+ // $('#amount').val("");
|
|
|
|
+ // });
|
|
|
|
+ // });
|
|
|
|
+
|
|
|
|
+ // $('#name').keyup(function(){
|
|
|
|
+ // $('#greet').text('Hello ' + $('#name').val())
|
|
|
|
+ // })
|
|
|
|
+})
|
|
|
|
+
|