Загрузить файлы в «/»

This commit is contained in:
Fovway 2025-03-09 12:36:45 +00:00
commit e4a875c644
4 changed files with 142 additions and 0 deletions

51
exit.js Normal file
View File

@ -0,0 +1,51 @@
function sourceChange() {
document.querySelector('.head__actions').insertAdjacentHTML(
'beforeend',
`<div class='head__action selector source-btn'>
<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <path fill-rule="evenodd" clip-rule="evenodd" d="M5.29289 5.29289C5.68342 4.90237 6.31658 4.90237 6.70711 5.29289L12 10.5858L17.2929 5.29289C17.6834 4.90237 18.3166 4.90237 18.7071 5.29289C19.0976 5.68342 19.0976 6.31658 18.7071 6.70711L13.4142 12L18.7071 17.2929C19.0976 17.6834 19.0976 18.3166 18.7071 18.7071C18.3166 19.0976 17.6834 19.0976 17.2929 18.7071L12 13.4142L6.70711 18.7071C6.31658 19.0976 5.68342 19.0976 5.29289 18.7071C4.90237 18.3166 4.90237 17.6834 5.29289 17.2929L10.5858 12L5.29289 6.70711C4.90237 6.31658 4.90237 5.68342 5.29289 5.29289Z" fill="currentColor"></path> </g></svg>
</div>`
);
document.querySelector('.source-btn').addEventListener('click', function() {
if (Lampa.Platform.is('apple_tv'))
window.location.assign('exit://exit');
if (Lampa.Platform.is("tizen"))
tizen.application.getCurrentApplication().exit();
if (Lampa.Platform.is("webos")) window.close();
if (Lampa.Platform.is("android")) Lampa.Android.exit();
if (Lampa.Platform.is("orsay")) Lampa.Orsay.exit();
if (Lampa.Platform.is("nw")) nw.Window.get().close();
});
document.querySelector('.source-btn').addEventListener('touchend', function() {
if (Lampa.Platform.is('apple_tv'))
window.location.assign('exit://exit');
if (Lampa.Platform.is("tizen"))
tizen.application.getCurrentApplication().exit();
if (Lampa.Platform.is("webos")) window.close();
if (Lampa.Platform.is("android")) Lampa.Android.exit();
if (Lampa.Platform.is("orsay")) Lampa.Orsay.exit();
if (Lampa.Platform.is("nw")) nw.Window.get().close();
});
document.querySelector('.source-btn').addEventListener('keydown',
function(event) {
if (event.key === 'Enter') {
if (Lampa.Platform.is('apple_tv'))
window.location.assign('exit://exit');
if (Lampa.Platform.is("tizen"))
tizen.application.getCurrentApplication().exit();
if (Lampa.Platform.is("webos")) window.close();
if (Lampa.Platform.is("android")) Lampa.Android.exit();
if (Lampa.Platform.is("orsay")) Lampa.Orsay.exit();
if (Lampa.Platform.is("nw")) nw.Window.get().close();
}
});
}
if (window.appready) start();
else {
Lampa.Listener.follow('app', function(e) {
if (e.type == 'ready') {
sourceChange();
}
});
}

32
reload.js Normal file
View File

@ -0,0 +1,32 @@
function reloadApp() {
document.querySelector('.head__actions').insertAdjacentHTML(
'beforeend',
`<div class='head__action selector reload--btn'>
<svg fill="#ffffff" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" stroke="#ffffff" stroke-width="0.48">
<path d="M4,12a1,1,0,0,1-2,0A9.983,9.983,0,0,1,18.242,4.206V2.758a1,1,0,1,1,2,0v4a1,1,0,0,1-1,1h-4a1,1,0,0,1,0-2h1.743A7.986,7.986,0,0,0,4,12Zm17-1a1,1,0,0,0-1,1A7.986,7.986,0,0,1,7.015,18.242H8.757a1,1,0,1,0,0-2h-4a1,1,0,0,0-1,1v4a1,1,0,0,0,2,0V19.794A9.984,9.984,0,0,0,22,12,1,1,0,0,0,21,11Z" fill="currentColor"></path>
</svg>
</div>`
);
document.querySelector('.reload--btn').addEventListener('click', function() {
location.reload();
});
document.querySelector('.reload--btn').addEventListener('touchend', function() {
location.reload();
});
document.querySelector('.reload--btn').addEventListener('keydown',
function(event) {
if(event.key === 'Enter') {
location.reload();
}
});
}
if (window.appready) start();
else {
Lampa.Listener.follow('app', function(e) {
if (e.type == 'ready') {
reloadApp();
}
});
}

