Skip to content
This repository has been archived by the owner on May 27, 2024. It is now read-only.

Commit

Permalink
update plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
k03mad committed Jan 25, 2024
1 parent 2000d95 commit cd19221
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 12 deletions.
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
# Lampa Plugins

— Дополнительное меню выбора плагинов из этого репозитория \
— Дополнительное меню настроек выбора плагинов из этого репозитория \
https://cdn.jsdelivr.net/gh/k03mad/lampa/plugins/add-store.js

— Добавить Мультфильмы и расположить вместе с Аниме после Сериалов \
— Добавить в главное меню Мультфильмы и расположить вместе с Аниме после Сериалов \
https://cdn.jsdelivr.net/gh/k03mad/lampa/plugins/add-mult.js

— Добавить в главное меню Кинопоиск и расположить перед Каталогом \
https://cdn.jsdelivr.net/gh/k03mad/lampa/plugins/add-mult.js \
Не зависит от текущего источника по умолчанию, отображается всегда \
Работает только вместе со сторонним плагином, добавляющим сам Кинопоиск как источник \
https://nb557.github.io/plugins/kp_source.js

— Скрыть иконки Премиума и Ленты из верхнего тулбара \
https://cdn.jsdelivr.net/gh/k03mad/lampa/plugins/hide-icons.js
56 changes: 56 additions & 0 deletions plugins/add-kp.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
(() => {
// eslint-disable-next-line strict, unicorn/prefer-module
'use strict';

const main = () => {
const NEW_ITEM_ATTR = 'data-action="mad_kp"';
const NEW_ITEM_SELECTOR = `[${NEW_ITEM_ATTR}]`;
const NEW_ITEM_TEXT = 'Кинопоиск';

const ITEM_CATALOG_SELECTOR = '[data-action="catalog"]';

const ITEM_MOVE_TIMEOUT = 2000;

const moveItemBefore = (item, before) => setTimeout(
() => $(item).insertBefore($(before)),
ITEM_MOVE_TIMEOUT,
);

const field = $(/* html */`
<li class="menu__item selector" ${NEW_ITEM_ATTR}>
<div class="menu__ico">
<svg width="24" height="23" viewBox="0 0 24 23" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M15.6162 7.10981L15.8464 7.55198L16.3381 7.63428L22.2841 8.62965C22.8678 8.72736 23.0999 9.44167 22.6851 9.86381L18.4598 14.1641L18.1104 14.5196L18.184 15.0127L19.0748 20.9752C19.1622 21.5606 18.5546 22.002 18.025 21.738L12.6295 19.0483L12.1833 18.8259L11.7372 19.0483L6.34171 21.738C5.81206 22.002 5.20443 21.5606 5.29187 20.9752L6.18264 15.0127L6.25629 14.5196L5.9069 14.1641L1.68155 9.86381C1.26677 9.44167 1.49886 8.72736 2.08255 8.62965L8.02855 7.63428L8.52022 7.55198L8.75043 7.10981L11.5345 1.76241C11.8078 1.23748 12.5589 1.23748 12.8322 1.76241L15.6162 7.10981Z" stroke="currentColor" stroke-width="2.2"></path>
</svg>
</div>
<div class="menu__text">${NEW_ITEM_TEXT}</div>
</li>
`);

field.on('hover:enter', () => {
Lampa.Activity.push({
url: '',
title: NEW_ITEM_TEXT,
component: 'main',
source: 'KP',
});
});

Lampa.Menu
.render()
.find(ITEM_CATALOG_SELECTOR)
.before(field);

moveItemBefore(NEW_ITEM_SELECTOR, ITEM_CATALOG_SELECTOR);
};

if (window.appready) {
main();
} else {
Lampa.Listener.follow('app', event => {
if (event.type === 'ready') {
main();
}
});
}
})();
17 changes: 11 additions & 6 deletions plugins/add-mult.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,17 @@
const NEW_ITEM_ATTR = 'data-action="mad_mult"';
const NEW_ITEM_SELECTOR = `[${NEW_ITEM_ATTR}]`;
const NEW_ITEM_TEXT = 'Мультфильмы';
const NEW_ITEM_SOURCES = new Set(['cub', 'tmdb']);

const ITEM_TV_SELECTOR = '[data-action="tv"]';
const ITEM_ANIME_SELECTOR = '[data-action="anime"]';

const ITEM_MOVE_TIMEOUT = 2000;

const moveItemAfter = (item, after) => setTimeout(() => {
$(item).insertAfter($(after));
}, ITEM_MOVE_TIMEOUT);
const moveItemAfter = (item, after) => setTimeout(
() => $(item).insertAfter($(after)),
ITEM_MOVE_TIMEOUT,
);

const field = $(/* html */`
<li class="menu__item selector" ${NEW_ITEM_ATTR}>
Expand All @@ -31,13 +33,16 @@
`);

field.on('hover:enter', () => {
const {source: currentSource} = Lampa.Activity.active();
const source = NEW_ITEM_SOURCES.has(currentSource) ? currentSource : 'tmdb';

Lampa.Activity.push({
url: '',
title: `${NEW_ITEM_TEXT} - CUB`,
url: 'movie',
title: `${NEW_ITEM_TEXT} - ${source.toUpperCase()}`,
component: 'category',
genres: 16,
id: 16,
source: 'cub',
source,
card_type: true,
page: 1,
});
Expand Down
15 changes: 11 additions & 4 deletions plugins/store.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,21 @@
"secuses": true,
"results": [
{
"title": "My",
"title": "Мои",
"results": [
{
"name": "Добавить Мультфильмы и расположить вместе с Аниме после Сериалов",
"name": "Добавить в главное меню Мультфильмы и расположить вместе с Аниме после Сериалов",
"author": "https://github.com/k03mad/lampa",
"link": "https://cdn.jsdelivr.net/gh/k03mad/lampa/plugins/add-mult.js",
"available_lampa": 1
},
{
"name": "Добавить в главное меню Кинопоиск и расположить перед Каталогом",
"descr": "Не зависит от текущего источника по умолчанию, отображается всегда\nРаботает только вместе с плагином, добавляющим сам Кинопоиск как источник",
"author": "https://github.com/k03mad/lampa",
"link": "https://cdn.jsdelivr.net/gh/k03mad/lampa/plugins/add-kp.js",
"available_lampa": 1
},
{
"name": "Скрыть иконки Премиума и Ленты из верхнего тулбара",
"author": "https://github.com/k03mad/lampa",
Expand All @@ -19,7 +26,7 @@
]
},
{
"title": "Various",
"title": "Сообщество",
"results": [
{
"name": "Альтернативный магазин плагинов",
Expand All @@ -28,7 +35,7 @@
"available_lampa": 1
},
{
"name": "Источник КиноПоиск",
"name": "Источник Кинопоиск",
"author": "https://github.com/nb557/plugins",
"link": "https://nb557.github.io/plugins/kp_source.js",
"available_lampa": 1
Expand Down

0 comments on commit cd19221

Please sign in to comment.