Greasy Fork is available in English.

YouTubeの検索バーを自動でクリアする

YouTubeの検索バーを自動でクリアする。

// ==UserScript==
// @name        YouTubeの検索バーを自動でクリアする
// @description YouTubeの検索バーを自動でクリアする。
// @match       *://www.youtube.com/*
// @author      toshi (https://github.com/k08045kk)
// @license     MIT License
// @see         https://opensource.org/licenses/MIT
// @version     2.0
// @since       1.20201128 - 初版
// @since       2.20220126 - fix 検索文字が残ることがある
// @grant       none
// @namespace https://www.bugbugnow.net/
// ==/UserScript==
 
(function() {
  let href = location.href;
  setInterval(() => {
    if (href != location.href) {
      if (location.pathname != '/results') {
        //console.log('YouTube search bar clear.');
        document.querySelector('#search.ytd-searchbox').value = '';
      }
      href = location.href;
    }
  }, 500);
})();