fix: add Porn365 button in Lampa settings menu
This commit is contained in:
32
porn365.js
32
porn365.js
@@ -82,6 +82,16 @@
|
|||||||
setStatus(getProxy() ? 'Proxy сохранён' : 'Proxy отключен');
|
setStatus(getProxy() ? 'Proxy сохранён' : 'Proxy отключен');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function openCatalog() {
|
||||||
|
var root = $('#p365x-root');
|
||||||
|
if (!root) return;
|
||||||
|
root.style.display = 'block';
|
||||||
|
if (!STATE.items.length) loadNextPage();
|
||||||
|
if (getProxy()) setStatus('Proxy: включен');
|
||||||
|
}
|
||||||
|
|
||||||
function createUi() {
|
function createUi() {
|
||||||
if ($('#p365x-root')) return;
|
if ($('#p365x-root')) return;
|
||||||
|
|
||||||
@@ -115,11 +125,7 @@
|
|||||||
document.body.appendChild(root);
|
document.body.appendChild(root);
|
||||||
document.body.appendChild(player);
|
document.body.appendChild(player);
|
||||||
|
|
||||||
fab.addEventListener('click', function () {
|
fab.addEventListener('click', openCatalog);
|
||||||
root.style.display = 'block';
|
|
||||||
if (!STATE.items.length) loadNextPage();
|
|
||||||
if (getProxy()) setStatus('Proxy: включен');
|
|
||||||
});
|
|
||||||
$('#p365x-close').addEventListener('click', function () { root.style.display = 'none'; });
|
$('#p365x-close').addEventListener('click', function () { root.style.display = 'none'; });
|
||||||
$('#p365x-more').addEventListener('click', loadNextPage);
|
$('#p365x-more').addEventListener('click', loadNextPage);
|
||||||
$('#p365x-proxy').addEventListener('click', openProxyPrompt);
|
$('#p365x-proxy').addEventListener('click', openProxyPrompt);
|
||||||
@@ -176,7 +182,21 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function start() { createUi(); }
|
|
||||||
|
|
||||||
|
function registerInLampaMenu() {
|
||||||
|
if (!(window.Lampa && Lampa.SettingsApi)) return;
|
||||||
|
try {
|
||||||
|
Lampa.SettingsApi.addParam({
|
||||||
|
component: 'interface',
|
||||||
|
param: { type: 'button', name: 'porn365_open' },
|
||||||
|
field: { name: 'Porn365', description: 'Открыть каталог Porn365' },
|
||||||
|
onChange: function () { openCatalog(); }
|
||||||
|
});
|
||||||
|
} catch (e) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
function start() { createUi(); registerInLampaMenu(); }
|
||||||
|
|
||||||
if (window.appready) start();
|
if (window.appready) start();
|
||||||
else if (window.Lampa && Lampa.Listener) {
|
else if (window.Lampa && Lampa.Listener) {
|
||||||
|
|||||||
Reference in New Issue
Block a user