Advertisement
Guest User

Youtube fullscreen

a guest
Aug 23rd, 2017
852
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.61 KB | None | 0 0
  1. <html><head><meta charset=utf-8><title>YouTube</title><style>
  2. body{margin:0;background-color:#1b1b1b;-ms-overflow-style:none}
  3. iframe{border:0;width:100%;height:100%;opacity:0;transition-duration:1s;transition-property:opacity}
  4. pre{white-space:pre-line;font-family:monospace;color:#999;font-size:15px}
  5. a{color:#999;text-decoration:none}
  6. input{color:#999;background-color:#1b1b1b;text-align:center;width:100%;height:25px;font-size:20px;
  7. border:none;opacity:0;transition-property:opacity;transition-duration:1s}
  8. #search{width:100%;outline:#999 solid 1px;margin-bottom:4px}
  9. #search:hover input{opacity:1}input:focus{opacity:1;outline:0}
  10. ::-webkit-scrollbar{display:none}
  11. </style></head>
  12. <body><div id='player'></div><div id='below'></div>
  13. <script src='//youtube.com/iframe_api'></script>
  14. <script>
  15. try{
  16. id=window.location.search.split('v=')[1].split('&')[0].split('#')[0];
  17. }
  18. catch(err){
  19. document.body.innerHTML = '<pre>Hi, add ?v= and a valid video id to url.<pre>';
  20. }
  21. url = window.location.search.split('&spfreload=10')[0];
  22. history.replaceState(null, document.title, "//iflyun.net/y/"+url);
  23. alist=url.match(/list=/)?url.split('list=')[1].split('&')[0]:0;
  24.  
  25. var player;
  26.  
  27. function onYouTubeIframeAPIReady() {
  28. update();
  29. player = new YT.Player('player', {
  30. videoId: id,
  31. playerVars: {
  32. autoplay: 1,
  33. autohide: 1,
  34. showinfo: 0,
  35. list: alist
  36. },
  37. events: {
  38. onReady: function(event) {
  39. document.getElementsByTagName('iframe')[0].style.opacity = 1;
  40. player.addEventListener('onStateChange',
  41. 'onchange');
  42. }
  43. }
  44. });
  45. }
  46.  
  47. function onchange(event) {
  48. if (event.data == 0 && lid) alist ? player.previousVideo() : player.seekTo();
  49. if (event.data == -1 && !lid) {
  50. id = player.getVideoUrl().split('v=')[1].split('&')[0];
  51. update();
  52. setTimeout(function(){
  53. url=player.getVideoUrl().split('?')[1];
  54. history.pushState(null, document.title, "//iflyun.net/y/?"+url);
  55. }, 1000);
  56. }
  57. }
  58. function update() {
  59. document.getElementById('below').innerHTML = '';
  60. xmlhttp = new XMLHttpRequest();
  61. xmlhttp.onreadystatechange = function() {
  62. if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
  63. json = xmlhttp.responseText;
  64. o = JSON.parse(json).items[0];
  65. os=o.snippet,ox=o.statistics;
  66. document.title = os.title;
  67. r = ox.likeCount ? ' <a id="loop" href="javascript:loop()">Rating: <u>' + (ox.likeCount/ox.dislikeCount).toFixed(2) + '</u></a>' : '';
  68. m = '<a href="http://www.video2mp3.net/loading.php?url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D' + id + '" >ViewCount</a>';
  69. document.getElementById('below').innerHTML =
  70. '<center><pre>' + os.title +
  71. '<br />Uploader: <a href="//youtube.com/channel/' + os.channelId +
  72. '"><u>' + os.channelTitle + '</u></a> Date: <u>' + os.publishedAt
  73. .split('T')[0] + '</u> ' + m + ': <u>' + ox.viewCount +
  74. '</u>' + r + '<br /><br />' + os.description +
  75. '</pre><div id="search"><form action="//youtube.com/results" method="get"><input name="search_query" placeholder="Search YouTube"></form><div></center>';
  76. xmlhttp = new XMLHttpRequest();
  77. xmlhttp.onreadystatechange = function() {
  78. if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
  79. json = xmlhttp.responseText;
  80. obj = JSON.parse(json);
  81. for (var a = 0; a < obj.items.length; a++) {
  82. e = obj.items[a].snippet.topLevelComment.snippet;
  83. if (e.textDisplay) document.getElementById('below').innerHTML += '<pre><u>' +
  84. e.authorDisplayName + '</u><br />' + e.textDisplay + '<br /></pre>';
  85. }
  86. }
  87. };
  88. xmlhttp.open('GET', 'https://www.googleapis.com/youtube/v3/commentThreads?part=snippet&maxResults=50&fields=items%2Fsnippet%2FtopLevelComment%2Fsnippet&videoId=' + id +
  89. '&key=AIzaSyBoiirKvEerE6QSutb_lEn-kQ-Dwy_1qKg', true);
  90. xmlhttp.send();
  91. }
  92. };
  93. xmlhttp.open('GET', 'https://www.googleapis.com/youtube/v3/videos?part=snippet%2Cstatistics%2CcontentDetails&id=' + id +
  94. '&key=AIzaSyBoiirKvEerE6QSutb_lEn-kQ-Dwy_1qKg', true);
  95. xmlhttp.send();
  96. }
  97. var lid;
  98. function loop(){
  99. lo=document.getElementById('loop');
  100. if (lid){
  101. lid=0;
  102. lo.innerHTML=lbackup;
  103. } else {
  104. lid=1;
  105. lbackup=lo.innerHTML;
  106. lo.innerHTML="Loop: <u>∞</u>";
  107. }
  108. }
  109. </script></body></html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement