Skip to content

Commit

Permalink
Update for Google Play, fixes adampash#9.
Browse files Browse the repository at this point in the history
Just change every instance of "music.google" to "play.google/music/".
  • Loading branch information
Glench committed Mar 9, 2012
1 parent 71cc574 commit 5e463b6
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 29 deletions.
6 changes: 3 additions & 3 deletions notification.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@
chrome.tabs.sendRequest(parseInt(localStorage["tabID"]), {'action' : 'set_popup', 'url' : "none", 'data' : 'arbs'},
function(response) {
if (chrome.extension.lastError) {
chrome.tabs.create({url: "http://music.google.com/"});
chrome.tabs.create({url: "http://play.google.com/music/"});
console.log('there was an error connecting to the tab');
window.close();
}
else {
$("#song_title").html(response.song_title);
$("#artist").html(response.artist);
if (response.album_art == 'http://default_album_med.png' || response.album_art == 'http://undefined') {
response.album_art = 'http://music.google.com/music/default_album_med.png';
response.album_art = 'http://play.google.com/music/default_album_med.png';
}
$("#album_art_img").attr('src', response.album_art);
if (response.status == 'Play') {
Expand All @@ -69,7 +69,7 @@
<div id="popup">
<div id="player">
<div id="album_art" class="big_art">
<img id="album_art_img" src="http://music.google.com/music/default_album_med.png" height="100" width="100" />
<img id="album_art_img" src="http://play.google.com/music/default_album_med.png" height="100" width="100" />
</div>
<div id="song_indicator" class="paused-indicator"></div>
<div id="song_info">
Expand Down
20 changes: 10 additions & 10 deletions popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

function open_g_music() {
localStorage['notification_visible'] = false;
chrome.tabs.create({url: "http://music.google.com/"});
chrome.tabs.create({url: "http://play.google.com/music/"});
window.close();
}

Expand All @@ -26,7 +26,7 @@
if (localStorage["tabID"] === undefined || localStorage["tabID"] == 'closed') {
console.log("Open a new tab: " + localStorage["tabID"]);
$('#artist').html('You need to <a href="#" onclick="open_g_music();">open a new Google Music tab</a>.');
// chrome.tabs.create({url: "http://music.google.com/"});
// chrome.tabs.create({url: "http://play.google.com/music/"});
// chrome.tabs.onRemoved.addListener(function(integer tabId, object removeInfo)
// window.close();
}
Expand All @@ -36,7 +36,7 @@
function(response) {
if (chrome.extension.lastError) {
$('#artist').html('You need to <a href="#" onclick="open_g_music();">open a new Google Music tab</a>.');
// chrome.tabs.create({url: "http://music.google.com/"});
// chrome.tabs.create({url: "http://play.google.com/music/"});
console.log('there was an error connecting to the tab');
// window.close();
}
Expand All @@ -46,7 +46,7 @@
$("#song_title").html(response.song_title);
$("#artist").html(response.artist);
if (response.album_art.split('default_album_med').length > 1 || response.album_art == 'http://undefined') {
response.album_art = 'http://music.google.com/music/default_album_med.png';
response.album_art = 'http://play.google.com/music/default_album_med.png';
}
// console.log('response.status: ' + response.status);
if (response.status == 'Play') {
Expand Down Expand Up @@ -144,7 +144,7 @@
function(response) {
$('#loadingOverlay').toggle();
if (chrome.extension.lastError) {
chrome.tabs.create({url: "http://music.google.com/"});
chrome.tabs.create({url: "http://play.google.com/music/"});
console.log('there was an error connecting to the tab');
window.close();
}
Expand All @@ -158,7 +158,7 @@
$('#navigate').scrollTop(0);
$.each(albums.albums, function(index, album) {
// console.log(album.album.title);
if (album.album.art.split('default_album_med').length > 1) album.album.art = 'music.google.com/music/default_album_med.png';
if (album.album.art.split('default_album_med').length > 1) album.album.art = 'play.google.com/music/default_album_med.png';
// console.log(album.album.id);
var row = '<div class="album_row" onclick="fetch_album(\'' + escape(album.album.id) + '\');"><img width="32" height="32" src="http://' + decodeURI(album.album.art) + '" /><b>' + decodeURIComponent(album.album.title) + '</b><br>' + decodeURI(album.album.artist) + '</div>';
$('#navigate').append(row);
Expand All @@ -175,7 +175,7 @@
if (artist.artist.title == '') {
return;
}
if (artist.artist.art.split('default_album_med').length > 1) artist.artist.art = 'music.google.com/music/default_album_med.png';
if (artist.artist.art.split('default_album_med').length > 1) artist.artist.art = 'play.google.com/music/default_album_med.png';
var row = '<div class="album_row" onclick="fetch_nav_item(\'artistSelected\', \'' + decodeURI(artist.artist.id) + '\', \'' + decodeURI(artist.artist.title) + '\', false);"><img width="32" height="32" src="http://' + decodeURI(artist.artist.art) + '" /><b>' + decodeURIComponent(artist.artist.title) + '</b><br></div>';
$('#navigate').append(row);
});
Expand Down Expand Up @@ -204,7 +204,7 @@
function(response) {
$('#loadingOverlay').toggle();
if (chrome.extension.lastError) {
chrome.tabs.create({url: "http://music.google.com/"});
chrome.tabs.create({url: "http://play.google.com/music/"});
console.log('there was an error connecting to the tab');
window.close();
}
Expand Down Expand Up @@ -573,7 +573,7 @@

<div id="player">
<div id="album_art" class="big_art">
<img id="album_art_img" src="http://music.google.com/music/default_album_med.png" height="128" width="128" />
<img id="album_art_img" src="http://play.google.com/music/default_album_med.png" height="128" width="128" />
</div>
<div id="song_indicator" class="paused-indicator"></div>
<div id="song_info">
Expand Down Expand Up @@ -655,7 +655,7 @@
// function(response) {
// $('#loadingOverlay').toggle();
// if (chrome.extension.lastError) {
// chrome.tabs.create({url: "http://music.google.com/"});
// chrome.tabs.create({url: "http://play.google.com/music/"});
// console.log('there was an error connecting to the tab');
// window.close();
// }
Expand Down
14 changes: 7 additions & 7 deletions scripts/lyrics.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
// @version 0.9.3
// @namespace http://www.radicalpi.net/
// @author Chris Hendry
// @include http*://music.google.com/music/listen*
// @match http://music.google.com/music/listen*
// @match https://music.google.com/music/listen*
// @include http*://play.google.com/music/listen*
// @match http://play.google.com/music/listen*
// @match https://play.google.com/music/listen*
// @icon http://radicalpi.net/upload/gMusic/gMusic.png
// @description Adds a lyrics panel that automatically fetches lyrics in Google Music.
// ==/UserScript==
Expand Down Expand Up @@ -64,7 +64,7 @@ function fetchNowPlaying() {

if(localLyrics == null || localLyrics.length < 1 || reload) {
reload = false;
document.getElementById('lyrics').innerHTML = "<div id='lyricsLoader' style='text-align:center;'><img src='http://music.google.com/music/Spinner_48.gif' style='vertical-align:middle;'></div>";
document.getElementById('lyrics').innerHTML = "<div id='lyricsLoader' style='text-align:center;'><img src='http://play.google.com/music/Spinner_48.gif' style='vertical-align:middle;'></div>";
document.getElementById('lyricsLoader').style.height = (window.innerHeight-237)+'px';
document.getElementById('lyricsLoader').style.lineHeight = (window.innerHeight-237)+'px';

Expand Down Expand Up @@ -197,11 +197,11 @@ document.getElementById('modalBG').style.visibility = "hidden";
}


if (localStorage['lyrics'] == 'true' && window.location.host == 'music.google.com') {
if (localStorage['lyrics'] == 'true' && window.location.host == 'play.google.com') {
console.log('fetch new lyrics');
$(document).ready(function(e) {
$('#coloredBar').after('<div id="coloredBar222"></div>');
document.getElementById('coloredBar222').innerHTML += "<div id='lyricsToolbar' style=\"z-index:2; position:absolute; top:169px; right:17px; width:278px; height:22px; padding:0px; background-image:url('http://music.google.com/music/bg_header.gif');\"></div>";
document.getElementById('coloredBar222').innerHTML += "<div id='lyricsToolbar' style=\"z-index:2; position:absolute; top:169px; right:17px; width:278px; height:22px; padding:0px; background-image:url('http://play.google.com/music/bg_header.gif');\"></div>";
document.getElementById('lyricsToolbar').innerHTML += "<img id='reloadLyrics' style='position:relative; top:2px; left:2px; width:18px; height:18px; visibility:hidden;' src='http://radicalpi.net/upload/gMusic/refresh.png'>";
document.getElementById('lyricsToolbar').innerHTML += "<img id='editLyrics' style='position:relative; top:2px; left:8px; width:18px; height:18px; visibility:hidden;' src='http://radicalpi.net/upload/gMusic/edit.png'>";
document.getElementById('lyricsToolbar').innerHTML += "<img id='editSettings' style='position:relative; top:2px; left:220px; width:18px; height:18px;' src='http://radicalpi.net/upload/gMusic/gear.png'>";
Expand Down Expand Up @@ -264,4 +264,4 @@ if (localStorage['lyrics'] == 'true' && window.location.host == 'music.google.co
})

});
}
}
6 changes: 3 additions & 3 deletions scripts/myscript.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ var consoleLog = function(msg){
//console.log(msg);
};

if (localStorage['download'] == 'true' && window.location.host == 'music.google.com') {
if (localStorage['download'] == 'true' && window.location.host == 'play.google.com') {
consoleLog('insert download button');
insert_download_button();
}
Expand All @@ -25,7 +25,7 @@ function restore_settings() {
function check_url() {
consoleLog('check url');
restore_settings();
if (window.location.host == 'music.google.com') {
if (window.location.host == 'play.google.com') {
consoleLog('setting tab id');
chrome.extension.sendRequest({'action' : 'set_tab_id'}, function(response) {
localStorage["tabID"] = response;
Expand Down Expand Up @@ -553,7 +553,7 @@ function download() {
var id = document.getElementById('song_indicator').parentNode.parentNode.parentNode.id;
if(id == "") id = document.getElementById('song_indicator').parentNode.parentNode.id;
id = id.split("_")[1];
var url = 'http://music.google.com/music/play?u=0&songid='+id+'&pt=e';
var url = 'http://play.google.com/music/play?u=0&songid='+id+'&pt=e';
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function(data) {
if (xhr.readyState == 4) {
Expand Down
12 changes: 6 additions & 6 deletions scripts/scrobble.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
// @name Google Music Player Enhancements
// @namespace http://www.danielslaughter.com/
// @author Daniel Slaughter
// @include http*://music.google.com/music/listen*
// @match http://music.google.com/music/listen*
// @match https://music.google.com/music/listen*
// @include http*://play.google.com/music/listen*
// @match http://play.google.com/music/listen*
// @match https://play.google.com/music/listen*
// @icon http://www.danielslaughter.com/projects/googlecloudplayer/icon_32x32.png
// @description Adds Last.fm scrobbling support as well as other optional features.

if (localStorage['scrobble'] == 'true' && window.location.host == 'music.google.com') {
if (localStorage['scrobble'] == 'true' && window.location.host == 'play.google.com') {
var o = {
interval: 250, // How often to check for page load. Default: 250 (1/4 second)
max: 15000, // How long to check for page load. Default: 15000 (15 seconds)
domain: location.protocol + '//' + location.hostname, // ie.: https://music.google.com
domain: location.protocol + '//' + location.hostname, // ie.: https://play.google.com
protocol: location.protocol + '//', // Used for secure connections. ie.: https://
version: '5/26/2011', // Script version number used to check for updates
path: location.pathname, // leave this alone; it's used to determine if you're on a valid player page or not
Expand Down Expand Up @@ -92,4 +92,4 @@ if (localStorage['scrobble'] == 'true' && window.location.host == 'music.google.
}
};
o.init();
}
}

0 comments on commit 5e463b6

Please sign in to comment.