-
Notifications
You must be signed in to change notification settings - Fork 6
/
LinkedInLearning.bsstrategy
57 lines (55 loc) · 1.62 KB
/
LinkedInLearning.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
44
45
46
47
48
49
50
51
52
53
54
55
56
//
// LinkedInLearning.plist
// BeardedSpice
//
// Created by Michele Vetturi on 05/07/20.
// Copyright (c) 2020 GPL v3 http://www.gnu.org/licenses/gpl.html
//
BSStrategy = {
version: 1,
displayName: "LinkedIn Learning",
accepts: {
method: "predicateOnTab",
format: "%K LIKE[c] '*linkedin.com/learning/*'",
args: ["URL"]
},
pause: function () {
let pause = $('BUTTON[type="button"][title="Pause"]').get(0);
$(pause).click();
},
isPlaying: function () {
return $('BUTTON[type="button"][title="Pause"]').length === 1
},
toggle: function () {
if ($('BUTTON[type="button"][title="Play"]:visible').length) {
let play = $('BUTTON[type="button"][title="Play"]').get(0);
$(play).click();
} else {
let pause = $('BUTTON[type="button"][title="Pause"]').get(0);
$(pause).click();
}
},
previous: function () {
let prev = $('BUTTON[type="button"][title="Previous"]').get(0);
$(prev).click();
},
next: function () {
let next = $('BUTTON[type="button"][title="Next"]').get(0);
$(next).click();
},
favorite: function () {
let like = $('BUTTON[type="button"][data-control-name="toggle_like"]').get(0);
$(like).click();
},
trackInfo: function () {
var course = document.querySelector('#ember1903 h1').textContent.trim();
var track = document.querySelector('#ember1903 h2').textContent.trim();
let like = $('BUTTON[type="button"][data-control-name="toggle_like"]').get(0);
return {
'album': course,
'track': track,
'favorited': like.getAttribute('aria-pressed')
};
}
}
// The file must have an empty line at the end.