Guest User

Untitled

a guest
Dec 4th, 2014
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.69 KB | None | 0 0
  1. <body bgcolor="#ffffff">
  2. <script>
  3. function refreshDiv(){
  4. // alert("In function");
  5. var container = document.getElementById("dialerDiv1");
  6. var content = container.innerHTML;
  7. //alert(content);
  8. container.innerHTML= content;
  9. }
  10. </script>
  11. <div id="dialerDiv1">
  12. <iframe Id="youtube" width="" height="" src="" frameborder="0" allowfullscreen></iframe>
  13. </div>
  14. <script>
  15. var link = "";
  16. var width = 0;
  17. var height = 0;
  18. var fulllink = "";
  19.  
  20. function getVars(){
  21. console.log("getting vars");
  22. link = prompt("Please enter a youtube tag here\n(everything after watch?v=)", "paste it here");
  23. if (link.indexOf('&') != -1){
  24. link = convLink();
  25. }
  26. width = prompt("Please enter a window width here\ndefault is 560", "560");
  27. height = prompt("Please enter a window height here\ndefault is 315 ","315");
  28. fulllink = "https://www.youtube.com/embed/" + link;
  29. console.log(link,width,height,fulllink);
  30. if (height == "" || height == null ){
  31. console.log("height was null");
  32. height = window.innerHeight - 20;
  33. }
  34. if (width == "" || width == null){
  35. console.log("width was null");
  36. width = window.innerWidth - 20;
  37. }
  38. }
  39. function setVars(){
  40. console.log("setting vars");
  41. document.getElementById("youtube").src = fulllink;
  42. document.getElementById("youtube").width = width;
  43. document.getElementById("youtube").height = height;
  44.  
  45.  
  46. }
  47. function convLink(){
  48. var indexof1st = link.indexOf("&");
  49. var indexof2nd = link.indexOf("&", indexof1st + 1);
  50. var part1 = link.slice(0,indexof1st);
  51. var part2 = link.slice(indexof2nd +1, link.length);
  52. var newlink = part1 + "?" + part2;
  53. return newlink;
  54. }
  55.  
  56. getVars();
  57. setVars();
  58. console.log(link,height,width,fulllink);
  59. </script>
  60.  
  61. </body>
Advertisement
Add Comment
Please, Sign In to add comment