/
App.js
5563 lines (4960 loc) · 149 KB
/
App.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
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/**
* Copyright (c) 2006-2018, JGraph Ltd
* Copyright (c) 2006-2018, Gaudenz Alder
*/
/**
* Constructs a new point for the optional x and y coordinates. If no
* coordinates are given, then the default values for <x> and <y> are used.
* @constructor
* @class Implements a basic 2D point. Known subclassers = {@link mxRectangle}.
* @param {number} x X-coordinate of the point.
* @param {number} y Y-coordinate of the point.
*/
App = function(editor, container, lightbox)
{
EditorUi.call(this, editor, container, (lightbox != null) ? lightbox :
(urlParams['lightbox'] == '1' || (uiTheme == 'min' &&
urlParams['chrome'] != '0')));
// Logs unloading of window with modifications for Google Drive file
if (!mxClient.IS_CHROMEAPP && !EditorUi.isElectronApp)
{
window.onunload = mxUtils.bind(this, function()
{
var file = this.getCurrentFile();
if (file != null && file.constructor == DriveFile && file.isModified() && this.drive != null)
{
EditorUi.logEvent({category: 'DISCARD-SAVE-GOOGLE-' + file.getId() + '.' +
file.desc.headRevisionId + '.' + file.desc.modifiedDate,
action: 'time-' + new Date().toISOString() + '-saved-' +
((file.lastSaved != null) ? file.lastSaved.toISOString() : 'never'),
label: (this.drive.user != null) ? this.drive.user.id : 'unknown-user'});
}
});
}
// Pre-fetches images
if (mxClient.IS_SVG)
{
mxGraph.prototype.warningImage.src = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAE7SURBVHjaYvz//z8DJQAggBjwGXDuHMP/tWuD/uPTCxBAOA0AaQRK/f/+XeJ/cbHlf1wGAAQQTgPu3QNLgfHSpZo4DQAIIKwGwGyH4e/fFbG6AiQJEEAs2Ew2NFzH8OOHBMO6dT/A/KCg7wxGRh+wuhQggDBcALMdFIAcHBxgDGJjcwVIIUAAYbhAUXEdVos4OO4DXcGBIQ4QQCguQPY7sgtgAYruCpAgQACx4LJdU1OCwctLEcyWlLwPJF+AXQE0EMUBAAEEdwF6yMOiD4RRY0QT7gqQAEAAseDzu6XldYYPH9DD4joQa8L5AAEENgWb7SBcXa0JDQMBrK4AcQACiAlfyOMCEFdAnAYQQEz4FLa0XGf4/v0H0IIPONUABBAjyBmMjIwMS5cK/L927QORbtBkaG29DtYLEGAAH6f7oq3Zc+kAAAAASUVORK5CYII=';
}
else
{
var img = new Image();
img.src = mxGraph.prototype.warningImage.src;
}
// Global helper method to deal with popup blockers
window.openWindow = mxUtils.bind(this, function(url, pre, fallback)
{
var wnd = null;
try
{
wnd = window.open(url);
}
catch (e)
{
// ignore
}
if (wnd == null || wnd === undefined)
{
this.showDialog(new PopupDialog(this, url, pre, fallback).container, 320, 140, true, true);
}
else if (pre != null)
{
pre();
}
});
// Handles cloning errors when copying cells
var clipboardCopy = mxClipboard.copy;
var self = this;
mxClipboard.copy = function(graph, cells)
{
var result = null;
try
{
result = clipboardCopy.apply(this, arguments);
}
catch (e)
{
self.handleError(e);
}
return result;
},
// Initial state for toolbar items is disabled
this.updateDocumentTitle();
this.updateUi();
// Global helper method to display error messages
window.showOpenAlert = mxUtils.bind(this, function(message)
{
// Cancel must be called before showing error message
if (window.openFile != null)
{
window.openFile.cancel(true);
}
this.handleError(message);
});
// Handles opening files via drag and drop
if (!this.editor.chromeless || this.editor.editable)
{
this.addFileDropHandler([document]);
}
// Process the queue for waiting plugins
if (App.DrawPlugins != null)
{
for (var i = 0; i < App.DrawPlugins.length; i++)
{
try
{
App.DrawPlugins[i](this);
}
catch (e)
{
if (window.console != null)
{
console.log('Plugin Error:', e, App.DrawPlugins[i]);
}
}
}
// Installs global callback for plugins
window.Draw.loadPlugin = mxUtils.bind(this, function(callback)
{
callback(this);
});
}
this.load();
};
/**
* Executes the first step for connecting to Google Drive.
*/
App.ERROR_TIMEOUT = 'timeout';
/**
* Executes the first step for connecting to Google Drive.
*/
App.ERROR_BUSY = 'busy';
/**
* Executes the first step for connecting to Google Drive.
*/
App.ERROR_UNKNOWN = 'unknown';
/**
* Sets the delay for autosave in milliseconds. Default is 2000.
*/
App.MODE_GOOGLE = 'google';
/**
* Sets the delay for autosave in milliseconds. Default is 2000.
*/
App.MODE_DROPBOX = 'dropbox';
/**
* Sets the delay for autosave in milliseconds. Default is 2000.
*/
App.MODE_ONEDRIVE = 'onedrive';
/**
* Sets the delay for autosave in milliseconds. Default is 2000.
*/
App.MODE_GITHUB = 'github';
/**
* Sets the delay for autosave in milliseconds. Default is 2000.
*/
App.MODE_DEVICE = 'device';
/**
* Sets the delay for autosave in milliseconds. Default is 2000.
*/
App.MODE_BROWSER = 'browser';
/**
* Trello App Mode
*/
App.MODE_TRELLO = 'trello';
/**
* Sets the delay for autosave in milliseconds. Default is 2000.
*/
App.DROPBOX_APPKEY = 'libwls2fa9szdji';
/**
* Sets URL to load the Dropbox SDK from
*/
App.DROPBOX_URL = 'js/dropbox/Dropbox-sdk.min.js';
/**
* Sets the delay for autosave in milliseconds. Default is 2000.
*/
App.DROPINS_URL = 'https://www.dropbox.com/static/api/2/dropins.js';
/**
* OneDrive Client JS (file/folder picker). This is a slightly modified version to allow using accessTokens
* But it doesn't work for IE11, so we fallback to the original one
*/
App.ONEDRIVE_URL = mxClient.IS_IE11? 'https://js.live.net/v7.2/OneDrive.js' : 'js/onedrive/OneDrive.js';
/**
* Trello URL
*/
App.TRELLO_URL = 'https://api.trello.com/1/client.js';
/**
* Trello JQuery dependency
*/
App.TRELLO_JQUERY_URL = 'https://code.jquery.com/jquery-1.7.1.min.js';
/**
* Trello JQuery dependency
*/
App.FOOTER_PLUGIN_URL = 'https://www.jgraph.com/drawio-footer.js';
/**
* Specifies the key for the pusher project.
*/
App.PUSHER_KEY = '1e756b07a690c5bdb054';
/**
* Specifies the key for the pusher project.
*/
App.PUSHER_CLUSTER = 'eu';
/**
* Specifies the URL for the pusher API.
*/
App.PUSHER_URL = 'https://js.pusher.com/4.3/pusher.min.js';
/**
* Google APIs to load. The realtime API is needed to notify collaborators of conversion
* of the realtime files, but after Dec 11 it's read-only and hence no longer needed.
*/
App.GOOGLE_APIS = 'client,drive-share';
/**
* Defines plugin IDs for loading via p URL parameter. Update the table at
* https://desk.draw.io/solution/articles/16000042546
*/
App.pluginRegistry = {'4xAKTrabTpTzahoLthkwPNUn': '/plugins/explore.js',
'ex': '/plugins/explore.js', 'p1': '/plugins/p1.js',
'ac': '/plugins/connect.js', 'acj': '/plugins/connectJira.js',
'ac148': '/plugins/cConf-1-4-8.js', 'voice': '/plugins/voice.js',
'tips': '/plugins/tooltips.js', 'svgdata': '/plugins/svgdata.js',
'electron': 'plugins/electron.js',
'number': '/plugins/number.js', 'sql': '/plugins/sql.js',
'props': '/plugins/props.js', 'text': '/plugins/text.js',
'anim': '/plugins/animation.js', 'update': '/plugins/update.js',
'trees': '/plugins/trees/trees.js', 'import': '/plugins/import.js',
'replay': '/plugins/replay.js', 'anon': '/plugins/anonymize.js',
'tr': '/plugins/trello.js', 'f5': '/plugins/rackF5.js',
'tickets': '/plugins/tickets.js', 'flow': '/plugins/flow.js',
'webcola': '/plugins/webcola/webcola.js', 'rnd': '/plugins/random.js',
'page': '/plugins/page.js', 'gd': '/plugins/googledrive.js'};
/**
* Function: authorize
*
* Authorizes the client, gets the userId and calls <open>.
*/
App.getStoredMode = function()
{
var mode = null;
if (mode == null && isLocalStorage)
{
mode = localStorage.getItem('.mode');
}
if (mode == null && typeof(Storage) != 'undefined')
{
var cookies = document.cookie.split(";");
for (var i = 0; i < cookies.length; i++)
{
// Removes spaces around cookie
var cookie = mxUtils.trim(cookies[i]);
if (cookie.substring(0, 5) == 'MODE=')
{
mode = cookie.substring(5);
break;
}
}
if (mode != null && isLocalStorage)
{
// Moves to local storage
var expiry = new Date();
expiry.setYear(expiry.getFullYear() - 1);
document.cookie = 'MODE=; expires=' + expiry.toUTCString();
localStorage.setItem('.mode', mode);
}
}
return mode;
};
/**
* Static Application initializer executed at load-time.
*/
(function()
{
if (!mxClient.IS_CHROMEAPP)
{
if (urlParams['offline'] != '1')
{
// Switches to dropbox mode for db.draw.io
if (window.location.hostname == 'db.draw.io' && urlParams['mode'] == null)
{
urlParams['mode'] = 'dropbox';
}
App.mode = urlParams['mode'];
if (App.mode == null)
{
// Stored mode overrides preferred mode
App.mode = App.getStoredMode();
}
}
/**
* Lazy loading backends.
*/
if (window.mxscript != null)
{
// Loads gapi for all browsers but IE8 and below if not disabled or if enabled and in embed mode
if (urlParams['embed'] != '1')
{
if (typeof window.DriveClient === 'function')
{
if (urlParams['gapi'] != '0' && isSvgBrowser &&
(document.documentMode == null || document.documentMode >= 10))
{
// Immediately loads client
if (App.mode == App.MODE_GOOGLE || (urlParams['state'] != null &&
window.location.hash == '') || (window.location.hash != null &&
window.location.hash.substring(0, 2) == '#G'))
{
mxscript('https://apis.google.com/js/api.js');
}
// Keeps lazy loading for fallback to authenticated Google file if not public in loadFile
else if (urlParams['chrome'] == '0' && (window.location.hash == null ||
window.location.hash.substring(0, 45) !== '#Uhttps%3A%2F%2Fdrive.google.com%2Fuc%3Fid%3D'))
{
// Disables loading of client
window.DriveClient = null;
}
}
else
{
// Disables loading of client
window.DriveClient = null;
}
}
// Loads dropbox for all browsers but IE8 and below (no CORS) if not disabled or if enabled and in embed mode
// KNOWN: Picker does not work in IE11 (https://dropbox.zendesk.com/requests/1650781)
if (typeof window.DropboxClient === 'function')
{
if (urlParams['db'] != '0' && isSvgBrowser &&
(document.documentMode == null || document.documentMode > 9))
{
// Immediately loads client
if (App.mode == App.MODE_DROPBOX || (window.location.hash != null &&
window.location.hash.substring(0, 2) == '#D'))
{
mxscript(App.DROPBOX_URL);
// Must load this after the dropbox SDK since they use the same namespace
mxscript(App.DROPINS_URL, null, 'dropboxjs', App.DROPBOX_APPKEY);
}
else if (urlParams['chrome'] == '0')
{
window.DropboxClient = null;
}
}
else
{
// Disables loading of client
window.DropboxClient = null;
}
}
// Loads OneDrive for all browsers but IE6/IOS if not disabled or if enabled and in embed mode
if (typeof window.OneDriveClient === 'function')
{
if (urlParams['od'] != '0' && (navigator.userAgent.indexOf('MSIE') < 0 || document.documentMode >= 10))
{
// Immediately loads client
if (App.mode == App.MODE_ONEDRIVE || (window.location.hash != null &&
window.location.hash.substring(0, 2) == '#W'))
{
mxscript(App.ONEDRIVE_URL);
}
else if (urlParams['chrome'] == '0')
{
window.OneDriveClient = null;
}
}
else
{
// Disables loading of client
window.OneDriveClient = null;
}
}
// Loads Trello for all browsers but < IE10 if not disabled or if enabled and in embed mode
if (typeof window.TrelloClient === 'function')
{
if (urlParams['tr'] != '0' && isSvgBrowser &&
(document.documentMode == null || document.documentMode >= 10))
{
// Immediately loads client
if (App.mode == App.MODE_TRELLO || (window.location.hash != null &&
window.location.hash.substring(0, 2) == '#T'))
{
mxscript(App.TRELLO_JQUERY_URL);
mxscript(App.TRELLO_URL);
}
else if (urlParams['chrome'] == '0')
{
window.TrelloClient = null;
}
}
else
{
// Disables loading of client
window.TrelloClient = null;
}
}
}
// Loads JSON for older browsers
if (typeof(JSON) == 'undefined')
{
mxscript('js/json/json2.min.js');
}
}
}
})();
/**
* Program flow starts here.
*
* Optional callback is called with the app instance.
*/
App.main = function(callback, createUi)
{
// Logs uncaught errors
window.onerror = function(message, url, linenumber, colno, err)
{
EditorUi.logError(message, url, linenumber, colno, err);
};
// Removes info text in embed mode
if (urlParams['embed'] == '1' || urlParams['lightbox'] == '1')
{
var geInfo = document.getElementById('geInfo');
if (geInfo != null)
{
geInfo.parentNode.removeChild(geInfo);
}
}
// Redirects to the latest AWS icons
if (document.referrer != null && urlParams['libs'] == 'aws3' &&
document.referrer.substring(0, 42) == 'https://aws.amazon.com/architecture/icons/')
{
urlParams['libs'] = 'aws4';
}
if (window.mxscript != null)
{
// Injects offline dependencies
if (urlParams['offline'] == '1' || urlParams['appcache'] == '1')
{
mxscript('js/shapes.min.js');
mxscript('js/stencils.min.js');
mxscript('js/extensions.min.js');
var frame = document.createElement('iframe');
frame.setAttribute('width', '0');
frame.setAttribute('height', '0');
frame.setAttribute('src', 'offline.html');
document.body.appendChild(frame);
}
// Loads Pusher API
if (!mxClient.IS_CHROMEAPP && !EditorUi.isElectronApp && DrawioFile.SYNC == 'auto')
{
// TODO: Check if async loading is fast enough
mxscript(App.PUSHER_URL);
}
// Loads plugins
if (urlParams['plugins'] != '0' && urlParams['offline'] != '1')
{
// mxSettings is not yet initialized in configure mode, redirect parameter
// to p URL parameter in caller for plugins in embed mode
var plugins = (mxSettings.settings != null) ? mxSettings.getPlugins() : null;
var temp = urlParams['p'];
App.initPluginCallback();
if (temp != null)
{
// Mapping from key to URL in App.plugins
App.loadPlugins(temp.split(';'));
}
if (plugins != null && plugins.length > 0 && urlParams['plugins'] != '0')
{
// Loading plugins inside the asynchronous block below stops the page from loading so a
// hardcoded message for the warning dialog is used since the resources are loadd below
var warning = 'The page has requested to load the following plugin(s):\n \n {1}\n \n Would you like to load these plugin(s) now?\n \n NOTE : Only allow plugins to run if you fully understand the security implications of doing so.\n';
var tmp = window.location.protocol + '//' + window.location.host;
var local = true;
for (var i = 0; i < plugins.length && local; i++)
{
if (plugins[i].charAt(0) != '/' && plugins[i].substring(0, tmp.length) != tmp)
{
local = false;
}
}
if (local || mxUtils.confirm(mxResources.replacePlaceholders(warning, [plugins.join('\n')]).replace(/\\n/g, '\n')))
{
for (var i = 0; i < plugins.length; i++)
{
try
{
if (App.pluginsLoaded[plugins[i]] == null)
{
App.pluginsLoaded[plugins[i]] = true;
mxscript(plugins[i]);
}
}
catch (e)
{
// ignore
}
}
}
}
}
// Loads gapi for all browsers but IE8 and below if not disabled or if enabled and in embed mode
// Special case: Cannot load in asynchronous code below
if (typeof window.DriveClient === 'function' &&
(typeof gapi === 'undefined' && (((urlParams['embed'] != '1' && urlParams['gapi'] != '0') ||
(urlParams['embed'] == '1' && urlParams['gapi'] == '1')) && isSvgBrowser &&
isLocalStorage && (document.documentMode == null || document.documentMode >= 10))))
{
mxscript('https://apis.google.com/js/api.js?onload=DrawGapiClientCallback', null, null, null, mxClient.IS_SVG);
}
// Disables client
else if (typeof window.gapi === 'undefined')
{
window.DriveClient = null;
}
}
/**
* Asynchronous MathJax extension.
*/
if (urlParams['math'] != '0')
{
Editor.initMath();
}
function doLoad(bundle)
{
// Prefetches asynchronous requests so that below code runs synchronous
// Loading the correct bundle (one file) via the fallback system in mxResources. The stylesheet
// is compiled into JS in the build process and is only needed for local development.
mxUtils.getAll((urlParams['dev'] != '1') ? [bundle] : [bundle,
STYLE_PATH + '/default.xml', STYLE_PATH + '/dark-default.xml'], function(xhr)
{
// Adds bundle text to resources
mxResources.parse(xhr[0].getText());
// Prepares themes with mapping from old default-style to old XML file
if (xhr.length > 2)
{
Graph.prototype.defaultThemes['default-style2'] = xhr[1].getDocumentElement();
Graph.prototype.defaultThemes['darkTheme'] = xhr[2].getDocumentElement();
}
// Main
var ui = (createUi != null) ? createUi() : new App(new Editor(
urlParams['chrome'] == '0' || uiTheme == 'min',
null, null, null, urlParams['chrome'] != '0'));
if (window.mxscript != null)
{
// Loads dropbox for all browsers but IE8 and below (no CORS) if not disabled or if enabled and in embed mode
// KNOWN: Picker does not work in IE11 (https://dropbox.zendesk.com/requests/1650781)
if (typeof window.DropboxClient === 'function' &&
(window.Dropbox == null && window.DrawDropboxClientCallback != null &&
(((urlParams['embed'] != '1' && urlParams['db'] != '0') ||
(urlParams['embed'] == '1' && urlParams['db'] == '1')) &&
isSvgBrowser && (document.documentMode == null || document.documentMode > 9))))
{
mxscript(App.DROPBOX_URL, function()
{
// Must load this after the dropbox SDK since they use the same namespace
mxscript(App.DROPINS_URL, function()
{
DrawDropboxClientCallback();
}, 'dropboxjs', App.DROPBOX_APPKEY);
});
}
// Disables client
else if (typeof window.Dropbox === 'undefined' || typeof window.Dropbox.choose === 'undefined')
{
window.DropboxClient = null;
}
// Loads OneDrive for all browsers but IE6/IOS if not disabled or if enabled and in embed mode
if (typeof window.OneDriveClient === 'function' &&
(typeof OneDrive === 'undefined' && window.DrawOneDriveClientCallback != null &&
(((urlParams['embed'] != '1' && urlParams['od'] != '0') || (urlParams['embed'] == '1' &&
urlParams['od'] == '1')) && (navigator.userAgent.indexOf('MSIE') < 0 || document.documentMode >= 10))))
{
mxscript(App.ONEDRIVE_URL, window.DrawOneDriveClientCallback);
}
// Disables client
else if (typeof window.OneDrive === 'undefined')
{
window.OneDriveClient = null;
}
// Loads Trello for all browsers but < IE10 if not disabled or if enabled and in embed mode
if (typeof window.TrelloClient === 'function' &&
(typeof window.Trello === 'undefined' && window.DrawTrelloClientCallback != null &&
(((urlParams['embed'] != '1' && urlParams['tr'] != '0') || (urlParams['embed'] == '1' &&
urlParams['tr'] == '1')) && (navigator.userAgent.indexOf('MSIE') < 0 || document.documentMode >= 10))))
{
mxscript(App.TRELLO_JQUERY_URL, function()
{
// Must load this after the dropbox SDK since they use the same namespace
mxscript(App.TRELLO_URL, function()
{
DrawTrelloClientCallback();
});
});
}
// Disables client
else if (typeof window.Trello === 'undefined')
{
window.TrelloClient = null;
}
}
if (callback != null)
{
callback(ui);
}
/**
* For developers only
*/
if (urlParams['chrome'] != '0' && urlParams['test'] == '1')
{
EditorUi.debug('Started in ' + (new Date().getTime() - t0.getTime()) + 'ms');
if (urlParams['export'] != null)
{
EditorUi.debug('Export:', EXPORT_URL);
}
}
}, function(xhr)
{
var st = document.getElementById('geStatus');
if (st != null)
{
st.innerHTML = 'Error loading page. <a>Please try refreshing.</a>';
// Tries reload with default resources in case any language resources were not available
st.getElementsByTagName('a')[0].onclick = function()
{
mxLanguage = 'en';
doLoad(mxResources.getDefaultBundle(RESOURCE_BASE, mxLanguage) ||
mxResources.getSpecialBundle(RESOURCE_BASE, mxLanguage));
};
}
});
};
function doMain()
{
// Adds required resources (disables loading of fallback properties, this can only
// be used if we know that all keys are defined in the language specific file)
mxResources.loadDefaultBundle = false;
doLoad(mxResources.getDefaultBundle(RESOURCE_BASE, mxLanguage) ||
mxResources.getSpecialBundle(RESOURCE_BASE, mxLanguage));
};
// Sends load event if configuration is requested and waits for configure action
if (urlParams['configure'] == '1')
{
var op = window.opener || window.parent;
var configHandler = function(evt)
{
if (evt.source == op)
{
try
{
var data = JSON.parse(evt.data);
if (data != null && data.action == 'configure')
{
mxEvent.removeListener(window, 'message', configHandler);
Editor.configure(data.config, true);
mxSettings.load();
doMain();
}
}
catch (e)
{
if (window.console != null)
{
console.log('Error in configuration: ' + e);
}
}
}
};
// Receives XML message from opener and puts it into the graph
mxEvent.addListener(window, 'message', configHandler);
op.postMessage(JSON.stringify({event: 'configure'}), '*');
}
else
{
doMain();
}
};
//Extends EditorUi
mxUtils.extend(App, EditorUi);
/**
* Executes the first step for connecting to Google Drive.
*/
App.prototype.defaultUserPicture = 'https://lh3.googleusercontent.com/-HIzvXUy6QUY/AAAAAAAAAAI/AAAAAAAAAAA/giuR7PQyjEk/photo.jpg?sz=30';
/**
*
*/
App.prototype.shareImage = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA2RpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYwIDYxLjEzNDc3NywgMjAxMC8wMi8xMi0xNzozMjowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLz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AAACdFJOU/8A5bcwSgAAAB9JREFUeNpiYEQDDEQJMMABTAAmNdAC6A4j0XMAAQYAcbwA1Xvj1CgAAAAASUVORK5CYII=';
/**
*
*/
App.prototype.fullscreenImage = (!mxClient.IS_SVG) ? IMAGE_PATH + '/fullscreen.png' : 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAABlBMVEUAAAAAAAClZ7nPAAAAAXRSTlMAQObYZgAAABpJREFUCNdjgAAbGxAy4AEh5gNwBBGByoIBAIueBd12TUjqAAAAAElFTkSuQmCC';
/**
* Overriden UI settings depending on mode.
*/
if (urlParams['embed'] != '1')
{
App.prototype.menubarHeight = 60;
}
else
{
App.prototype.footerHeight = 0;
}
/**
* Queue for loading plugins and wait for UI instance
*/
App.initPluginCallback = function()
{
if (App.DrawPlugins == null)
{
// Workaround for need to load plugins now but wait for UI instance
App.DrawPlugins = [];
// Global entry point for plugins is Draw.loadPlugin. This is the only
// long-term supported solution for access to the EditorUi instance.
window.Draw = new Object();
window.Draw.loadPlugin = function(callback)
{
App.DrawPlugins.push(callback);
};
}
};
/**
*
*/
App.pluginsLoaded = {};
/**
* Queue for loading plugins and wait for UI instance
*/
App.loadPlugins = function(plugins, useInclude)
{
for (var i = 0; i < plugins.length; i++)
{
if (plugins[i] != null && plugins[i].length > 0)
{
try
{
var url = App.pluginRegistry[plugins[i]];
if (url != null)
{
if (App.pluginsLoaded[url] == null)
{
App.pluginsLoaded[url] = true;
if (typeof window.drawDevUrl === 'undefined')
{
if (useInclude)
{
mxinclude(url);
}
else
{
mxscript(url);
}
}
else
{
if (useInclude)
{
mxinclude(url);
}
else
{
mxscript(drawDevUrl + url);
}
}
}
}
else if (window.console != null)
{
console.log('Unknown plugin:', plugins[i]);
}
}
catch (e)
{
if (window.console != null)
{
console.log('Error loading plugin:', plugins[i], e);
}
}
}
}
};
/**
* Translates this point by the given vector.
*
* @param {number} dx X-coordinate of the translation.
* @param {number} dy Y-coordinate of the translation.
*/
App.prototype.init = function()
{
EditorUi.prototype.init.apply(this, arguments);
/**
* Specifies the default filename.
*/
this.defaultLibraryName = mxResources.get('untitledLibrary');
/**
* Holds the listener for description changes.
*/
this.descriptorChangedListener = mxUtils.bind(this, this.descriptorChanged);
/**
* Creates github client.
*/
this.gitHub = (!mxClient.IS_IE || document.documentMode == 10 ||
mxClient.IS_IE11 || mxClient.IS_EDGE) &&
(urlParams['gh'] != '0' && (urlParams['embed'] != '1' ||
urlParams['gh'] == '1')) ? new GitHubClient(this) : null;
if (this.gitHub != null)
{
this.gitHub.addListener('userChanged', mxUtils.bind(this, function()
{
this.updateUserElement();
this.restoreLibraries();
}))
}
/**
* Lazy-loading for individual backends
*/
if (urlParams['embed'] != '1' || urlParams['od'] == '1')
{
/**
* Creates onedrive client if all required libraries are available.
*/
var initOneDriveClient = mxUtils.bind(this, function()
{
if (typeof OneDrive !== 'undefined')
{
/**
* Holds the x-coordinate of the point.
*/
this.oneDrive = new OneDriveClient(this);
this.oneDrive.addListener('userChanged', mxUtils.bind(this, function()
{
this.updateUserElement();
this.restoreLibraries();
}));
// Notifies listeners of new client
this.fireEvent(new mxEventObject('clientLoaded', 'client', this.oneDrive));
}
else if (window.DrawOneDriveClientCallback == null)
{
window.DrawOneDriveClientCallback = initOneDriveClient;
}
});
initOneDriveClient();
}
/**
* Lazy-loading for Trello
*/
if (urlParams['embed'] != '1' || urlParams['tr'] == '1')
{
/**
* Creates Trello client if all required libraries are available.
*/
var initTrelloClient = mxUtils.bind(this, function()
{
if (typeof window.Trello !== 'undefined')
{
this.trello = new TrelloClient(this);
//TODO we have no user info from Trello so we don't set a user
this.trello.addListener('userChanged', mxUtils.bind(this, function()
{
this.updateUserElement();
this.restoreLibraries();
}));
// Notifies listeners of new client
this.fireEvent(new mxEventObject('clientLoaded', 'client', this.trello));
}
else if (window.DrawTrelloClientCallback == null)
{
window.DrawTrelloClientCallback = initTrelloClient;
}
});
initTrelloClient();
}
/**
* Creates drive client with all required libraries are available.
*/
if (urlParams['embed'] != '1' || urlParams['gapi'] == '1')