|
22 | 22 | <link rel="apple-touch-icon" href="images/apple-touch-icon.png"> |
23 | 23 | <link rel="stylesheet" type="text/css" href="styles/grapheditor.css"> |
24 | 24 | <link rel="stylesheet" media="(forced-colors: active)" href="styles/high-contrast.css" id="high-contrast-stylesheet"> |
25 | | - <script id="geBootstrap" type="text/javascript"> |
26 | | - /** |
27 | | - * URL Parameters and protocol description are here: |
28 | | - * |
29 | | - * https://www.drawio.com/doc/faq/supported-url-parameters |
30 | | - * |
31 | | - * Parameters for developers: |
32 | | - * |
33 | | - * - dev=1: For developers only |
34 | | - * - test=1: For developers only |
35 | | - * - export=URL for export: For developers only |
36 | | - * - ignoremime=1: For developers only (see DriveClient.js). Use Cmd-S to override mime. |
37 | | - * - createindex=1: For developers only (see etc/build/README) |
38 | | - * - filesupport=0: For developers only (see Editor.js in core) |
39 | | - * - savesidebar=1: For developers only (see Sidebar.js) |
40 | | - * - pages=1: For developers only (see Pages.js) |
41 | | - * - lic=email: For developers only (see LicenseServlet.java) |
42 | | - * -- |
43 | | - * - networkshapes=1: For testing network shapes (temporary) |
44 | | - */ |
45 | | - var urlParams = (function() |
46 | | - { |
47 | | - var result = new Object(); |
48 | | - var params = window.location.search.slice(1).split('&'); |
49 | | - |
50 | | - for (var i = 0; i < params.length; i++) |
51 | | - { |
52 | | - var idx = params[i].indexOf('='); |
53 | | - |
54 | | - if (idx > 0) |
55 | | - { |
56 | | - result[params[i].substring(0, idx)] = params[i].substring(idx + 1); |
57 | | - } |
58 | | - } |
59 | | - |
60 | | - return result; |
61 | | - })(); |
62 | | - |
63 | | - // Forces CDN caches by passing URL parameters via URL hash |
64 | | - if (window.location.hash != null && window.location.hash.substring(0, 2) == '#P') |
65 | | - { |
66 | | - try |
67 | | - { |
68 | | - urlParams = JSON.parse(decodeURIComponent(window.location.hash.substring(2))); |
69 | | - |
70 | | - if (urlParams.hash != null) |
71 | | - { |
72 | | - window.location.hash = urlParams.hash; |
73 | | - } |
74 | | - } |
75 | | - catch (e) |
76 | | - { |
77 | | - // ignore |
78 | | - } |
79 | | - } |
80 | | - |
81 | | - // Global variable for desktop |
82 | | - var mxIsElectron = navigator.userAgent != null && navigator.userAgent.toLowerCase().indexOf(' electron/') > -1 && |
83 | | - navigator.userAgent.indexOf(' draw.io/') > -1; |
84 | | - |
85 | | - // Redirects page if required |
86 | | - if (urlParams['dev'] != '1') |
87 | | - { |
88 | | - (function() |
89 | | - { |
90 | | - var proto = window.location.protocol; |
91 | | - |
92 | | - if (!mxIsElectron) |
93 | | - { |
94 | | - var host = window.location.host; |
95 | | - |
96 | | - // Redirects apex, drive and rt to www |
97 | | - if (host === 'draw.io' || host === 'rt.draw.io' || host === 'drive.draw.io') |
98 | | - { |
99 | | - host = 'www.draw.io'; |
100 | | - } |
101 | | - |
102 | | - var href = proto + '//' + host + window.location.href.substring( |
103 | | - window.location.protocol.length + |
104 | | - window.location.host.length + 2); |
105 | | - |
106 | | - // Redirects if href changes |
107 | | - if (href != window.location.href) |
108 | | - { |
109 | | - window.location.href = href; |
110 | | - } |
111 | | - } |
112 | | - })(); |
113 | | - } |
114 | | - |
115 | | - /** |
116 | | - * Adds meta tag to the page. |
117 | | - */ |
118 | | - function mxmeta(name, content, httpEquiv) |
119 | | - { |
120 | | - try |
121 | | - { |
122 | | - var s = document.createElement('meta'); |
123 | | - |
124 | | - if (name != null) |
125 | | - { |
126 | | - s.setAttribute('name', name); |
127 | | - } |
128 | | - |
129 | | - s.setAttribute('content', content); |
130 | | - |
131 | | - if (httpEquiv != null) |
132 | | - { |
133 | | - s.setAttribute('http-equiv', httpEquiv); |
134 | | - } |
135 | | - |
136 | | - var t = document.getElementsByTagName('meta')[0]; |
137 | | - t.parentNode.insertBefore(s, t); |
138 | | - } |
139 | | - catch (e) |
140 | | - { |
141 | | - // ignore |
142 | | - } |
143 | | - }; |
144 | | - |
145 | | - /** |
146 | | - * Synchronously adds scripts to the page. |
147 | | - */ |
148 | | - function mxscript(src, onLoad, id, dataAppKey, noWrite, onError) |
149 | | - { |
150 | | - var defer = onLoad == null && !noWrite; |
151 | | - |
152 | | - if ((urlParams['dev'] != '1' && typeof document.createElement('canvas').getContext === "function") || |
153 | | - onLoad != null || noWrite) |
154 | | - { |
155 | | - var s = document.createElement('script'); |
156 | | - s.setAttribute('type', 'text/javascript'); |
157 | | - s.setAttribute('defer', 'true'); |
158 | | - s.setAttribute('src', src); |
159 | | - |
160 | | - if (id != null) |
161 | | - { |
162 | | - s.setAttribute('id', id); |
163 | | - } |
164 | | - |
165 | | - if (dataAppKey != null) |
166 | | - { |
167 | | - s.setAttribute('data-app-key', dataAppKey); |
168 | | - } |
169 | | - |
170 | | - if (onLoad != null) |
171 | | - { |
172 | | - var r = false; |
173 | | - |
174 | | - s.onload = s.onreadystatechange = function() |
175 | | - { |
176 | | - if (!r && (!this.readyState || this.readyState == 'complete')) |
177 | | - { |
178 | | - r = true; |
179 | | - onLoad(); |
180 | | - } |
181 | | - }; |
182 | | - } |
183 | | - |
184 | | - if (onError != null) |
185 | | - { |
186 | | - s.onerror = function(e) |
187 | | - { |
188 | | - onError('Failed to load ' + src, e); |
189 | | - }; |
190 | | - } |
191 | | - |
192 | | - var t = document.getElementsByTagName('script')[0]; |
193 | | - |
194 | | - if (t != null) |
195 | | - { |
196 | | - t.parentNode.insertBefore(s, t); |
197 | | - } |
198 | | - } |
199 | | - else |
200 | | - { |
201 | | - document.write('<script src="' + src + '"' + ((id != null) ? ' id="' + id +'" ' : '') + |
202 | | - ((dataAppKey != null) ? ' data-app-key="' + dataAppKey +'" ' : '') + '></scr' + 'ipt>'); |
203 | | - } |
204 | | - }; |
205 | | - |
206 | | - /** |
207 | | - * Asynchronously adds scripts to the page. |
208 | | - */ |
209 | | - function mxinclude(src) |
210 | | - { |
211 | | - var g = document.createElement('script'); |
212 | | - g.type = 'text/javascript'; |
213 | | - g.async = true; |
214 | | - g.src = src; |
215 | | - |
216 | | - var s = document.getElementsByTagName('script')[0]; |
217 | | - s.parentNode.insertBefore(g, s); |
218 | | - }; |
219 | | - |
220 | | - /** |
221 | | - * Adds meta tags with application name (depends on offline URL parameter) |
222 | | - */ |
223 | | - (function() |
224 | | - { |
225 | | - var name = 'diagrams.net'; |
226 | | - mxmeta('apple-mobile-web-app-title', name); |
227 | | - mxmeta('application-name', name); |
228 | | - |
229 | | - if (mxIsElectron) |
230 | | - { |
231 | | - mxmeta(null, 'default-src \'self\'; script-src \'self\' \'sha256-6g514VrT/cZFZltSaKxIVNFF46+MFaTSDTPB8WfYK+c=\'; connect-src \'self\' https://*.draw.io https://*.diagrams.net https://fonts.googleapis.com https://fonts.gstatic.com; img-src * data:; media-src *; font-src *; frame-src \'none\'; style-src \'self\' \'unsafe-inline\' https://fonts.googleapis.com; base-uri \'none\';child-src \'self\';object-src \'none\';', 'Content-Security-Policy'); |
232 | | - } |
233 | | - })(); |
234 | | - |
235 | | - // Checks for local storage |
236 | | - var isLocalStorage = false; |
237 | | - |
238 | | - try |
239 | | - { |
240 | | - isLocalStorage = urlParams['local'] != '1' && typeof(localStorage) != 'undefined'; |
241 | | - } |
242 | | - catch (e) |
243 | | - { |
244 | | - // ignored |
245 | | - } |
246 | | - |
247 | | - var mxScriptsLoaded = false, mxWinLoaded = false; |
248 | | - |
249 | | - function checkAllLoaded() |
250 | | - { |
251 | | - if (mxScriptsLoaded && mxWinLoaded) |
252 | | - { |
253 | | - App.main(); |
254 | | - } |
255 | | - }; |
256 | | - |
257 | | - var t0 = new Date(); |
258 | | - |
259 | | - // Changes paths for local development environment |
260 | | - if (urlParams['dev'] == '1') |
261 | | - { |
262 | | - // Used to request grapheditor/mxgraph sources in dev mode |
263 | | - var mxDevUrl = ''; |
264 | | - |
265 | | - // Used to request draw.io sources in dev mode |
266 | | - var drawDevUrl = ''; |
267 | | - var geBasePath = 'js/grapheditor'; |
268 | | - var mxBasePath = 'mxgraph/src'; |
269 | | - |
270 | | - if (document.location.protocol == 'file:') |
271 | | - { |
272 | | - // Forces includes for dev environment in node.js |
273 | | - mxForceIncludes = true; |
274 | | - } |
275 | | - |
276 | | - mxForceIncludes = false; |
277 | | - |
278 | | - mxscript(drawDevUrl + 'js/PreConfig.js'); |
279 | | - mxscript(drawDevUrl + 'js/diagramly/Init.js'); |
280 | | - mxscript(geBasePath + '/Init.js'); |
281 | | - mxscript(mxBasePath + '/mxClient.js'); |
282 | | - |
283 | | - // Adds all JS code that depends on mxClient. This indirection via Devel.js is |
284 | | - // required in some browsers to make sure mxClient.js (and the files that it |
285 | | - // loads asynchronously) are available when the code loaded in Devel.js runs. |
286 | | - mxscript(drawDevUrl + 'js/diagramly/Devel.js'); |
287 | | - |
288 | | - // Electron |
289 | | - if (mxIsElectron) |
290 | | - { |
291 | | - mxscript('js/diagramly/DesktopLibrary.js'); |
292 | | - mxscript('js/diagramly/ElectronApp.js'); |
293 | | - } |
294 | | - |
295 | | - mxscript(drawDevUrl + 'js/PostConfig.js'); |
296 | | - } |
297 | | - else |
298 | | - { |
299 | | - (function() |
300 | | - { |
301 | | - var hostName = window.location.hostname; |
302 | | - |
303 | | - // Supported domains are *.draw.io and the packaged version in Quip |
304 | | - var supportedDomain = (hostName.substring(hostName.length - 8, hostName.length) === '.draw.io') || |
305 | | - (hostName.substring(hostName.length - 13, hostName.length) === '.diagrams.net'); |
306 | | - |
307 | | - function loadAppJS() |
308 | | - { |
309 | | - mxscript('js/app.min.js', function() |
310 | | - { |
311 | | - mxScriptsLoaded = true; |
312 | | - checkAllLoaded(); |
313 | | - |
314 | | - // Electron |
315 | | - if (mxIsElectron) |
316 | | - { |
317 | | - mxscript('js/diagramly/DesktopLibrary.js', function() |
318 | | - { |
319 | | - mxscript('js/diagramly/ElectronApp.js', function() |
320 | | - { |
321 | | - mxscript('js/extensions.min.js', function() |
322 | | - { |
323 | | - mxscript('js/stencils.min.js', function() |
324 | | - { |
325 | | - mxscript('js/shapes-14-6-5.min.js', function() |
326 | | - { |
327 | | - mxscript('js/PostConfig.js'); |
328 | | - }); |
329 | | - }); |
330 | | - }); |
331 | | - }); |
332 | | - }); |
333 | | - } |
334 | | - else if (!supportedDomain || navigator.onLine) |
335 | | - { |
336 | | - mxscript('js/PostConfig.js'); |
337 | | - } |
338 | | - }); |
339 | | - }; |
340 | | - |
341 | | - if (!supportedDomain || mxIsElectron || navigator.onLine) |
342 | | - { |
343 | | - mxscript('js/PreConfig.js', loadAppJS); |
344 | | - } |
345 | | - else |
346 | | - { |
347 | | - loadAppJS(); |
348 | | - } |
349 | | - })(); |
350 | | - } |
351 | | - |
352 | | - // Adds basic error handling |
353 | | - window.onerror = function() |
354 | | - { |
355 | | - var status = document.getElementById('geStatus'); |
356 | | - |
357 | | - if (status != null) |
358 | | - { |
359 | | - status.innerHTML = 'Page could not be loaded. Please try refreshing.'; |
360 | | - } |
361 | | - }; |
362 | | - </script> |
| 25 | + <script src="js/bootstrap.js"></script> |
363 | 26 | <style type="text/css"> |
364 | 27 | .geBlock { |
365 | 28 | z-index:-3; |
@@ -390,22 +53,6 @@ <h2 id="geStatus">Loading... <img src="images/spin.gif"/></h2> |
390 | 53 | </p> |
391 | 54 | </div> |
392 | 55 | </div> |
393 | | -<script id="geMain" type="text/javascript"> |
394 | | -/** |
395 | | - * Main |
396 | | - */ |
397 | | -if (urlParams['dev'] != '1' && typeof document.createElement('canvas').getContext === "function") |
398 | | -{ |
399 | | - window.addEventListener('load', function() |
400 | | - { |
401 | | - mxWinLoaded = true; |
402 | | - checkAllLoaded(); |
403 | | - }); |
404 | | -} |
405 | | -else |
406 | | -{ |
407 | | - App.main(); |
408 | | -} |
409 | | -</script> |
| 56 | +<script src="js/main.js"></script> |
410 | 57 | </body> |
411 | 58 | </html> |
0 commit comments