Created
June 29, 2023 09:18
-
-
Save hisasann/76bb6cea6950dd3110f86ea669633652 to your computer and use it in GitHub Desktop.
amazonホームだけ検索窓に勝手にフォーカスするスクリプト
This file contains 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 amazonホームだけ検索窓に勝手にフォーカスするスクリプト | |
// @namespace http://hisasann.dev/ | |
// @version 0.1 | |
// @description nameのまま | |
// @author hisasann | |
// @match https://www.amazon.co.jp/ | |
// @icon https://www.google.com/s2/favicons?sz=64&domain=amazon.co.jp | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
const regex1 = new RegExp('https?:\/\/(www)?.amazon.co.jp\/?', 'g'); | |
const regex2 = new RegExp('https?:\/\/(www)?.amazon.co.jp/ref=nav_logo', 'g'); | |
if ( | |
regex1.test(location.href) || | |
regex2.test(location.href) | |
) { | |
document.querySelector('#twotabsearchtextbox').focus(); | |
console.log('focus amazon searchbox!') | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment