/
exhibit.js
246 lines (240 loc) · 14.8 KB
/
exhibit.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
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
var exhibitPersonPedigreeTemplate = {
'tag': "div",
'class': "exhibit-pedigree",
'children': [
{ 'tag': "div", 'class': "exhibit-pedigree-header", 'style': {'top': '0', 'left': '3px'}, 'children': ["Spouse(s)"] },
{ 'tag': "div", 'id': "exhibit-pedigree-Spouse", 'class': "exhibit-pedigree-box", 'style': {'top': '25px', 'left': '3px', 'height': '75px', 'width': '170px'}},
{ 'tag': "div", 'class': "exhibit-pedigree-header", 'style': {'top': '100px', 'left': '3px'}, 'children': ["Children"] },
{ 'tag': "div", 'id': "exhibit-pedigree-Child", 'class': "exhibit-pedigree-box", 'style': {'top': '125px', 'left': '3px', 'height': '275px', 'width': '160px'}},
{ 'tag': "div", 'id': "exhibit-pedigree-P1", 'class': "exhibit-pedigree-box", 'style': {'top': '165px', 'left': '167px', 'height': '75px'}},
{ 'tag': "div", 'id': "exhibit-pedigree-P2", 'class': "exhibit-pedigree-box", 'style': {'top': '72px', 'left': '245px', 'height': '75px'}},
{ 'tag': "div", 'id': "exhibit-pedigree-P3", 'class': "exhibit-pedigree-box", 'style': {'top': '272px', 'left': '245px', 'height': '75px'}},
{ 'tag': "div", 'id': "exhibit-pedigree-P4", 'class': "exhibit-pedigree-box", 'style': {'top': '37px', 'left': '350px'}},
{ 'tag': "div", 'id': "exhibit-pedigree-P5", 'class': "exhibit-pedigree-box", 'style': {'top': '137px', 'left': '350px'}},
{ 'tag': "div", 'id': "exhibit-pedigree-P6", 'class': "exhibit-pedigree-box", 'style': {'top': '237px', 'left': '350px'}},
{ 'tag': "div", 'id': "exhibit-pedigree-P7", 'class': "exhibit-pedigree-box", 'style': {'top': '337px', 'left': '350px'}},
{ 'tag': "div", 'id': "exhibit-pedigree-P8", 'class': "exhibit-pedigree-box", 'style': {'top': '12px', 'left': '430px'}},
{ 'tag': "div", 'id': "exhibit-pedigree-P9", 'class': "exhibit-pedigree-box", 'style': {'top': '62px', 'left': '430px'}},
{ 'tag': "div", 'id': "exhibit-pedigree-P10", 'class': "exhibit-pedigree-box", 'style': {'top': '112px', 'left': '430px'}},
{ 'tag': "div", 'id': "exhibit-pedigree-P11", 'class': "exhibit-pedigree-box", 'style': {'top': '162px', 'left': '430px'}},
{ 'tag': "div", 'id': "exhibit-pedigree-P12", 'class': "exhibit-pedigree-box", 'style': {'top': '212px', 'left': '430px'}},
{ 'tag': "div", 'id': "exhibit-pedigree-P13", 'class': "exhibit-pedigree-box", 'style': {'top': '262px', 'left': '430px'}},
{ 'tag': "div", 'id': "exhibit-pedigree-P14", 'class': "exhibit-pedigree-box", 'style': {'top': '312px', 'left': '430px'}},
{ 'tag': "div", 'id': "exhibit-pedigree-P15", 'class': "exhibit-pedigree-box", 'style': {'top': '362px', 'left': '430px'}},
{ 'tag': "div", 'id': "exhibit-pedigree-P16", 'class': "exhibit-pedigree-box", 'style': {'top': '0', 'left': '575px'}},
{ 'tag': "div", 'id': "exhibit-pedigree-P17", 'class': "exhibit-pedigree-box", 'style': {'top': '25px', 'left': '575px'}},
{ 'tag': "div", 'id': "exhibit-pedigree-P18", 'class': "exhibit-pedigree-box", 'style': {'top': '50px', 'left': '575px'}},
{ 'tag': "div", 'id': "exhibit-pedigree-P19", 'class': "exhibit-pedigree-box", 'style': {'top': '75px', 'left': '575px'}},
{ 'tag': "div", 'id': "exhibit-pedigree-P20", 'class': "exhibit-pedigree-box", 'style': {'top': '100px', 'left': '575px'}},
{ 'tag': "div", 'id': "exhibit-pedigree-P21", 'class': "exhibit-pedigree-box", 'style': {'top': '125px', 'left': '575px'}},
{ 'tag': "div", 'id': "exhibit-pedigree-P22", 'class': "exhibit-pedigree-box", 'style': {'top': '150px', 'left': '575px'}},
{ 'tag': "div", 'id': "exhibit-pedigree-P23", 'class': "exhibit-pedigree-box", 'style': {'top': '175px', 'left': '575px'}},
{ 'tag': "div", 'id': "exhibit-pedigree-P24", 'class': "exhibit-pedigree-box", 'style': {'top': '200px', 'left': '575px'}},
{ 'tag': "div", 'id': "exhibit-pedigree-P25", 'class': "exhibit-pedigree-box", 'style': {'top': '225px', 'left': '575px'}},
{ 'tag': "div", 'id': "exhibit-pedigree-P26", 'class': "exhibit-pedigree-box", 'style': {'top': '250px', 'left': '575px'}},
{ 'tag': "div", 'id': "exhibit-pedigree-P27", 'class': "exhibit-pedigree-box", 'style': {'top': '275px', 'left': '575px'}},
{ 'tag': "div", 'id': "exhibit-pedigree-P28", 'class': "exhibit-pedigree-box", 'style': {'top': '300px', 'left': '575px'}},
{ 'tag': "div", 'id': "exhibit-pedigree-P29", 'class': "exhibit-pedigree-box", 'style': {'top': '325px', 'left': '575px'}},
{ 'tag': "div", 'id': "exhibit-pedigree-P30", 'class': "exhibit-pedigree-box", 'style': {'top': '350px', 'left': '575px'}},
{ 'tag': "div", 'id': "exhibit-pedigree-P31", 'class': "exhibit-pedigree-box", 'style': {'top': '375px', 'left': '575px'}}
]
};
var exhibitFamilyPedigreeTemplate = {
'tag': "div",
'class': "exhibit-pedigree",
'children': [
{ 'tag': "div", 'class': "exhibit-pedigree-header", 'style': {'top': '0', 'left': '10px'}, 'children': ["Children"] },
{ 'tag': "div", 'id': "exhibit-pedigree-Child", 'class': "exhibit-pedigree-box", 'style': {'top': '25px', 'left': '10px', 'height': '375px', 'width': '160px'}},
{ 'tag': "div", 'id': "exhibit-pedigree-P2", 'class': "exhibit-pedigree-box", 'style': {'top': '72px', 'left': '245px', 'height': '75px'}},
{ 'tag': "div", 'id': "exhibit-pedigree-P3", 'class': "exhibit-pedigree-box", 'style': {'top': '272px', 'left': '245px', 'height': '75px'}},
{ 'tag': "div", 'id': "exhibit-pedigree-P4", 'class': "exhibit-pedigree-box", 'style': {'top': '37px', 'left': '350px'}},
{ 'tag': "div", 'id': "exhibit-pedigree-P5", 'class': "exhibit-pedigree-box", 'style': {'top': '137px', 'left': '350px'}},
{ 'tag': "div", 'id': "exhibit-pedigree-P6", 'class': "exhibit-pedigree-box", 'style': {'top': '237px', 'left': '350px'}},
{ 'tag': "div", 'id': "exhibit-pedigree-P7", 'class': "exhibit-pedigree-box", 'style': {'top': '337px', 'left': '350px'}},
{ 'tag': "div", 'id': "exhibit-pedigree-P8", 'class': "exhibit-pedigree-box", 'style': {'top': '12px', 'left': '430px'}},
{ 'tag': "div", 'id': "exhibit-pedigree-P9", 'class': "exhibit-pedigree-box", 'style': {'top': '62px', 'left': '430px'}},
{ 'tag': "div", 'id': "exhibit-pedigree-P10", 'class': "exhibit-pedigree-box", 'style': {'top': '112px', 'left': '430px'}},
{ 'tag': "div", 'id': "exhibit-pedigree-P11", 'class': "exhibit-pedigree-box", 'style': {'top': '162px', 'left': '430px'}},
{ 'tag': "div", 'id': "exhibit-pedigree-P12", 'class': "exhibit-pedigree-box", 'style': {'top': '212px', 'left': '430px'}},
{ 'tag': "div", 'id': "exhibit-pedigree-P13", 'class': "exhibit-pedigree-box", 'style': {'top': '262px', 'left': '430px'}},
{ 'tag': "div", 'id': "exhibit-pedigree-P14", 'class': "exhibit-pedigree-box", 'style': {'top': '312px', 'left': '430px'}},
{ 'tag': "div", 'id': "exhibit-pedigree-P15", 'class': "exhibit-pedigree-box", 'style': {'top': '362px', 'left': '430px'}},
{ 'tag': "div", 'id': "exhibit-pedigree-P16", 'class': "exhibit-pedigree-box", 'style': {'top': '0', 'left': '575px'}},
{ 'tag': "div", 'id': "exhibit-pedigree-P17", 'class': "exhibit-pedigree-box", 'style': {'top': '25px', 'left': '575px'}},
{ 'tag': "div", 'id': "exhibit-pedigree-P18", 'class': "exhibit-pedigree-box", 'style': {'top': '50px', 'left': '575px'}},
{ 'tag': "div", 'id': "exhibit-pedigree-P19", 'class': "exhibit-pedigree-box", 'style': {'top': '75px', 'left': '575px'}},
{ 'tag': "div", 'id': "exhibit-pedigree-P20", 'class': "exhibit-pedigree-box", 'style': {'top': '100px', 'left': '575px'}},
{ 'tag': "div", 'id': "exhibit-pedigree-P21", 'class': "exhibit-pedigree-box", 'style': {'top': '125px', 'left': '575px'}},
{ 'tag': "div", 'id': "exhibit-pedigree-P22", 'class': "exhibit-pedigree-box", 'style': {'top': '150px', 'left': '575px'}},
{ 'tag': "div", 'id': "exhibit-pedigree-P23", 'class': "exhibit-pedigree-box", 'style': {'top': '175px', 'left': '575px'}},
{ 'tag': "div", 'id': "exhibit-pedigree-P24", 'class': "exhibit-pedigree-box", 'style': {'top': '200px', 'left': '575px'}},
{ 'tag': "div", 'id': "exhibit-pedigree-P25", 'class': "exhibit-pedigree-box", 'style': {'top': '225px', 'left': '575px'}},
{ 'tag': "div", 'id': "exhibit-pedigree-P26", 'class': "exhibit-pedigree-box", 'style': {'top': '250px', 'left': '575px'}},
{ 'tag': "div", 'id': "exhibit-pedigree-P27", 'class': "exhibit-pedigree-box", 'style': {'top': '275px', 'left': '575px'}},
{ 'tag': "div", 'id': "exhibit-pedigree-P28", 'class': "exhibit-pedigree-box", 'style': {'top': '300px', 'left': '575px'}},
{ 'tag': "div", 'id': "exhibit-pedigree-P29", 'class': "exhibit-pedigree-box", 'style': {'top': '325px', 'left': '575px'}},
{ 'tag': "div", 'id': "exhibit-pedigree-P30", 'class': "exhibit-pedigree-box", 'style': {'top': '350px', 'left': '575px'}},
{ 'tag': "div", 'id': "exhibit-pedigree-P31", 'class': "exhibit-pedigree-box", 'style': {'top': '375px', 'left': '575px'}}
]
};
var exhibitSmallLens = { 'tag': "div", 'class': "exhibit-pedigree-small-lens", 'children': [
{ 'tag': "div", 'class': "exhibit-pedigree-lens-padding", 'children': [
{ 'tag': "div", 'children': [
{ 'tag': "span", "ex:if": ".FullName <> ''", 'children': [
{ 'tag': "span", "ex:content": "value", "ex:formats": "item { title: expression(.FullName) }" },
{ 'tag': "span", "ex:content": "value" }
] }
] }
] }
] };
var exhibitChildLens = { 'tag': "table", 'class': "exhibit-pedigree-table", 'children': [
{ 'tag': "tr", 'children': [
{ 'tag': "td", 'children': [
{ 'tag': "div", 'class': "exhibit-pedigree-arrow", 'children': [
{ 'tag': "span", "ex:if-exists": ".FullName", 'children': [
{ 'tag': "a", "ex:href-subcontent": "/wiki/Special:ShowPedigree?pagetitle={{.label}}", 'children': [ "<" ] }
] }
] }
] },
{ 'tag': "td", 'children': [
{ 'tag': "div", 'class': "exhibit-pedigree-child-lens", 'children': [
{ 'tag': "div", 'class': "exhibit-pedigree-lens-padding", 'children': [
{ 'tag': "div", 'children': [
{ 'tag': "span", "ex:if": ".FullName <> ''", 'children': [
{ 'tag': "span", "ex:content": "value", "ex:formats": "item { title: expression(.FullName) }" },
{ 'tag': "span", "ex:content": "value" }
] }
] }
] }
] }
] }
] }
] };
var exhibitEOLLens = { 'tag': "table", 'class': "exhibit-pedigree-table", 'children': [
{ 'tag': "tr", 'children': [
{ 'tag': "td", 'children': [
{ 'tag': "div", 'class': "exhibit-pedigree-eol-lens", 'children': [
{ 'tag': "div", 'class': "exhibit-pedigree-lens-padding", 'children': [
{ 'tag': "div", 'children': [
{ 'tag': "span", "ex:if": ".FullName <> ''", 'children': [
{ 'tag': "span", "ex:content": "value", "ex:formats": "item { title: expression(.FullName) }" },
{ 'tag': "span", "ex:content": "value" }
] }
] }
] }
] }
] },
{ 'tag': "td", 'children': [
{ 'tag': "div", 'class': "exhibit-pedigree-arrow", 'children': [
{ 'tag': "span", "ex:if-exists": ".Parents", 'children': [
{ 'tag': "a", "ex:href-subcontent": "/wiki/Special:ShowPedigree?pagetitle={{.label}}", 'children': [ ">" ] }
] }
] }
] }
] }
] };
var exhibitMedLens = { 'tag': "div", 'class': "exhibit-pedigree-med-lens", 'children': [
{ 'tag': "div", 'class': "exhibit-pedigree-lens-padding", 'children': [
{ 'tag': "div", 'children': [
{ 'tag': "span", "ex:if": ".FullName <> ''", 'children': [
{ 'tag': "span", "ex:content": "value", "ex:formats": "item { title: expression(.FullName) }" },
{ 'tag': "span", "ex:content": "value" }
] }
] },
{ 'tag': "div", 'children': [ "b. ", { 'tag': "span", "ex:content": ".BirthDate" } ] },
{ 'tag': "div", 'children': [ "d. ", { 'tag': "span", "ex:content": ".DeathDate" } ] }
] }
] };
var exhibitBigLens = { 'tag': "div", 'class': "exhibit-pedigree-big-lens", 'children': [
{ 'tag': "div", 'class': "exhibit-pedigree-lens-padding", 'children': [
{ 'tag': "div", 'children': [
{ 'tag': "span", "ex:if": ".FullName <> ''", 'children': [
{ 'tag': "span", "ex:content": "value", "ex:formats": "item { title: expression(.FullName) }" },
{ 'tag': "span", "ex:content": "value" }
] }
] },
{ 'tag': "div", 'children': [ "b. ", { 'tag': "span", "ex:content": ".BirthDate" } ] },
{ 'tag': "div", 'children': [ "m. ", { 'tag': "span", "ex:content": ".Spouse.MarriageDate" } ] },
{ 'tag': "div", 'children': [ "d. ", { 'tag': "span", "ex:content": ".DeathDate" } ] }
] }
] };
var exhibitLenses = {
'P1': exhibitBigLens,
'Spouse': exhibitSmallLens,
'Child': exhibitChildLens,
'P2': exhibitMedLens,
'P3': exhibitMedLens,
'P4': exhibitSmallLens,
'P5': exhibitSmallLens,
'P6': exhibitSmallLens,
'P7': exhibitSmallLens,
'P8': exhibitSmallLens,
'P9': exhibitSmallLens,
'P10': exhibitSmallLens,
'P11': exhibitSmallLens,
'P12': exhibitSmallLens,
'P13': exhibitSmallLens,
'P14': exhibitSmallLens,
'P15': exhibitSmallLens,
'*': exhibitEOLLens
};
function wrExhibitMapAddOverlays(self, itemID) {
var database = self._uiContext.getDatabase();
var accessors = self._accessors;
var map = self._map;
var latlngs = [];
accessors.getProxy(itemID, database, function(proxy) {
accessors.getLatlng(proxy, database, function(v) {
if (v != null && "lat" in v && "lng" in v) latlngs.push(v);
});
});
for (var i = 0; i < latlngs.length-1; i++) {
var start = latlngs[i];
var end = latlngs[i+1];
var line = new GPolyline([new GLatLng(start.lat, start.lng), new GLatLng(end.lat, end.lng)], '#000000', 4, 0.3);
map.addOverlay(line);
}
}
function wrExhibitColorMarkerGenerator(color) {
var baseURL = '/w/skins/common/images/maps/balloon';
var balloonSize = 20;
elmt = document.createElement('img');
elmt.src = baseURL + '-' + balloonSize + '-' + color.substr(1) + '.png';
elmt.style.verticalAlign = "middle";
return elmt;
}
function wrExhibitMakeIcon(shape, color, iconSize, label, iconURL, settings) {
var baseURL = '/w/skins/common/images/maps/balloon';
var balloonSize = 48;
var pinSize = 6;
var halfWidth = Math.ceil(balloonSize / 2);
var pinHalfWidth = Math.ceil(pinSize / 2);
var height = balloonSize + pinSize;
var icon = new GIcon();
icon.iconAnchor = new GPoint(halfWidth, height);
icon.imageMap = [
0, 0,
0, balloonSize,
halfWidth - pinHalfWidth, balloonSize,
halfWidth, height,
halfWidth + pinHalfWidth, balloonSize,
balloonSize, balloonSize,
balloonSize, 0
];
icon.shadowSize = new GSize(balloonSize * 1.5, height - 2);
icon.infoWindowAnchor = new GPoint(halfWidth, 0);
if (iconURL != null) {
icon.image = iconURL;
}
else {
if (label.length > 0 && parseInt(label) > 5) label = '5';
var baseName = baseURL + '-' + balloonSize + '-' + color.substr(1) + (label.length > 0 ? '-'+label : '');
icon.image = baseName + '.png';
icon.printImage = baseName + '.gif';
icon.mozPrintImage = baseName + '.gif';
}
icon.shadow = baseURL + '-shadow-' + balloonSize + '.png';
icon.iconSize = new GSize(balloonSize, height);
icon.shadowSize = new GSize(balloonSize * 1.5, height - 2);
return icon;
}