Advertisement
Guest User

Untitled

a guest
Aug 21st, 2019
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.80 KB | None | 0 0
  1. <!doctype html><html>
  2. <head>
  3. <meta charset="UTF-8">
  4. <link rel="stylesheet" href="https://cdn.plyr.io/1.8.2/plyr.css">
  5. <style>
  6. * {margin: 0; padding:0;}
  7. body {
  8. width: 100%;
  9. background: #0a0d0d;
  10. color: gray;
  11. font-family: HelveticaNeueRegular,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;
  12. font-size: 13px;
  13. line-height: 1.384;
  14. margin: 5px 0;
  15. }
  16. .container {
  17. position: relative;
  18. width: 100%;
  19. max-width: 1200px;
  20. margin: 0 auto;
  21. padding: 0 12px;
  22. box-sizing: border-box;
  23. }
  24.  
  25. .column, .columns { width: 100%; float: left; box-sizing: border-box; }
  26.  
  27. @media (min-width: 400px) { .container { width: 95%; padding: 0; } }
  28.  
  29. /* For devices larger than 550px */
  30. @media (min-width: 550px) {
  31. .column, .columns { margin-left: 4%; }
  32. .column:first-child, .columns:first-child { margin-left: 0; }
  33.  
  34. .one.column,
  35. .one.columns { width: 4.66666666667%; }
  36. .two.columns { width: 13.3333333333%; }
  37. .three.columns { width: 22%; }
  38. .four.columns { width: 30.6666666667%; }
  39. .five.columns { width: 39.3333333333%; }
  40. .six.columns { width: 48%; }
  41. .seven.columns { width: 56.6666666667%; }
  42. .eight.columns { width: 65.3333333333%; }
  43. .nine.columns { width: 74.0%; }
  44. .ten.columns { width: 82.6666666667%; }
  45. .eleven.columns { width: 91.3333333333%; }
  46. .twelve.columns { width: 100%; margin-left: 0; }
  47.  
  48. .one-third.column { width: 30.6666666667%; }
  49. .two-thirds.column { width: 65.3333333333%; }
  50.  
  51. .one-half.column { width: 48%; }
  52. }
  53. .videobox {position: absolute;width: 100%;height: 100%;z-index:999;top:0;left:0;background-color:#000;}
  54. video { width:100%; }
  55. .box {
  56. width: 210px;
  57. margin: 0 2em 2.5em 0;
  58. position: relative;
  59. display: inline-block;
  60. vertical-align: top;
  61. text-transform: uppercase;
  62. text-align: center;
  63. }
  64. .box a {
  65. text-decoration: none;
  66. cursor: pointer;
  67. }
  68. .box a .cover {
  69. border-radius: .4em;
  70. overflow: hidden;
  71. z-index: 1;
  72. }
  73. .box a .cover:before {
  74. content: "";
  75. display: block;
  76. position: absolute;
  77. top: 0;
  78. left: 0;
  79. right: 0;
  80. bottom: 0;
  81. background: rgba(0,0,0,.5);
  82. opacity: 0;
  83. z-index: 2;
  84. transition: opacity .3s;
  85. }
  86. .box:hover a .cover:before, .box:hover .hover-play .hover-icon-container {
  87. opacity: 1;
  88. }
  89. .box .info {
  90. position: relative;
  91. margin-top: 1em;
  92. }
  93. .box .info .title, .box .info .title-en {
  94. text-overflow: ellipsis;
  95. overflow: hidden;
  96. margin: 0;
  97. color: #fff;
  98. font-size: 18px;
  99. font-weight: 400;
  100. line-height: 1.2;
  101. text-transform: uppercase;
  102. letter-spacing: .03em;
  103. }
  104. .box .info .title-en {
  105. color: grey;
  106. font-size: 14px;
  107. }
  108. .box .info .separator {
  109. height: 2px;
  110. margin: .4em 0 .6em;
  111. background: #333;
  112. }
  113. .box .hover-play {
  114. position: absolute;
  115. top: 0;
  116. left: 0;
  117. right: 0;
  118. height: 0;
  119. }
  120. .box .hover-play .hover-icon-container .hover-title {
  121. pointer-events: none;
  122. color: #fff;
  123. margin-bottom: .4em;
  124. position: relative;
  125. z-index: 1;
  126. font-size: 12px;
  127. font-weight: 400;
  128. line-height: 1.2;
  129. margin: .67em 0;
  130. text-transform: uppercase;
  131. letter-spacing: .03em;
  132. }
  133. .box .hover-play .hover-icon-container a {
  134. border-radius: 100%;
  135. border: 2px solid #cbcbcb;
  136. background: rgba(0,0,0,.3);
  137. color: #cbcbcb;
  138. display: inline-block;
  139. line-height: 24px;
  140. height: 24px;
  141. width: 24px;
  142. font-size: 14px;
  143. text-align: center;
  144. position: relative;
  145. z-index: 1;
  146. margin: 0 .2em .4em;
  147. cursor: pointer;
  148. box-sizing: content-box;
  149. }
  150. .box .hover-play .hover-icon-container {
  151. opacity: 0;
  152. width: 6em;
  153. }
  154. .box .hover-play > * {
  155. display: inline-block;
  156. vertical-align: middle;
  157. }
  158. .popup-search-input {
  159. font-size: 35px;
  160. border: none;
  161. border-bottom: 2px solid #4a4a4a;
  162. width: 96%;
  163. padding: 0 48px 2px 0!important;
  164. text-align: left;
  165. background: none;
  166. border-radius: 0;
  167. height: 55px;
  168. color: #fff;
  169. letter-spacing: .025em;
  170. text-transform: none;
  171. font-weight: 100;
  172. margin-bottom:15px;
  173. outline: none;
  174. </style>
  175. </head>
  176. <body>
  177. <div class="container">
  178. <div class="twelve columns" data-content>
  179. <input type="text" class="popup-search-input" placeholder="Поиск сериалов" maxlength="40" />
  180.  
  181. </div>
  182. </div>
  183. <script id="page-main" type="application/template">
  184. <a href="#">
  185. <div class="cover">
  186. <img width="210" height="150" src="{cover}"/>
  187. </div>
  188. <div class="info">
  189. <div class="title">{serialName}</div>
  190. <div class="separator"></div>
  191. <div class="title-en">{serialNameEn}</div>
  192. </div>
  193. </a>
  194. <div class="hover-play">
  195. <div style="height:150px;"></div>
  196. <div class="hover-icon-container">
  197. <div class="hover-title">{episodeName}</div>
  198. <a href="#">{number}</a>
  199. </div>
  200. </div>
  201. </script>
  202. <script id="page-video" type="application/template">
  203. <video preload="none" id="player" autoplay controls crossorigin src=""></video>
  204. </script>
  205. <script>
  206. document.body.onclick = function() { console.log('loadvideo'); loadvideo(); };
  207. function nano(template, data) {
  208. return template.replace(/\{([\w\.]*)\}/g, function(str, key) {
  209. var keys = key.split("."), v = data[keys.shift()];
  210. for (i = 0, l = keys.length; i < l; i++) v = v[this];
  211. return (typeof v !== "undefined" && v !== null) ? v : "";
  212. });
  213. };
  214.  
  215. var xhr = new XMLHttpRequest();
  216. xhr.open('GET', 'http://localhost:1101/main.json', false);
  217. xhr.onreadystatechange = function() {
  218. if (xhr.readyState != 4 && xhr.status != 200) return;
  219. var template = document.querySelector('#page-main').innerHTML;
  220. var elems = JSON.parse(xhr.responseText);
  221. elems.results.forEach(function(item,index) {
  222. console.log(item.title);
  223. item.serialName = item.title;
  224. item.serialNameEn = "";
  225. item.episodeName = "";
  226. item.cover = item.assets.productPoster.replace('{SIZE}', '220x150');
  227. var newElement = document.createElement('div');
  228. newElement.classList.add('box');
  229. newElement.innerHTML = nano(template, item);
  230. newElement.onclick = function() { console.log('loadvideo'); loadvideo(); };
  231. document.querySelector('[data-content]').appendChild(newElement);
  232. });
  233. };
  234. xhr.send();
  235.  
  236. var loadvideo = function() {
  237. var template = document.querySelector('#page-video').innerHTML;
  238. var newElement = document.createElement('div');
  239. newElement.classList.add('videobox');
  240. newElement.innerHTML = nano(template, {});
  241. document.body.appendChild(newElement);
  242.  
  243. var xhr = new XMLHttpRequest();
  244. xhr.open('GET', 'http://localhost:1101/load', false);
  245. xhr.onreadystatechange = function() {
  246. if (xhr.readyState != 4 && xhr.status != 200) return;
  247. var vid = document.querySelector('video');
  248. if (Hls.isSupported()) {
  249. var hls = new Hls();
  250. hls.loadSource("http://localhost:1101/index.m3u8");
  251. hls.attachMedia(vid);
  252. hls.on(Hls.Events.MANIFEST_PARSED,function() {
  253. vid.play();
  254. });
  255. }
  256.  
  257. plyr.setup(vid);
  258. };
  259. xhr.send();
  260. };
  261. var errorHandler = function(e) {
  262. console.log("error", e);
  263. };
  264. </script>
  265. <script src="https://cdn.plyr.io/1.8.2/plyr.js"></script>
  266. <script src="https://cdn.jsdelivr.net/hls.js/latest/hls.js"></script>
  267. </body>
  268. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement