-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpostSlugGenerator.js
More file actions
33 lines (27 loc) · 1.51 KB
/
Copy pathpostSlugGenerator.js
File metadata and controls
33 lines (27 loc) · 1.51 KB
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
/**
* Video title generator
*
* var matches: table of matches
* teama: text for team a
* teamb: text for team b
*/
const matches = document.querySelectorAll('.matches')[1].querySelector('tbody').querySelectorAll('tr')
const teama = document.querySelector('.container.left').children[0].textContent.strip()
const teamb = document.querySelector('.container.right').children[0].textContent.strip()
let date = ""
matches.forEach(m => {
if (Array.from(m.querySelectorAll('td.team.team-a'))[0].querySelector('a').title === teama && Array.from(m.querySelectorAll('td.team.team-b'))[0].querySelector('a').title === teamb) {
date = Array.from(m.querySelectorAll('td.full-date'))[0].innerText
}
})
console.log(teama + ' vs ' + teamb + ' ' + date)
// broswer API only
// copy(teama + ' vs ' + teamb + ' ' + date)
/*
matches = document.querySelectorAll('.matches')[1].querySelector('tbody').querySelectorAll('tr');
teama = document.querySelector('.container.left').children[0].textContent.strip();
teamb = document.querySelector('.container.right').children[0].textContent.strip();
date = "";
matches.forEach(m => { if (Array.from(m.querySelectorAll('td.team.team-a'))[0].querySelector('a').title === teama && Array.from(m.querySelectorAll('td.team.team-b'))[0].querySelector('a').title === teamb) { date = Array.from(m.querySelectorAll('td.full-date'))[0].innerText } });
navigator.clipboard.writeText(teama + ' vs ' + teamb + ' ' + date).then(function() { console.log('success') }, function() { console.log('failed') });
*/