Last active
June 18, 2019 10:08
-
-
Save KrabCode/5f46a6a29bac699829d0d4be3ef99099 to your computer and use it in GitHub Desktop.
minimalist google search text input start page
This file contains hidden or 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
| <head> | |
| <script type="text/javascript"> | |
| var textInput; | |
| function onload() { | |
| textInput = document.getElementById('textInput'); | |
| textInput.addEventListener("keyup", function(event) { | |
| if (event.keyCode === 13) { | |
| event.preventDefault(); | |
| enterUp(); | |
| } | |
| }); | |
| textInput.focus(); | |
| textInput.select(); | |
| } | |
| function enterUp(){ | |
| var val = textInput.value; | |
| window.location = 'https://www.google.com/search?q=' + val; | |
| } | |
| </script> | |
| <style> | |
| body { | |
| background-color: black; | |
| } | |
| input[type=text] { | |
| width: 100%; | |
| height: 100%; | |
| padding: 12px 20px; | |
| margin: 8px 0; | |
| box-sizing: border-box; | |
| position: absolute; | |
| left: 50%; | |
| top: 40%; | |
| transform: translate(-50%, -50%); | |
| font-size:45px; | |
| background-color:black; | |
| color: white; | |
| border-color:black; | |
| text-align:center; | |
| } | |
| input:focus, textarea:focus, select:focus{ | |
| outline: none; | |
| } | |
| </style> | |
| </head> | |
| <body onload="onload();"> | |
| <input type="text" name="enter" class="enter" value="" id="textInput"/> | |
| </body> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment