Guest User

stpg script

a guest
Jun 1st, 2020
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.84 KB | None | 0 0
  1. HTML
  2. <form method="get" id="searchBarForm" autocomplete="off" >
  3. <div id="textoBusqueda"> <input onkeydown="fAction(event)" id="searchBar" type="text" name="q" placeholder="honestly, it really do be like that . . ." required autofocus="autofocus" onfocus="this.select()" >
  4. <hr id="line">
  5. </form>
  6.  
  7. JS
  8.  
  9. function fAction(event) {
  10. var x = event.key;
  11. if (x == "Enter") {
  12. event.preventDefault()
  13. let text = document.getElementById("searchBar").value;
  14. let pre= text.substring(0, 3);
  15. let next= text.substring(3);
  16. if (pre == "red" || pre == "4ch") {
  17. switch (next) {
  18. case ("red"):
  19. switch (siguiente) {
  20. case ("d2"):
  21. url = "https://www.reddit.com/r/dota2/"
  22. break;
  23. .
  24. .
  25. .
  26.  
  27. default:
  28. url = "https://www.reddit.com/";
  29. break;
  30. }
  31. break;
  32. case ("4ch"):
  33. switch (next) {
  34. case ("wg"):
  35. url = "https://boards.4chan.org/wg/";
  36. break;
  37. .
  38. .
  39. .
  40. default:
  41. url = "https://boards.4chan.org";
  42. break;
  43. }
  44. }
  45. } else {
  46. switch (text) {
  47. case ("yt"):
  48. url = "https://www.youtube.com/";
  49. break;
  50. .
  51. .
  52. .
  53. default:
  54. url = 'https://duckduckgo.com/?q=' + text;
  55. break;
  56. }
  57. }
  58. window.open(url, '_self');
  59. }
  60. }
Add Comment
Please, Sign In to add comment