-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfilmography.js
36 lines (32 loc) · 996 Bytes
/
filmography.js
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
var filmographyActorRows = $("div.filmo-row[id*='actor']")
filmographyActorRows.each(function(index) {
var yearElement = $(this).children("span");
var year = yearElement.text();
var filmElement = $(this).children("b").children("a");
var title = filmElement.text();
var url = filmElement.attr('href');
imdbIdRegex = /\/title\/(tt.*)\//;
var matches = url.match(imdbIdRegex);
var imdbId = matches[1];
message = {
action: "getImdbMetadata",
imdbId: imdbId,
title: title
}
browser.runtime.sendMessage(message)
.then(function(response) {
response.title = title;
console.log(response);
})
.catch((err) => {
console.log('sendMessage error (getImdbMetadata)');
console.error(err);
});
});
function addFlag(data, element) {
var countryCode = "CA";
var flagUrl = "https://cdnjs.cloudflare.com/ajax/libs/flag-icon-css/2.7.0/flags/4x3/" + countryCode + ".svg"
}
function addRating(rating, element) {
element.text(rating + '\xa0' + year);
}