Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am nippey on github.
  • I am nippey (https://keybase.io/nippey) on keybase.
  • I have a public key ASBwbDZ3RAHm1RENXj-7M0hVePO7_mhO0j3GH6UwaTwrkAo

To claim this, I am signing this object:

@Nippey
Nippey / bobfm_gettingSongInfos.js
Created October 28, 2015 10:52
This gist showcases a way of how to get artist and title information from bop.fm to be used by browser extensions
var lastObservation = "";
var observer = new MutationObserver(function(mutations) {
mutations.forEach(function(mutation) {
var classes = mutation.target.className;
var observation = "";
if ( classes.indexOf("song-playing") > -1 )
{
var artist = $(".song-info .artist")[0];
artist = (artist && artist.textContent) ? artist.textContent.trim() : "";
Object.defineProperty(SVGElement.prototype, 'innerSVG', {
get: function() {
var $node, $temp;
$temp = document.createElement('div');
$node = this.cloneNode(true);
$temp.appendChild($node);
return $temp.innerHTML;
},
set: function(markup) {
var $element, $temp, _i, _len, _ref, _results;