This repository has been archived by the owner on Apr 28, 2022. It is now read-only.
forked from web-scrobbler/web-scrobbler
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f088002
commit 54699b4
Showing
7 changed files
with
85 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
var _gaq = _gaq || []; | ||
_gaq.push(['_setAccount', 'UA-16968457-1']); | ||
_gaq.push(['_trackPageview']); | ||
|
||
(function() { | ||
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; | ||
ga.src = 'https://ssl.google-analytics.com/ga.js'; | ||
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga); | ||
})(); |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
$(function(){ | ||
/* | ||
var o = '<pre>'; | ||
for (var x in chrome.extension.getBackgroundPage().song) { | ||
o += x + ' : ' + chrome.extension.getBackgroundPage().song[x] + '\n'; | ||
} | ||
o += '</pre>'; | ||
$(o).appendTo('body'); | ||
*/ | ||
|
||
if (chrome.extension.getBackgroundPage().song.artist != '') | ||
$('#artist').val(chrome.extension.getBackgroundPage().song.artist); | ||
|
||
if (chrome.extension.getBackgroundPage().song.track != '') | ||
$('#track').val(chrome.extension.getBackgroundPage().song.track); | ||
|
||
|
||
$('#submit').click(function(){ | ||
$(this).attr('disabled', true); | ||
$(this).siblings().remove(); | ||
|
||
var artist = $('#artist').val(); | ||
var track = $('#track').val(); | ||
var res = chrome.extension.getBackgroundPage().validate( artist, track ); | ||
|
||
if (res == false) { | ||
$(this).attr('disabled', false); | ||
$(this).siblings().remove(); | ||
$(this).parent().append('<span class="note">Not valid</span>'); | ||
} | ||
else { | ||
// did the content script recognize at least the duration? | ||
if (!chrome.extension.getBackgroundPage().song.duration) | ||
chrome.extension.getBackgroundPage().song.duration = res.duration; | ||
|
||
// fill other data | ||
chrome.extension.getBackgroundPage().song.artist = res.artist; | ||
chrome.extension.getBackgroundPage().song.track = res.track; | ||
//chrome.extension.getBackgroundPage().song.album = res.album; | ||
|
||
// make the connection to last.fm service to notify | ||
chrome.extension.getBackgroundPage().nowPlaying(); | ||
|
||
// The minimum time is 240 seconds or half the track's total length | ||
// minus the time that already past | ||
var past = parseInt(new Date().getTime() / 1000.0) - chrome.extension.getBackgroundPage().song.startTime; | ||
var min_time = Math.min(240, chrome.extension.getBackgroundPage().song.duration / 2) - past; | ||
|
||
// Set up the timer to scrobble | ||
chrome.extension.getBackgroundPage().scrobbleTimeout = chrome.extension.getBackgroundPage().setTimeout(chrome.extension.getBackgroundPage().submit, min_time * 1000); | ||
|
||
$('#form').fadeOut(0); | ||
$('#valid').fadeIn(0); | ||
} | ||
|
||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters