Advertisement
codervitali

Attempt 4 LINKMODE (YWOT)

Jul 25th, 2017
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2.     Automatic Links for yourworldoftext.com.
  3.     Copyright (C) 2017 Your World of Text user Ancientcraft.
  4.  
  5.     This program is free software: you can redistribute it and/or modify
  6.     it under the terms of the GNU General Public License as published by
  7.     the Free Software Foundation, either version 3 of the License, or
  8.     (at your option) any later version.
  9.  
  10.     This program is distributed in the hope that it will be useful,
  11.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13.     GNU General Public License for more details.
  14.  
  15.     You should have received a copy of the GNU General Public License
  16.     along with this program.  If not, see <http://www.gnu.org/licenses/>.
  17. */
  18.  
  19. var linkmode = true;
  20.  
  21. /* The "Create link to URL" button in the menu. */
  22. var urlprompt =
  23.     document.getElementById("nav").
  24.     getElementsByTagName("ul")[0].
  25.     getElementsByTagName("li")[4].
  26.     getElementsByTagName("div")[0];
  27.  
  28. /* The button to enable link creation. */
  29. var linksubmitbtn =
  30.     document.getElementById("url_input_submit").
  31.     getElementsByTagName("input")[0];
  32.  
  33. /* The URL of the link you want to create. */
  34. var url = document.getElementById("url_input_form_input").value;
  35.  
  36. var init = prompt("Enter the URL you want and then press [OK]. This URL must be an HTTP or HTTPS one.\n\nAlternatively, press [CANCEL] to cancel and terminate the script.\n\nTo stop the script after starting it, you can enter into the console:\n\nlinkmode = false;");
  37.  
  38. function auto() {
  39.     if(linkmode) {
  40.         urlprompt.click();
  41.         url = init;
  42.         linksubmitbtn.click();
  43.         setTimeout(auto, 250);
  44.     }
  45. }
  46.  
  47. if (init) {
  48.     auto();
  49. } else {
  50.     linkmode = false;
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement