Advertisement
DanAtkinson

Better Multilink

Dec 21st, 2013
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 0.84 KB | None | 0 0
  1. <!doctype html>
  2. <html>
  3.     <head>
  4.         <title>Multilink</title>
  5.         <script type="text/javascript">
  6.             //Based on http://goo.gl/Fv9R0O. I just cleaned it up as it had a couple of issues.
  7.             function openLinks() {
  8.                 var regex = new RegExp("^http(s)?://");
  9.                 var allLinks = document.getElementById("alllinks").value;
  10.                 var arrLinks = allLinks.split("\n");
  11.  
  12.                 for(i = 0; i < arrLinks.length; i++) {
  13.  
  14.                     if(!arrLinks[i].length) {
  15.                         continue;
  16.                     }
  17.  
  18.                     if(regex.test(arrLinks[i])) {
  19.                         window.open(arrLinks[i], '_blank');
  20.                     } else {
  21.                         window.open("http://" + arrLinks[i], '_blank');
  22.                     }
  23.                 }
  24.             }
  25.         </script>
  26.     </head>
  27.     <body>
  28.         <textarea rows="20" cols="80" id="allLinks" placeholder="Paste all links here" autofocus></textarea>
  29.         <br>
  30.         <input type="submit" onclick="openLinks()" value="OPEN">
  31.     </body>
  32. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement