Site Quick Open网页快开

Click on the lower left button in the search engine, quickly open all websites.(Please allow the browser to redirect many times). 点击左下角按钮帮您快速打开搜索引擎的所有链接(请先允许浏览器多次重定向)

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Site Quick Open网页快开
// @namespace    http://tampermonkey.net/
// @version      1.6
// @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        *://*.baidu.com/s*
// @match        *://*.google.com.*/search*
// @match        *://*.google.com/search*
// @match        *://*.google.com.hk/search*
// @match        *://*.bing.com/search*
// @match        *://*.yahoo.com/search*
// @match        *://*.yandex.com/search*
// ==/UserScript==
(function () {
	"use strict";
	// ready
	let data = [
		{
			name: "bing",
			resultItemSelector: "#b_content li.b_algo",
			aSelector: "h2 a",
			contentSelector: "#b_content",
		},
		{
			name: "baidu",
			resultItemSelector: ".c-container.new-pmd:has(h3):not(.c-gap-top)",
			aSelector: "h3 a",
			contentSelector: "#wrapper",
		},
		{
			name: "google",
			resultItemSelector: "#search div.g",
			aSelector: "span a",
			contentSelector: "#main",
		},
		{
			name: "yahoo",
			resultItemSelector: ".searchCenterMiddle .algo",
			aSelector: ".compTitle a",
			contentSelector: "#results",
		},
		{
			name: "yandex",
			resultItemSelector: ".content__left ul li",
			aSelector: ".OrganicTitle-Link",
			contentSelector: ".main.serp.i-bem",
		},
	];
	// get the site type
	let url = window.location.href;
	let type = data.findIndex((item) => url.includes(item.name));

	let titleItems = document.querySelectorAll(data[type].resultItemSelector);

	if (!titleItems) {
		return;
	}

	//add button
	let 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.outline = "none";
	btn.style.margin = "25px";
	btn.addEventListener("click", function () {
		quickOpen(titleItems);
	});
	document.querySelector(data[type].contentSelector).append(btn);

	// openlink
	function quickOpen(titleItems) {
		Array.from(titleItems).forEach((titleItem) => {
			// // check for the presence of the ublacklist chrome plugin
			// // check for the presence of the ac-baidu script
			if (titleItem.getAttribute("data-ub-blocked") || titleItem.getAttribute("ac-needhide")) {
				return;
			}

			let aTile = titleItem.querySelector(data[type].aSelector);

			if (!aTile) {
				return;
			}

			let target = document.createElement("a");
			target.setAttribute("href", aTile.getAttribute("href"));
			target.setAttribute("target", "_blank");
			target.click();
		});
	}
})();