Skip to content

Instantly share code, notes, and snippets.

@1024kibits
Last active October 27, 2024 15:45
Show Gist options
  • Save 1024kibits/b1beb7aab328ebe6a0a0ec7f254ffc5c to your computer and use it in GitHub Desktop.
Save 1024kibits/b1beb7aab328ebe6a0a0ec7f254ffc5c to your computer and use it in GitHub Desktop.
radiko に再生速度変更ボタンと指定秒ジャンプボタンを追加する bookmarklet
javascript:((i,a,p,c,m,s,l,e,j,r,u)=>{
if($('#'+i)[0])return;
$('.live-detail__failed').append(
`<div id=${i}>
Jump:
<button>-10m</button><button> -2m</button><button>-20s</button><button> -5s</button>
<button> +5s</button><button>+20s</button><button> +2m</button><button>+10m</button>
Rate:
<input type=number step=0.05 min=0.25 max=4.0 value=1.00 style=width:4em>
<button>-0.1</button><button>+0.1</button><button>=1.0</button>
</div>`
);
j=(d)=>{
let b=$('#seekbar'),k=b.find('.knob'),w=b.width();
k.css('left', c(k.position().left+w*d/player.duration(),0,w))
.draggable('option', 'stop')()
};
e=$(`#${i} :first`);
e .click(()=>{j(-600)});
(e=e.next()).click(()=>{j(-120)});
(e=e.next()).click(()=>{j( -20)});
(e=e.next()).click(()=>{j( -5)});
(e=e.next()).click(()=>{j( +5)});
(e=e.next()).click(()=>{j( +20)});
(e=e.next()).click(()=>{j(+120)});
(e=e.next()).click(()=>{j(+600)});
u=(d=0,v)=>{
a().playbackRate=
a().defaultPlaybackRate=
+(r.value=c((v?v:+r.value)+d,0.25,4.0).toFixed(2));
};
r=((e=e.next()).change(()=>u())).get(0);
(e=e.next()).click(()=>u(-0.1));
(e=e.next()).click(()=>u(+0.1));
(e=e.next()).click(()=>u(0,1));
setInterval(u,1000);
l=p.loadHlsjs;
p.loadHlsjs=function(u){return l.call(this,u.replace(...(u.match(m)?[m,s]:[s,m])))};
})('additional-controlls',()=>player._player._audio,player._player.constructor.prototype,c=(v,l,h)=>Math.min(Math.max(v,l),h),'tf-f-rpaa-radiko.smartstream.ne.jp/tf','radiko.jp/v2/api/ts')
@1024kibits
Copy link
Author

1024kibits commented Jan 25, 2021

TODO

  • サーバー指定の置換が想定通り動いていないのを修正(ドメイン以降のパスも置換が必要)
  • ブックマーク作りやすいようにリンクを用意

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment