0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Voicy.jpの再生スピードを、任意のショートカットキー押下でUP・DOWNできる様にするスクリプト

Last updated at Posted at 2022-02-18
/*
  2022/02/18
  Voicy.jpの再生スピードを、任意のショートカットキー押下でUP・DOWNできる様にするスクリプト。
  by rtyaoke

  chrome拡張の「ScriptAutoRunner」等での使用がおすすめ。
  https://chrome.google.com/webstore/detail/scriptautorunner/gpgjofmpmjjopcogjgdldidobhmjmdbm?hl=ja-jp
*/
window.onload=function(){

  // shortcut.jsのインポート用に、DOM要素を作成
  const script = document.createElement('script');
  script.src = 'https://www.openjs.com/scripts/events/keyboard_shortcuts/shortcut.js';

  // shortcut.jsが読み込み完了してからショートカット登録
  script.onload = function() {
    const op = {
      'type':'keydown',
      'propagate':false,
      'disable_in_input':true,
      'target':document
    }
    // 再生スピードUP用。↓の"E"を任意のショートカットキーに変更する。
    shortcut.add("E",function() {
      const speed_btn = document.querySelector("button.speed");
      speed_btn.click();
    },op);
    // 再生スピードDOWN用。↓の"Q"を任意のショートカットキーに変更する。
    shortcut.add("Q",function() {
      const speed_btn = document.querySelector("button.speed");
      speed_btn.click();
      speed_btn.click();
      speed_btn.click();
    },op);
  }

  // shortcut.jsのインポート用のDOM要素を<head>内に追加
  document.head.appendChild(script);

}
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?