Skip to content

Instantly share code, notes, and snippets.

@mipselqq
Created May 18, 2025 11:16
Show Gist options
  • Select an option

  • Save mipselqq/f669cd834f9fb29433760d563d39fd86 to your computer and use it in GitHub Desktop.

Select an option

Save mipselqq/f669cd834f9fb29433760d563d39fd86 to your computer and use it in GitHub Desktop.
Фикс, позволяющий в новом дизайне Яндекс Музяки переключать проигрывание на пробел
// ==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