Free javascript Hosting


lampa-kinolive.js

Uploaded on Dec 24 2021 14:50 by julja1974

(function () {
'use strict';

function resetTemplates() {
Lampa.Template.add('online', "<div class=\"online selector\">\n <div class=\"online__body\">\n <div style=\"position: absolute;left: 0;top: -0.3em;width: 2.4em;height: 2.4em\">\n <svg style=\"height: 2.4em; width: 2.4em;\" viewBox=\"0 0 128 128\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <circle cx=\"64\" cy=\"64\" r=\"56\" stroke=\"white\" stroke-width=\"16\"/>\n <path d=\"M90.5 64.3827L50 87.7654L50 41L90.5 64.3827Z\" fill=\"white\"/>\n </svg>\n </div>\n <div class=\"online__title\" style=\"padding-left: 2.1em;\">{title}</div>\n <div class=\"online__quality\" style=\"padding-left: 3.4em;\">{quality}{info}</div>\n </div>\n </div>");
Lampa.Template.add('online_folder', "<div class=\"online selector\">\n <div class=\"online__body\">\n <div style=\"position: absolute;left: 0;top: -0.3em;width: 2.4em;height: 2.4em\">\n <svg style=\"height: 2.4em; width: 2.4em;\" viewBox=\"0 0 128 112\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <rect y=\"20\" width=\"128\" height=\"92\" rx=\"13\" fill=\"white\"/>\n <path d=\"M29.9963 8H98.0037C96.0446 3.3021 91.4079 0 86 0H42C36.5921 0 31.9555 3.3021 29.9963 8Z\" fill=\"white\" fill-opacity=\"0.23\"/>\n <rect x=\"11\" y=\"8\" width=\"106\" height=\"76\" rx=\"13\" fill=\"white\" fill-opacity=\"0.51\"/>\n </svg>\n </div>\n <div class=\"online__title\" style=\"padding-left: 2.1em;\">{title}</div>\n <div class=\"online__quality\" style=\"padding-left: 3.4em;\">{quality}{info}</div>\n </div>\n </div>");
}
function get_req() {
var req = document.getElementsByClassName('full-start__title')[0].innerText
return req;
}

var button = "<div class=\"full-start__button selector view--online\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" xmlns:svgjs=\"http://svgjs.com/svgjs\" version=\"1.1\" width=\"512\" height=\"512\" x=\"0\" y=\"0\" viewBox=\"0 0 30.051 30.051\" style=\"enable-background:new 0 0 512 512\" xml:space=\"preserve\" class=\"\">\n <g xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M19.982,14.438l-6.24-4.536c-0.229-0.166-0.533-0.191-0.784-0.062c-0.253,0.128-0.411,0.388-0.411,0.669v9.069 c0,0.284,0.158,0.543,0.411,0.671c0.107,0.054,0.224,0.081,0.342,0.081c0.154,0,0.31-0.049,0.442-0.146l6.24-4.532 c0.197-0.145,0.312-0.369,0.312-0.607C20.295,14.803,20.177,14.58,19.982,14.438z\" fill=\"currentColor\"/>\n <path d=\"M15.026,0.002C6.726,0.002,0,6.728,0,15.028c0,8.297,6.726,15.021,15.026,15.021c8.298,0,15.025-6.725,15.025-15.021 C30.052,6.728,23.324,0.002,15.026,0.002z M15.026,27.542c-6.912,0-12.516-5.601-12.516-12.514c0-6.91,5.604-12.518,12.516-12.518 c6.911,0,12.514,5.607,12.514,12.518C27.541,21.941,21.937,27.542,15.026,27.542z\" fill=\"currentColor\"/>\n </g></svg>\n\n <span>KinoLive</span>\n </div>";

Lampa.Component.add('kinolive');

resetTemplates();
Lampa.Listener.follow('full', function (e) {
if (e.type == 'complite') {
var btn = $(button);
btn.on('hover:enter', function () {
var xhr = new XMLHttpRequest();
var dp = new DOMParser();

var req = get_req();

xhr.open('GET', 'http://95.181.230.125/kinolive/kinolive.php?search=' + req, false);
xhr.send();
if (xhr.status != 200) {
var resp_api = xhr.status;
} else {
var resp_api = xhr.responseText;
}
console.log(resp_api);
// "title":"(.*?)","playlist_url":"(.*?)"
var json_api = JSON.parse(String(resp_api));
var url = json_api.channels[0].playlist_url;
xhr.open('GET', url, false);
xhr.send();
if (xhr.status != 200) {
var resp = xhr.status;
} else {
var resp = xhr.responseText;
}
var json_api_ = JSON.parse(String(resp));
var url = json_api_.channels[1].stream_url;
resetTemplates();
Lampa.Component.add('kinolive');
var first = {
url: url,
timeline: '',
title: get_req()
};
Lampa.Player.play(first);
});
e.object.activity.render().find('.view--torrent').after(btn);
}
});

})();

Back to list