首页 > 其他 > 详细

关于百度音乐盒

时间:2014-12-11 15:27:33      阅读:303      评论:0      收藏:0      [点我收藏+]

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

  直接看脚本吧

bubuko.com,布布扣
 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>

关于百度音乐盒

原文:http://www.cnblogs.com/surfing/p/4157438.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!