平凡 发表于 2023-10-2 12:50

毛不易精选


<style>
#papa { margin: 0 0 0 calc(50% - 513px); display: grid; place-items: center; width: 1024px; height: 640px; background: gray url('http://www.yinhuabbs.cn/data/attachment/forum/202011/26/204330gj9jj2r9mkjkrczr.jpg') no-repeat center/cover; background-blend-mode: normal, color; box-shadow: 3px 3px 20px #000; overflow: hidden; user-select: none; position: relative; perspective: 3000px; z-index: 1; }
#papa::before, #papa::after { position: absolute; content: ''; pointer-events: none; }
#papa::after { content: '毛不易精选'; font: bold 1.3em / 1.3em sans-serif; color: orange; text-shadow: 2px 2px 4px black; bottom: 10px; left: 0; transform: rotate(01deg); }
</style>

<div id="papa"></div>

<script >
(function() {
        (function(mkPlayer) {let defaults = {player_css: 'bottom: 0; left: 50%; transform: translateX(-50%);',mlist_css: 'top: 0; left: 0;',fs_btn: 'left: 0; top: 0;',playerCode: `<style>#mplayer {position: absolute;display: grid;grid-template-areas: 'cur btnplay dur''prog prog prog';gap: 8px 2px;place-items: end center;color: var(--color);font: normal 16px sans-serif;padding-bottom: 20px;z-index: 999;--ww: 260px;--color: hsla(0,0%,100%,.75);--track: hsla(90,100%,95%,.65);--prog: linear-gradient(90deg,hsla(90,30%,50%,.55),hsla(280,40%,50%,.75),hsla(30,100%,50%,.65));}#cur { grid-area: cur; color: var(--color); }#dur { grid-area: dur; color: var(--color); }#btnplay {--state: paused;grid-area: btnplay;background: conic-gradient(red,orange,yellow,green,teal,blue,purple);mask: radial-gradient(transparent 3px,red 0);-webkit-mask: radial-gradient(transparent 3px,red 0);border-radius: 50%;width: 35px;height: 35px;cursor: pointer;animation: rot linear 3s infinite;animation-play-state: var(--state);}#prog {--xx: 0px;grid-area: prog;width: var(--ww);height: 4px;background: var(--track);position: relative;display: grid;place-items: center;border-radius: 4px;}#prog::before, #prog::after { position: absolute; content: ''; }#prog::before {left: 0;width: var(--xx);height: 100%;border-radius: 6px;background: var(--prog);border-radius: 4px;}#prog::after {left: calc(var(--xx) - 12px);opacity: .85;width: 16px;height: 16px;background: radial-gradient(transparent 2px, teal 0, black);border-radius: 50%;cursor: pointer;}#mlist { --color1: lightgreen; --color2: pink;position: absolute; padding: 20px; }#mlist > a { color: var(--color1); cursor: pointer; text-shadow: 1px 1px 2px black; text-decoration: none; }#mlist >a:hover { color: var(--color2); }.sColor { color: var(--color2); }#btnMsg {position: absolute;color: snow;background: black;opacity: 0;border: 2px solid snow;border-radius: 8px;padding: 4px;transition: all .75s;cursor: pointer;z-index: 1000;}@keyframes rot { to { transform: rotate(1turn); } }</style><div id="mlist"></div><div id="mplayer"><span id="btnplay"></span><span id="prog"></span><span id="cur">00:00</span><span id="dur">00:00</span></div><span id="btnMsg">全屏观赏</span>`,};let playCode = (user_config) => {let data = Object.assign({}, defaults, user_config);papa.innerHTML += data.playerCode;mplayer.style.cssText += data.player_css;mlist.style.cssText += data.mlist_css;btnMsg.style.cssText += data.fs_btn;let mDrag = false, timerId, fs = false;let aud = document.createElement('audio');papa.appendChild(aud);(function addList() {let str = '';data.m_ar.forEach( (item,key) => {str += `<a onclick="javascript:mplay(${key})">${key+1} ${data.m_ar}</a><br>`;});mlist.innerHTML = str;})();btnplay.onclick = () => aud.paused ? aud.play() : aud.pause();btnMsg.onclick = () => fs ? document.exitFullscreen() : papa.requestFullscreen();papa.onmousemove = (e) => {clearTimeout(timerId);btnMsg.style.opacity = '.95';timerId = setTimeout('btnMsg.style.opacity = "0"', 3000);};aud.addEventListener('timeupdate', () => {cur.innerText = toMin(aud.currentTime);dur.innerText = toMin(aud.duration);if(mDrag===false) prog.style.setProperty('--xx', aud.currentTime * prog.offsetWidth / aud.duration + 'px');});aud.addEventListener('pause', () => mState());aud.addEventListener('play', () => mState());aud.addEventListener('ended', () => mplay());aud.onerror = () => mplay();prog.onmousedown = () => mDrag = true;document.onmouseup = () => mDrag = false;mplayer.onmouseup = (e) => { if(mDrag) aud.currentTime = aud.duration * e.offsetX / prog.offsetWidth; };mplayer.onmousemove = (e) => { if(mDrag) moveBar(e.offsetX); };let mState = () => aud.paused ? btnplay.style.setProperty('--state', 'paused'): btnplay.style.setProperty('--state', 'running');mplay = (idx=-1) => {if (idx < 0) idx = Math.floor(Math.random() * data.m_ar.length);aud.src = data.m_ar;aud.play();setRed(idx);};document.addEventListener("fullscreenchange", () => {if (document.fullscreenElement !== null) {fs = true;btnMsg.innerText = '退出全屏';} else {fs = false;btnMsg.innerText = '全屏观赏';}});let setRed= (idx) => {let str = mlist.innerHTML;str = str.replace(/<\/?span[^\>]*\>/g,'');str = str.replace(`${idx+1} ${m_ar}`, `${idx+1} <span class="sColor">${m_ar}</span>`);mlist.innerHTML = str;};let moveBar = (x) => {if(x < 0) x = 0;if(x > prog.offsetWidth - 5) x = prog.offsetWidth - 5;prog.style.setProperty('--xx', x + 'px');};let toMin = (val) => {if (!val) return '00:00';val = Math.floor(val);let min = parseInt(val / 60), sec = parseFloat(val % 60);if (min < 10) min = '0' + min;if (sec < 10) sec = '0' + sec;return min + ':' + sec;};mplay();};mkPlayer.HCPlayer = playCode;})(this);
        let m_ar = [
                ['https://music.163.com/song/media/outer/url?id=569200213.mp3','消愁'],
                ['https://music.163.com/song/media/outer/url?id=1953125353','看得最远的地方 '],
                ['https://music.163.com/song/media/outer/url?id=569200210','给你给我 '],
                ['https://music.163.com/song/media/outer/url?id=569214247','平凡的一天'],
                ['https://music.163.com/song/media/outer/url?id=569200212','一荤一素'],
                ['https://music.163.com/song/media/outer/url?id=2068042776','我要你 (Live版)'],
                ['https://music.163.com/song/media/outer/url?id=1940770243','遥远的她 (Live) '],
                ['https://music.163.com/song/media/outer/url?id=1845994577','海上日记 '],
        ];

        HCPlayer({
                m_ar: m_ar,
                mlist_css: '--color1: lightgreen; --color2: orange; top: 0; right: 0;',
                fs_btn: 'left: 20px; top: 20px; background: #222;',
        });
})();
</script>

张红 发表于 2023-10-2 14:55

问好榕哥节日快乐!

巫荣云师 发表于 2023-10-2 20:46

欣赏收藏榕哥的[毛不易精选] 非常好听,点赞!

平凡 发表于 2023-10-2 22:22

张红 发表于 2023-10-2 14:55
问好榕哥节日快乐!

张红妹子,节日快乐

平凡 发表于 2023-10-2 22:23

巫荣云师 发表于 2023-10-2 20:46
欣赏收藏榕哥的[毛不易精选] 非常好听,点赞!

问好巫荣云师,节日快乐

蓝魔 发表于 2023-10-3 08:54

欣赏一下,谢谢。

平凡 发表于 2023-10-3 17:06

蓝魔 发表于 2023-10-3 08:54
欣赏一下,谢谢。

祝节日快乐

容轩听雨 发表于 2023-10-3 21:49

欣赏一组好歌,赞!问好老师,国庆愉快!

平凡 发表于 2023-10-4 00:45

容轩听雨 发表于 2023-10-3 21:49
欣赏一组好歌,赞!问好老师,国庆愉快!

问好,节日快乐
页: [1]
查看完整版本: 毛不易精选