chrome_extensions/js/popup.js

43 lines
1.0 KiB
JavaScript
Raw Normal View History

2024-08-19 17:05:34 +08:00
/*
* @Author: lingling 1077478963@qq.com
* @Date: 2024-08-19 09:47:04
* @LastEditors: lingling 1077478963@qq.com
2024-08-19 18:02:42 +08:00
* @LastEditTime: 2024-08-19 17:53:29
2024-08-19 17:05:34 +08:00
* @FilePath: \谷歌自动搜索邮箱自动点击v3\js\popup.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
2024-08-19 09:59:57 +08:00
$(function () {
// var id = 0, due = ['Dell', ' Lenovo ', "ASUS"], kme = 0 , name="";
2024-08-19 17:05:34 +08:00
var id = 0
var name = "";
2024-08-19 09:59:57 +08:00
setTimeout(function () {
2024-08-19 17:05:34 +08:00
chrome.tabs.create(
{
url: "https://www.baidu.com/",
},
(e) => {
name = "naver";
id = e.id;
}
);
2024-08-19 09:59:57 +08:00
}, 2000);
// 浏览器监听事件 每当有新页面生成就会执行
2024-08-19 17:05:34 +08:00
chrome.runtime.onMessage.addListener(function (
request,
sender,
sendResponse
) {
// 判断是产生一个新页面是
if (request.ty == "get") {
2024-08-19 18:02:42 +08:00
console.log(id)
sendResponse({name,id});
2024-08-19 09:59:57 +08:00
}
2024-08-19 18:02:42 +08:00
// if (request.ty == "remove") {
// sendResponse({name,id});
// }
2024-08-19 17:05:34 +08:00
return true;
});
});