Advertisement
Guest User

add "save" button

a guest
Oct 30th, 2022
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JavaScript 0.90 KB | Source Code | 0 0
  1. var blue_box=document.getElementsByTagName("div")[4];
  2. var URL_box=blue_box.getElementsByTagName("input")[0];
  3. var new_button=document.createElement("button");
  4.  
  5. new_button.innerHTML="save";
  6.  
  7. // copy style from "search button
  8. new_button.style=blue_box.getElementsByTagName("input")[1].getAttribute("style");
  9.  
  10. new_button.onclick=function() {
  11.     document.getElementsByTagName("form")[0].action="/"; // invalidate to prevent override
  12.     document.getElementsByTagName("input")[0].name="url"; // invalidate to prevent override
  13.     window.location.href = "/?url=" + encodeURIComponent(URL_box.value);
  14. }
  15. blue_box.getElementsByTagName("div")[1].style.width="";
  16. blue_box.getElementsByTagName("div")[0].style.right="260px";
  17. document.body.appendChild(document.createElement("style"));
  18. document.body.lastChild.innerHTML="input,button { margin-right: 1em; }";
  19. blue_box.getElementsByTagName("div")[1].appendChild(new_button);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement