Commit e259294c authored by Ahoy's avatar Ahoy

video tag

parent cf1ea566
Pipeline #31288599 passed with stages
in 58 seconds
......@@ -400,21 +400,25 @@
</div>
<h2>
<a href="#pleer_na_tege_video" id="pleer_na_tege_video" style="color: #fff">
Как показывать плеер на HTML5 теге <span class="tag">&lt;</span>video<span class="tag">&gt;</span>?
Как показывать плеер на HTML5 теге &lt;video&gt;?
</a>
</h2>
Есть возможность открывать плеер на HTML5 теге <span class="tag">&lt;</span>video<span class="tag">&gt;</span>.
Есть возможность открывать плеер на HTML5 теге &lt;video&gt; вместо &lt;div&gt;.
<div class="code">
<span class="tag">&lt;video</span>
<span> </span>
<span class="attr-name">id=&quot;</span><span class="attr-value">yohoho</span><span class="attr-name">&quot;</span>
<span> </span>
<span class="attr-name">data-kinopoisk=&quot;</span><span class="attr-value">401522</span><span class="attr-name">&quot;</span><span class="tag">&gt;</span>
<span class="attr-name">data-kinopoisk=&quot;</span><span class="attr-value">401522</span><span class="attr-name">&quot;</span>
<span> </span>
<span class="attr-name">controls</span>
<span class="tag">&gt;</span>
<br>&nbsp;&nbsp;<span class="tag">&lt;source</span>
<span> </span>
<span class="attr-name">src=&quot;</span><span class="attr-value">//yohoho.cc/yo.mp4</span><span class="attr-name">&quot;</span>
<span> </span>
<span class="attr-name">type=&quot;</span><span class="attr-value">video/mp4</span><span class="attr-name">&quot;</span><span class="tag">&gt;</span>
<br>
<span class="tag">&lt;/video&gt;</span>
<br>
<span class="tag">&lt;script</span>
......@@ -429,7 +433,7 @@
</div>
<div class="preview">
<div id="yohoho" data-title="Тайна Коко / Coco (2018)"></div>
<div id="yohoho" data-title="Тайна Коко"></div>
<div id="yohoho-kinopoisk" data-kinopoisk="401522"></div>
<div id="yohoho-trailer" data-player="trailer" data-title="Пила 8"></div>
<div id="yohoho-torrent" data-player="torrent" data-title="Инферно"></div>
......
......@@ -19,12 +19,12 @@ function ahoy_yo() {
function yo(sel) {
var h, a, w, i, l, d, s, t = false, p = '';
var yohoho = document.querySelector('#' + ((sel) ? sel : 'yohoho'));
if (!yohoho) {
yohoho = document.querySelector('#yohoho-online');
if (!yohoho) {
yohoho = document.querySelector('#yohoho-torrent');
if (!yohoho) {
d = document.querySelector('#' + ((sel) ? sel : 'yohoho'));
if (!d) {
d = document.querySelector('#yohoho-online');
if (!d) {
d = document.querySelector('#yohoho-torrent');
if (!d) {
return false;
}
else {
......@@ -33,6 +33,11 @@ function yo(sel) {
}
}
var yohoho = document.createElement('div');
var attr = Array.prototype.slice.call(d.attributes);
while(a = attr.pop()) {yohoho.setAttribute(a.nodeName, a.nodeValue);}
d.parentNode.replaceChild(yohoho, d);
var options = [].slice.call(yohoho.attributes).reduce(function (o, a) {
return /^data-/.test(a.name) && (o[a.name.substr(5)] = decodeURIComponent(a.value)), o;
}, {});
......@@ -115,10 +120,7 @@ function yo(sel) {
l = document.createElement('div');
l.setAttribute('id', 'yohoho-loading');
d = document.createElement('div');
var attr = Array.prototype.slice.call(yohoho.attributes);
while(a = attr.pop()) {d.setAttribute(a.nodeName, a.nodeValue);}
yohoho.parentNode.replaceChild(d, yohoho);
yohoho.innerHTML = '';
yohoho.appendChild(l);
i = document.createElement('iframe');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment