// ==UserScript== // @name Google Search Tools to Sidebar // @namespace https://greasyfork.org/users/137 // @version 4.0.1 // @description Always expands the search tool and moves it back to the left side (legacy feature). // @author 100の人 // @homepageURL https://greasyfork.org/scripts/412326 // @license MPL-2.0 // @grant GM_addStyle // @run-at document-start // @match *://*/* // @downloadURL none // ==/UserScript== (function() { let css = ""; css += ` @namespace url(http://www.w3.org/1999/xhtml); /* デバッグ用URL プレイス検索 https://www.google.co.jp/search?tbm=lcl&q=%E5%90%8D%E5%8F%A4%E5%B1%8B https://www.google.co.jp/search?sa=X&hl=ja&q=%E5%85%AD%E6%9C%AC%E6%9C%A8&ved=2ahUKEwiLsa67hcTyAhUIyosBHbiSB9gQvS4wAnoECAYQSg&biw=1037&bih=633&dpr=1&tbs=lrf:!1m4!1u2!2m2!2m1!1e1!1m4!1u1!2m2!1m1!1e1!1m4!1u1!2m2!1m1!1e2!1m4!1u3!2m2!3m1!1e1!1m5!1u3!2m2!3m1!1e2!4e2!2m1!1e2!2m1!1e1!2m1!1e3!3sIAE,lf:1,lf_ui:9&rflfq=1&num=10&rldimm=6272632682033027264&phdesc=Rk9EApHyPnA&rlst=f&rlfi=hd:;si:&rlvp=clear COVID‑19のサイドバー https://www.google.com/search?q=covid-19 https://www.google.com/search?q=%E3%82%B3%E3%83%AD%E3%83%8A https://www.google.com/search?q=%E6%96%B0%E5%9E%8B YouTube Music https://www.google.co.jp/search?q=%E3%81%BE%E3%81%BE%E3%81%94%E3%81%A8+%E5%80%89%E6%A9%8B%E3%83%A8%E3%82%A8%E3%82%B3 歌詞 https://www.google.co.jp/search?q=%E3%81%BE%E3%81%BE%E3%81%94%E3%81%A8+%E6%AD%8C%E8%A9%9E アニメなど https://www.google.com/search?q=%E5%A4%A2%E3%81%AE%E3%82%AF%E3%83%AC%E3%83%A8%E3%83%B3%E7%8E%8B%E5%9B%BD 「摂氏」「華氏」のサイドバー (難読化のため対策不可) https://www.google.co.jp/search?q=%E6%91%82%E6%B0%8F */ `; if (location.href === "https://www.google.com/search?q=Greasy%20Fork" || location.href === "https://www.google.co.jp/search?q=Greasy%20Fork") { css += `/* Greasy Forkの適用サイト用 */ regexp("https?://www\\\\.google\\\\.(?:com|(?:com?\\\\.)?[a-z][a-z])/(?!(?:webhp$|$)|maps(?:$|.*)|search\\\\?(.*&)?(?:tbm=(?:lcl|shop)|tbs=lrf)(?:$|.*)).*") { body { /* サイドバーの幅 */ --sidebar-width: 138px; } /*------------------------------------ 検索フォームと検索結果の水平位置 */ .logo { /* ロゴ */ left: calc(-1 * var(--sidebar-width) + 10px); } [role="search"] > * > [jsaction] { /* 検索フォーム */ margin-left: calc(var(--sidebar-width) - 27px); } #main [role="navigation"]:not(#hdtb), /* カテゴリ一覧 */ #appbar { /* ヒット件数 */ padding-left: var(--sidebar-width); } #center_col { /* 検索結果 */ margin-left: var(--sidebar-width) !important; } /*------------------------------------ 検索ツール */ #top_nav { /* サイドバー全体 */ position: absolute; min-width: 0 !important; width: var(--sidebar-width); } #top_nav #hdtb { /* サイドバー全体 */ margin-top: -10px; border-bottom: unset; /* 画像を選択したときの背景色 */ background: #FFFFFF; } #top_nav #hdtbMenus { display: unset; position: unset; visibility: unset; } #top_nav #hdtbMenus > div:first-of-type { width: unset; } #top_nav #hdtbMenus g-popup { text-align: left; } #top_nav #hdtbMenus .hdtb-mn-cont { /* 画像を選択したときの背景色 */ height: unset; } #hdtb-tls { /* 「ツール」ボタン */ display: none; } /*------------------------------------ 検索ツールの各項目の見出し */ #top_nav #hdtbMenus .mn-dwn-arw, #top_nav #hdtbMenus .hdtb-mn-hd { display: none; } #top_nav #hdtbMenus .hdtb-mn-hd { /* 日付けで期間が指定されているとき */ line-height: unset; padding-right: 0; text-align: right; } #top_nav #hdtbMenus .hdtb-mn-hd .mn-hd-txt { white-space: initial; } /*------------------------------------ 検索ツールの各項目の選択肢一覧 */ #top_nav #hdtbMenus [jsname][style*="display:none"]:not([aria-hidden]) { display: block !important; position: unset; box-shadow: unset; /* 日付けで期間が指定されているときに、表示されている期間をクリックしたとき */ min-width: unset !important; } /*------------------------------------ 検索ツールの各項目の選択肢 */ #top_nav #hdtbMenus g-menu-item { padding: 0 0.3em; font-size: 13px; background: unset; color: #222222; } #top_nav #hdtbMenus g-menu-item:hover { text-decoration: underline; } #top_nav #hdtbMenus g-menu-item [aria-checked="true"] { /* 選択されている選択肢 */ color: #DD4B39; font-weight: bold; } #top_nav #hdtbMenus g-menu-item > * > * { padding: unset; } /*------------------------------------ 「期間を指定」ボタン */ g-menu-item:nth-of-type(7):last-of-type { display: inline-block; color: #666666; border: solid 1px #DDDDDD; background: linear-gradient(to bottom, #FFFFFF, #F5F5F5); border-radius: 4px; padding: 0 12px 0 12px; line-height: 25px; margin: 5px 10px; } g-menu-item:nth-of-type(7):last-of-type:hover { border-color: #BBBBBB; text-decoration: none !important; } /*------------------------------------ 表示領域の幅が狭い場合に壊れる問題への対処 */ #hdtb, #main > div > div { margin-left: unset; } `; } if (typeof GM_addStyle !== "undefined") { GM_addStyle(css); } else { const styleNode = document.createElement("style"); styleNode.appendChild(document.createTextNode(css)); (document.querySelector("head") || document.documentElement).appendChild(styleNode); } })();