Created
May 18, 2025 11:16
-
-
Save mipselqq/f669cd834f9fb29433760d563d39fd86 to your computer and use it in GitHub Desktop.
Фикс, позволяющий в новом дизайне Яндекс Музяки переключать проигрывание на пробел
This file contains hidden or 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 Yandex Music Spacebar Play/Pause | |
| // @namespace http://tampermonkey.net/ | |
| // @version 1.1 | |
| // @description Делает то, что долбоёбы в новом дизайне сделать не смогли | |
| // @author PPL | |
| // @match https://music.yandex.ru/* | |
| // @grant none | |
| // ==/UserScript== | |
| (function() { | |
| 'use strict'; | |
| document.addEventListener('keydown', function(event) { | |
| if (event.code === 'Space' && !event.repeat && !event.target.matches('input, textarea, [contenteditable]')) { | |
| event.preventDefault(); | |
| const playerBar = document.querySelector('[class^="PlayerBarDesktop_sonata"]'); | |
| if (!playerBar) return; | |
| const playPauseButton = playerBar.querySelector( | |
| 'button[aria-label="Воспроизведение"], button[aria-label="Пауза"]' | |
| ); | |
| if (playPauseButton) { | |
| playPauseButton.click(); | |
| } | |
| } | |
| }); | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment