zoukankan      html  css  js  c++  java
  • 关于百度音乐盒

    最近喜欢用百度音乐盒听音乐,但是有一个让人蛋疼的问题:每当当前歌曲播放结束下一首播放之前偶尔会插播一段语音广告...

      直接看脚本吧

     1         function fRandomBy(under, over){
     2         switch(arguments.length){
     3             case 1: return parseInt(Math.random()*under+1);
     4             case 2: return parseInt(Math.random()*(over-under+1) + under);
     5             default: return 0;
     6             }
     7         } 
     8         $(function(){
     9         setInterval(function(){
    10             if($('.curTime').text().replace("00:00","")==$('.totalTime').text().substr(0,$('.totalTime').text().length-1)+"0"){
    11                 var curSong=fRandomBy(1,$('.playlist-length').text().replace(/D/g,''));
    12                 console.log(curSong);
    13                 $('div[reellist-row='+curSong+']').dblclick()
    14         }
    15         },1000)
    16     }) 
    View Code

    具体做法:在当前歌曲播放结束之前随机播放列表中的一首歌曲。

    function:取区间随机数

    setInterval函数之所以写在$(function(){})里面是因为播放下一首歌曲的时候页面ReLoad了。

    <OVER>

  • 相关阅读:
    mysql分组排序取组内第一的数据行
    C#版Nebula客户端编译
    关于nginx
    http状态码
    gitlab
    TCP/IP 3次握手和四次断开
    nps 内网穿透
    用CentOS7做一个简单的路由器
    linux 简单特效
    LVS粗讲
  • 原文地址:https://www.cnblogs.com/surfing/p/4157438.html
Copyright © 2011-2022 走看看