Last active
February 15, 2024 13:52
-
-
Save AndroPlus-org/9743094fd9a83f08cce92ca2eba82312 to your computer and use it in GitHub Desktop.
Google検索に日本語のみ、英語のみ表示するボタンを追加するユーザースクリプト
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Google検索 日本語のみ・英語のみボタン | |
// @namespace http://0-oo.net/ | |
// @description Google検索に「日本語のみ」「英語のみ」ボタンを追加する | |
// @homepage http://0-oo.net/log/category/greasemonkey/ | |
// @version 1.1 | |
// @include http*://www.google.tld/search* | |
// @include http*://www.google.tld/webhp* | |
// @include http*://www.google.tld/#* | |
// @include http*://www.google.tld/ | |
// ==/UserScript== | |
// | |
// ( The MIT License ) | |
// | |
(function(){ | |
var btn = document.body.appendChild(document.createElement("img")); | |
btn.src = "https://chart.googleapis.com/chart?chst=d_simple_text_icon_above&chld=|0|000|flag_ja|24|000|000"; | |
btn.title = "日本語のページを検索"; | |
btn.style.position = "absolute"; | |
btn.style.top = "90px"; | |
btn.style.right = "155px"; | |
btn.style.zIndex = 1000; | |
btn.style.border = "solid 1px #ccc"; | |
btn.style.cursor = "pointer"; | |
btn.addEventListener("click", function() { | |
const url = new URL(location.href); | |
url.searchParams.set("tbs", "lr:lang_1ja"); | |
url.searchParams.set("lr", "lang_ja"); | |
location.href = url; | |
}, false); | |
var btn2 = document.body.appendChild(document.createElement("img")); | |
btn2.src = "https://chart.googleapis.com/chart?chst=d_simple_text_icon_above&chld=|0|000|flag_us|24|000|000"; | |
btn2.title = "英語のページを検索"; | |
btn2.style.position = "absolute"; | |
btn2.style.top = "90px"; | |
btn2.style.right = "210px"; | |
btn2.style.zIndex = 1000; | |
btn2.style.border = "solid 1px #ccc"; | |
btn2.style.cursor = "pointer"; | |
btn2.addEventListener("click", function() { | |
const url = new URL(location.href); | |
url.searchParams.set("tbs", "lr:lang_1en"); | |
url.searchParams.set("lr", "lang_en"); | |
location.href = url; | |
}, false); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment