Greasy Fork

Greasy Fork is available in English.

必应搜索双栏显示

双栏显示必应搜索结果

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         必应搜索双栏显示
// @namespace    http://tampermonkey.net/
// @version      0.1.1
// @description  双栏显示必应搜索结果
// @include      *://*.bing.com/search?*
// @author       Mr.NullNull
// ==/UserScript==

(function () {
    'use strict';

    Main();
    function Main() {
        document.querySelector("#b_results").setAttribute("class", "listOld");
        document.querySelector("div#b_content > main").innerHTML += '<ol id="b_results" class="listA"></ol><ol id="b_results" class="listB"></ol><ol id="b_results" class="listC"></ol>';
        document.querySelector("head").innerHTML += `
        <style>
            ool>li{ outline: 1px solid #ccc; }
            #b_content {
                width: 1280px;
            }
            .listOld {
                display: none !important;
                width: 100% !important;
            }
            #b_results {
                width: 50%;
                float: left;
            }
            .listC {
                width: 100% !important;
            }
            #b_context {
                width: 100%;
                margin: 5px 0;
                padding: 0 20px;
                background-color: initial;
            }
            #b_context > .b_ans {
                background-color: initial;
            }
            .b_vList>li {
                float: left;
                width: 20%;
                height: 1.5em;
            }
            
        </style>
        <style>
            body {
                background-color: #f1f2f3 !important;
            }
            #b_results>.b_algo, #b_results>.b_ans {
                margin: 7px 5px !important;
                padding: 10px 20px !important;
                display: block !important;
                background-color: #fff !important;
                box-shadow: 0 2px 3px 0 rgba(0, 0, 0, .1), 0 0 0 1px rgba(0, 0, 0, .05);
                overflow: hidden !important;
            }
        </style>
        `;

        let list = document.querySelectorAll("#b_results > .b_algo, #b_results > .b_ans");

        var listA = document.querySelector(".listA");
        var listB = document.querySelector(".listB");
        for (let i = 0; i < list.length; i++) {
            const element = list[i];
            console.log(element.innerHTML);
            if (element.querySelector(".b_rs") == null && element.innerHTML != "") {
                if (parseInt(listA.offsetHeight) <= parseInt(listB.offsetHeight)) {
                    listA.appendChild(element);
                } else {
                    listB.appendChild(element);
                }
            }
        }


        //移动页码
        document.querySelector("#b_content > main").appendChild(document.querySelector("#b_results > .b_pag"));
        
    }
})();