Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

解决搜索番剧信息时的CORS问题,兼容4.8+ #55

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions ede.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@

(async function () {
'use strict';
if (document.querySelector('meta[name="application-name"]').content == 'Emby') {
const appVersion = document.querySelector('html').getAttribute('data-appversion').substring(0, 3);
const isVersionOld = appVersion < 4.8;
const applicationName = document.querySelector('meta[name="application-name"]').content;
if (applicationName == 'Emby' || applicationName.includes('Media Server')) {
// ------ configs start------
const check_interval = 200;
const chConverTtitle = ['当前状态: 未启用', '当前状态: 转换为简体', '当前状态: 转换为繁体'];
Expand All @@ -30,7 +33,10 @@
is: 'paper-icon-button-light',
};
const uiAnchorStr = '\uE034';
const mediaContainerQueryStr = "div[data-type='video-osd']";
let mediaContainerQueryStr = ".htmlVideoPlayerContainer";
if (isVersionOld) {
mediaContainerQueryStr = "div[data-type='video-osd']";
}
const mediaQueryStr = 'video';
const displayButtonOpts = {
title: '弹幕开关',
Expand Down Expand Up @@ -304,7 +310,7 @@
animeName = prompt('确认动画名:', animeName);
}

let searchUrl = 'https://api.dandanplay.net/api/v2/search/episodes?anime=' + animeName + '&withRelated=true';
let searchUrl = 'https://api.9-ch.com/cors/https://api.dandanplay.net/api/v2/search/episodes?anime=' + animeName + '&withRelated=true';
if (is_auto) {
searchUrl += '&episode=' + episode;
}
Expand Down Expand Up @@ -393,6 +399,9 @@

let _container = document.querySelector(mediaContainerQueryStr);
let _media = document.querySelector(mediaQueryStr);
if (!isVersionOld) {
_media.style.position = 'absolute';
}
window.ede.danmaku = new Danmaku({
container: _container,
media: _media,
Expand Down