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 отключен');
|
||||
}
|
||||
|
||||
|
||||
|
||||
function openCatalog() {
|
||||
var root = $('#p365x-root');
|
||||
if (!root) return;
|
||||
root.style.display = 'block';
|
||||
if (!STATE.items.length) loadNextPage();
|
||||
if (getProxy()) setStatus('Proxy: включен');
|
||||
}
|
||||
|
||||
function createUi() {
|
||||
if ($('#p365x-root')) return;
|
||||
|
||||
@@ -115,11 +125,7 @@
|
||||
document.body.appendChild(root);
|
||||
document.body.appendChild(player);
|
||||
|
||||
fab.addEventListener('click', function () {
|
||||
root.style.display = 'block';
|
||||
if (!STATE.items.length) loadNextPage();
|
||||
if (getProxy()) setStatus('Proxy: включен');
|
||||
});
|
||||
fab.addEventListener('click', openCatalog);
|
||||
$('#p365x-close').addEventListener('click', function () { root.style.display = 'none'; });
|
||||
$('#p365x-more').addEventListener('click', loadNextPage);
|
||||
$('#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();
|
||||
else if (window.Lampa && Lampa.Listener) {
|
||||
|
||||
Reference in New Issue
Block a user