|
|
- <style>
- @import 'https://638183.freep.cn/638183/web/tz/tz.v4.css';
-
- .pa {
- --offsetX: 0px;
- --bg: url('https://ff.xiaoqiaodali.top:5401/i/2026/06/21/6a36d4571ca23.gif') no-repeat center/cover;
- --ma-size: 12%;
- width: 450px;
- height: 800px;
- position: relative;
- overflow: hidden;
- }
- .pa *, .pa *::before, .pa *::after {
- content: none !important;
- }
-
- #custom-lrc-container {
- position: absolute;
- top: 50px; /* 定位显示的位置 */
- right: 30px;
- width: 2em; /* 宽高与横排时反过来 */
- height: 80%;
- writing-mode: vertical-rl; /* 设为竖排 */
- z-index: 9999;
- pointer-events: none;
- }
-
- .lrc-line {
- position: absolute;
- left: 50%;
- transform: translateX(-50%);
- white-space: nowrap;
- color: #fefefe;
- color:darkgreen;
- font-size: 20px;
- font-family: "隶书", "LiSu", serif;
- font-weight: normal;
- text-shadow: 0 0 12px rgba(0,0,0,0.8);
- opacity: 0;
- transition: opacity 0.5s ease, transform 0.5s ease;
- margin: 0;
- top: 0;
- }
-
- .lrc-line.active {
- opacity: 1;
- transform: translateX(-50%) scale(1.15);
- z-index: 10;
- }
-
- @media (max-aspect-ratio: 9/16) {
- .pa {
- width: 100vw;
- height: calc(100vw * 16 / 9);
- }
- }
- @media (min-aspect-ratio: 9/16) {
- .pa {
- width: calc(100vh * 9 / 16);
- height: 100vh;
- }
- }
- </style>
- <div class="pa">
- <div id="custom-lrc-container"></div>
- </div>
- <script type="module">
- import TZ from 'https://638183.freep.cn/638183/web/tz/tz.v4.js';
- const tz = TZ.TZ('pa');
- tz.add('audio', '', '', { src: 'https://imgimg.qqdsw8.cn/view.php/915c88832e0049c6bd78acf0744ba633.mp3' });
- tz.add('video', '', 'pd-vid', {src: 'https://imgimg.qqdsw8.cn/view.php/2ec28ce2bc8f195e7a531771c6e8ff41.mp4'}).style('opacity: 0.5;');
- //
- tz.add('img', '', 'ma', {
- src: 'https://pic1.imgdb.cn/item/6a36c2802830ce602a508060.gif'
- })
- .style('right: 10px; bottom: 400px;')
- .playmp3();
-
- //
- tz.bgprog().style('bottom: 50%; color: #fefefe; width: 80%; ')
- tz.fs().style('left: 40px; top: 40px;');
- const lrcString = `
- [00:04.45]曾醉
- [00:06.33]作词:五子
- [00:07.91]作曲:Winky诗
- [00:10.10]演唱:HITA
- [00:25.50]山深问桃花染过几度春
- [00:29.65]哪一枝勾住过客衣上风尘
- [00:36.34]有倦意三分
- [00:38.38]要行路千程
- [00:41.12]怎记这山水静默待离人
- [00:49.95]轻舟邀斜月听岸上孤筝
- [00:54.14]回旋处恰趁醉踏青石前门
- [01:00.79]有余音两声
- [01:02.98]共与你微醺
- [01:04.90]融入这一夜长灯落满身
- [01:13.09]曾画下山间桃花流水逐云
- [01:18.43]跌破了一晌贪梦了无痕
- [01:23.92]倚泉浣笔重逢或偶遇洗不净
- [01:29.40]点墨片心留在归梦时分
- [01:58.22]斟满浮生在酒中浮与沉
- [02:02.17]哪一口填满岁月旧日余温
- [02:08.79]有醉意三分
- [02:10.90]都酿做前尘
- [02:13.70]梦醒后又在何处扮离人
- [02:22.39]红梅邀斜月听墙里孤筝
- [02:26.85]回旋处不是你惯唱的游吟
- [02:33.54]似乡音两声
- [02:35.68]唱今雪纷纷
- [02:37.64]错看成那年桃花落满身
- [02:45.83]曾见你山间走马落日长云
- [02:51.25]踏破了一声珍重无处闻
- [02:56.70]敛花做酒
- [02:58.57]相送或独酌都太冷清
- [03:02.25]待到如今那池春水已平
- [03:08.13]用醉眼看不清擦肩人
- [03:13.70]酒醒后分不清假与真
- [03:19.13]行遍天涯旧约难记存
- [03:23.85]分岔太多归路不可寻
- [03:29.41]曾画下山间桃花流水逐云
- [03:34.88]跌破了一晌贪梦何处寻
- [03:40.28]倚泉浣笔
- [03:42.30]重逢或偶遇洗不净
- [03:45.82]点墨片心留在归梦时分
- [03:51.23]曾见你山间走马落日长云
- [03:56.60]踏破了一声珍重了无痕
- [04:02.05]敛花做酒
- [04:03.82]相送或独酌都太冷清
- [04:07.66]待到如今那池春水已平`;
- function initCustomLrc(lrcText) {
- const container = document.getElementById('custom-lrc-container');
- const lines = [];
-
- const lineRegex = /\[(\d{2}):(\d{2})\.(\d{2,3})\](.*)/;
- const rawLines = lrcText.split('\n');
-
- rawLines.forEach(text => {
- const match = text.match(lineRegex);
- if (match) {
- const minutes = parseInt(match[1]);
- const seconds = parseInt(match[2]);
- const milliseconds = parseInt(match[3]);
- const time = minutes * 60 + seconds + milliseconds / 1000;
- let content = match[4].trim();
-
-
- content = content.replace(/&#\d+;/g, '').trim();
-
- if (content) {
- lines.push({ time, content, element: null });
- }
- }
- });
- lines.forEach((line) => {
- const div = document.createElement('div');
- div.className = 'lrc-line';
- div.textContent = line.content;
- container.appendChild(div);
- line.element = div;
- });
- const audio = document.querySelector('.pa audio');
-
- if (audio) {
- audio.addEventListener('timeupdate', () => {
- const currentTime = audio.currentTime;
- let activeIndex = -1;
- for (let i = 0; i < lines.length; i++) {
- if (currentTime >= lines[i].time) {
- activeIndex = i;
- } else {
- break;
- }
- }
- lines.forEach((line, idx) => {
- if (idx === activeIndex) {
- line.element.classList.add('active');
- } else {
- line.element.classList.remove('active');
- }
- });
- });
-
- audio.addEventListener('ended', () => {
- lines.forEach(line => line.element.classList.remove('active'));
- });
- }
- }
- setTimeout(() => {
- const audioEl = document.querySelector('.pa audio');
- if(audioEl) {
- initCustomLrc(lrcString);
- } else {
- const observer = new MutationObserver(() => {
- const aud = document.querySelector('.pa audio');
- if(aud) {
- initCustomLrc(lrcString);
- observer.disconnect();
- }
- });
- observer.observe(document.querySelector('.pa'), { childList: true, subtree: true });
- }
- }, 500);
- let prog = document.querySelector('.prog');
- prog.style.transform = 'rotate(-90deg)';
- prog.style.cssText += 'left:300px;top:250px;color:brown;';
- </script>
复制代码 |
|