Skip to content

Instantly share code, notes, and snippets.

@ShinyChang
Last active November 30, 2018 10:55
Show Gist options
  • Save ShinyChang/5d40936d89ba577f7e0b to your computer and use it in GitHub Desktop.
Save ShinyChang/5d40936d89ba577f7e0b to your computer and use it in GitHub Desktop.
VoiceTube User Defined JavaScript
+(function(){
"use strict";
// only for google.com
if (!window.location.host.match(/google.com/)) {
return;
}
var input = document.querySelector("input[name=q]");
if (!input) {
return;
}
document.querySelector("body").addEventListener("mouseenter", function(e){
input.select();
});
})();
{
"manifest_version": 2,
"name": "Vinsen User Javascript",
"version": "0.1",
"content_scripts": [{
"matches": [
"<all_urls>"
],
"js": ["google.user.js", "voicetube.user.js"]
}]
}
+(function(){
"use strict";
// only for tw.voicetube.com
if (window.location.host !== "tw.voicetube.com") {
return;
}
document.querySelector("body").addEventListener("mouseenter", function(e){
document.querySelector("#query").select();
});
document.querySelector("#query").addEventListener("keyup", function(e){
if (e.keyCode === 13) {
document.querySelector("#btn-search").click();
}
});
})();
@JAFFA-0777
Copy link

окумент . querySelector ( " #query " ). addEventListener ( " keyup " , function ( e ) {
if ( e . keyCode === 13 ) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment