This commit is contained in:
parent
9fae3ae864
commit
95cdd45fd0
@ -3,7 +3,7 @@
|
|||||||
// @description Jellyfin弹幕插件
|
// @description Jellyfin弹幕插件
|
||||||
// @namespace https://github.com/RyoLee
|
// @namespace https://github.com/RyoLee
|
||||||
// @author RyoLee
|
// @author RyoLee
|
||||||
// @version 1.46
|
// @version 1.49
|
||||||
// @copyright 2022, RyoLee (https://github.com/RyoLee)
|
// @copyright 2022, RyoLee (https://github.com/RyoLee)
|
||||||
// @license MIT; https://raw.githubusercontent.com/Izumiko/jellyfin-danmaku/jellyfin/LICENSE
|
// @license MIT; https://raw.githubusercontent.com/Izumiko/jellyfin-danmaku/jellyfin/LICENSE
|
||||||
// @icon https://github.githubassets.com/pinned-octocat.svg
|
// @icon https://github.githubassets.com/pinned-octocat.svg
|
||||||
@ -25,10 +25,15 @@
|
|||||||
}
|
}
|
||||||
// ------ configs start------
|
// ------ configs start------
|
||||||
const isInTampermonkey = !(typeof GM_xmlhttpRequest === 'undefined');
|
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 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 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 };
|
let ddplayStatus = JSON.parse(localStorage.getItem('ddplayStatus')) || { isLogin: false, token: '', tokenExpire: 0 };
|
||||||
const check_interval = 200;
|
const check_interval = 200;
|
||||||
// 0:当前状态关闭 1:当前状态打开
|
// 0:当前状态关闭 1:当前状态打开
|
||||||
@ -152,10 +157,18 @@
|
|||||||
<span id="lbspeed" style="flex: auto;">弹幕速度:</span>
|
<span id="lbspeed" style="flex: auto;">弹幕速度:</span>
|
||||||
<input style="width: 50%;" type="range" id="speed" min="20" max="600" step="10" value="${window.ede.speed || 200}" />
|
<input style="width: 50%;" type="range" id="speed" min="20" max="600" step="10" value="${window.ede.speed || 200}" />
|
||||||
</div>
|
</div>
|
||||||
|
<div style="display: flex;">
|
||||||
|
<label style="flex: auto;">字体:</label>
|
||||||
|
<div><input style="flex-grow: 1;" id="danmakuFontFamily" placeholder="sans-serif" value="${window.ede.fontFamily ?? "sans-serif"}" /></div>
|
||||||
|
</div>
|
||||||
<div style="display: flex;">
|
<div style="display: flex;">
|
||||||
<span id="lbfontSize" style="flex: auto;">字体大小:</span>
|
<span id="lbfontSize" style="flex: auto;">字体大小:</span>
|
||||||
<input style="width: 50%;" type="range" id="fontSize" min="8" max="80" step="1" value="${window.ede.fontSize || 18}" />
|
<input style="width: 50%;" type="range" id="fontSize" min="8" max="80" step="1" value="${window.ede.fontSize || 18}" />
|
||||||
</div>
|
</div>
|
||||||
|
<div style="display: flex;">
|
||||||
|
<label style="flex: auto;">其他字体选項:</label>
|
||||||
|
<div><input style="flex-grow: 1;" id="danmakuFontOptions" placeholder="" value="${window.ede.fontOptions ?? ""}" /></div>
|
||||||
|
</div>
|
||||||
<div style="display: flex;">
|
<div style="display: flex;">
|
||||||
<span id="lbheightRatio" style="flex: auto;">高度比例:</span>
|
<span id="lbheightRatio" style="flex: auto;">高度比例:</span>
|
||||||
<input style="width: 50%;" type="range" id="heightRatio" min="0" max="1" step="0.05" value="${window.ede.heightRatio || 0.9}" />
|
<input style="width: 50%;" type="range" id="heightRatio" min="0" max="1" step="0.05" value="${window.ede.heightRatio || 0.9}" />
|
||||||
@ -274,6 +287,12 @@
|
|||||||
window.ede.curEpOffset = epOffset;
|
window.ede.curEpOffset = epOffset;
|
||||||
showDebugInfo(`设置弹幕偏移时间:${window.ede.curEpOffset}`);
|
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');
|
reloadDanmaku('reload');
|
||||||
closeModal();
|
closeModal();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@ -475,6 +494,12 @@
|
|||||||
// 当前剧集弹幕偏移时间
|
// 当前剧集弹幕偏移时间
|
||||||
this.curEpOffset = 0;
|
this.curEpOffset = 0;
|
||||||
this.curEpOffsetModified = false;
|
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.danmaku = null;
|
||||||
this.episode_info = null;
|
this.episode_info = null;
|
||||||
@ -714,7 +739,7 @@
|
|||||||
mode: modemap,
|
mode: modemap,
|
||||||
time: time,
|
time: time,
|
||||||
style: {
|
style: {
|
||||||
font: `${window.ede.fontSize}px sans-serif`,
|
font: `${window.ede.fontOptions} ${window.ede.fontSize}px ${window.ede.fontFamily}`,
|
||||||
fillStyle: `#${colorStr}`,
|
fillStyle: `#${colorStr}`,
|
||||||
strokeStyle: colorStr === '000000' ? '#fff' : '#000',
|
strokeStyle: colorStr === '000000' ? '#fff' : '#000',
|
||||||
lineWidth: 2.0,
|
lineWidth: 2.0,
|
||||||
@ -1139,6 +1164,8 @@
|
|||||||
showDebugInfo(`弹幕来源过滤:${window.ede.danmakuFilter}`);
|
showDebugInfo(`弹幕来源过滤:${window.ede.danmakuFilter}`);
|
||||||
showDebugInfo(`弹幕模式过滤:${window.ede.danmakuModeFilter}`);
|
showDebugInfo(`弹幕模式过滤:${window.ede.danmakuModeFilter}`);
|
||||||
showDebugInfo(`弹幕字号:${window.ede.fontSize}`);
|
showDebugInfo(`弹幕字号:${window.ede.fontSize}`);
|
||||||
|
showDebugInfo(`弹幕字体:${window.ede.fontFamily}`);
|
||||||
|
showDebugInfo(`弹幕字体选項:${window.ede.fontOptions}`);
|
||||||
showDebugInfo(`屏幕分辨率:${window.screen.width}x${window.screen.height}`);
|
showDebugInfo(`屏幕分辨率:${window.screen.width}x${window.screen.height}`);
|
||||||
if (window.ede.curEpOffset !== 0) showDebugInfo(`当前弹幕偏移:${window.ede.curEpOffset} 秒`);
|
if (window.ede.curEpOffset !== 0) showDebugInfo(`当前弹幕偏移:${window.ede.curEpOffset} 秒`);
|
||||||
|
|
||||||
@ -1369,7 +1396,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function danmakuParser(all_cmts) {
|
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 disableBilibili = (danmakuFilter & 1) === 1;
|
||||||
const disableGamer = (danmakuFilter & 2) === 2;
|
const disableGamer = (danmakuFilter & 2) === 2;
|
||||||
@ -1417,7 +1444,7 @@
|
|||||||
mode,
|
mode,
|
||||||
time: time + curEpOffset,
|
time: time + curEpOffset,
|
||||||
style: {
|
style: {
|
||||||
font: `${fontSize}px sans-serif`,
|
font: `${fontOptions} ${fontSize}px ${fontFamily}`,
|
||||||
fillStyle: `#${color}`,
|
fillStyle: `#${color}`,
|
||||||
strokeStyle: color === '000000' ? '#fff' : '#000',
|
strokeStyle: color === '000000' ? '#fff' : '#000',
|
||||||
lineWidth: 2.0,
|
lineWidth: 2.0,
|
||||||
@ -1494,4 +1521,4 @@
|
|||||||
})();
|
})();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
})();
|
})();
|
Loading…
x
Reference in New Issue
Block a user