body-view-wp.js
2.14 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
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
var bodyRegionData;
var bodyLayerData;
var bodyArtData;
loadBodyViewData = function (currentBodyViewId)
{
//1.
var bodyRegionjsonPath = '~/../content/data/json/da/da_dat_brview.json';
var req = new XMLHttpRequest();
req.open("GET", bodyRegionjsonPath, true);
req.setRequestHeader("Content-type", "application/json");
req.onreadystatechange = function () {
if (req.readyState == 4 && req.status == 200)
{
bodyRegionData = JSON.parse(req.responseText);
console.log("bodyRegionData returned: " + bodyRegionData);
loadLayerDataForCurrentBodyView(currentBodyViewId)
}
}
req.send();
}
loadLayerDataForCurrentBodyView = function (currentBodyViewId) {
//1.
var bgArtJsonPath = '';
var CommonViewId = 0;
//2.
var layerJsonPath = '~/../content/data/json/da/body-views/' + currentBodyViewId + '/da_dat_layer_' + currentBodyViewId + '.json';
var req = new XMLHttpRequest();
req.open("GET", layerJsonPath, true);
req.setRequestHeader("Content-type", "application/json");
req.onreadystatechange = function () {
if (req.readyState == 4 && req.status == 200) {
bodyLayerData = JSON.parse(req.responseText);
console.log("data returned: " + bodyLayerData);
loadBodyArtData();
}
}
req.send();
}
loadBodyArtData = function () {
var bgArtJsonPath = '';
bgArtJsonPath = '~/../content/data/json/da/da_dat_bgart.json';
var req = new XMLHttpRequest();
req.open("GET", bgArtJsonPath, true);
req.setRequestHeader("Content-type", "application/json");
req.onreadystatechange = function () {
if (req.readyState == 4 && req.status == 200) {
bodyArtData = JSON.parse(req.responseText);
console.log("data returned: " + bodyArtData);
self.postMessage({
'bodyRegionData': bodyRegionData,
'bodyLayerData': bodyLayerData,
'bodyArtData': bodyArtData
});
}
}
req.send();
};
self.onmessage = function (e) {
loadBodyViewData(e.data.currentViewId);
}