Greasy Fork is available in English.
Click on the lower left button in the search engine, quickly open all websites.(Please allow the browser to redirect many times)点击左下角按钮帮您快速打开搜索引擎的所有链接(请先允许浏览器多次重定向)
当前为
// ==UserScript==
// @name Site Quick Open 网页快开
// @namespace http://tampermonkey.net/
// @version 0.2
// @description Click on the lower left button in the search engine, quickly open all websites.(Please allow the browser to redirect many times)点击左下角按钮帮您快速打开搜索引擎的所有链接(请先允许浏览器多次重定向)
// @author Exisi
// @match *www.baidu.com/s*
// @match *www.google.com/search*
// @match *www.bing.com/search*
// @match *search.yahoo.com/search*
// @grant none
// ==/UserScript==
(function () {
//ready
let data = [{
name: "bing",
aNodeClass: "b_title",
contentId: "b_content",
},
{
name: "baidu",
aNodeClass: "result c-container new-pmd",
contentId: "wrapper",
},
{
name: "google",
aNodeClass: "yuRUbf",
contentId: "main",
},
{
name: "yahoo",
aNodeClass: "compTitle options-toggle",
contentId: "results",
},
];
//get the site name
let url = window.location.href;
//set the site type
let type = getSiteType(url);
let item = document.getElementsByClassName(data[type].aNodeClass);
if (item != null) {
createButton(item);
}
//openlink
function quickOpen(item) {
for (const i in item) {
if (item[i].nodeType > 0) {
item[i].getElementsByTagName("a")[0].click();
}
}
}
//add button
function createButton(item) {
var btn = document.createElement("input");
btn.setAttribute("type", "button");
btn.setAttribute("value", "🚀");
btn.setAttribute("id", "startBtn");
btn.style.background = "pink";
btn.style.color = "white";
btn.style.fontWeight = "500";
btn.style.width = "50px";
btn.style.height = "50px";
btn.style.borderRadius = "100px";
btn.style.fontSize = "14px";
btn.style.position = "fixed";
btn.style.border = "1px pink solid";
btn.style.bottom = 0;
btn.style.left = 0;
btn.style.margin = "25px";
btn.addEventListener("click", function () {
for (const i in item) {
if (item[i].nodeType != null) {
let link = item[i].getElementsByTagName("a")[0].href;
if (link != null) {
window.open(link);
}
}
}
});
document.getElementById(data[type].contentId).append(btn);
}
//get site type
function getSiteType(url){
if (url.search(data[0].name) > 0) {
return 0;
} else if (url.search(data[1].name) > 0) {
return 1;
} else if (url.search(data[2].name) > 0) {
return 2;
} else if (url.search(data[3].name) > 0) {
return 3;
}
}
})();