36
source.js Normal file
View File

@ -0,0 +1,36 @@
function sourceChanger() {
document.querySelector(".head__actions").insertAdjacentHTML(
"beforeend",
`<div class='head__action selector source--btn'>
<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"><path fill-rule="evenodd" clip-rule="evenodd" d="M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10zm7.865-11.491a1.014 1.014 0 0 0-.153.033c-.979.295-2.055.522-3.228.68-.12-2.881-.895-5.251-1.833-6.867 2.666.948 4.687 3.285 5.214 6.154zm.117 2.038c-.217 3.293-2.378 6.048-5.331 7.098.887-1.528 1.628-3.73 1.808-6.402a23.812 23.812 0 0 0 3.523-.696zm-5.49-1.126C14.367 7.166 12.904 4 12 4c-.904 0-2.367 3.166-2.492 7.42.794.053 1.624.08 2.492.08.868 0 1.698-.026 2.492-.08zm-6.95 1.821a23.822 23.822 0 0 1-3.524-.695c.217 3.293 2.378 6.048 5.331 7.098-.887-1.528-1.628-3.73-1.808-6.403zm-.026-2.02c.12-2.881.895-5.251 1.833-6.867-2.666.948-4.687 3.285-5.214 6.154.051.007.102.018.153.033a21.04 21.04 0 0 0 3.228.68zm6.932 2.206A39.83 39.83 0 0 1 12 13.5c-.847 0-1.663-.024-2.449-.072C9.828 17.247 11.157 20 12 20c.843 0 2.172-2.752 2.448-6.572z" fill="currentColor"></path></g></svg>
</div>`
);
const sourceList = ["tmdb", "cub", "MIX", "MIX KIDS", "MIX RUS"];
document.querySelector(".source--btn").addEventListener("click", function () {
const sourceStorage = Lampa.Storage.get("source");
const index = sourceList.indexOf(sourceStorage);
if (index !== -1) {
let nextIndex = index + 1;
if (nextIndex >= sourceList.length) {
nextIndex = 0;
}
Lampa.Storage.set("source", sourceList[nextIndex]);
console.log(`Источник изменен на: ${sourceList[nextIndex]}`);
} else {
// Если текущий источник отсутствует в массиве, ставим первый
Lampa.Storage.set("source", sourceList[0]);
console.log(`Источник сброшен на: ${sourceList[0]}`);
}
});
}
if (window.appready) start();
else {
Lampa.Listener.follow('app', function(e) {
if (e.type == 'ready') {
sourceChanger();
}
});
}

23
vote-color.js Normal file
View File

@ -0,0 +1,23 @@
function updateVoteColors() {
document.querySelectorAll(".card__vote").forEach(voteElement => {
const vote = parseFloat(voteElement.textContent.trim());
if (vote >= 0 && vote <= 3) {
voteElement.style.color = "red";
} else if (vote >= 3 && vote <= 5.9) {
voteElement.style.color = "orange";
} else if (vote >= 6 && vote <= 7.9) {
voteElement.style.color = "cornflowerblue";
} else if (vote >= 8 && vote <= 10) {
voteElement.style.color = "lawngreen";
}
});
}
document.addEventListener("DOMContentLoaded", function () {
setTimeout(updateVoteColors, 500);
});
// Следим за изменениями в контейнере с карточками
const observer = new MutationObserver(updateVoteColors);
observer.observe(document.body, { childList: true, subtree: true });