-
Notifications
You must be signed in to change notification settings - Fork 6
/
Blitzr.bsstrategy
33 lines (33 loc) · 1.22 KB
/
Blitzr.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
//
// Blitzr.plist
// BeardedSpice
//
// Created by Pascal Fouque on 23/07/2015.
// Copyright (c) 2015 GPL v3 http://www.gnu.org/licenses/gpl.html
//
BSStrategy = {
version:1,
displayName:"Blitzr",
accepts: {
method: "predicateOnTab",
format:"%K LIKE[c] '*blitzr.com*'",
args: ["URL"]
},
isPlaying: function () { return document.querySelector('#blitzr_playpause span.fa').className.indexOf('fa-play') == -1 },
toggle: function () {document.querySelector('#blitzr_playpause').click()},
next: function () {document.querySelector('#blitzr_next').click()},
previous: function () {document.querySelector('#blitzr_prev').click()},
pause: function () {
if (document.querySelector('#blitzr_playpause span.fa').className.indexOf('fa-play') == -1) {
document.querySelector('#blitzr_playpause').click()
}
},
trackInfo: function () {
return {
'track': document.querySelector('#playerTitle strong').innerText,
'album': document.querySelector('#playerInfo .media-left a').title,
'artist': document.querySelectorAll('#playerArtists')[0].querySelector('a').innerText,
'image': document.querySelector('#playerInfo .media-left a img').style['background-image'].slice(4, -1),
}
}
}