您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
for Bandcamp and its embeded player: seek, autoseek when changing track, play/pause. Designed for those digging through lots of tunes.
当前为
// ==UserScript== // @name BC: keyboard shortcuts // @description for Bandcamp and its embeded player: seek, autoseek when changing track, play/pause. Designed for those digging through lots of tunes. // @namespace userscript1 // @grant none // @version 1.3.1 // @match https://bandcamp.com/* // @match https://*.bandcamp.com/* // @match https://*/* // @license GPLv3 // ==/UserScript== (function() { 'use strict'; // Key_ settings refer to physical positions as if you had a QWERTY layout, not letters. // https://developer.mozilla.org/en-US/docs/Web/API/UI_Events/Keyboard_event_code_values const playPause = 'KeyP'; const prev = 'KeyI'; const next = 'KeyO'; const prevAndSeek = 'KeyH'; const nextAndSeek = 'KeyL'; const seekBack = 'KeyJ'; const seekForward = 'KeyK'; const initialSeek = 60; const manualSeek = 30; // end configuration // only run on *bandcamp.com or bandcamp on a custom domain if (!document.location.hostname.endsWith('bandcamp.com') && !document.head.querySelector('meta[property="twitter:site"][content="@bandcamp"]') ) { return; } const aud = document.querySelectorAll('audio')[0]; if (!aud) { return; } const prevButton = $('.prev-icon') || $('.prevbutton'); const nextButton = $('.next-icon') || $('.nextbutton'); const playButton = $('.playpause') || $('.playbutton') || $('#big_play_button'); if (!playButton) { return; } function $(s) { return document.querySelector(s); } function scrollEmbedPlayer() { $('li.currenttrack')?.scrollIntoView({behavior: 'smooth', block: 'nearest', inline: 'nearest'}); } window.addEventListener('keydown', (evt) => { if ($('.ui-widget-overlay')) { // dialog box is open return; } //console.log(evt.code); // uncomment to check key codes switch(evt.code) { case prev: prevButton.click(); scrollEmbedPlayer(); break; case prevAndSeek: prevButton.click(); aud.currentTime = initialSeek; scrollEmbedPlayer(); break; case next: nextButton.click(); scrollEmbedPlayer(); break; case nextAndSeek: nextButton.click(); aud.currentTime = initialSeek; scrollEmbedPlayer(); break; case seekBack: aud.currentTime -= manualSeek; break; case seekForward: aud.currentTime += manualSeek; break; case playPause: playButton.click(); if (playPause === 'Space') { evt.preventDefault(); // prevent page scroll } break; } }, false); })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址