Commit 06829957 authored by Ahoy's avatar Ahoy

JSON out

parent 971dcb51
Pipeline #17867222 passed with stages
in 54 seconds
...@@ -242,6 +242,9 @@ ...@@ -242,6 +242,9 @@
<br> <br>
<span class="attr-name">data-button=&quot;</span><span class="attr-value">moonwalk: Плеер {N}, hdgo: Плеер {N}</span><span class="attr-name">&quot;</span> <span class="attr-name">data-button=&quot;</span><span class="attr-value">moonwalk: Плеер {N}, hdgo: Плеер {N}</span><span class="attr-name">&quot;</span>
<span class="comment"> - можно использовать нумерацию {N}, будет указана цифра плеера</span> <span class="comment"> - можно использовать нумерацию {N}, будет указана цифра плеера</span>
<br>
<span class="attr-name">data-button=&quot;</span><span class="attr-value">moonwalk: {Q} {T}, hdgo: {Q} {T}</span><span class="attr-name">&quot;</span>
<span class="comment"> - можно использовать {Q} - будет указано качество в плеере, {T} - будет указан перевод в плеере (только для moonwalk, hdgo, iframe)</span>
</div> </div>
<div class="code"> <div class="code">
<span class="comment"> <span class="comment">
...@@ -269,6 +272,40 @@ ...@@ -269,6 +272,40 @@
<span class="attr-name">data-country=&quot;</span><span class="attr-value">RU</span><span class="attr-name">&quot;</span> <span class="attr-name">data-country=&quot;</span><span class="attr-value">RU</span><span class="attr-name">&quot;</span>
<span class="comment"> - ISO 3166-1 код названия страны</span> <span class="comment"> - ISO 3166-1 код названия страны</span>
</div> </div>
<div class="code">
<span class="comment">
Отобразить качество и перевод на странице
</span>
<br>
<span class="tag">&lt;script&gt;</span>
<span class="attr-value">
<br>document.addEventListener('DOMContentLoaded', function() {
<br>&nbsp;&nbsp;window.addEventListener('message', function(e) {
<br>&nbsp;&nbsp;&nbsp;&nbsp;if (!e || !e.data) return;
<br>&nbsp;&nbsp;&nbsp;&nbsp;var quality = document.querySelector('[data-yo="quality"]');
<br>&nbsp;&nbsp;&nbsp;&nbsp;var translate = document.querySelector('[data-yo="translate"]');
<br>&nbsp;&nbsp;&nbsp;&nbsp;if (e.data.quality && quality) {
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;quality.innerHTML = e.data.quality;
<br>&nbsp;&nbsp;&nbsp;&nbsp;}
<br>&nbsp;&nbsp;&nbsp;&nbsp;if (e.data.translate && translate) {
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;translate.innerHTML = e.data.translate;
<br>&nbsp;&nbsp;&nbsp;&nbsp;}
<br>&nbsp;&nbsp;});
<br>});
</span>
<br>
<span class="tag">&lt;/script&gt;</span>
<br>
<span class="tag">&lt;span</span>
<span> </span>
<span class="attr-name">data-yo=&quot;</span><span class="attr-value">quality</span><span class="attr-name">&quot;</span><span class="tag">&gt;&lt;/span&gt;</span>
<span class="comment"> - будет показано качество на странице</span>
<br>
<span class="tag">&lt;span</span>
<span> </span>
<span class="attr-name">data-yo=&quot;</span><span class="attr-value">translate</span><span class="attr-name">&quot;</span><span class="tag">&gt;&lt;/span&gt;</span>
<span class="comment"> - будет показан перевод на странице</span>
</div>
<div class="text-muted text-justify"> <div class="text-muted text-justify">
<h1> <h1>
<a href="#pleery_filmov_online" id="pleery_filmov_online" style="color: #fff"> <a href="#pleery_filmov_online" id="pleery_filmov_online" style="color: #fff">
......
...@@ -44,7 +44,7 @@ function yo(sel) { ...@@ -44,7 +44,7 @@ function yo(sel) {
options.player = (options.title && options.title.indexOf('трейлер')+1 || t) options.player = (options.title && options.title.indexOf('трейлер')+1 || t)
? 'trailer' ? 'trailer'
: (!options.player) : (!options.player)
? 'moonwalk,hdgo,kodik,allserials,iframe,trailer,torrent' ? 'moonwalk,hdgo,iframe,kodik,allserials,trailer,torrent'
: options.player; : options.player;
var bg = (options.bg && options.bg.replace(/[^0-9a-z]/ig, '')) var bg = (options.bg && options.bg.replace(/[^0-9a-z]/ig, ''))
...@@ -52,6 +52,9 @@ function yo(sel) { ...@@ -52,6 +52,9 @@ function yo(sel) {
: '2A3440'; : '2A3440';
var btns = {}; var btns = {};
options.button = (options.button)
? options.button
: 'moonwalk: {Q}|{T}, hdgo: {Q}|{T}, iframe: {Q}|{T}';
if (options.button) { if (options.button) {
options.button.split(',').forEach(function (button) { options.button.split(',').forEach(function (button) {
var btn = button.split(':'); var btn = button.split(':');
...@@ -165,30 +168,59 @@ function yo(sel) { ...@@ -165,30 +168,59 @@ function yo(sel) {
var j = 0; var j = 0;
for (var i = 0, len = keys.length; i < len; i++) { for (var i = 0, len = keys.length; i < len; i++) {
var key = keys[i].toLowerCase().trim(); var key = keys[i].toLowerCase().trim();
if (players.hasOwnProperty(key) && players[key]) { if (players.hasOwnProperty(key) && players[key] && players[key].iframe) {
if (key === 'moonwalk') { if (key === 'moonwalk') {
if (options.start_episode) { if (options.start_episode) {
var reg = options.start_episode.match(/^([a-z0-9]*?)\|([0-9]*?)\|([0-9]*?)$/i); var reg = options.start_episode.match(/^([a-z0-9]*?)\|([0-9]*?)\|([0-9]*?)$/i);
if (reg && reg.length === 4) { if (reg && reg.length === 4) {
players[key] = players[key].replace(/serial\/([a-z0-9]*?)\//i, 'serial/' + reg[1] + '/'); players[key].iframe = players[key].iframe
players[key] = (players[key].indexOf('?')+1) .replace(/serial\/([a-z0-9]*?)\//i, 'serial/' + reg[1] + '/');
? players[key] + '&season=' + reg[2] + '&episode=' + reg[3] players[key].iframe = (players[key].iframe.indexOf('?')+1)
: players[key] + '?season=' + reg[2] + '&episode=' + reg[3] ? players[key].iframe + '&season=' + reg[2] + '&episode=' + reg[3]
: players[key].iframe + '?season=' + reg[2] + '&episode=' + reg[3]
} }
} }
if (options.start_time) { if (options.start_time) {
players[key] = (players[key].indexOf('?')+1) players[key].iframe = (players[key].iframe.indexOf('?')+1)
? players[key] + '&start_time=' + options.start_time ? players[key].iframe + '&start_time=' + options.start_time
: players[key] + '?start_time=' + options.start_time : players[key].iframe + '?start_time=' + options.start_time
} }
} }
players[key].quality = (players[key].quality)
? players[key].quality.replace(/"/g, '\'')
: '';
players[key].translate = (players[key].translate)
? players[key].translate.replace(/"/g, '\'')
: '';
var option = document.createElement('div'); var option = document.createElement('div');
option.setAttribute('onclick', 'showPlayer("' + players[key] + '", this)'); option.setAttribute('onclick', 'showPlayer("' + players[key].iframe + '", "' + players[key].quality + '", "' + players[key].translate + '", this)');
option.dataset.iframe = players[key]; option.dataset.iframe = players[key].iframe;
option.dataset.quality = players[key].quality;
option.dataset.translate = players[key].translate;
if (btns.hasOwnProperty(key) && btns[key]) { if (btns.hasOwnProperty(key) && btns[key]) {
var q = (players[key].quality)
? players[key].quality
.toUpperCase()
.replace(/\s?ХОРОШЕЕ\s?|\s?СРЕДНЕЕ\s?|\s?ПЛОХОЕ\s?/gi, '')
: '';
var t = (players[key].translate)
? (players[key].translate.toUpperCase().indexOf('ДУБЛ')+1)
? 'ДУБЛЯЖ'
: (players[key].translate.toUpperCase().indexOf('ПРОФ')+1)
? 'ПРОФ.'
: (players[key].translate.toUpperCase().indexOf('ЛЮБИТ')+1)
? 'ЛЮБИТ.'
: (players[key].translate.toUpperCase().indexOf('АВТОР')+1)
? 'АВТОР.'
: players[key].translate.toUpperCase()
: '';
j++; j++;
btns[key] = btns[key].replace('{N}', j); btns[key] = btns[key].replace('{N}', j);
option.innerText = j + '► ' + btns[key]; btns[key] = btns[key].replace('{Q}', q);
btns[key] = btns[key].replace('{T}', t);
option.innerText = j + '► ' + btns[key]
.replace(/\s+/g, ' ')
.replace(/(^\s*)|(\s*)$/g, '');
} }
else if (key === 'trailer') { else if (key === 'trailer') {
j++; j++;
...@@ -203,7 +235,7 @@ function yo(sel) { ...@@ -203,7 +235,7 @@ function yo(sel) {
option.innerText = j + '► ' + key.toUpperCase(); option.innerText = j + '► ' + key.toUpperCase();
} }
if (first) { if (first) {
showPlayer(players[key], option, buttons); showPlayer(players[key].iframe, players[key].quality, players[key].translate, option, buttons);
first = false; first = false;
} }
buttons.appendChild(option); buttons.appendChild(option);
...@@ -220,12 +252,13 @@ function yo(sel) { ...@@ -220,12 +252,13 @@ function yo(sel) {
} }
function showPlayer(iframe, element, buttons) { function showPlayer(iframe, quality, translate, element, buttons) {
window.parent.postMessage({"quality": quality, "translate": translate}, "*");
var yohohoLoading = document.querySelector('#yohoho-loading'); var yohohoLoading = document.querySelector('#yohoho-loading');
yohohoLoading.style.display = 'block'; yohohoLoading.style.display = 'block';
setTimeout(function () { setTimeout(function () {
yohohoLoading.style.display = 'none'; yohohoLoading.style.display = 'none';
},2000); }, 2000);
var yohohoIframe = document.querySelector('#yohoho-iframe'); var yohohoIframe = document.querySelector('#yohoho-iframe');
yohohoIframe.style.display = 'block'; yohohoIframe.style.display = 'block';
yohohoIframe.setAttribute('src', iframe); yohohoIframe.setAttribute('src', 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