Youtube Save To Playlist Hotkey And Filter

Adds a P hotkey to Youtube, to bring up the Save to Playlist dialog. Playlists will be displayed alfabetically sorted, any any playlist the current video belongs to, will be shown at the top. Also adds a focuced filter input field. If nothing is written into the filter input, all playlists will be shown, alternatively only the playlists where the name containes the sequence of letters typed in the input field, will be displayed. Press escape to exit the dialog.

< 腳本Youtube Save To Playlist Hotkey And Filter的回應

評論:普通 - 腳本能使用,但有一些問題

§
發表於:2025-01-11

Hi,
You should ignore P when in edition mode. Here is how to do it.

// Listen for the 'p' key at the document level
document.addEventListener('keydown', evt => {
// Avoid capturing if user holds Ctrl/Alt/Meta, or if in a text field, etc.
const activeElement = document.activeElement;
const isTextInput = activeElement.tagName === 'INPUT' || activeElement.tagName === 'TEXTAREA' || activeElement.isContentEditable;

if (evt.key === 'p' && !evt.ctrlKey && !evt.altKey && !evt.metaKey && !isTextInput) {
// Prevent YouTube from interpreting 'p' in any other way
evt.preventDefault();
evt.stopPropagation();

// Attempt to open the "Save to playlist" dialog
openSaveToPlaylistDialog();
}
}, true);

§
發表於:2025-03-29

I believe it's fixed in the 1.2 version.

發表回覆

登入以回復