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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
|
// Ties lots and lots of functions together in a convenient package accessible
// to page write functions. This is kept in a separate file from other write
// areas to keep imports neat and isolated.
import chroma from 'chroma-js';
import * as html from '../util/html.js';
import {bindOpts} from '../util/sugar.js';
import {getColors} from '../util/colors.js';
import {bindFind} from '../util/find.js';
import {thumb} from '../util/urls.js';
export function bindUtilities({
absoluteTo,
cachebust,
defaultLanguage,
getSizeOfAdditionalFile,
getSizeOfImageFile,
language,
languages,
pagePath,
to,
urls,
wikiData,
}) {
// TODO: Is there some nicer way to define these,
// may8e without totally re-8inding everything for
// each page?
const bound = {};
Object.assign(bound, {
absoluteTo,
cachebust,
defaultLanguage,
getSizeOfAdditionalFile,
getSizeOfImageFile,
html,
language,
languages,
pagePath,
thumb,
to,
urls,
wikiData,
wikiInfo: wikiData.wikiInfo,
});
bound.getColors = bindOpts(getColors, {chroma});
bound.find = bindFind(wikiData, {mode: 'warn'});
/*
bound.generateNavigationLinks = bindOpts(generateNavigationLinks, {
link: bound.link,
language,
});
bound.generateStickyHeadingContainer = bindOpts(generateStickyHeadingContainer, {
[bindOpts.bindIndex]: 0,
html,
img: bound.img,
});
bound.generateChronologyLinks = bindOpts(generateChronologyLinks, {
html,
language,
link: bound.link,
wikiData,
generateNavigationLinks: bound.generateNavigationLinks,
});
bound.generateInfoGalleryLinks = bindOpts(generateInfoGalleryLinks, {
[bindOpts.bindIndex]: 2,
link: bound.link,
language,
});
bound.getGridHTML = bindOpts(getGridHTML, {
[bindOpts.bindIndex]: 0,
img: bound.img,
html,
language,
getRevealStringFromArtTags: bound.getRevealStringFromArtTags,
});
bound.getAlbumGridHTML = bindOpts(getAlbumGridHTML, {
[bindOpts.bindIndex]: 0,
link: bound.link,
language,
getAlbumCover: bound.getAlbumCover,
getGridHTML: bound.getGridHTML,
});
bound.getFlashGridHTML = bindOpts(getFlashGridHTML, {
[bindOpts.bindIndex]: 0,
link: bound.link,
getFlashCover: bound.getFlashCover,
getGridHTML: bound.getGridHTML,
});
bound.getCarouselHTML = bindOpts(getCarouselHTML, {
[bindOpts.bindIndex]: 0,
img: bound.img,
html,
});
*/
return bound;
}
|