TODO:
1. 需要改为一个Chrome一个任务. 因为有全局的cookie. 如果开相同的网站会导致cookie混乱.
This commit is contained in:
14
background/boss.js
Normal file
14
background/boss.js
Normal file
@@ -0,0 +1,14 @@
|
||||
console.log("login start")
|
||||
|
||||
|
||||
console.log(window.location.hostname, window.location.pathname);
|
||||
|
||||
if(window.location.hostname === "signup.zhipin.com") {
|
||||
console.log("登录操作", document.getElementsByClassName("link-signin"));
|
||||
document.getElementsByClassName("link-signin")[1].click();
|
||||
|
||||
|
||||
// https://www.zhipin.com/web/geek/recommend
|
||||
} else if ( window.location.pathname == "web/geek/recommend" ) {
|
||||
|
||||
}
|
||||
@@ -3,7 +3,13 @@ console.log("background");
|
||||
chrome.runtime.onMessage.addListener(function (msg, sender, sendResponse) {
|
||||
console.log(msg, sender)
|
||||
if(msg.name === "boss") { // boss
|
||||
chrome.tabs.cre // 创建一个tab 然后注入脚本
|
||||
|
||||
// 创建一个tab 然后注入脚本
|
||||
chrome.tabs.create({ url: "https://signup.zhipin.com/" }, function (tab) {
|
||||
chrome.tabs.executeScript(tab.id, { runAt: "document_end", file: "background/boss.js" });
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
// sendResponse({});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user