Created
April 2, 2013 18:40
-
-
Save ianjennings/5294942 to your computer and use it in GitHub Desktop.
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
function extractUrl(input) { | |
// remove quotes and wrapping url() | |
if (typeof input !== "undefined") { | |
return input.replace(/"/g,"").replace(/url\(|\)$/ig, ""); | |
} else { | |
return; | |
} | |
} | |
setInterval(function(){ | |
var active = null; | |
$(document).ready(function() { | |
if($('.active-playing-green').length > 0) { | |
active = $('.active-playing-green'); | |
} else { | |
active = $($('.section-track')[0]); | |
} | |
}); | |
var thisArtist = $($('#player-nowplaying a')[3]).text(); | |
var thisSong = $($('#player-nowplaying a')[4]).text(); | |
rec.notify(thisArtist, thisSong, extractUrl(active.find('.readpost > span').css('background-image'))); | |
// transfer button states | |
if($('#playerPlay').hasClass('play')) { | |
rec.updateButton('play', 'play', null); | |
} | |
if($('#playerPlay').hasClass('pause')) { | |
rec.updateButton('play', 'pause', null); | |
} | |
if($('#playerFav').hasClass('fav-on')) { | |
rec.updateButton('heart', null, '#ff0000'); | |
} else { | |
rec.updateButton('heart', null, '#434345'); | |
} | |
}, 1000); | |
window.moteio_config = { | |
version: "0.1", | |
notify: { | |
x: 0, | |
y: 0 | |
}, | |
search: { | |
true: true, | |
action: function(value) { | |
$('#q').val(value); | |
$('#g').click(); | |
} | |
}, | |
selects: [ | |
{ | |
x: 0, | |
y: 0, | |
options: { | |
'all': { | |
optgroup: 'latest', | |
text: 'Latest', | |
action: function() { | |
window.location = "/latest"; | |
} | |
}, | |
'fresh': { | |
optgroup: 'latest', | |
text: 'Freshest', | |
action: function() { | |
window.location = "/latest/fresh"; | |
} | |
}, | |
'remix': { | |
optgroup: 'latest', | |
text: 'Remixes Only', | |
action: function() { | |
window.location = "/latest/remix"; | |
} | |
}, | |
'noremix': { | |
optgroup: 'latest', | |
text: 'No Remixes', | |
action: function() { | |
window.location = "/latest/noremix"; | |
} | |
}, | |
'blogs': { | |
optgroup: 'latest', | |
text: 'Blogs in USA', | |
action: function() { | |
window.location = "/latest/us"; | |
} | |
} | |
} | |
} | |
], | |
buttons: { | |
'backward': { | |
down: function () { | |
rec.simulateClick('playerPrev'); | |
}, | |
x: 20, | |
y: 75, | |
icon: 'backward' | |
}, | |
'play': { | |
down: function () { | |
rec.simulateClick('playerPlay'); | |
}, | |
x: 95, | |
y: 75, | |
icon: 'play' | |
}, | |
'heart': { | |
down: function () { | |
rec.simulateClick('playerFav'); | |
}, | |
x: 170, | |
y: 75, | |
icon: 'heart' | |
}, | |
'forward': { | |
down: function () { | |
rec.simulateClick('playerNext'); | |
}, | |
x: 245, | |
y: 75, | |
icon: 'forward' | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment