-
Notifications
You must be signed in to change notification settings - Fork 0
/
inject.js
45 lines (37 loc) · 1.02 KB
/
inject.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
37
38
39
40
41
42
43
function text(sel) {
let e = document.querySelector(sel)
if (!e) {
console.log("could not find element " + sel)
return ""
}
return e.textContent.trim()
}
let months = {
"Jan": "01",
"Feb": "02",
"Mar": "03",
"Apr": "04",
"May": "05",
"Jun": "06",
"Jul": "07",
"Aug": "08",
"Sep": "09",
"Oct": "10",
"Nov": "11",
"Dec": "12",
"": "blah"
}
let day = text(".date-box .part-left")
let month = months[text(".date-box .part-right :nth-child(1)")]
let year = text(".date-box .part-right :nth-child(2)")
let venue = text(".tour-entry .content a :nth-child(1)")
let city = text(".tour-entry .content a :nth-child(2)")
let list = ["%a | %T | %n | %t", ""]
let tracks = document.querySelectorAll(".track-title")
tracks.forEach(function(e, num) {
let title = e.innerText.trim()
list.push(`King Crimson | ${year}.${month}.${day} ${venue} - ${city} | ${num+1} | ${title}`)
})
let pre = document.createElement("pre")
pre.textContent = list.join("\n")
document.querySelector(".buy-links").prepend(pre)