Greasy Fork

Greasy Fork is available in English.

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). 点击左下角按钮帮您快速打开搜索引擎的所有链接(请先允许浏览器多次重定向)

当前为 2022-03-17 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Site Quick Open网页快开
// @namespace    http://tampermonkey.net/
// @version      0.7
// @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.hk/search*
// @match        *.bing.com/search*
// @match        *.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;
    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.outline = "none";
        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) {
        for (let i in data) {
            if (url.search(data[i].name) > 0) {
                return i;
            }
        }
    }
})();