Skip to content

Commit

Permalink
[Fix, New, Сustomizing (34599)] - Pull request
Browse files Browse the repository at this point in the history
[Fix, New, Сustomizing (34599)] - Pull request - #126
  • Loading branch information
AN0NCER authored Oct 14, 2024
2 parents f890d1b + e779805 commit e7c485b
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 7 deletions.
2 changes: 1 addition & 1 deletion javascript/modules/AnimeCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export const ACard = {
*/
GenV2: function ({ type = 'a', anime, data, exclude = [] } = {}) {
if (type == 'a') {
return `<a href="/watch.html?id=${anime.id}" class="card-anime" data-id="${anime.id}" ${Data()}>${Gen()}</a>`;
return `<a href="/watch.html?id=${anime.id}&iss=true" class="card-anime" data-id="${anime.id}" ${Data()}>${Gen()}</a>`;
} else {
return `<div class="card-anime" data-id="${anime.id}" ${Data()}>${Gen()}</div>`;
}
Expand Down
42 changes: 42 additions & 0 deletions javascript/pages/anime/34599.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { History } from "../watch/mod_history.js";
import { Screenshots } from "../watch/mod_resource.js";

let load_image = "https://image.tmdb.org/t/p/original/uzp513qTcHsAavlCJ58x5d73bzy.jpg";

if (/Android|webOS|iPhone|iPad|iPod|Opera Mini/i.test(navigator.userAgent)) {
load_image = "https://image.tmdb.org/t/p/original/tBt5LUvnt1aUL64EXUbZebkENqC.jpg";
}

const url = "https://image.tmdb.org/t/p/original/uzp513qTcHsAavlCJ58x5d73bzy.jpg";
const bg = "https://image.tmdb.org/t/p/original/qIJZpiKZfGYC9GpfX2jBSTOW1Dl.jpg";

$(`.page-loading`).css("--image", `url(${load_image})`);

const callback = (screenshots) => {
try {
screenshots.Add({ type: 'prepend', url, id: screenshots.list.length, shikiurl: false });
screenshots.list.push({ original: url });
const have = History().custom.have
if (!have) {
History().custom.init(screenshots.list.length - 1);
} else {
History().custom.click(screenshots.list.length - 1);
}
} catch {
console.log('Error complete script');
}

};

export default {
OnLoad: () => {
const screenshots = Screenshots.Init();
screenshots.on("init", callback);
if (screenshots.init) {
callback(screenshots);
}

$('img.main').attr('src', bg);
$('img.bg').attr('src', bg);
}
}
6 changes: 4 additions & 2 deletions javascript/pages/watch.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@ export const $ID = new URLSearchParams(window.location.search).get("id");
export let $CONTINUE = new URLSearchParams(window.location.search).get("continue");
//Наведение на плеер
export const $SHOWPLAYER = new URLSearchParams(window.location.search).get("player");
//Существование аниме
const $ISSET = new URLSearchParams(window.location.search).get("iss") ? true : false;

export const Player = IPlayer.Init({ standart: $PARAMETERS.player.standart });

ClearParams(['continue', 'player']);
ClearParams(['continue', 'player', 'iss']);

export let $RULES = undefined;

Expand All @@ -37,7 +39,7 @@ Main(async (e) => {
} catch { }
}
//Проверка на существование такого ID
const check = await CheckID($ID);
const check = await CheckID($ID, $ISSET);

if (!check) {
//Аниме с такий ID не существует, перекидываем на страницу 404
Expand Down
7 changes: 6 additions & 1 deletion javascript/pages/watch/mod_resource.js
Original file line number Diff line number Diff line change
Expand Up @@ -564,12 +564,17 @@ export async function LoadAnime(e = () => { }, isLogged = false) {
/**
* Проверка на существование ID в бд Shikimori
* @param {string} id
* @param {boolean} isset - уде проверено что аниме существует
* @returns {boolean}
*/
export function CheckID(id) {
export function CheckID(id, isset = false) {
if (Cache.Get({ id, type: 'isset' })) {
return true;
}
if (isset = true) {
Cache.Set({ id: id, type: 'isset', value: true });
return true;
}
return new Promise((resolve) => {
GraphQl.animes({ ids: `"${id}"`, limit: 1 }, async (response) => {
if (response.failed) {
Expand Down
5 changes: 4 additions & 1 deletion javascript/pages/watch/mod_wscore.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,12 @@ const WindowScore = {
});

//Отслеживаем сохранение заметки
$('.content-score > .content-wraper > .btn-commit').click(function () {
$('.content-score > .content-wraper > .btn-commit').click(() => {
let info = document.querySelector('#info-anime').checked;
let val = $('textarea.noten').val();
if (!val && val.length >= 0) {
this.hide();
_windowScore.hide();
return;
}

Expand All @@ -95,6 +97,7 @@ const WindowScore = {
WindowScore.auto_grow(document.querySelector('textarea.noten'))
//Устанавливает заметкку
UserRate().Controls.Note(val);
this.hide();
_windowScore.hide();
});

Expand Down
4 changes: 2 additions & 2 deletions sw.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const version = '2.5.4';
const hash = '2c9f8';
const version = '2.5.5';
const hash = '69c3d';
const cacheName = `pwa-tunime-${hash}-v${version}`;
const appShellFilesToCache = [
// Директория: /images/genres
Expand Down

0 comments on commit e7c485b

Please sign in to comment.