Greasy Fork is available in English.
qq音乐,酷我,酷狗,虾米,咪咕在线可实现倍速音乐播放,那些喜欢加速播放音乐的可有福利了,音乐加速播放带感。 可惜的是网易,千千音乐,喜马拉雅都是利用flash生成应用播放的,能力有限做不到啊~~~
当前为
// ==UserScript==
// @name qq音乐,酷我,酷狗,虾米,咪咕在线音乐平台倍速播放
// @namespace http://tampermonkey.net/
// @version 0.1
// @description qq音乐,酷我,酷狗,虾米,咪咕在线可实现倍速音乐播放,那些喜欢加速播放音乐的可有福利了,音乐加速播放带感。 可惜的是网易,千千音乐,喜马拉雅都是利用flash生成应用播放的,能力有限做不到啊~~~
// @author YQS
// @match *://y.qq.com/portal/player*
// @match *://www.kuwo.cn/play_detail/*
// @match *://www.kugou.com/song/*
// @match *://*.xiami.com/*
// @match *://music.migu.cn/v3/music/player*
// @grant none
// ==/UserScript==
(function() {
'use strict';
var host = window.location.host;
var audio = "";
var speed = 1.0;
var add_speed = 0.1;
var timer = null;
var getObj = function(flag,id){
if(flag == 1){
return document.getElementById(id);
}else if(flag == 2){
return document.getElementsByTagName(id)[0];
}
}
if(host.search("qq.com") != -1){
timer = setInterval(function(){
audio = getObj(1,"h5audio_media");
if(audio){
clearInterval(timer);
}
},1000);
}else if(host.search("kuwo.cn") != -1){
audio = getObj(2,"audio");
}else if(host.search("kugou.com") != -1){
audio = getObj(1,"myAudio");
}else if(host.search("xiami.com") != -1){
audio = getObj(2,"audio");
}else if(host.search("migu.cn") != -1){
audio = getObj(1,"migu_audio");
}
var body = document.getElementsByTagName("body")[0];
var style_div = "position:fixed; right:0; bottom:50px; width:40px; height:100px;border-top-left-radius:3px; border-bottom-left-radius:3px; background:rgba(0,0,0,.3); z-index:100000";
var style_add = "width:100%;height:40px; box-sizing: border-box; text-align:center; line-height:40px; color:white; font-size:30px; font-weight:bold;cursor: pointer;";
var style_plus = "border-bottom:1px solid #ccc";
var style_show = "width:100%;height:20px; box-sizing: border-box; text-align:center; line-height:20px; color:white; font-size:16px; font-weight:bold;";
var create_div = document.createElement("div");
var create_plus = document.createElement("div");
var create_show = document.createElement("div");
var create_sign = document.createElement("div");
create_div.style.cssText = style_div;
create_plus.innerText = "+";
create_plus.style.cssText = style_add + style_plus;
create_sign.innerText ="-";
create_sign.style.cssText = style_add;
create_show.style.cssText = style_show + style_plus;
create_show.innerText = parseFloat(speed).toFixed(1);
create_div.appendChild(create_plus);
create_div.appendChild(create_show);
create_div.appendChild(create_sign);
body.appendChild(create_div);
create_plus.addEventListener("click",function(){
var rate = audio.playbackRate;
audio.playbackRate = parseFloat(rate + add_speed).toFixed(1);
speed = audio.playbackRate;
console.log(speed);
create_show.innerText = speed;
});
create_sign.addEventListener("click",function(){
if(speed <= add_speed){
alert("不能再减了");
return;
}
var rate = audio.playbackRate;
audio.playbackRate = parseFloat(rate - add_speed).toFixed(1);
speed = audio.playbackRate;
console.log(speed);
create_show.innerText = speed;
});
setInterval(function(){
audio.playbackRate = speed;
},500);
})();