-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathSaavn.bsstrategy
37 lines (36 loc) · 1.14 KB
/
Saavn.bsstrategy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
//
// 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 () {
return document.querySelector('#play').classList.contains('hide')
},
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 () {
var reg = /(.*)(\()(.*)(\).*)/;
return {
'track': document.querySelector('#player-track-name a').textContent,
'album': document.querySelector('#player-album-name a').textContent,
'image': document.querySelector('#now-playing .key-art').getAttribute('style').replace(reg, "$3").replace(/\"/g, "")
}
}
}