chrome_extensions/js/popup.js

58 lines
1.4 KiB
JavaScript
Raw Normal View History

2024-08-19 09:59:57 +08:00
$(function () {
// var id = 0, due = ['Dell', ' Lenovo ', "ASUS"], kme = 0 , name="";
var name="";
chrome.tabs.create({ url: "https://www.youtube.com/" }, e => {
name="youtube";
})
// 延时器作用 过一点时间执行一次
// setTimeout(function () {
// chrome.tabs.create({ url: "https://www.google.com/" }, e => {
// kme = 1;
// id = e.id;
// });
// setTimeout(function () {
// chrome.tabs.create({ url: "https://www.google.com/" }, e => {
// kme = 2;
// id = e.id;
// });
// setTimeout(function () {
// chrome.tabs.create({ url: "https://mail.google.com/" }, e => {
// id = e.id;
// });
// }, 20000);
// }, 20000);
// }, 20000);
// 定时1分30秒后 执行新建页面打开油管
setTimeout(function () {
chrome.tabs.create({ url: "https://www.youtube.com/shorts/" }, e => {
name="youtube/shorts";
});
}, 2000);
// 浏览器监听事件 每当有新页面生成就会执行
chrome.runtime.onMessage.addListener(
function (request, sender, sendResponse) {
// 判断是产生一个新页面是
if (request.ty == 'get') {
// if (sender.tab.id == id) {
// sendResponse(due[kme]);
// }
// else {
// sendResponse(name);
// }
sendResponse(name);
}
return true;
}
);
})
//*[@id="like-button"]/yt-button-shape/label/button/yt-touch-feedback-shape/div/div[2]