// @author You // @license MIT // @match *://*/* // @grant none // ==UserScript== // @name Yandex 搜索结果双列显示 // @namespace https://greasyfork.org/users/your-username // @version 1.0 // @description 将 Yandex 搜索结果以双列方式排列,提高可读性与信息密度 // @author 你的名字或昵称 // @match https://ya.ru/* // @match https://yandex.com/search/* // @match https://yandex.ru/search/* // @icon https://yandex.com/favicon.ico // @license MIT // @grant none // @downloadURL none // ==/UserScript== (function () { 'use strict'; function applyTwoColumnLayout() { const resultsContainer = document.querySelector('[data-zone-name="SearchResults"]'); if (!resultsContainer) return; // 设置为网格布局 resultsContainer.style.display = 'grid'; resultsContainer.style.gridTemplateColumns = '1fr 1fr'; resultsContainer.style.gap = '20px'; resultsContainer.style.alignItems = 'start'; // 每个搜索项设定统一宽度/样式 const items = resultsContainer.querySelectorAll('li.serp-item'); items.forEach((item) => { item.style.width = '100%'; item.style.boxSizing = 'border-box'; }); } // 初次加载或动态加载内容后执行 const observer = new MutationObserver(() => { applyTwoColumnLayout(); }); observer.observe(document.body, { childList: true, subtree: true, }); // 首次执行 applyTwoColumnLayout(); })();