-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.js
186 lines (171 loc) · 5.38 KB
/
init.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
var dojoConfig, jimuConfig;
/*global weinreUrl, loadResources, loadPolyfills, loadingCallback, debug, allCookies, unescape */
var ie = (function() {
var undef,
v = 3,
div = document.createElement('div'),
all = div.getElementsByTagName('i');
div.innerHTML = '<!--[if gt IE ' + (++v) + ']><i></i><![endif]-->';
while(all[0]){
div.innerHTML = '<!--[if gt IE ' + (++v) + ']><i></i><![endif]-->';
}
return v > 4 ? v : undef;
}());
(function(argument) {
if (ie < 8){
var mainLoading = document.getElementById('main-loading');
var appLoading = document.getElementById('app-loading');
var ieNotes = document.getElementById('ie-note');
appLoading.style.display = 'none';
ieNotes.style.display = 'block';
mainLoading.style.backgroundColor="#fff";
return;
}
var resources = [];
if (debug) {
resources.push(weinreUrl);
}
if (!window.apiUrl) {
console.error('no apiUrl.');
} else if (!window.path) {
console.error('no path.');
} else {
if(window.location.protocol === 'https:'){
var reg = /^http:\/\//i;
if(reg.test(window.apiUrl)){
window.apiUrl = window.apiUrl.replace(reg, 'https://');
}
if(reg.test(window.path)){
window.path = window.path.replace(reg, 'https://');
}
}
/*jshint unused:false*/
dojoConfig = {
parseOnLoad: false,
async: true,
tlmSiblingOfDojo: false,
has: {
'extend-esri': 1
}
};
if(allCookies.esri_auth){
/*jshint -W061 */
var userObj = eval('(' + unescape(allCookies.esri_auth)+ ')');
if(userObj.culture){
dojoConfig.locale = userObj.culture;
}
}
if(allCookies.arcgisLocale){
dojoConfig.locale = allCookies.arcgisLocale.toLowerCase();
}
if(allCookies.appbuilder_locale){
dojoConfig.locale = allCookies.appbuilder_locale.toLowerCase();
}
resources = resources.concat([
window.apiUrl + 'dojo/resources/dojo.css',
window.apiUrl + 'dijit/themes/claro/claro.css',
window.apiUrl + 'esri/css/esri.css',
window.path + 'jimu.js/css/jimu.css'
]);
if (window.apiUrl.substr(this.length - 'arcgis-js-api/'.length, 'arcgis-js-api/'.length) === 'arcgis-js-api/') {
//after build, we put js api here
//user can also download release api package and put here
dojoConfig.baseUrl = window.path;
dojoConfig.packages = [{
name: "dojo",
location: window.apiUrl + "dojo"
}, {
name: "dijit",
location: window.apiUrl + "dijit"
}, {
name: "dojox",
location: window.apiUrl + "dojox"
}, {
name: "put-selector",
location: window.apiUrl + "put-selector"
}, {
name: "xstyle",
location: window.apiUrl + "xstyle"
}, {
name: "dgrid",
location: window.apiUrl + "dgrid"
}, {
name: "esri",
location: window.apiUrl + "esri"
}, {
name: "widgets",
location: "widgets"
}, {
name: "jimu",
location: "jimu.js"
}, {
name: "themes",
location: "themes"
}, {
name: "libs",
location: "libs"
}, {
name: "dynamic-modules",
location: "dynamic-modules"
}];
resources.push(window.apiUrl + '/dojo/dojo.js');
} else {
dojoConfig.baseUrl = window.apiUrl + 'dojo';
dojoConfig.packages = [{
name: "widgets",
location: window.path + "widgets"
}, {
name: "jimu",
location: window.path + "jimu.js"
}, {
name: "themes",
location: window.path + "themes"
}, {
name: "libs",
location: window.path + "libs"
}, {
name: "dynamic-modules",
location: window.path + "dynamic-modules"
}];
resources.push(window.apiUrl + 'init.js');
}
jimuConfig = {
loadingId: 'main-loading',
mainPageId: 'main-page',
layoutId: 'jimu-layout-manager',
mapId: '6f292ca5250642208830ab31b4c37274'
};
loadResources(resources, null, function(url, loaded) {
if (typeof loadingCallback === 'function') {
loadingCallback(url, loaded, resources.length);
}
}, function() {
loadPolyfills("", function() {
require(['jimu/main', 'libs/main', 'dynamic-modules/preload'], function(jimuMain) {
loadingCallback('jimu', resources.length + 1, resources.length);
jimuMain.initApp();
});
});
});
}
document.addEventListener('click', function(){
var popup = document.querySelector('.esriPopupVisible');
if (popup) {
var ifAdExist = popup.querySelector('.ad-info');
}
if ((popup)&&(!ifAdExist)){
var view = popup.querySelector('.esriViewPopup'),
adInfo = document.createElement('div'),
header = popup.querySelector('.header').innerHTML;
adInfo.classList.add('ad-info');
switch (header){
case 'Львівський національний медичний університет імені Данила Галицького':
console.log('Львівський національний медичний університет імені Данила Галицького');
adInfo.innerHTML = 'Ректор: Медичного <br/> Телефон: 1020205';
default:
console.log('not in database');
}
view.appendChild(adInfo);
}
});
})();