Last active
January 31, 2024 19:35
-
-
Save JonnyWong16/1ebd38a5f5872408e5b840ed28006dec to your computer and use it in GitHub Desktop.
Open the Plex search page when pressing enter in the search box.
This file contains 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 Open Plex Serach Page on Enter | |
// @namespace https://app.plex.tv | |
// @version 1.1 | |
// @description Open the Plex search page when pressing enter in the search box. | |
// @author JonnyWong16 | |
// @homepage https://gist.github.com/JonnyWong16/1ebd38a5f5872408e5b840ed28006dec | |
// @downloadURL https://gist.github.com/JonnyWong16/1ebd38a5f5872408e5b840ed28006dec/raw/openPlexSearch.user.js | |
// @updateURL https://gist.github.com/JonnyWong16/1ebd38a5f5872408e5b840ed28006dec/raw/openPlexSearch.user.js | |
// @match https://app.plex.tv/* | |
// @grant none | |
// ==/UserScript== | |
window.addEventListener('load', function() { | |
const searchInput = document.getElementById('downshift-0-input'); | |
searchInput.addEventListener('keydown', (e) => { | |
if (e.key === 'Enter') { | |
e.preventDefault(); | |
window.location = 'https://app.plex.tv/desktop/#!/search?query=' + encodeURIComponent(searchInput.value); | |
searchInput.blur(); | |
} | |
}); | |
}, false); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Did some troubleshooting. If I paste your code from line 15 to line 22 into the console, everything works fine. If I include line 14 and 23 (i.e. the window.addEventListener stuff), it doesn't work.
If I put the code into Tampermonkey, it doesn't work no matter if I include line 14 and 23 or not.
The Tampermonkey icon in Chrome says it is enabled and that your script is active on the Plex page.