-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathDigitallyImported.bsstrategy
43 lines (43 loc) · 1.44 KB
/
DigitallyImported.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
38
39
40
41
42
43
//
// DigitallyImported.plist
// BeardedSpice
//
// Created by Dennis Lysenko on 4/4/15.
// Copyright (c) 2015 Tyler Rhodes / Jose Falcon. All rights reserved.
//
BSStrategy = {
version:2,
displayName:"Digitally Imported",
accepts: {
method: "predicateOnTab",
format:"%K LIKE[c] '*di.fm*'",
args: ["URL"]
},
isPlaying:function () {
var pause = $('#webplayer-region .controls .ico.icon-pause').length;
var spinner = $('#webplayer-region .controls .ico.icon-spinner3').length;
var sponsor = $('#webplayer-region .metadata-container .track-title .sponsor').length;
return pause ? true : (spinner && sponsor);
},
toggle: function () { return document.querySelectorAll('div.controls a')[0].click() },
favorite: function () { $('.vote-btn.up').click(); },
pause:function () {
var pause = document.querySelectorAll('div.controls a')[0];
if(pause.classList.contains('icon-pause')){
pause.click();
}
},
trackInfo: function () {
var artistName = $('.artist-name').text();
var trackName = $('.track-name').text().replace(artistName, "");
if (artistName.length > 3) {
artistName = artistName.substring(0, artistName.length - 3);
}
return {
'artist': artistName,
'track': trackName.replace(/\s+/, ''),
'favorited': ($('.icon-thumbs-up-filled').get(0) ? true : false),
'image': $('#webplayer-region .track-region .artwork img').attr('src')
}
}
}