🏠 返回首頁 

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);

发表回复

登录以发表回复。