加林森 发表于 2021-12-1 14:40

锻炼身体、保卫自己!

本帖最后由 加林森 于 2022-2-16 18:57 编辑 <br /><br />出去锻炼了~~~~~~~~~~~~~~~~~~~

<style type="text/css">
.mnBox {
      margin: 0 auto;
      padding: 35px;
      width: 800px;
      border: none;
      border-top: 6px solid #000;/* 顶部边框样式*/
      border-radius: 10px;
      background: #b3c3c3;
}
.ctBox {
      margin: 0;
      padding: 10px;
      background: #fff;
      min-height: 300px;
      border-radius: 10px;
      box-shadow: 1px 3px 2px 2px rgba(4,4,4,.6);
}

.ctBox p,img, h2,button { text-align:center; }

.picBtn {
      width: 32px;
      height: 32px;
      outline: none;
      border: none;
      border-radius: 8px;
      background: transparent url('https://pic.imgdb.cn/item/61e446952ab3f51d917b0f77.png') no-repeat;
      cursor: pointer;
      box-shadow: 1px 1px 2px 1px rgba(0,0,0,.25);
}

.picBtn:hover {
      opacity: 0.95;
      box-shadow: 1px 1px 2px 2px rgba(0,0,0,.3);
}

.picBtn:active {
      opacity: 0.8;
      box-shadow: 1px 1px 1px 0px rgba(0,0,0,.5);
}

</style>

<div class="mnBox">
      <div class="ctBox">

            <p><img style="padding-top: 30px; alt="" src="https://pic.imgdb.cn/item/620cb66d2ab3f51d91156205.jpg" /></p>

         
<style>

#bigPa { position: relative; left:-100px; width: -0px; height:0px; background:#333 url('https://pic.imgdb.cn/item/620c62922ab3f') no-repeat center/cover; box-shadow: 0 0 0 2px #111;}
#gcDiv { width: 500px; float: right; column-count:2; color: #eee; font-size: 1em; text-shadow: 1px 1px 1px #111; }
#paDiv { position: relative; left: 10px; top: 10px; width: 220px; display: flex; align-items: center; border: 1px solid olive; border-radius: 8px 0px 8px 0px; background: rgba(0,0,0,.8); box-shadow: 1px 1px 2px #000; }
@keyframes rol { to { transform:rotate(360deg); } }

</style>

<div id="bigPa">
        <div id="paDiv">
                <div id="btn-ro">·</div>
                <div id="jindu">
                        <div id="jd-go"></div>
                </div>
        </div>
      </div>
</div>
<style type="text/css">
#waiDiv { margin:10px; padding:8px; width:400px; background:#696969; border-radius:10px; box-shadow:2px 2px 4px #000; display:flex; flex-direction:column; position:relative; }
#audDiv { width:100%; display:flex; flex-direction:row; align-items:center; font-size:10px; position: relative; }
#add1 { margin-left: 12px; background:#eee; text-align:center; width:20px; height:20px; line-height:20px; border-radius:50%; cursor:pointer; }
#add1:hover { color: red; }
#mLiDiv { margin-top: 10px; background:#eee; color:#000; min-height:100px; padding:10px; border:1px solid olive; font-size:14px; column-count: 2;}
#mLiDiv a { text-decoration: none; cursor:pointer; }
#mLiDiv a:hover { color:red; }
#prompt { position:absolute; left:200px; top:50px; width:400px; padding:6px 12px; background:silver; font-size:12px; display:none; box-shadow:1px 1px 1px #666; border-radius:2px; }
#prompt input { outline:none; }
#prompt input { margin:4px;padding:4px; width:392px; }
#prompt input { border-radius:4px; cursor:pointer;border:1px solid gray; border-radius:3px; box-shadow: 1px 1px 2px #444; }
#audDiv input, #audDiv input { cursor:pointer; }
#paDiv { margin: auto; width: 220px; display: flex; align-items: center; border: 1px solid olive; border-radius: 8px 0px 8px 0px; background: rgba(0,0,0,.8); box-shadow: 1px 1px 2px #000; position: relative; }
#jindu { position: relative; width: 200px; height: 8px; line-height: 8px; font-size: 10px; color: #eee; text-align: center; background: linear-gradient(90deg, olive, green) no-repeat; background-size: 8px 0px; cursor: pointer; }
#btn-ro { width: 20px; height: 20px; line-height: 20px; font-size: 12px; background: linear-gradient(blue, silver, red); outline:none; color: white; border-radius: 50%; text-align: center; cursor: pointer; animation: rol linear 2s infinite; }
#btn-ro:hover { opacity: 0.8; }
#btn-ro:active { opacity: 1; }
@keyframes rol { to { transform:rotate(360deg); } }
</style>

<div id="waiDiv">
      <div id="audDiv">
                <div id="paDiv">
                        <div id="btn-ro">·</div>
                        <div id="jindu"><div id="jd-go"></div></div>
                </div>
                <input id="muted" type="checkbox" onclick="aud.muted = this.checked ? true : false">静音
                <input id="dqxh" type="radio" name="rad" checked="checked" onclick="howplay()" />单曲
                <input id="lhbf" type="radio" name="rad" onclick="howplay()" />轮播
                <div id="add1">+</div>
      </div>
      <div id="mLiDiv"></div>
      <div id="prompt">
      <div>添歌</div>
                <input type="text" id="mName" placeholder="歌曲名称" /><br />
                <input type="text" id="mUrl" placeholder="歌曲地址" /><br />
                <div style="text-align:center;">
                        <input id="subMe" type="button" value=" 添加 " />
                        <input id="cancelMe" type="button" value=" 算了 " />
                </div>
      </div>
</div>

<script>
//音乐数据 注意最后一个结尾不要逗号但前面每一个的结尾都要有逗号
var muAr = [
      ["http://www.kumeiwp.com/sub/filestores/2021/01/31/7341dcedf43c11dd16d22800f7097204.mp3","梅花泪"],
      ["http://www.kumeiwp.com/sub/filestores/2021/01/31/9d1f8a6e5f8171b2a1b7bd3effc36b0e.mp3","雪中情"],
      ["http://www.kumeiwp.com/sub/filestores/2021/01/31/221e902c0841fade7d57ae35b70ad94a.mp3","枉凝眉"]
];

var btn = document.getElementById('btn-ro');
var jindu = document.getElementById('jindu');
var aud = document.getElementById('myPlayer');
var mLi = document.getElementById('mLiDiv');
var mAdd = document.getElementById('add1');
var prom = document.getElementById('prompt');
var cancelMe = document.getElementById('cancelMe');
var subMe = document.getElementById('subMe');
var dqxh = document.getElementById('dqxh');
var lhbf = document.getElementById('lhbf');
var aud = document.createElement('audio');
aud.loop = true;
var playIdx = 0; //当前播放索引
if(aud.paused) btn.style.animationPlayState="paused";
//写歌单
var str = "";
for(j=0; j<muAr.length; j++) {
      str += (j+1) + ".<a id='list" + j + "' onclick='iPlay(" + j + ")' >" + muAr + "</a><br />";
}
mLi.innerHTML += str;

function iPlay(idx){ //播放函数
      playIdx = idx;
      aud.src = muAr;
      aud.play();
      aud.addEventListener('timeupdate', tmMsg, true);
      aud.addEventListener('ended', function() { btn.style.animationPlayState="paused"; }, true);
      btn.style.animationPlayState="running";
      nameRed(playIdx);
}

function howplay(){ //单曲&轮播处理
      dqxh.checked ? aud.loop = true : (aud.loop = false,playNext(),aud.addEventListener('ended',playNext,false));
      prom.style.display = "none";
}

function playNext(){ //处理下一首
      if(aud.paused) iPlay(playIdx);
      playIdx += 1;
      if(playIdx >= muAr.length) playIdx = 0;
}

function nameRed(){ //歌单着色
      for(k=0;k<muAr.length;k++){
                let listId = "list" + k;
                document.getElementById(listId).style.removeProperty("color");
      }
      listId = "list" + playIdx;
      document.getElementById(listId).style.color = "red";
}

function tmMsg(){ //进度条
      let auT = Math.floor(aud.duration - aud.currentTime);
      let auM = auT / 60;
      let auMs = parseInt(auM);
      if (auMs <10) auMs = "0" + auMs;
      let auS = auT % 60;
      let auSs = Math.round(auS);
      if (auSs < 10) auSs = "0" + auSs;
      let jd = (100*aud.currentTime)/aud.duration;
      if(jd>0) {
                jindu.innerHTML = "- " + auMs +":" + auSs;
                jindu.style.backgroundSize = jd+ "% 8px";
      }
}

jindu.onclick = function(){ //进度控制
      let w = offset(jindu,"left");
      let x = (event.clientX - w) * aud.duration / jindu.clientWidth;
      aud.currentTime = x;
}

function offset(obj,direction){//获取元素总偏移量
      let offsetDir = "offset" + direction.toUpperCase()+direction.substring(1);
      let realNum = obj;
      let positionParent = obj.offsetParent;
      while(positionParent != null){
                realNum += positionParent;
                positionParent = positionParent.offsetParent;
      }
      return realNum;
}

btn.onclick = function(){ //光盘按钮点击事件
      aud.paused ? (aud.play(), btn.style.animationPlayState="running") : (aud.pause(), btn.style.animationPlayState="paused");
}

mAdd.onclick = function(){ prom.style.display = "block"; } //呼出加歌界面
cancelMe.onclick = function(){ prom.style.display = "none"; } //放弃加歌

subMe.onclick = function(){ //加歌并播放新歌
      let uri = document.getElementById('mUrl');
      let name = document.getElementById('mName');
      let tnum = muAr.length;
      let str1 = uri.value.trim();
      let str2 = name.value.trim();
      if(str1 !="" && str2 != ""){
                muAr = ;
                mLi.innerHTML += (tnum+1) + ".<a id='list" + tnum + "' onclick='iPlay(" + tnum + ")' >" + str2 + "</a><br />";
                iPlay(tnum);
                uri.value = "";
                name.value = "";
      }
      prom.style.display = "none";
}
//自动播放(默认播放第一首)
iPlay(playIdx);
</script>

红影 发表于 2021-12-1 14:53

哈哈,这是因为木被抽掉太多的原因么{:4_170:}

加林森 发表于 2021-12-1 16:49

红影 发表于 2021-12-1 14:53
哈哈,这是因为木被抽掉太多的原因么

对的对的,赶紧锻炼回来嘛。{:4_189:}

红影 发表于 2021-12-1 18:14

加林森 发表于 2021-12-1 16:49
对的对的,赶紧锻炼回来嘛。

要加紧啊,马上又有烤蟹活动了{:4_189:}

加林森 发表于 2021-12-1 18:19

红影 发表于 2021-12-1 18:14
要加紧啊,马上又有烤蟹活动了

先把老黑关起来再说。

红影 发表于 2021-12-1 18:37

加林森 发表于 2021-12-1 18:19
先把老黑关起来再说。

队长多锻炼锻炼就不怕了{:4_170:}

马黑黑 发表于 2021-12-1 18:45

加林森 发表于 2021-12-1 18:19
先把老黑关起来再说。

关我何用?将军之令,要死心塌地执行

加林森 发表于 2021-12-1 19:13

马黑黑 发表于 2021-12-1 18:45
关我何用?将军之令,要死心塌地执行

将军没有通知我,我不知道。

加林森 发表于 2021-12-1 19:14

红影 发表于 2021-12-1 18:37
队长多锻炼锻炼就不怕了

必须的,我看谁还敢乱七八糟的发将军令!

红影 发表于 2021-12-1 20:15

加林森 发表于 2021-12-1 19:14
必须的,我看谁还敢乱七八糟的发将军令!

哈哈,队长怒了{:4_170:}

加林森 发表于 2021-12-1 20:17

红影 发表于 2021-12-1 20:15
哈哈,队长怒了

哈哈,谁再敢乱发将军命令的,杀无赦!

大猫咪 发表于 2021-12-1 20:52

队长必须锻炼,准备打黑{:4_170:}

加林森 发表于 2021-12-1 21:11

大猫咪 发表于 2021-12-1 20:52
队长必须锻炼,准备打黑

哈哈哈哈,猫猫真乖!

大猫咪 发表于 2021-12-1 21:12

加林森 发表于 2021-12-1 21:11
哈哈哈哈,猫猫真乖!

和队长一起打黑 {:4_170:}

加林森 发表于 2021-12-1 21:15

大猫咪 发表于 2021-12-1 21:12
和队长一起打黑

就你那个小体量能打老黑吗?{:4_170:}

马黑黑 发表于 2021-12-2 08:09

加林森 发表于 2021-12-1 21:15
就你那个小体量能打老黑吗?

大猫咪有技巧。搏击不仅凭力气,技巧更重要

加林森 发表于 2021-12-2 10:25

马黑黑 发表于 2021-12-2 08:09
大猫咪有技巧。搏击不仅凭力气,技巧更重要

说得太有道理了。
页: [1]
查看完整版本: 锻炼身体、保卫自己!