Last active
November 30, 2018 10:55
-
-
Save ShinyChang/5d40936d89ba577f7e0b to your computer and use it in GitHub Desktop.
VoiceTube User Defined JavaScript
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
+(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(); | |
}); | |
})(); |
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
{ | |
"manifest_version": 2, | |
"name": "Vinsen User Javascript", | |
"version": "0.1", | |
"content_scripts": [{ | |
"matches": [ | |
"<all_urls>" | |
], | |
"js": ["google.user.js", "voicetube.user.js"] | |
}] | |
} |
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
+(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(); | |
} | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
окумент . querySelector ( " #query " ). addEventListener ( " keyup " , function ( e ) {
if ( e . keyCode === 13 ) {