Skip to content

Instantly share code, notes, and snippets.

@mohakshah
Created February 27, 2017 12:25
Show Gist options
  • Save mohakshah/be79b904c9572a1fd7c972aca4030111 to your computer and use it in GitHub Desktop.
Save mohakshah/be79b904c9572a1fd7c972aca4030111 to your computer and use it in GitHub Desktop.
//
// Saavn.plist
// BeardedSpice
//
// Created by Yash Aggarwal on 1/6/15.
// Copyright (c) 2015 Tyler Rhodes / Jose Falcon. All rights reserved.
//
BSStrategy = {
version:2,
displayName:"Saavn",
accepts: {
method: "predicateOnTab",
format:"%K LIKE[c] '*saavn.com*'",
args: ["URL"]
},
isPlaying: function () {},
toggle: function () {
var e = document.getElementById('play');
var t = document.getElementById('pause');
if (t.className.indexOf('hide')===-1) { t.click(); }
else { e.click(); }
},
next: function () { document.getElementById('fwd').click();},
previous: function () { document.getElementById('rew').click();},
pause: function () { document.getElementById('pause').click();},
trackInfo: function () {
return {
'track': document.getElementById('player-track-name').firstChild.innerHTML,
'album': document.getElementById('player-album-name').firstChild.innerHTML,
'image': document.querySelector("#now-playing .key-art").getAttribute("style").replace(/(.*)(\")(.*)(\")(.*)/, "$3")
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment