Skip to content

Instantly share code, notes, and snippets.

@takanakahiko
Last active November 27, 2015 18:18
Show Gist options
  • Save takanakahiko/789112149f53931098e6 to your computer and use it in GitHub Desktop.
Save takanakahiko/789112149f53931098e6 to your computer and use it in GitHub Desktop.
GooglePlayMusicでNowPlayingするブックマークレット
javascript:
var te=document.getElementById("player-song-title");
var t=te.innerHTML;
t=t.replace(/& /g,"&");
var ae=document.getElementById("player-artist");
var a=ae.innerHTML;
a=a.replace(/& /g,"&");
var ale=document.getElementsByClassName("player-album");
var al=ale[0].innerHTML;
al=al.replace(/& /g,"&");
var link=document.getElementsByClassName("player-album");
var link=link[0].dataset.id;
link=link.replace(/[\/].*/g,"");
var tweet=encodeURIComponent('Title : '+t+'\n')+
encodeURIComponent('Artist : '+a+'\n')+
encodeURIComponent('Album : '+al+'\n\n')+
encodeURIComponent('#GooglePlayMusic\n')+
encodeURIComponent('#NowPlaying\n')+
encodeURIComponent('https://play.google.com/music/m/'+link);
void(window.open('https://twitter.com/intent/tweet?text='+tweet));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment