您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Allows the left and right keyboard arrows to be used to go to the previous and next songs on bandcamp.
- // ==UserScript==
- // @name Next, Previous, and play/pause key shortcuts for bandcamp
- // @description Allows the left and right keyboard arrows to be used to go to the previous and next songs on bandcamp.
- // @author Zach Saucier
- // @namespace https://zachsaucier.com/
- // @version 1.2
- // @match https://bandcamp.com/*
- // @match https://*.bandcamp.com/*
- // ==/UserScript==
- (function() {
- 'use strict';
- window.addEventListener('keydown', (event) => {
- console.log(event.code);
- switch(event.code) {
- case 'ArrowLeft':
- if(document.querySelector('.prev-icon'))
- document.querySelector('.prev-icon').click();
- if(document.querySelector('.prevbutton'))
- document.querySelector('.prevbutton').click();
- break;
- case 'ArrowRight':
- if(document.querySelector('.next-icon'))
- document.querySelector('.next-icon').click();
- if(document.querySelector('.nextbutton'))
- document.querySelector('.nextbutton').click();
- break;
- case 'Space':
- if(document.querySelector('.playpause'))
- document.querySelector('.playpause').click();
- if(document.querySelector('.playbutton'))
- document.querySelector('.playbutton').click();
- event.preventDefault();
- break;
- }
- }, false);
- })();