diff --git a/static/ede.user.js b/static/ede.user.js
index 858e3d6..67c50fa 100644
--- a/static/ede.user.js
+++ b/static/ede.user.js
@@ -3,7 +3,7 @@
// @description Jellyfin弹幕插件
// @namespace https://github.com/RyoLee
// @author RyoLee
-// @version 1.46
+// @version 1.49
// @copyright 2022, RyoLee (https://github.com/RyoLee)
// @license MIT; https://raw.githubusercontent.com/Izumiko/jellyfin-danmaku/jellyfin/LICENSE
// @icon https://github.githubassets.com/pinned-octocat.svg
@@ -25,10 +25,15 @@
}
// ------ configs start------
const isInTampermonkey = !(typeof GM_xmlhttpRequest === 'undefined');
+ const isLocalCors = (!isInTampermonkey && document.currentScript?.src) ? new URL(document.currentScript?.src).searchParams.has("noCors") : false;
const corsProxy = 'https://ddplay-api.930524.xyz/cors/';
- const apiPrefix = isInTampermonkey ? 'https://api.dandanplay.net' : corsProxy + 'https://api.dandanplay.net';
+ const apiPrefix = isInTampermonkey
+ ? 'https://api.dandanplay.net'
+ : isLocalCors
+ ? `${window.location.origin}/ddplay-api`
+ : corsProxy + 'https://api.dandanplay.net';
// const apiPrefix = 'https://api.930524.xyz';
- const authPrefix = corsProxy + 'https://api.dandanplay.net'; // 在Worker上计算Hash
+ const authPrefix = isLocalCors ? apiPrefix : corsProxy + 'https://api.dandanplay.net'; // 在Worker上计算Hash
let ddplayStatus = JSON.parse(localStorage.getItem('ddplayStatus')) || { isLogin: false, token: '', tokenExpire: 0 };
const check_interval = 200;
// 0:当前状态关闭 1:当前状态打开
@@ -152,10 +157,18 @@
弹幕速度:
+
字体大小:
+
高度比例:
@@ -274,6 +287,12 @@
window.ede.curEpOffset = epOffset;
showDebugInfo(`设置弹幕偏移时间:${window.ede.curEpOffset}`);
}
+ window.ede.fontFamily = document.getElementById("danmakuFontFamily").value || "sans-serif";
+ window.localStorage.setItem('danmakuFontFamily', window.ede.fontFamily);
+ showDebugInfo(`字体:${window.ede.fontFamily}`);
+ window.ede.fontOptions = document.getElementById("danmakuFontOptions").value;
+ window.localStorage.setItem('danmakuFontOptions', window.ede.fontOptions);
+ showDebugInfo(`字体选項:${window.ede.fontOptions}`);
reloadDanmaku('reload');
closeModal();
} catch (e) {
@@ -475,6 +494,12 @@
// 当前剧集弹幕偏移时间
this.curEpOffset = 0;
this.curEpOffsetModified = false;
+ // 字體
+ const fontFamily = window.localStorage.getItem('danmakuFontFamily');
+ this.fontFamily = fontFamily ?? "sans-serif";
+ // 字体选項
+ const fontOptions = window.localStorage.getItem('danmakuFontOptions');
+ this.fontOptions = fontOptions ?? "";
this.danmaku = null;
this.episode_info = null;
@@ -714,7 +739,7 @@
mode: modemap,
time: time,
style: {
- font: `${window.ede.fontSize}px sans-serif`,
+ font: `${window.ede.fontOptions} ${window.ede.fontSize}px ${window.ede.fontFamily}`,
fillStyle: `#${colorStr}`,
strokeStyle: colorStr === '000000' ? '#fff' : '#000',
lineWidth: 2.0,
@@ -1139,6 +1164,8 @@
showDebugInfo(`弹幕来源过滤:${window.ede.danmakuFilter}`);
showDebugInfo(`弹幕模式过滤:${window.ede.danmakuModeFilter}`);
showDebugInfo(`弹幕字号:${window.ede.fontSize}`);
+ showDebugInfo(`弹幕字体:${window.ede.fontFamily}`);
+ showDebugInfo(`弹幕字体选項:${window.ede.fontOptions}`);
showDebugInfo(`屏幕分辨率:${window.screen.width}x${window.screen.height}`);
if (window.ede.curEpOffset !== 0) showDebugInfo(`当前弹幕偏移:${window.ede.curEpOffset} 秒`);
@@ -1369,7 +1396,7 @@
}
function danmakuParser(all_cmts) {
- const { fontSize, danmakuFilter, danmakuModeFilter, curEpOffset } = window.ede;
+ const { fontSize, fontOptions, fontFamily, danmakuFilter, danmakuModeFilter, curEpOffset } = window.ede;
const disableBilibili = (danmakuFilter & 1) === 1;
const disableGamer = (danmakuFilter & 2) === 2;
@@ -1417,7 +1444,7 @@
mode,
time: time + curEpOffset,
style: {
- font: `${fontSize}px sans-serif`,
+ font: `${fontOptions} ${fontSize}px ${fontFamily}`,
fillStyle: `#${color}`,
strokeStyle: color === '000000' ? '#fff' : '#000',
lineWidth: 2.0,
@@ -1494,4 +1521,4 @@
})();
}
});
-})();
+})();
\ No newline at end of file