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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
import {empty} from '#sugar';
export default {
contentDependencies: [
'generateListingPage',
'generateListRandomPageLinksAllAlbumsSection',
'generateListRandomPageLinksGroupSection',
],
extraDependencies: ['html', 'language', 'wikiData'],
sprawl: ({wikiInfo}) => ({wikiInfo}),
query: ({wikiInfo: {divideTrackListsByGroups: groups}}, spec) => ({
spec,
groups,
divideByGroups: !empty(groups),
}),
relations: (relation, query) => ({
page: relation('generateListingPage', query.spec),
allAlbumsSection:
(query.divideByGroups
? null
: relation('generateListRandomPageLinksAllAlbumsSection')),
groupSections:
(query.divideByGroups
? query.groups
.map(group => relation('generateListRandomPageLinksGroupSection', group))
: null),
}),
generate(relations, {html, language}) {
return relations.page.slots({
type: 'custom',
content: [
html.tag('p',
language.$('listingPage.other.randomPages.chooseLinkLine', {
fromPart:
(empty(relations.groupSections)
? language.$('listingPage.other.randomPages.chooseLinkLine.fromPart.notDividedByGroups')
: language.$('listingPage.other.randomPages.chooseLinkLine.fromPart.dividedByGroups')),
browserSupportPart:
language.$('listingPage.other.randomPages.chooseLinkLine.browserSupportPart'),
})),
html.tag('p',
{class: 'js-hide-once-data'},
language.$('listingPage.other.randomPages.dataLoadingLine')),
html.tag('p',
{class: 'js-show-once-data'},
language.$('listingPage.other.randomPages.dataLoadedLine')),
html.tag('dl', [
html.tag('dt',
language.$('listingPage.other.randomPages.misc')),
html.tag('dd',
html.tag('ul', [
html.tag('li',
language.$('listingPage.other.randomPages.misc.randomArtist', {
mainLink:
html.tag('a',
{href: '#', 'data-random': 'artist'},
language.$('listingPage.other.randomPages.misc.randomArtist.mainLink')),
atLeastTwoContributions:
html.tag('a',
{href: '#', 'data-random': 'artist-more-than-one-contrib'},
language.$('listingPage.other.randomPages.misc.randomArtist.atLeastTwoContributions')),
})),
html.tag('li',
html.tag('a',
{href: '#', 'data-random': 'album'},
language.$('listingPage.other.randomPages.misc.randomAlbumWholeSite'))),
html.tag('li',
html.tag('a',
{href: '#', 'data-random': 'track'},
language.$('listingPage.other.randomPages.misc.randomTrackWholeSite'))),
])),
relations.allAlbumsSection,
relations.groupSections,
]),
],
});
},
};
|