Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <body bgcolor="#ffffff">
- <script>
- function refreshDiv(){
- // alert("In function");
- var container = document.getElementById("dialerDiv1");
- var content = container.innerHTML;
- //alert(content);
- container.innerHTML= content;
- }
- </script>
- <div id="dialerDiv1">
- <iframe Id="youtube" width="" height="" src="" frameborder="0" allowfullscreen></iframe>
- </div>
- <script>
- var link = "";
- var width = 0;
- var height = 0;
- var fulllink = "";
- function getVars(){
- console.log("getting vars");
- link = prompt("Please enter a youtube tag here\n(everything after watch?v=)", "paste it here");
- if (link.indexOf('&') != -1){
- link = convLink();
- }
- width = prompt("Please enter a window width here\ndefault is 560", "560");
- height = prompt("Please enter a window height here\ndefault is 315 ","315");
- fulllink = "https://www.youtube.com/embed/" + link;
- console.log(link,width,height,fulllink);
- if (height == "" || height == null ){
- console.log("height was null");
- height = window.innerHeight - 20;
- }
- if (width == "" || width == null){
- console.log("width was null");
- width = window.innerWidth - 20;
- }
- }
- function setVars(){
- console.log("setting vars");
- document.getElementById("youtube").src = fulllink;
- document.getElementById("youtube").width = width;
- document.getElementById("youtube").height = height;
- }
- function convLink(){
- var indexof1st = link.indexOf("&");
- var indexof2nd = link.indexOf("&", indexof1st + 1);
- var part1 = link.slice(0,indexof1st);
- var part2 = link.slice(indexof2nd +1, link.length);
- var newlink = part1 + "?" + part2;
- return newlink;
- }
- getVars();
- setVars();
- console.log(link,height,width,fulllink);
- </script>
- </body>
Advertisement
Add Comment
Please, Sign In to add comment