Skip to content

Commit

Permalink
made more links available and added a Not Working line
Browse files Browse the repository at this point in the history
  • Loading branch information
JonahKC committed Apr 4, 2021
1 parent 8263c99 commit 74b390e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ <h3>Insert YouTube Link:</h3>
<div id="instructions" class="center">
<hr style="width:25% !important">
<h3>About</h3>
<p>Use to get around blocks, and watch YouTube ad-free! Just paste in the link and click Submit!
<p>Use to get around blocks, and watch YouTube ad-free! Just paste in the link and click Submit!</p>
<h3>Not Working?</h3>
<p>Make sure there isn't anything funky at the end of the link, just the video ID!</p>


<!--<h3>Acceptable link formats:</h3>
Expand Down
6 changes: 3 additions & 3 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//https://www.youtube-nocookie.com/embed/dQw4w9WgXcQ?wmode=transparent&amp;iv_load_policy=3&amp;autoplay=1&amp;html5=1&amp;showinfo=0&amp;rel=0&amp;modestbranding=1&amp;playsinline=0&amp;theme=light
const base = "https://www.youtube-nocookie.com/embed/";
const end = "?wmode=transparent&amp;iv_load_policy=3&amp;autoplay=0&amp;html5=1&amp;showinfo=0&amp;rel=0&amp;modestbranding=1&amp;playsinline=0&amp;theme=light";
const strip_chars = /[^0-9a-zA-z]/
const strip_timestamps = /\?t=\d+/;
var submit = document.getElementById('submit');
var url = document.getElementById('url');
var video_holder;
Expand All @@ -14,8 +14,8 @@ submit.onclick = () => {
document.getElementById('instructions').remove();
}
link = url.value;
id = link.replace(strip_chars, "");
id = id.substr(link.replace(strip_chars, "").length - 11, 11);
id = link.replace(strip_timestamps, "");
id = id.substr(id.length - 11, 11);
video_holder = document.getElementById('video-holder').cloneNode(true);
video_holder.style.display = 'block';
video_holder.children[1].src = base + id + end;
Expand Down

0 comments on commit 74b390e

Please # to comment.