Commit e3604567fafd5d9226acb782653c2b2c9eb02c35

Authored by ww
1 parent 1c917a32

chore: 格式化文件

Showing 1 changed file with 297 additions and 562 deletions
@@ -65,8 +65,7 @@ App = function (editor, container, lightbox) { @@ -65,8 +65,7 @@ App = function (editor, container, lightbox) {
65 // Pre-fetches images 65 // Pre-fetches images
66 if (mxClient.IS_SVG) { 66 if (mxClient.IS_SVG) {
67 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='; 67 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=';
68 - }  
69 - else { 68 + } else {
70 var img = new Image(); 69 var img = new Image();
71 img.src = mxGraph.prototype.warningImage.src; 70 img.src = mxGraph.prototype.warningImage.src;
72 } 71 }
@@ -82,15 +81,13 @@ App = function (editor, container, lightbox) { @@ -82,15 +81,13 @@ App = function (editor, container, lightbox) {
82 81
83 try { 82 try {
84 wnd = window.open(url); 83 wnd = window.open(url);
85 - }  
86 - catch (e) { 84 + } catch (e) {
87 // ignore 85 // ignore
88 } 86 }
89 87
90 if (wnd == null || wnd === undefined) { 88 if (wnd == null || wnd === undefined) {
91 this.showDialog(new PopupDialog(this, url, pre, fallback).container, 320, 140, true, true); 89 this.showDialog(new PopupDialog(this, url, pre, fallback).container, 320, 140, true, true);
92 - }  
93 - else if (pre != null) { 90 + } else if (pre != null) {
94 pre(); 91 pre();
95 } 92 }
96 }); 93 });
@@ -119,13 +116,11 @@ App = function (editor, container, lightbox) { @@ -119,13 +116,11 @@ App = function (editor, container, lightbox) {
119 for (var i = 0; i < App.DrawPlugins.length; i++) { 116 for (var i = 0; i < App.DrawPlugins.length; i++) {
120 try { 117 try {
121 App.DrawPlugins[i](this); 118 App.DrawPlugins[i](this);
122 - }  
123 - catch (e) { 119 + } catch (e) {
124 if (window.console != null) { 120 if (window.console != null) {
125 console.log('Plugin Error:', e, App.DrawPlugins[i]); 121 console.log('Plugin Error:', e, App.DrawPlugins[i]);
126 } 122 }
127 - }  
128 - finally { 123 + } finally {
129 App.embedModePluginsCount--; 124 App.embedModePluginsCount--;
130 this.initializeEmbedMode(); 125 this.initializeEmbedMode();
131 } 126 }
@@ -135,8 +130,7 @@ App = function (editor, container, lightbox) { @@ -135,8 +130,7 @@ App = function (editor, container, lightbox) {
135 window.Draw.loadPlugin = mxUtils.bind(this, function (callback) { 130 window.Draw.loadPlugin = mxUtils.bind(this, function (callback) {
136 try { 131 try {
137 callback(this); 132 callback(this);
138 - }  
139 - finally { 133 + } finally {
140 App.embedModePluginsCount--; 134 App.embedModePluginsCount--;
141 this.initializeEmbedMode(); 135 this.initializeEmbedMode();
142 } 136 }
@@ -425,8 +419,7 @@ App.getStoredMode = function () { @@ -425,8 +419,7 @@ App.getStoredMode = function () {
425 // Disables loading of client 419 // Disables loading of client
426 window.DriveClient = null; 420 window.DriveClient = null;
427 } 421 }
428 - }  
429 - else { 422 + } else {
430 // Disables loading of client 423 // Disables loading of client
431 window.DriveClient = null; 424 window.DriveClient = null;
432 } 425 }
@@ -444,12 +437,10 @@ App.getStoredMode = function () { @@ -444,12 +437,10 @@ App.getStoredMode = function () {
444 // Must load this after the dropbox SDK since they use the same namespace 437 // Must load this after the dropbox SDK since they use the same namespace
445 mxscript(App.DROPINS_URL, null, 'dropboxjs', App.DROPBOX_APPKEY, true); 438 mxscript(App.DROPINS_URL, null, 'dropboxjs', App.DROPBOX_APPKEY, true);
446 }); 439 });
447 - }  
448 - else if (urlParams['chrome'] == '0') { 440 + } else if (urlParams['chrome'] == '0') {
449 window.DropboxClient = null; 441 window.DropboxClient = null;
450 } 442 }
451 - }  
452 - else { 443 + } else {
453 // Disables loading of client 444 // Disables loading of client
454 window.DropboxClient = null; 445 window.DropboxClient = null;
455 } 446 }
@@ -464,12 +455,10 @@ App.getStoredMode = function () { @@ -464,12 +455,10 @@ App.getStoredMode = function () {
464 window.location.hash.substring(0, 2) == '#W')) { 455 window.location.hash.substring(0, 2) == '#W')) {
465 //Editor.oneDriveInlinePicker can be set with configuration which is done later, so load it all time 456 //Editor.oneDriveInlinePicker can be set with configuration which is done later, so load it all time
466 mxscript(App.ONEDRIVE_URL); 457 mxscript(App.ONEDRIVE_URL);
467 - }  
468 - else if (urlParams['chrome'] == '0') { 458 + } else if (urlParams['chrome'] == '0') {
469 window.OneDriveClient = null; 459 window.OneDriveClient = null;
470 } 460 }
471 - }  
472 - else { 461 + } else {
473 // Disables loading of client 462 // Disables loading of client
474 window.OneDriveClient = null; 463 window.OneDriveClient = null;
475 } 464 }
@@ -485,12 +474,10 @@ App.getStoredMode = function () { @@ -485,12 +474,10 @@ App.getStoredMode = function () {
485 mxscript(App.TRELLO_JQUERY_URL, function () { 474 mxscript(App.TRELLO_JQUERY_URL, function () {
486 mxscript(App.TRELLO_URL); 475 mxscript(App.TRELLO_URL);
487 }); 476 });
488 - }  
489 - else if (urlParams['chrome'] == '0') { 477 + } else if (urlParams['chrome'] == '0') {
490 window.TrelloClient = null; 478 window.TrelloClient = null;
491 } 479 }
492 - }  
493 - else { 480 + } else {
494 // Disables loading of client 481 // Disables loading of client
495 window.TrelloClient = null; 482 window.TrelloClient = null;
496 } 483 }
@@ -530,7 +517,7 @@ App.main = function (callback, createUi) { @@ -530,7 +517,7 @@ App.main = function (callback, createUi) {
530 // 应用启动入口时创建一个axios实例,供全局使用 517 // 应用启动入口时创建一个axios实例,供全局使用
531 defHttp = createAxios({ 518 defHttp = createAxios({
532 timeout: 10 * 1000, 519 timeout: 10 * 1000,
533 - baseURL: '/api', 520 + baseURL: '/api'
534 }) 521 })
535 // Logs uncaught errors 522 // Logs uncaught errors
536 window.onerror = function (message, url, linenumber, colno, err) { 523 window.onerror = function (message, url, linenumber, colno, err) {
@@ -605,13 +592,11 @@ App.main = function (callback, createUi) { @@ -605,13 +592,11 @@ App.main = function (callback, createUi) {
605 alert('Cache cleared'); 592 alert('Cache cleared');
606 } 593 }
607 }); 594 });
608 - }  
609 - else if (Editor.enableServiceWorker) { 595 + } else if (Editor.enableServiceWorker) {
610 // Runs as progressive web app if service workers are supported 596 // Runs as progressive web app if service workers are supported
611 navigator.serviceWorker.register('/service-worker.js'); 597 navigator.serviceWorker.register('/service-worker.js');
612 } 598 }
613 - }  
614 - catch (e) { 599 + } catch (e) {
615 if (window.console != null) { 600 if (window.console != null) {
616 console.error(e); 601 console.error(e);
617 } 602 }
@@ -646,8 +631,7 @@ App.main = function (callback, createUi) { @@ -646,8 +631,7 @@ App.main = function (callback, createUi) {
646 if (temp != null) { 631 if (temp != null) {
647 plugins = temp.plugins; 632 plugins = temp.plugins;
648 } 633 }
649 - }  
650 - catch (e) { 634 + } catch (e) {
651 // ignore 635 // ignore
652 } 636 }
653 } 637 }
@@ -686,8 +670,7 @@ App.main = function (callback, createUi) { @@ -686,8 +670,7 @@ App.main = function (callback, createUi) {
686 670
687 mxscript(plugins[i]); 671 mxscript(plugins[i]);
688 } 672 }
689 - }  
690 - catch (e) { 673 + } catch (e) {
691 // ignore 674 // ignore
692 } 675 }
693 } 676 }
@@ -766,13 +749,11 @@ App.main = function (callback, createUi) { @@ -766,13 +749,11 @@ App.main = function (callback, createUi) {
766 } 749 }
767 750
768 value = config; 751 value = config;
769 - }  
770 - catch (e) { 752 + } catch (e) {
771 window.location.hash = ''; 753 window.location.hash = '';
772 alert(e); 754 alert(e);
773 } 755 }
774 - }  
775 - else { 756 + } else {
776 value = value.merge; 757 value = value.merge;
777 } 758 }
778 } 759 }
@@ -786,8 +767,7 @@ App.main = function (callback, createUi) { @@ -786,8 +767,7 @@ App.main = function (callback, createUi) {
786 } 767 }
787 768
788 window.location.hash = ''; 769 window.location.hash = '';
789 - }  
790 - catch (e) { 770 + } catch (e) {
791 window.location.hash = ''; 771 window.location.hash = '';
792 alert(e); 772 alert(e);
793 } 773 }
@@ -877,8 +857,7 @@ App.main = function (callback, createUi) { @@ -877,8 +857,7 @@ App.main = function (callback, createUi) {
877 if (urlParams['dev'] == '1' || EditorUi.isElectronApp) //TODO check if we can remove these scripts loading from index.html 857 if (urlParams['dev'] == '1' || EditorUi.isElectronApp) //TODO check if we can remove these scripts loading from index.html
878 { 858 {
879 realMain(); 859 realMain();
880 - }  
881 - else { 860 + } else {
882 mxStencilRegistry.allowEval = false; 861 mxStencilRegistry.allowEval = false;
883 let loadScriptList = [ 862 let loadScriptList = [
884 'js/shapes-14-6-5.min.js', 863 'js/shapes-14-6-5.min.js',
@@ -926,8 +905,7 @@ App.main = function (callback, createUi) { @@ -926,8 +905,7 @@ App.main = function (callback, createUi) {
926 if (!isNaN(val) && val > 0) { 905 if (!isNaN(val) && val > 0) {
927 DrawioFile.prototype.autosaveDelay = val; 906 DrawioFile.prototype.autosaveDelay = val;
928 EditorUi.debug('Setting autosaveDelay', val); 907 EditorUi.debug('Setting autosaveDelay', val);
929 - }  
930 - else { 908 + } else {
931 EditorUi.debug('Invalid autosaveDelay', val); 909 EditorUi.debug('Invalid autosaveDelay', val);
932 } 910 }
933 } 911 }
@@ -938,14 +916,12 @@ App.main = function (callback, createUi) { @@ -938,14 +916,12 @@ App.main = function (callback, createUi) {
938 if (!isNaN(val) && val > 0) { 916 if (!isNaN(val) && val > 0) {
939 Graph.prototype.defaultEdgeLength = val; 917 Graph.prototype.defaultEdgeLength = val;
940 EditorUi.debug('Using defaultEdgeLength', val); 918 EditorUi.debug('Using defaultEdgeLength', val);
941 - }  
942 - else { 919 + } else {
943 EditorUi.debug('Invalid defaultEdgeLength', val); 920 EditorUi.debug('Invalid defaultEdgeLength', val);
944 } 921 }
945 } 922 }
946 } 923 }
947 - }  
948 - catch (e) { 924 + } catch (e) {
949 if (window.console != null) { 925 if (window.console != null) {
950 console.error(e); 926 console.error(e);
951 } 927 }
@@ -986,8 +962,7 @@ App.main = function (callback, createUi) { @@ -986,8 +962,7 @@ App.main = function (callback, createUi) {
986 mxSettings.load(); 962 mxSettings.load();
987 doMain(); 963 doMain();
988 } 964 }
989 - }  
990 - catch (e) { 965 + } catch (e) {
991 if (window.console != null) { 966 if (window.console != null) {
992 console.log('Error in configure message: ' + e, evt.data); 967 console.log('Error in configure message: ' + e, evt.data);
993 } 968 }
@@ -998,8 +973,7 @@ App.main = function (callback, createUi) { @@ -998,8 +973,7 @@ App.main = function (callback, createUi) {
998 // Receives XML message from opener and puts it into the graph 973 // Receives XML message from opener and puts it into the graph
999 mxEvent.addListener(window, 'message', configHandler); 974 mxEvent.addListener(window, 'message', configHandler);
1000 op.postMessage(JSON.stringify({ event: 'configure' }), '*'); 975 op.postMessage(JSON.stringify({ event: 'configure' }), '*');
1001 - }  
1002 - else { 976 + } else {
1003 if (Editor.config == null) { 977 if (Editor.config == null) {
1004 // Loads configuration from global scope or local storage 978 // Loads configuration from global scope or local storage
1005 if (window.DRAWIO_CONFIG != null) { 979 if (window.DRAWIO_CONFIG != null) {
@@ -1007,8 +981,7 @@ App.main = function (callback, createUi) { @@ -1007,8 +981,7 @@ App.main = function (callback, createUi) {
1007 EditorUi.debug('Using global configuration', window.DRAWIO_CONFIG); 981 EditorUi.debug('Using global configuration', window.DRAWIO_CONFIG);
1008 Editor.configure(window.DRAWIO_CONFIG); 982 Editor.configure(window.DRAWIO_CONFIG);
1009 mxSettings.load(); 983 mxSettings.load();
1010 - }  
1011 - catch (e) { 984 + } catch (e) {
1012 if (window.console != null) { 985 if (window.console != null) {
1013 console.error(e); 986 console.error(e);
1014 } 987 }
@@ -1028,8 +1001,7 @@ App.main = function (callback, createUi) { @@ -1028,8 +1001,7 @@ App.main = function (callback, createUi) {
1028 Editor.configure(configData); 1001 Editor.configure(configData);
1029 mxSettings.load(); 1002 mxSettings.load();
1030 } 1003 }
1031 - }  
1032 - catch (e) { 1004 + } catch (e) {
1033 if (window.console != null) { 1005 if (window.console != null) {
1034 console.error(e); 1006 console.error(e);
1035 } 1007 }
@@ -1101,8 +1073,7 @@ App.prototype.fullscreenMode = false; @@ -1101,8 +1073,7 @@ App.prototype.fullscreenMode = false;
1101 */ 1073 */
1102 if (urlParams['embed'] != '1') { 1074 if (urlParams['embed'] != '1') {
1103 App.prototype.menubarHeight = 64; 1075 App.prototype.menubarHeight = 64;
1104 -}  
1105 -else { 1076 +} else {
1106 App.prototype.footerHeight = 0; 1077 App.prototype.footerHeight = 0;
1107 } 1078 }
1108 1079
@@ -1148,26 +1119,21 @@ App.loadPlugins = function (plugins, useInclude) { @@ -1148,26 +1119,21 @@ App.loadPlugins = function (plugins, useInclude) {
1148 if (typeof window.drawDevUrl === 'undefined') { 1119 if (typeof window.drawDevUrl === 'undefined') {
1149 if (useInclude) { 1120 if (useInclude) {
1150 mxinclude(url); 1121 mxinclude(url);
1151 - }  
1152 - else { 1122 + } else {
1153 mxscript(url); 1123 mxscript(url);
1154 } 1124 }
1155 - }  
1156 - else { 1125 + } else {
1157 if (useInclude) { 1126 if (useInclude) {
1158 mxinclude(url); 1127 mxinclude(url);
1159 - }  
1160 - else { 1128 + } else {
1161 mxscript(drawDevUrl + url); 1129 mxscript(drawDevUrl + url);
1162 } 1130 }
1163 } 1131 }
1164 } 1132 }
1165 - }  
1166 - else if (window.console != null) { 1133 + } else if (window.console != null) {
1167 console.log('Unknown plugin:', plugins[i]); 1134 console.log('Unknown plugin:', plugins[i]);
1168 } 1135 }
1169 - }  
1170 - catch (e) { 1136 + } catch (e) {
1171 if (window.console != null) { 1137 if (window.console != null) {
1172 console.log('Error loading plugin:', plugins[i], e); 1138 console.log('Error loading plugin:', plugins[i], e);
1173 } 1139 }
@@ -1188,8 +1154,7 @@ App.prototype.initializeEmbedMode = function () { @@ -1188,8 +1154,7 @@ App.prototype.initializeEmbedMode = function () {
1188 1154
1189 if (App.embedModePluginsCount > 0 || this.initEmbedDone) { 1155 if (App.embedModePluginsCount > 0 || this.initEmbedDone) {
1190 return; //Wait for plugins to load, or this is a duplicate call due to timeout 1156 return; //Wait for plugins to load, or this is a duplicate call due to timeout
1191 - }  
1192 - else { 1157 + } else {
1193 this.initEmbedDone = true; 1158 this.initEmbedDone = true;
1194 } 1159 }
1195 1160
@@ -1212,7 +1177,7 @@ App.prototype.initializeViewerMode = function () { @@ -1212,7 +1177,7 @@ App.prototype.initializeViewerMode = function () {
1212 1177
1213 /** 1178 /**
1214 * Translates this point by the given vector. 1179 * Translates this point by the given vector.
1215 - * 原型初始化,所有的原型调用此方法初始化 1180 + * 原型初始化,所有的原型调用此方法初始化
1216 * @param {number} dx X-coordinate of the translation. 1181 * @param {number} dx X-coordinate of the translation.
1217 * @param {number} dy Y-coordinate of the translation. 1182 * @param {number} dy Y-coordinate of the translation.
1218 */ 1183 */
@@ -1280,8 +1245,7 @@ App.prototype.init = function () { @@ -1280,8 +1245,7 @@ App.prototype.init = function () {
1280 1245
1281 // Notifies listeners of new client 1246 // Notifies listeners of new client
1282 this.fireEvent(new mxEventObject('clientLoaded', 'client', this.oneDrive)); 1247 this.fireEvent(new mxEventObject('clientLoaded', 'client', this.oneDrive));
1283 - }  
1284 - else if (window.DrawOneDriveClientCallback == null) { 1248 + } else if (window.DrawOneDriveClientCallback == null) {
1285 window.DrawOneDriveClientCallback = initOneDriveClient; 1249 window.DrawOneDriveClientCallback = initOneDriveClient;
1286 } 1250 }
1287 }); 1251 });
@@ -1309,14 +1273,12 @@ App.prototype.init = function () { @@ -1309,14 +1273,12 @@ App.prototype.init = function () {
1309 1273
1310 // Notifies listeners of new client 1274 // Notifies listeners of new client
1311 this.fireEvent(new mxEventObject('clientLoaded', 'client', this.trello)); 1275 this.fireEvent(new mxEventObject('clientLoaded', 'client', this.trello));
1312 - }  
1313 - catch (e) { 1276 + } catch (e) {
1314 if (window.console != null) { 1277 if (window.console != null) {
1315 console.error(e); 1278 console.error(e);
1316 } 1279 }
1317 } 1280 }
1318 - }  
1319 - else if (window.DrawTrelloClientCallback == null) { 1281 + } else if (window.DrawTrelloClientCallback == null) {
1320 window.DrawTrelloClientCallback = initTrelloClient; 1282 window.DrawTrelloClientCallback = initTrelloClient;
1321 } 1283 }
1322 }); 1284 });
@@ -1353,12 +1315,10 @@ App.prototype.init = function () { @@ -1353,12 +1315,10 @@ App.prototype.init = function () {
1353 * Clears any callbacks. 1315 * Clears any callbacks.
1354 */ 1316 */
1355 window.DrawGapiClientCallback = null; 1317 window.DrawGapiClientCallback = null;
1356 - }  
1357 - else { 1318 + } else {
1358 doInit(); 1319 doInit();
1359 } 1320 }
1360 - }  
1361 - else if (window.DrawGapiClientCallback == null) { 1321 + } else if (window.DrawGapiClientCallback == null) {
1362 window.DrawGapiClientCallback = initDriveClient; 1322 window.DrawGapiClientCallback = initDriveClient;
1363 } 1323 }
1364 }); 1324 });
@@ -1390,14 +1350,12 @@ App.prototype.init = function () { @@ -1390,14 +1350,12 @@ App.prototype.init = function () {
1390 1350
1391 // Notifies listeners of new client 1351 // Notifies listeners of new client
1392 this.fireEvent(new mxEventObject('clientLoaded', 'client', this.dropbox)); 1352 this.fireEvent(new mxEventObject('clientLoaded', 'client', this.dropbox));
1393 - }  
1394 - catch (e) { 1353 + } catch (e) {
1395 if (window.console != null) { 1354 if (window.console != null) {
1396 console.error(e); 1355 console.error(e);
1397 } 1356 }
1398 } 1357 }
1399 - }  
1400 - else if (window.DrawDropboxClientCallback == null) { 1358 + } else if (window.DrawDropboxClientCallback == null) {
1401 window.DrawDropboxClientCallback = initDropboxClient; 1359 window.DrawDropboxClientCallback = initDropboxClient;
1402 } 1360 }
1403 }); 1361 });
@@ -1420,8 +1378,7 @@ App.prototype.init = function () { @@ -1420,8 +1378,7 @@ App.prototype.init = function () {
1420 // Sets the initial mode 1378 // Sets the initial mode
1421 if (urlParams['local'] == '1') { 1379 if (urlParams['local'] == '1') {
1422 this.setMode(App.MODE_DEVICE); 1380 this.setMode(App.MODE_DEVICE);
1423 - }  
1424 - else { 1381 + } else {
1425 this.mode = App.mode; 1382 this.mode = App.mode;
1426 } 1383 }
1427 1384
@@ -1445,8 +1402,7 @@ App.prototype.init = function () { @@ -1445,8 +1402,7 @@ App.prototype.init = function () {
1445 if (urlParams['extAuth'] != '1' && (mode == App.MODE_DEVICE || mode == App.MODE_BROWSER)) { 1402 if (urlParams['extAuth'] != '1' && (mode == App.MODE_DEVICE || mode == App.MODE_BROWSER)) {
1446 //关闭桌面弹出广告 1403 //关闭桌面弹出广告
1447 //this.showDownloadDesktopBanner(); 1404 //this.showDownloadDesktopBanner();
1448 - }  
1449 - else if (urlParams['embed'] != '1' && this.getServiceName() == 'draw.io') { 1405 + } else if (urlParams['embed'] != '1' && this.getServiceName() == 'draw.io') {
1450 // just app.diagrams.net users 1406 // just app.diagrams.net users
1451 // this.showNameConfBanner(); 1407 // this.showNameConfBanner();
1452 } 1408 }
@@ -1485,8 +1441,7 @@ App.prototype.init = function () { @@ -1485,8 +1441,7 @@ App.prototype.init = function () {
1485 window.clearTimeout(timeoutThread); 1441 window.clearTimeout(timeoutThread);
1486 })); 1442 }));
1487 } 1443 }
1488 - }  
1489 - else if (this.menubar != null) { 1444 + } else if (this.menubar != null) {
1490 this.menubar.container.style.paddingTop = '0px'; 1445 this.menubar.container.style.paddingTop = '0px';
1491 } 1446 }
1492 1447
@@ -1823,8 +1778,7 @@ App.prototype.checkLicense = function () { @@ -1823,8 +1778,7 @@ App.prototype.checkLicense = function () {
1823 } 1778 }
1824 } 1779 }
1825 } 1780 }
1826 - }  
1827 - catch (e) { 1781 + } catch (e) {
1828 // ignore 1782 // ignore
1829 } 1783 }
1830 })); 1784 }));
@@ -1848,8 +1802,7 @@ App.prototype.getEditBlankXml = function () { @@ -1848,8 +1802,7 @@ App.prototype.getEditBlankXml = function () {
1848 1802
1849 if (file != null && this.editor.isChromelessView() && this.editor.graph.isLightboxView()) { 1803 if (file != null && this.editor.isChromelessView() && this.editor.graph.isLightboxView()) {
1850 return file.getData(); 1804 return file.getData();
1851 - }  
1852 - else { 1805 + } else {
1853 return this.getFileData(true); 1806 return this.getFileData(true);
1854 } 1807 }
1855 }; 1808 };
@@ -1872,8 +1825,7 @@ App.prototype.addRecent = function (entry) { @@ -1872,8 +1825,7 @@ App.prototype.addRecent = function (entry) {
1872 1825
1873 if (recent == null) { 1826 if (recent == null) {
1874 recent = []; 1827 recent = [];
1875 - }  
1876 - else { 1828 + } else {
1877 for (var i = 0; i < recent.length; i++) { 1829 for (var i = 0; i < recent.length; i++) {
1878 if (recent[i].id == entry.id) { 1830 if (recent[i].id == entry.id) {
1879 recent.splice(i, 1); 1831 recent.splice(i, 1);
@@ -1900,8 +1852,7 @@ App.prototype.getRecent = function () { @@ -1900,8 +1852,7 @@ App.prototype.getRecent = function () {
1900 if (recent != null) { 1852 if (recent != null) {
1901 return JSON.parse(recent); 1853 return JSON.parse(recent);
1902 } 1854 }
1903 - }  
1904 - catch (e) { 1855 + } catch (e) {
1905 // ignore 1856 // ignore
1906 } 1857 }
1907 1858
@@ -1916,8 +1867,7 @@ App.prototype.resetRecent = function (entry) { @@ -1916,8 +1867,7 @@ App.prototype.resetRecent = function (entry) {
1916 if (isLocalStorage && localStorage != null) { 1867 if (isLocalStorage && localStorage != null) {
1917 try { 1868 try {
1918 localStorage.removeItem('.recent'); 1869 localStorage.removeItem('.recent');
1919 - }  
1920 - catch (e) { 1870 + } catch (e) {
1921 // ignore 1871 // ignore
1922 } 1872 }
1923 } 1873 }
@@ -1929,8 +1879,7 @@ App.prototype.resetRecent = function (entry) { @@ -1929,8 +1879,7 @@ App.prototype.resetRecent = function (entry) {
1929 App.prototype.onBeforeUnload = function () { 1879 App.prototype.onBeforeUnload = function () {
1930 if (urlParams['embed'] == '1' && this.editor.modified) { 1880 if (urlParams['embed'] == '1' && this.editor.modified) {
1931 return mxResources.get('allChangesLost'); 1881 return mxResources.get('allChangesLost');
1932 - }  
1933 - else { 1882 + } else {
1934 var file = this.getCurrentFile(); 1883 var file = this.getCurrentFile();
1935 1884
1936 if (file != null) { 1885 if (file != null) {
@@ -1939,11 +1888,9 @@ App.prototype.onBeforeUnload = function () { @@ -1939,11 +1888,9 @@ App.prototype.onBeforeUnload = function () {
1939 urlParams['nowarn'] != '1' && !this.isDiagramEmpty() && urlParams['url'] == null && 1888 urlParams['nowarn'] != '1' && !this.isDiagramEmpty() && urlParams['url'] == null &&
1940 !this.editor.isChromelessView() && file.fileHandle == null) { 1889 !this.editor.isChromelessView() && file.fileHandle == null) {
1941 return mxResources.get('ensureDataSaved'); 1890 return mxResources.get('ensureDataSaved');
1942 - }  
1943 - else if (file.isModified()) { 1891 + } else if (file.isModified()) {
1944 return mxResources.get('allChangesLost'); 1892 return mxResources.get('allChangesLost');
1945 - }  
1946 - else { 1893 + } else {
1947 file.close(true); 1894 file.close(true);
1948 } 1895 }
1949 } 1896 }
@@ -2023,8 +1970,7 @@ App.prototype.getThumbnail = function (width, fn) { @@ -2023,8 +1970,7 @@ App.prototype.getThumbnail = function (width, fn) {
2023 1970
2024 if (this.currentPage == page) { 1971 if (this.currentPage == page) {
2025 graph.setBackgroundImage(bgImg); 1972 graph.setBackgroundImage(bgImg);
2026 - }  
2027 - else if (page.viewState != null && page.viewState != null) { 1973 + } else if (page.viewState != null && page.viewState != null) {
2028 bgImg = page.viewState.backgroundImage; 1974 bgImg = page.viewState.backgroundImage;
2029 graph.setBackgroundImage(bgImg); 1975 graph.setBackgroundImage(bgImg);
2030 } 1976 }
@@ -2032,8 +1978,7 @@ App.prototype.getThumbnail = function (width, fn) { @@ -2032,8 +1978,7 @@ App.prototype.getThumbnail = function (width, fn) {
2032 graph.getGlobalVariable = function (name) { 1978 graph.getGlobalVariable = function (name) {
2033 if (name == 'page') { 1979 if (name == 'page') {
2034 return page.getName(); 1980 return page.getName();
2035 - }  
2036 - else if (name == 'pagenumber') { 1981 + } else if (name == 'pagenumber') {
2037 return 1; 1982 return 1;
2038 } 1983 }
2039 1984
@@ -2053,8 +1998,7 @@ App.prototype.getThumbnail = function (width, fn) { @@ -2053,8 +1998,7 @@ App.prototype.getThumbnail = function (width, fn) {
2053 if (graph != this.editor.graph && graph.container.parentNode != null) { 1998 if (graph != this.editor.graph && graph.container.parentNode != null) {
2054 graph.container.parentNode.removeChild(graph.container); 1999 graph.container.parentNode.removeChild(graph.container);
2055 } 2000 }
2056 - }  
2057 - catch (e) { 2001 + } catch (e) {
2058 canvas = null; 2002 canvas = null;
2059 } 2003 }
2060 2004
@@ -2066,8 +2010,7 @@ App.prototype.getThumbnail = function (width, fn) { @@ -2066,8 +2010,7 @@ App.prototype.getThumbnail = function (width, fn) {
2066 null, 'diagram', null); 2010 null, 'diagram', null);
2067 2011
2068 result = true; 2012 result = true;
2069 - }  
2070 - else if (this.canvasSupported && this.getCurrentFile() != null) { 2013 + } else if (this.canvasSupported && this.getCurrentFile() != null) {
2071 var canvas = document.createElement('canvas'); 2014 var canvas = document.createElement('canvas');
2072 var bounds = graph.getGraphBounds(); 2015 var bounds = graph.getGraphBounds();
2073 var t = graph.view.translate; 2016 var t = graph.view.translate;
@@ -2157,8 +2100,7 @@ App.prototype.getThumbnail = function (width, fn) { @@ -2157,8 +2100,7 @@ App.prototype.getThumbnail = function (width, fn) {
2157 if (graph != this.editor.graph && graph.container.parentNode != null) { 2100 if (graph != this.editor.graph && graph.container.parentNode != null) {
2158 graph.container.parentNode.removeChild(graph.container); 2101 graph.container.parentNode.removeChild(graph.container);
2159 } 2102 }
2160 - }  
2161 - catch (e) { 2103 + } catch (e) {
2162 canvas = null; 2104 canvas = null;
2163 } 2105 }
2164 2106
@@ -2167,8 +2109,7 @@ App.prototype.getThumbnail = function (width, fn) { @@ -2167,8 +2109,7 @@ App.prototype.getThumbnail = function (width, fn) {
2167 2109
2168 result = true; 2110 result = true;
2169 } 2111 }
2170 - }  
2171 - catch (e) { 2112 + } catch (e) {
2172 result = false; 2113 result = false;
2173 2114
2174 // Removes temporary graph from DOM 2115 // Removes temporary graph from DOM
@@ -2229,16 +2170,13 @@ App.prototype.createBackground = function () { @@ -2229,16 +2170,13 @@ App.prototype.createBackground = function () {
2229 if (mode == App.MODE_GOOGLE) { 2170 if (mode == App.MODE_GOOGLE) {
2230 this.appIcon.setAttribute('title', mxResources.get('openIt', [mxResources.get('googleDrive')])); 2171 this.appIcon.setAttribute('title', mxResources.get('openIt', [mxResources.get('googleDrive')]));
2231 this.appIcon.style.cursor = 'pointer'; 2172 this.appIcon.style.cursor = 'pointer';
2232 - }  
2233 - else if (mode == App.MODE_DROPBOX) { 2173 + } else if (mode == App.MODE_DROPBOX) {
2234 this.appIcon.setAttribute('title', mxResources.get('openIt', [mxResources.get('dropbox')])); 2174 this.appIcon.setAttribute('title', mxResources.get('openIt', [mxResources.get('dropbox')]));
2235 this.appIcon.style.cursor = 'pointer'; 2175 this.appIcon.style.cursor = 'pointer';
2236 - }  
2237 - else if (mode == App.MODE_ONEDRIVE) { 2176 + } else if (mode == App.MODE_ONEDRIVE) {
2238 this.appIcon.setAttribute('title', mxResources.get('openIt', [mxResources.get('oneDrive')])); 2177 this.appIcon.setAttribute('title', mxResources.get('openIt', [mxResources.get('oneDrive')]));
2239 this.appIcon.style.cursor = 'pointer'; 2178 this.appIcon.style.cursor = 'pointer';
2240 - }  
2241 - else { 2179 + } else {
2242 this.appIcon.removeAttribute('title'); 2180 this.appIcon.removeAttribute('title');
2243 this.appIcon.style.cursor = (mode == App.MODE_DEVICE) ? 'pointer' : 'default'; 2181 this.appIcon.style.cursor = (mode == App.MODE_DEVICE) ? 'pointer' : 'default';
2244 } 2182 }
@@ -2248,14 +2186,12 @@ App.prototype.createBackground = function () { @@ -2248,14 +2186,12 @@ App.prototype.createBackground = function () {
2248 try { 2186 try {
2249 if (isLocalStorage) { 2187 if (isLocalStorage) {
2250 localStorage.setItem('.mode', mode); 2188 localStorage.setItem('.mode', mode);
2251 - }  
2252 - else if (typeof (Storage) != 'undefined') { 2189 + } else if (typeof (Storage) != 'undefined') {
2253 var expiry = new Date(); 2190 var expiry = new Date();
2254 expiry.setYear(expiry.getFullYear() + 1); 2191 expiry.setYear(expiry.getFullYear() + 1);
2255 document.cookie = 'MODE=' + mode + '; expires=' + expiry.toUTCString(); 2192 document.cookie = 'MODE=' + mode + '; expires=' + expiry.toUTCString();
2256 } 2193 }
2257 - }  
2258 - catch (e) { 2194 + } catch (e) {
2259 // ignore possible access denied 2195 // ignore possible access denied
2260 } 2196 }
2261 } 2197 }
@@ -2270,8 +2206,7 @@ App.prototype.createBackground = function () { @@ -2270,8 +2206,7 @@ App.prototype.createBackground = function () {
2270 App.prototype.appIconClicked = function (evt) { 2206 App.prototype.appIconClicked = function (evt) {
2271 if (mxEvent.isAltDown(evt)) { 2207 if (mxEvent.isAltDown(evt)) {
2272 this.showSplash(true); 2208 this.showSplash(true);
2273 - }  
2274 - else { 2209 + } else {
2275 var file = this.getCurrentFile(); 2210 var file = this.getCurrentFile();
2276 var mode = (file != null) ? file.getMode() : null; 2211 var mode = (file != null) ? file.getMode() : null;
2277 2212
@@ -2280,15 +2215,12 @@ App.prototype.appIconClicked = function (evt) { @@ -2280,15 +2215,12 @@ App.prototype.appIconClicked = function (evt) {
2280 file.desc.parents.length > 0 && !mxEvent.isShiftDown(evt)) { 2215 file.desc.parents.length > 0 && !mxEvent.isShiftDown(evt)) {
2281 // Opens containing folder 2216 // Opens containing folder
2282 this.openLink('https://drive.google.com/drive/folders/' + file.desc.parents[0].id); 2217 this.openLink('https://drive.google.com/drive/folders/' + file.desc.parents[0].id);
2283 - }  
2284 - else if (file != null && file.getId() != null) { 2218 + } else if (file != null && file.getId() != null) {
2285 this.openLink('https://drive.google.com/open?id=' + file.getId()); 2219 this.openLink('https://drive.google.com/open?id=' + file.getId());
2286 - }  
2287 - else { 2220 + } else {
2288 this.openLink('https://drive.google.com/?authuser=0'); 2221 this.openLink('https://drive.google.com/?authuser=0');
2289 } 2222 }
2290 - }  
2291 - else if (mode == App.MODE_ONEDRIVE) { 2223 + } else if (mode == App.MODE_ONEDRIVE) {
2292 if (file != null && file.meta != null && file.meta.webUrl != null) { 2224 if (file != null && file.meta != null && file.meta.webUrl != null) {
2293 var url = file.meta.webUrl; 2225 var url = file.meta.webUrl;
2294 var name = encodeURIComponent(file.meta.name); 2226 var name = encodeURIComponent(file.meta.name);
@@ -2298,12 +2230,10 @@ App.prototype.appIconClicked = function (evt) { @@ -2298,12 +2230,10 @@ App.prototype.appIconClicked = function (evt) {
2298 } 2230 }
2299 2231
2300 this.openLink(url); 2232 this.openLink(url);
2301 - }  
2302 - else { 2233 + } else {
2303 this.openLink('https://onedrive.live.com/'); 2234 this.openLink('https://onedrive.live.com/');
2304 } 2235 }
2305 - }  
2306 - else if (mode == App.MODE_DROPBOX) { 2236 + } else if (mode == App.MODE_DROPBOX) {
2307 if (file != null && file.stat != null && file.stat.path_display != null) { 2237 if (file != null && file.stat != null && file.stat.path_display != null) {
2308 var url = 'https://www.dropbox.com/home/Apps/drawio' + file.stat.path_display; 2238 var url = 'https://www.dropbox.com/home/Apps/drawio' + file.stat.path_display;
2309 2239
@@ -2312,31 +2242,24 @@ App.prototype.appIconClicked = function (evt) { @@ -2312,31 +2242,24 @@ App.prototype.appIconClicked = function (evt) {
2312 } 2242 }
2313 2243
2314 this.openLink(url); 2244 this.openLink(url);
2315 - }  
2316 - else { 2245 + } else {
2317 this.openLink('https://www.dropbox.com/'); 2246 this.openLink('https://www.dropbox.com/');
2318 } 2247 }
2319 - }  
2320 - else if (mode == App.MODE_TRELLO) { 2248 + } else if (mode == App.MODE_TRELLO) {
2321 this.openLink('https://trello.com/'); 2249 this.openLink('https://trello.com/');
2322 - }  
2323 - else if (mode == App.MODE_GITHUB) { 2250 + } else if (mode == App.MODE_GITHUB) {
2324 if (file != null && file.constructor == GitHubFile) { 2251 if (file != null && file.constructor == GitHubFile) {
2325 this.openLink(file.meta.html_url); 2252 this.openLink(file.meta.html_url);
2326 - }  
2327 - else { 2253 + } else {
2328 this.openLink('https://github.com/'); 2254 this.openLink('https://github.com/');
2329 } 2255 }
2330 - }  
2331 - else if (mode == App.MODE_GITLAB) { 2256 + } else if (mode == App.MODE_GITLAB) {
2332 if (file != null && file.constructor == GitLabFile) { 2257 if (file != null && file.constructor == GitLabFile) {
2333 this.openLink(file.meta.html_url); 2258 this.openLink(file.meta.html_url);
2334 - }  
2335 - else { 2259 + } else {
2336 this.openLink(DRAWIO_GITLAB_URL); 2260 this.openLink(DRAWIO_GITLAB_URL);
2337 } 2261 }
2338 - }  
2339 - else if (mode == App.MODE_DEVICE) { 2262 + } else if (mode == App.MODE_DEVICE) {
2340 this.openLink('https://get.draw.io/'); 2263 this.openLink('https://get.draw.io/');
2341 } 2264 }
2342 } 2265 }
@@ -2352,8 +2275,7 @@ App.prototype.appIconClicked = function (evt) { @@ -2352,8 +2275,7 @@ App.prototype.appIconClicked = function (evt) {
2352 App.prototype.clearMode = function () { 2275 App.prototype.clearMode = function () {
2353 if (isLocalStorage) { 2276 if (isLocalStorage) {
2354 localStorage.removeItem('.mode'); 2277 localStorage.removeItem('.mode');
2355 - }  
2356 - else if (typeof (Storage) != 'undefined') { 2278 + } else if (typeof (Storage) != 'undefined') {
2357 var expiry = new Date(); 2279 var expiry = new Date();
2358 expiry.setYear(expiry.getFullYear() - 1); 2280 expiry.setYear(expiry.getFullYear() - 1);
2359 document.cookie = 'MODE=; expires=' + expiry.toUTCString(); 2281 document.cookie = 'MODE=; expires=' + expiry.toUTCString();
@@ -2408,8 +2330,7 @@ App.prototype.open = function () { @@ -2408,8 +2330,7 @@ App.prototype.open = function () {
2408 value.substring(0, 8) != 'https://') { 2330 value.substring(0, 8) != 'https://') {
2409 var doc = mxUtils.parseXml(window.opener[value]); 2331 var doc = mxUtils.parseXml(window.opener[value]);
2410 this.editor.setGraphXml(doc.documentElement); 2332 this.editor.setGraphXml(doc.documentElement);
2411 - }  
2412 - else if (window.opener.openFile != null) { 2333 + } else if (window.opener.openFile != null) {
2413 window.opener.openFile.setConsumer(mxUtils.bind(this, function (xml, filename, temp) { 2334 window.opener.openFile.setConsumer(mxUtils.bind(this, function (xml, filename, temp) {
2414 this.spinner.stop(); 2335 this.spinner.stop();
2415 2336
@@ -2419,8 +2340,7 @@ App.prototype.open = function () { @@ -2419,8 +2340,7 @@ App.prototype.open = function () {
2419 2340
2420 if (title != null) { 2341 if (title != null) {
2421 filename = decodeURIComponent(title); 2342 filename = decodeURIComponent(title);
2422 - }  
2423 - else { 2343 + } else {
2424 filename = this.defaultFilename; 2344 filename = this.defaultFilename;
2425 } 2345 }
2426 } 2346 }
@@ -2438,8 +2358,7 @@ App.prototype.open = function () { @@ -2438,8 +2358,7 @@ App.prototype.open = function () {
2438 })); 2358 }));
2439 } 2359 }
2440 } 2360 }
2441 - }  
2442 - catch (e) { 2361 + } catch (e) {
2443 // ignore 2362 // ignore
2444 } 2363 }
2445 }; 2364 };
@@ -2462,8 +2381,7 @@ App.prototype.load = function () { @@ -2462,8 +2381,7 @@ App.prototype.load = function () {
2462 if (this.spinner.spin(document.body, mxResources.get('starting'))) { 2381 if (this.spinner.spin(document.body, mxResources.get('starting'))) {
2463 try { 2382 try {
2464 this.stateArg = (urlParams['state'] != null && this.drive != null) ? JSON.parse(decodeURIComponent(urlParams['state'])) : null; 2383 this.stateArg = (urlParams['state'] != null && this.drive != null) ? JSON.parse(decodeURIComponent(urlParams['state'])) : null;
2465 - }  
2466 - catch (e) { 2384 + } catch (e) {
2467 // ignores invalid state args 2385 // ignores invalid state args
2468 } 2386 }
2469 2387
@@ -2479,8 +2397,7 @@ App.prototype.load = function () { @@ -2479,8 +2397,7 @@ App.prototype.load = function () {
2479 if (urlParams['fileId'] != null) { 2397 if (urlParams['fileId'] != null) {
2480 window.location.hash = 'G' + urlParams['fileId']; 2398 window.location.hash = 'G' + urlParams['fileId'];
2481 window.location.search = this.getSearch(['fileId']); 2399 window.location.search = this.getSearch(['fileId']);
2482 - }  
2483 - else { 2400 + } else {
2484 // Asynchronous or disabled loading of client 2401 // Asynchronous or disabled loading of client
2485 if (this.drive == null) { 2402 if (this.drive == null) {
2486 if (this.mode == App.MODE_GOOGLE) { 2403 if (this.mode == App.MODE_GOOGLE) {
@@ -2488,20 +2405,19 @@ App.prototype.load = function () { @@ -2488,20 +2405,19 @@ App.prototype.load = function () {
2488 } 2405 }
2489 2406
2490 this.start(); 2407 this.start();
2491 - }  
2492 - else { 2408 + } else {
2493 this.loadGapi(mxUtils.bind(this, function () { 2409 this.loadGapi(mxUtils.bind(this, function () {
2494 this.start(); 2410 this.start();
2495 })); 2411 }));
2496 } 2412 }
2497 } 2413 }
2498 } 2414 }
2499 - }  
2500 - else { 2415 + } else {
2501 this.restoreLibraries(); 2416 this.restoreLibraries();
2502 2417
2503 if (urlParams['gapi'] == '1') { 2418 if (urlParams['gapi'] == '1') {
2504 - this.loadGapi(function () { }); 2419 + this.loadGapi(function () {
  2420 + });
2505 } 2421 }
2506 } 2422 }
2507 }; 2423 };
@@ -2648,8 +2564,7 @@ App.prototype.start = function () { @@ -2648,8 +2564,7 @@ App.prototype.start = function () {
2648 (!this.editor.chromeless || this.editor.editable)) { 2564 (!this.editor.chromeless || this.editor.editable)) {
2649 this.showNameChangeBanner(); 2565 this.showNameChangeBanner();
2650 } 2566 }
2651 - }  
2652 - catch (e) { 2567 + } catch (e) {
2653 // ignore 2568 // ignore
2654 } 2569 }
2655 2570
@@ -2662,8 +2577,7 @@ App.prototype.start = function () { @@ -2662,8 +2577,7 @@ App.prototype.start = function () {
2662 if (file == null || file.getHash() != id) { 2577 if (file == null || file.getHash() != id) {
2663 this.loadFile(id, true); 2578 this.loadFile(id, true);
2664 } 2579 }
2665 - }  
2666 - catch (e) { 2580 + } catch (e) {
2667 // Workaround for possible scrollWidth of null in Dialog ctor 2581 // Workaround for possible scrollWidth of null in Dialog ctor
2668 if (document.body != null) { 2582 if (document.body != null) {
2669 this.handleError(e, mxResources.get('errorLoadingFile'), mxUtils.bind(this, function () { 2583 this.handleError(e, mxResources.get('errorLoadingFile'), mxUtils.bind(this, function () {
@@ -2682,8 +2596,7 @@ App.prototype.start = function () { @@ -2682,8 +2596,7 @@ App.prototype.start = function () {
2682 null, mxUtils.bind(this, function (e) { 2596 null, mxUtils.bind(this, function (e) {
2683 this.handleError(e, mxResources.get('errorLoadingFile')); 2597 this.handleError(e, mxResources.get('errorLoadingFile'));
2684 })); 2598 }));
2685 - }  
2686 - catch (e) { 2599 + } catch (e) {
2687 this.handleError(e, mxResources.get('errorLoadingFile')); 2600 this.handleError(e, mxResources.get('errorLoadingFile'));
2688 } 2601 }
2689 } 2602 }
@@ -2708,8 +2621,7 @@ App.prototype.start = function () { @@ -2708,8 +2621,7 @@ App.prototype.start = function () {
2708 2621
2709 if (title != null) { 2622 if (title != null) {
2710 title = decodeURIComponent(title); 2623 title = decodeURIComponent(title);
2711 - }  
2712 - else { 2624 + } else {
2713 title = this.defaultFilename; 2625 title = this.defaultFilename;
2714 } 2626 }
2715 2627
@@ -2732,14 +2644,12 @@ App.prototype.start = function () { @@ -2732,14 +2644,12 @@ App.prototype.start = function () {
2732 2644
2733 if (value != null) { 2645 if (value != null) {
2734 doLoadFile(parent[decodeURIComponent(value)]); 2646 doLoadFile(parent[decodeURIComponent(value)]);
2735 - }  
2736 - else { 2647 + } else {
2737 value = urlParams['data']; 2648 value = urlParams['data'];
2738 2649
2739 if (value != null) { 2650 if (value != null) {
2740 doLoadFile(decodeURIComponent(value)); 2651 doLoadFile(decodeURIComponent(value));
2741 - }  
2742 - else { 2652 + } else {
2743 this.installMessageHandler(mxUtils.bind(this, function (xml, evt) { 2653 this.installMessageHandler(mxUtils.bind(this, function (xml, evt) {
2744 // Ignores messages from other windows 2654 // Ignores messages from other windows
2745 if (evt.source == parent) { 2655 if (evt.source == parent) {
@@ -2756,8 +2666,7 @@ App.prototype.start = function () { @@ -2756,8 +2666,7 @@ App.prototype.start = function () {
2756 var prev = Editor.useLocalStorage; 2666 var prev = Editor.useLocalStorage;
2757 this.createFile(this.defaultFilename, null, null, null, null, null, null, true); 2667 this.createFile(this.defaultFilename, null, null, null, null, null, null, true);
2758 Editor.useLocalStorage = prev; 2668 Editor.useLocalStorage = prev;
2759 - }  
2760 - else { 2669 + } else {
2761 var waiting = false; 2670 var waiting = false;
2762 2671
2763 // Checks if we're waiting for some asynchronous file to be loaded 2672 // Checks if we're waiting for some asynchronous file to be loaded
@@ -2765,24 +2674,21 @@ App.prototype.start = function () { @@ -2765,24 +2674,21 @@ App.prototype.start = function () {
2765 // were opened from another domain then this will fail. 2674 // were opened from another domain then this will fail.
2766 try { 2675 try {
2767 waiting = window.opener != null && window.opener.openFile != null; 2676 waiting = window.opener != null && window.opener.openFile != null;
2768 - }  
2769 - catch (e) { 2677 + } catch (e) {
2770 // ignore 2678 // ignore
2771 } 2679 }
2772 2680
2773 if (waiting) { 2681 if (waiting) {
2774 // Spinner is stopped in App.open 2682 // Spinner is stopped in App.open
2775 this.spinner.spin(document.body, mxResources.get('loading')) 2683 this.spinner.spin(document.body, mxResources.get('loading'))
2776 - }  
2777 - else { 2684 + } else {
2778 var id = this.getDiagramId(); 2685 var id = this.getDiagramId();
2779 2686
2780 if (EditorUi.enableDrafts && urlParams['mode'] == null && 2687 if (EditorUi.enableDrafts && urlParams['mode'] == null &&
2781 this.getServiceName() == 'draw.io' && (id == null || id.length == 0) && 2688 this.getServiceName() == 'draw.io' && (id == null || id.length == 0) &&
2782 !this.editor.isChromelessView()) { 2689 !this.editor.isChromelessView()) {
2783 this.checkDrafts(); 2690 this.checkDrafts();
2784 - }  
2785 - else if (id != null && id.length > 0) { 2691 + } else if (id != null && id.length > 0) {
2786 this.loadFile(id, null, null, mxUtils.bind(this, function () { 2692 this.loadFile(id, null, null, mxUtils.bind(this, function () {
2787 var temp = decodeURIComponent(urlParams['viewbox'] || ''); 2693 var temp = decodeURIComponent(urlParams['viewbox'] || '');
2788 2694
@@ -2790,18 +2696,15 @@ App.prototype.start = function () { @@ -2790,18 +2696,15 @@ App.prototype.start = function () {
2790 try { 2696 try {
2791 var bounds = JSON.parse(temp); 2697 var bounds = JSON.parse(temp);
2792 this.editor.graph.fitWindow(bounds, bounds.border); 2698 this.editor.graph.fitWindow(bounds, bounds.border);
2793 - }  
2794 - catch (e) { 2699 + } catch (e) {
2795 // Ignore invalid viewport 2700 // Ignore invalid viewport
2796 console.error(e); 2701 console.error(e);
2797 } 2702 }
2798 } 2703 }
2799 })); 2704 }));
2800 - }  
2801 - else if (urlParams['splash'] != '0' || urlParams['mode'] != null) { 2705 + } else if (urlParams['splash'] != '0' || urlParams['mode'] != null) {
2802 this.loadFile(); 2706 this.loadFile();
2803 - }  
2804 - else if (!EditorUi.isElectronApp) { 2707 + } else if (!EditorUi.isElectronApp) {
2805 this.createFile(this.defaultFilename, this.getFileData(), null, null, null, null, null, true); 2708 this.createFile(this.defaultFilename, this.getFileData(), null, null, null, null, null, true);
2806 } 2709 }
2807 } 2710 }
@@ -2817,7 +2720,8 @@ App.prototype.start = function () { @@ -2817,7 +2720,8 @@ App.prototype.start = function () {
2817 // Removes URL parameter and reloads the page 2720 // Removes URL parameter and reloads the page
2818 if (this.spinner.spin(document.body, mxResources.get('reconnecting'))) { 2721 if (this.spinner.spin(document.body, mxResources.get('reconnecting'))) {
2819 window.location.search = this.getSearch(['create', 'title']); 2722 window.location.search = this.getSearch(['create', 'title']);
2820 - }; 2723 + }
  2724 + ;
2821 }); 2725 });
2822 2726
2823 var showCreateDialog = mxUtils.bind(this, function (xml) { 2727 var showCreateDialog = mxUtils.bind(this, function (xml) {
@@ -2833,8 +2737,7 @@ App.prototype.start = function () { @@ -2833,8 +2737,7 @@ App.prototype.start = function () {
2833 2737
2834 if (title != null) { 2738 if (title != null) {
2835 title = decodeURIComponent(title); 2739 title = decodeURIComponent(title);
2836 - }  
2837 - else { 2740 + } else {
2838 title = this.defaultFilename; 2741 title = this.defaultFilename;
2839 } 2742 }
2840 2743
@@ -2853,8 +2756,7 @@ App.prototype.start = function () { @@ -2853,8 +2756,7 @@ App.prototype.start = function () {
2853 this.createFile((filename.length > 0) ? filename : this.defaultFilename, 2756 this.createFile((filename.length > 0) ? filename : this.defaultFilename,
2854 this.getFileData(), null, null, null, true, null, true); 2757 this.getFileData(), null, null, null, true, null, true);
2855 Editor.useLocalStorage = prev; 2758 Editor.useLocalStorage = prev;
2856 - }  
2857 - else { 2759 + } else {
2858 this.pickFolder(mode, mxUtils.bind(this, function (folderId) { 2760 this.pickFolder(mode, mxUtils.bind(this, function (folderId) {
2859 this.createFile(filename, this.getFileData(true), 2761 this.createFile(filename, this.getFileData(true),
2860 null, mode, null, true, folderId); 2762 null, mode, null, true, folderId);
@@ -2881,24 +2783,20 @@ App.prototype.start = function () { @@ -2881,24 +2783,20 @@ App.prototype.start = function () {
2881 try { 2783 try {
2882 if (window.opener != null && window.opener[value] != null) { 2784 if (window.opener != null && window.opener[value] != null) {
2883 showCreateDialog(window.opener[value]); 2785 showCreateDialog(window.opener[value]);
2884 - }  
2885 - else { 2786 + } else {
2886 this.handleError(null, mxResources.get('errorLoadingFile')); 2787 this.handleError(null, mxResources.get('errorLoadingFile'));
2887 } 2788 }
2888 - }  
2889 - catch (e) { 2789 + } catch (e) {
2890 this.handleError(e, mxResources.get('errorLoadingFile')); 2790 this.handleError(e, mxResources.get('errorLoadingFile'));
2891 } 2791 }
2892 - }  
2893 - else { 2792 + } else {
2894 this.loadTemplate(value, function (text) { 2793 this.loadTemplate(value, function (text) {
2895 showCreateDialog(text); 2794 showCreateDialog(text);
2896 }, mxUtils.bind(this, function () { 2795 }, mxUtils.bind(this, function () {
2897 this.handleError(null, mxResources.get('errorLoadingFile'), reconnect); 2796 this.handleError(null, mxResources.get('errorLoadingFile'), reconnect);
2898 })); 2797 }));
2899 } 2798 }
2900 - }  
2901 - else { 2799 + } else {
2902 // Passes the fileId from the state parameter to the hash tag and reloads 2800 // Passes the fileId from the state parameter to the hash tag and reloads
2903 // the page without the state parameter 2801 // the page without the state parameter
2904 if ((window.location.hash == null || window.location.hash.length <= 1) && 2802 if ((window.location.hash == null || window.location.hash.length <= 1) &&
@@ -2912,8 +2810,7 @@ App.prototype.start = function () { @@ -2912,8 +2810,7 @@ App.prototype.start = function () {
2912 2810
2913 window.location.hash = 'G' + this.stateArg.ids[0]; 2811 window.location.hash = 'G' + this.stateArg.ids[0];
2914 } 2812 }
2915 - }  
2916 - else if ((window.location.hash == null || window.location.hash.length <= 1) && 2813 + } else if ((window.location.hash == null || window.location.hash.length <= 1) &&
2917 this.drive != null && this.stateArg != null && this.stateArg.action == 'create') { 2814 this.drive != null && this.stateArg != null && this.stateArg.action == 'create') {
2918 if (window.history && window.history.replaceState) { 2815 if (window.history && window.history.replaceState) {
2919 // Removes state URL parameter without reloading the page 2816 // Removes state URL parameter without reloading the page
@@ -2927,12 +2824,10 @@ App.prototype.start = function () { @@ -2927,12 +2824,10 @@ App.prototype.start = function () {
2927 this.createFile((urlParams['title'] != null) ? 2824 this.createFile((urlParams['title'] != null) ?
2928 decodeURIComponent(urlParams['title']) : 2825 decodeURIComponent(urlParams['title']) :
2929 this.defaultFilename); 2826 this.defaultFilename);
2930 - }  
2931 - else { 2827 + } else {
2932 this.actions.get('new').funct(); 2828 this.actions.get('new').funct();
2933 } 2829 }
2934 - }  
2935 - else { 2830 + } else {
2936 // Removes open URL parameter. Hash is also updated in Init to load client. 2831 // Removes open URL parameter. Hash is also updated in Init to load client.
2937 if (urlParams['open'] != null && window.history && window.history.replaceState) { 2832 if (urlParams['open'] != null && window.history && window.history.replaceState) {
2938 2833
@@ -2945,8 +2840,7 @@ App.prototype.start = function () { @@ -2945,8 +2840,7 @@ App.prototype.start = function () {
2945 } 2840 }
2946 } 2841 }
2947 } 2842 }
2948 - }  
2949 - catch (e) { 2843 + } catch (e) {
2950 this.handleError(e); 2844 this.handleError(e);
2951 } 2845 }
2952 }; 2846 };
@@ -2994,16 +2888,14 @@ App.prototype.filterDrafts = function (filePath, guid, callback) { @@ -2994,16 +2888,14 @@ App.prototype.filterDrafts = function (filePath, guid, callback) {
2994 drafts.push(obj); 2888 drafts.push(obj);
2995 } 2889 }
2996 } 2890 }
2997 - }  
2998 - catch (e) { 2891 + } catch (e) {
2999 // ignore 2892 // ignore
3000 } 2893 }
3001 } 2894 }
3002 2895
3003 result(); 2896 result();
3004 }, result)); 2897 }, result));
3005 - }  
3006 - catch (e) { 2898 + } catch (e) {
3007 result(); 2899 result();
3008 } 2900 }
3009 }; 2901 };
@@ -3025,8 +2917,7 @@ App.prototype.checkDrafts = function () { @@ -3025,8 +2917,7 @@ App.prototype.checkDrafts = function () {
3025 this.loadDraft(drafts[0].data, mxUtils.bind(this, function () { 2917 this.loadDraft(drafts[0].data, mxUtils.bind(this, function () {
3026 this.removeDatabaseItem(drafts[0].key); 2918 this.removeDatabaseItem(drafts[0].key);
3027 })); 2919 }));
3028 - }  
3029 - else if (drafts.length > 1) { 2920 + } else if (drafts.length > 1) {
3030 var ts = new Date(drafts[0].modified); 2921 var ts = new Date(drafts[0].modified);
3031 2922
3032 var dlg = new DraftDialog(this, (drafts.length > 1) ? mxResources.get('selectDraft') : 2923 var dlg = new DraftDialog(this, (drafts.length > 1) ? mxResources.get('selectDraft') :
@@ -3053,23 +2944,19 @@ App.prototype.checkDrafts = function () { @@ -3053,23 +2944,19 @@ App.prototype.checkDrafts = function () {
3053 this.showDialog(dlg.container, 640, 480, true, false, mxUtils.bind(this, function (cancel) { 2944 this.showDialog(dlg.container, 640, 480, true, false, mxUtils.bind(this, function (cancel) {
3054 if (urlParams['splash'] != '0') { 2945 if (urlParams['splash'] != '0') {
3055 this.loadFile(); 2946 this.loadFile();
3056 - }  
3057 - else { 2947 + } else {
3058 this.createFile(this.defaultFilename, this.getFileData(), null, null, null, null, null, true); 2948 this.createFile(this.defaultFilename, this.getFileData(), null, null, null, null, null, true);
3059 } 2949 }
3060 })); 2950 }));
3061 dlg.init(); 2951 dlg.init();
3062 - }  
3063 - else if (urlParams['splash'] != '0') { 2952 + } else if (urlParams['splash'] != '0') {
3064 this.loadFile(); 2953 this.loadFile();
3065 - }  
3066 - else { 2954 + } else {
3067 this.createFile(this.defaultFilename, this.getFileData(), null, null, null, null, null, true); 2955 this.createFile(this.defaultFilename, this.getFileData(), null, null, null, null, null, true);
3068 } 2956 }
3069 })); 2957 }));
3070 }), 0); 2958 }), 0);
3071 - }  
3072 - catch (e) { 2959 + } catch (e) {
3073 // ignore 2960 // ignore
3074 } 2961 }
3075 }; 2962 };
@@ -3108,8 +2995,7 @@ App.prototype.showSplash = function (force) { @@ -3108,8 +2995,7 @@ App.prototype.showSplash = function (force) {
3108 mxResources.get('errorLoadingFile'), mxUtils.bind(this, function () { 2995 mxResources.get('errorLoadingFile'), mxUtils.bind(this, function () {
3109 this.showSplash(); 2996 this.showSplash();
3110 })); 2997 }));
3111 - }  
3112 - else if (!mxClient.IS_CHROMEAPP && (this.mode == null || force)) { 2998 + } else if (!mxClient.IS_CHROMEAPP && (this.mode == null || force)) {
3113 var rowLimit = (serviceCount == 4) ? 2 : 3; 2999 var rowLimit = (serviceCount == 4) ? 2 : 3;
3114 3000
3115 var dlg = new StorageDialog(this, mxUtils.bind(this, function () { 3001 var dlg = new StorageDialog(this, mxUtils.bind(this, function () {
@@ -3119,8 +3005,7 @@ App.prototype.showSplash = function (force) { @@ -3119,8 +3005,7 @@ App.prototype.showSplash = function (force) {
3119 3005
3120 this.showDialog(dlg.container, (rowLimit < 3) ? 200 : 300, 3006 this.showDialog(dlg.container, (rowLimit < 3) ? 200 : 300,
3121 ((serviceCount > 3) ? 320 : 210), true, false); 3007 ((serviceCount > 3) ? 320 : 210), true, false);
3122 - }  
3123 - else if (urlParams['create'] == null) { 3008 + } else if (urlParams['create'] == null) {
3124 showSecondDialog(); 3009 showSecondDialog();
3125 } 3010 }
3126 }; 3011 };
@@ -3209,12 +3094,10 @@ App.prototype.loadFileSystemEntry = function (fileHandle, success, error) { @@ -3209,12 +3094,10 @@ App.prototype.loadFileSystemEntry = function (fileHandle, success, error) {
3209 } 3094 }
3210 3095
3211 success(new LocalFile(this, data, file.name, null, fileHandle, file)); 3096 success(new LocalFile(this, data, file.name, null, fileHandle, file));
3212 - }  
3213 - else { 3097 + } else {
3214 this.openFileHandle(e.target.result, file.name, file, false, fileHandle); 3098 this.openFileHandle(e.target.result, file.name, file, false, fileHandle);
3215 } 3099 }
3216 - }  
3217 - catch (e) { 3100 + } catch (e) {
3218 error(e); 3101 error(e);
3219 } 3102 }
3220 }); 3103 });
@@ -3225,13 +3108,11 @@ App.prototype.loadFileSystemEntry = function (fileHandle, success, error) { @@ -3225,13 +3108,11 @@ App.prototype.loadFileSystemEntry = function (fileHandle, success, error) {
3225 file.type === 'application/pdf') && 3108 file.type === 'application/pdf') &&
3226 file.type.substring(0, 9) !== 'image/svg') { 3109 file.type.substring(0, 9) !== 'image/svg') {
3227 reader.readAsDataURL(file); 3110 reader.readAsDataURL(file);
3228 - }  
3229 - else { 3111 + } else {
3230 reader.readAsText(file); 3112 reader.readAsText(file);
3231 } 3113 }
3232 }), error); 3114 }), error);
3233 - }  
3234 - catch (e) { 3115 + } catch (e) {
3235 error(e); 3116 error(e);
3236 } 3117 }
3237 }; 3118 };
@@ -3261,12 +3142,10 @@ App.prototype.createFileSystemOptions = function (name) { @@ -3261,12 +3142,10 @@ App.prototype.createFileSystemOptions = function (name) {
3261 3142
3262 if (this.editor.diagramFileTypes[i].extension == temp) { 3143 if (this.editor.diagramFileTypes[i].extension == temp) {
3263 ext.splice(0, 0, obj); 3144 ext.splice(0, 0, obj);
3264 - }  
3265 - else { 3145 + } else {
3266 if (this.editor.diagramFileTypes[i].extension == temp) { 3146 if (this.editor.diagramFileTypes[i].extension == temp) {
3267 ext.splice(0, 0, obj); 3147 ext.splice(0, 0, obj);
3268 - }  
3269 - else { 3148 + } else {
3270 ext.push(obj); 3149 ext.push(obj);
3271 } 3150 }
3272 } 3151 }
@@ -3310,18 +3189,15 @@ App.prototype.pickFile = function (mode) { @@ -3310,18 +3189,15 @@ App.prototype.pickFile = function (mode) {
3310 if (mode == App.MODE_GOOGLE) { 3189 if (mode == App.MODE_GOOGLE) {
3311 if (this.drive != null && typeof (google) != 'undefined' && typeof (google.picker) != 'undefined') { 3190 if (this.drive != null && typeof (google) != 'undefined' && typeof (google.picker) != 'undefined') {
3312 this.drive.pickFile(); 3191 this.drive.pickFile();
3313 - }  
3314 - else { 3192 + } else {
3315 this.openLink('https://drive.google.com'); 3193 this.openLink('https://drive.google.com');
3316 } 3194 }
3317 - }  
3318 - else { 3195 + } else {
3319 var peer = this.getPeerForMode(mode); 3196 var peer = this.getPeerForMode(mode);
3320 3197
3321 if (peer != null) { 3198 if (peer != null) {
3322 peer.pickFile(); 3199 peer.pickFile();
3323 - }  
3324 - else if (mode == App.MODE_DEVICE && EditorUi.nativeFileSupport) { 3200 + } else if (mode == App.MODE_DEVICE && EditorUi.nativeFileSupport) {
3325 window.showOpenFilePicker().then(mxUtils.bind(this, function (fileHandles) { 3201 window.showOpenFilePicker().then(mxUtils.bind(this, function (fileHandles) {
3326 if (fileHandles != null && fileHandles.length > 0 && 3202 if (fileHandles != null && fileHandles.length > 0 &&
3327 this.spinner.spin(document.body, mxResources.get('loading'))) { 3203 this.spinner.spin(document.body, mxResources.get('loading'))) {
@@ -3332,8 +3208,7 @@ App.prototype.pickFile = function (mode) { @@ -3332,8 +3208,7 @@ App.prototype.pickFile = function (mode) {
3332 this.handleError(e); 3208 this.handleError(e);
3333 } 3209 }
3334 })); 3210 }));
3335 - }  
3336 - else if (mode == App.MODE_DEVICE && Graph.fileSupport) { 3211 + } else if (mode == App.MODE_DEVICE && Graph.fileSupport) {
3337 if (this.openFileInputElt == null) { 3212 if (this.openFileInputElt == null) {
3338 var input = document.createElement('input'); 3213 var input = document.createElement('input');
3339 input.setAttribute('type', 'file'); 3214 input.setAttribute('type', 'file');
@@ -3356,8 +3231,7 @@ App.prototype.pickFile = function (mode) { @@ -3356,8 +3231,7 @@ App.prototype.pickFile = function (mode) {
3356 } 3231 }
3357 3232
3358 this.openFileInputElt.click(); 3233 this.openFileInputElt.click();
3359 - }  
3360 - else { 3234 + } else {
3361 this.hideDialog(); 3235 this.hideDialog();
3362 window.openNew = this.getCurrentFile() != null && !this.isDiagramEmpty(); 3236 window.openNew = this.getCurrentFile() != null && !this.isDiagramEmpty();
3363 window.baseUrl = this.getUrl(); 3237 window.baseUrl = this.getUrl();
@@ -3398,8 +3272,7 @@ App.prototype.pickFile = function (mode) { @@ -3398,8 +3272,7 @@ App.prototype.pickFile = function (mode) {
3398 3272
3399 if (currentFile == null || !currentFile.isModified()) { 3273 if (currentFile == null || !currentFile.isModified()) {
3400 doOpenFile(); 3274 doOpenFile();
3401 - }  
3402 - else { 3275 + } else {
3403 this.confirm(mxResources.get('allChangesLost'), null, doOpenFile, 3276 this.confirm(mxResources.get('allChangesLost'), null, doOpenFile,
3404 mxResources.get('cancel'), mxResources.get('discardChanges')); 3277 mxResources.get('cancel'), mxResources.get('discardChanges'));
3405 } 3278 }
@@ -3419,8 +3292,7 @@ App.prototype.pickFile = function (mode) { @@ -3419,8 +3292,7 @@ App.prototype.pickFile = function (mode) {
3419 }); 3292 });
3420 } 3293 }
3421 } 3294 }
3422 - }  
3423 - catch (e) { 3295 + } catch (e) {
3424 this.handleError(e); 3296 this.handleError(e);
3425 } 3297 }
3426 }; 3298 };
@@ -3448,20 +3320,17 @@ App.prototype.pickLibrary = function (mode) { @@ -3448,20 +3320,17 @@ App.prototype.pickLibrary = function (mode) {
3448 if (optionalFile != null) { 3320 if (optionalFile != null) {
3449 try { 3321 try {
3450 this.loadLibrary(optionalFile); 3322 this.loadLibrary(optionalFile);
3451 - }  
3452 - catch (e) { 3323 + } catch (e) {
3453 this.handleError(e, mxResources.get('errorLoadingFile')); 3324 this.handleError(e, mxResources.get('errorLoadingFile'));
3454 } 3325 }
3455 - }  
3456 - else { 3326 + } else {
3457 if (this.spinner.spin(document.body, mxResources.get('loading'))) { 3327 if (this.spinner.spin(document.body, mxResources.get('loading'))) {
3458 peer.getLibrary(id, mxUtils.bind(this, function (file) { 3328 peer.getLibrary(id, mxUtils.bind(this, function (file) {
3459 this.spinner.stop(); 3329 this.spinner.stop();
3460 3330
3461 try { 3331 try {
3462 this.loadLibrary(file); 3332 this.loadLibrary(file);
3463 - }  
3464 - catch (e) { 3333 + } catch (e) {
3465 this.handleError(e, mxResources.get('errorLoadingFile')); 3334 this.handleError(e, mxResources.get('errorLoadingFile'));
3466 } 3335 }
3467 }), mxUtils.bind(this, function (resp) { 3336 }), mxUtils.bind(this, function (resp) {
@@ -3471,8 +3340,7 @@ App.prototype.pickLibrary = function (mode) { @@ -3471,8 +3340,7 @@ App.prototype.pickLibrary = function (mode) {
3471 } 3340 }
3472 })); 3341 }));
3473 } 3342 }
3474 - }  
3475 - else if (mode == App.MODE_DEVICE && Graph.fileSupport) { 3343 + } else if (mode == App.MODE_DEVICE && Graph.fileSupport) {
3476 if (this.libFileInputElt == null) { 3344 if (this.libFileInputElt == null) {
3477 var input = document.createElement('input'); 3345 var input = document.createElement('input');
3478 input.setAttribute('type', 'file'); 3346 input.setAttribute('type', 'file');
@@ -3486,8 +3354,7 @@ App.prototype.pickLibrary = function (mode) { @@ -3486,8 +3354,7 @@ App.prototype.pickLibrary = function (mode) {
3486 reader.onload = mxUtils.bind(this, function (e) { 3354 reader.onload = mxUtils.bind(this, function (e) {
3487 try { 3355 try {
3488 this.loadLibrary(new LocalLibrary(this, e.target.result, file.name)); 3356 this.loadLibrary(new LocalLibrary(this, e.target.result, file.name));
3489 - }  
3490 - catch (e) { 3357 + } catch (e) {
3491 this.handleError(e, mxResources.get('errorLoadingFile')); 3358 this.handleError(e, mxResources.get('errorLoadingFile'));
3492 } 3359 }
3493 }); 3360 });
@@ -3509,8 +3376,7 @@ App.prototype.pickLibrary = function (mode) { @@ -3509,8 +3376,7 @@ App.prototype.pickLibrary = function (mode) {
3509 } 3376 }
3510 3377
3511 this.libFileInputElt.click(); 3378 this.libFileInputElt.click();
3512 - }  
3513 - else { 3379 + } else {
3514 window.openNew = false; 3380 window.openNew = false;
3515 window.openKey = 'open'; 3381 window.openKey = 'open';
3516 3382
@@ -3538,8 +3404,7 @@ App.prototype.pickLibrary = function (mode) { @@ -3538,8 +3404,7 @@ App.prototype.pickLibrary = function (mode) {
3538 try { 3404 try {
3539 this.loadLibrary((mode == App.MODE_BROWSER) ? new StorageLibrary(this, xml, filename) : 3405 this.loadLibrary((mode == App.MODE_BROWSER) ? new StorageLibrary(this, xml, filename) :
3540 new LocalLibrary(this, xml, filename)); 3406 new LocalLibrary(this, xml, filename));
3541 - }  
3542 - catch (e) { 3407 + } catch (e) {
3543 this.handleError(e, mxResources.get('errorLoadingFile')); 3408 this.handleError(e, mxResources.get('errorLoadingFile'));
3544 } 3409 }
3545 })); 3410 }));
@@ -3589,43 +3454,37 @@ App.prototype.saveLibrary = function (name, images, file, mode, noSpin, noReload @@ -3589,43 +3454,37 @@ App.prototype.saveLibrary = function (name, images, file, mode, noSpin, noReload
3589 this.hideDialog(true); 3454 this.hideDialog(true);
3590 this.libraryLoaded(newFile, images); 3455 this.libraryLoaded(newFile, images);
3591 }), error, this.drive.libraryMimeType); 3456 }), error, this.drive.libraryMimeType);
3592 - }  
3593 - else if (mode == App.MODE_GITHUB && this.gitHub != null && this.spinner.spin(document.body, mxResources.get('inserting'))) { 3457 + } else if (mode == App.MODE_GITHUB && this.gitHub != null && this.spinner.spin(document.body, mxResources.get('inserting'))) {
3594 this.gitHub.insertLibrary(name, xml, mxUtils.bind(this, function (newFile) { 3458 this.gitHub.insertLibrary(name, xml, mxUtils.bind(this, function (newFile) {
3595 this.spinner.stop(); 3459 this.spinner.stop();
3596 this.hideDialog(true); 3460 this.hideDialog(true);
3597 this.libraryLoaded(newFile, images); 3461 this.libraryLoaded(newFile, images);
3598 }), error, folderId); 3462 }), error, folderId);
3599 - }  
3600 - else if (mode == App.MODE_GITLAB && this.gitLab != null && this.spinner.spin(document.body, mxResources.get('inserting'))) { 3463 + } else if (mode == App.MODE_GITLAB && this.gitLab != null && this.spinner.spin(document.body, mxResources.get('inserting'))) {
3601 this.gitLab.insertLibrary(name, xml, mxUtils.bind(this, function (newFile) { 3464 this.gitLab.insertLibrary(name, xml, mxUtils.bind(this, function (newFile) {
3602 this.spinner.stop(); 3465 this.spinner.stop();
3603 this.hideDialog(true); 3466 this.hideDialog(true);
3604 this.libraryLoaded(newFile, images); 3467 this.libraryLoaded(newFile, images);
3605 }), error, folderId); 3468 }), error, folderId);
3606 - }  
3607 - else if (mode == App.MODE_TRELLO && this.trello != null && this.spinner.spin(document.body, mxResources.get('inserting'))) { 3469 + } else if (mode == App.MODE_TRELLO && this.trello != null && this.spinner.spin(document.body, mxResources.get('inserting'))) {
3608 this.trello.insertLibrary(name, xml, mxUtils.bind(this, function (newFile) { 3470 this.trello.insertLibrary(name, xml, mxUtils.bind(this, function (newFile) {
3609 this.spinner.stop(); 3471 this.spinner.stop();
3610 this.hideDialog(true); 3472 this.hideDialog(true);
3611 this.libraryLoaded(newFile, images); 3473 this.libraryLoaded(newFile, images);
3612 }), error, folderId); 3474 }), error, folderId);
3613 - }  
3614 - else if (mode == App.MODE_DROPBOX && this.dropbox != null && this.spinner.spin(document.body, mxResources.get('inserting'))) { 3475 + } else if (mode == App.MODE_DROPBOX && this.dropbox != null && this.spinner.spin(document.body, mxResources.get('inserting'))) {
3615 this.dropbox.insertLibrary(name, xml, mxUtils.bind(this, function (newFile) { 3476 this.dropbox.insertLibrary(name, xml, mxUtils.bind(this, function (newFile) {
3616 this.spinner.stop(); 3477 this.spinner.stop();
3617 this.hideDialog(true); 3478 this.hideDialog(true);
3618 this.libraryLoaded(newFile, images); 3479 this.libraryLoaded(newFile, images);
3619 }), error, folderId); 3480 }), error, folderId);
3620 - }  
3621 - else if (mode == App.MODE_ONEDRIVE && this.oneDrive != null && this.spinner.spin(document.body, mxResources.get('inserting'))) { 3481 + } else if (mode == App.MODE_ONEDRIVE && this.oneDrive != null && this.spinner.spin(document.body, mxResources.get('inserting'))) {
3622 this.oneDrive.insertLibrary(name, xml, mxUtils.bind(this, function (newFile) { 3482 this.oneDrive.insertLibrary(name, xml, mxUtils.bind(this, function (newFile) {
3623 this.spinner.stop(); 3483 this.spinner.stop();
3624 this.hideDialog(true); 3484 this.hideDialog(true);
3625 this.libraryLoaded(newFile, images); 3485 this.libraryLoaded(newFile, images);
3626 }), error, folderId); 3486 }), error, folderId);
3627 - }  
3628 - else if (mode == App.MODE_BROWSER) { 3487 + } else if (mode == App.MODE_BROWSER) {
3629 var fn = mxUtils.bind(this, function () { 3488 var fn = mxUtils.bind(this, function () {
3630 var file = new StorageLibrary(this, xml, name); 3489 var file = new StorageLibrary(this, xml, name);
3631 3490
@@ -3638,17 +3497,14 @@ App.prototype.saveLibrary = function (name, images, file, mode, noSpin, noReload @@ -3638,17 +3497,14 @@ App.prototype.saveLibrary = function (name, images, file, mode, noSpin, noReload
3638 3497
3639 if (localStorage.getItem(name) == null) { 3498 if (localStorage.getItem(name) == null) {
3640 fn(); 3499 fn();
3641 - }  
3642 - else { 3500 + } else {
3643 this.confirm(mxResources.get('replaceIt', [name]), fn); 3501 this.confirm(mxResources.get('replaceIt', [name]), fn);
3644 } 3502 }
3645 - }  
3646 - else { 3503 + } else {
3647 this.handleError({ message: mxResources.get('serviceUnavailableOrBlocked') }); 3504 this.handleError({ message: mxResources.get('serviceUnavailableOrBlocked') });
3648 } 3505 }
3649 })); 3506 }));
3650 - }  
3651 - else if (noSpin || this.spinner.spin(document.body, mxResources.get('saving'))) { 3507 + } else if (noSpin || this.spinner.spin(document.body, mxResources.get('saving'))) {
3652 file.setData(xml); 3508 file.setData(xml);
3653 3509
3654 var doSave = mxUtils.bind(this, function () { 3510 var doSave = mxUtils.bind(this, function () {
@@ -3683,13 +3539,11 @@ App.prototype.saveLibrary = function (name, images, file, mode, noSpin, noReload @@ -3683,13 +3539,11 @@ App.prototype.saveLibrary = function (name, images, file, mode, noSpin, noReload
3683 3539
3684 doSave(); 3540 doSave();
3685 }), error) 3541 }), error)
3686 - }  
3687 - else { 3542 + } else {
3688 doSave(); 3543 doSave();
3689 } 3544 }
3690 } 3545 }
3691 - }  
3692 - catch (e) { 3546 + } catch (e) {
3693 this.handleError(e); 3547 this.handleError(e);
3694 } 3548 }
3695 }; 3549 };
@@ -3712,8 +3566,7 @@ App.prototype.saveFile = function (forceDialog, success) { @@ -3712,8 +3566,7 @@ App.prototype.saveFile = function (forceDialog, success) {
3712 // is to show no saved status for device files 3566 // is to show no saved status for device files
3713 if (file.getMode() != App.MODE_DEVICE) { 3567 if (file.getMode() != App.MODE_DEVICE) {
3714 this.editor.setStatus(mxUtils.htmlEntities(mxResources.get('allChangesSaved'))); 3568 this.editor.setStatus(mxUtils.htmlEntities(mxResources.get('allChangesSaved')));
3715 - }  
3716 - else { 3569 + } else {
3717 this.editor.setStatus(''); 3570 this.editor.setStatus('');
3718 } 3571 }
3719 } 3572 }
@@ -3725,8 +3578,7 @@ App.prototype.saveFile = function (forceDialog, success) { @@ -3725,8 +3578,7 @@ App.prototype.saveFile = function (forceDialog, success) {
3725 3578
3726 if (!forceDialog && file.getTitle() != null && file.invalidFileHandle == null && this.mode != null) { 3579 if (!forceDialog && file.getTitle() != null && file.invalidFileHandle == null && this.mode != null) {
3727 this.save(file.getTitle(), done); 3580 this.save(file.getTitle(), done);
3728 - }  
3729 - else if (file != null && file.constructor == LocalFile && file.fileHandle != null) { 3581 + } else if (file != null && file.constructor == LocalFile && file.fileHandle != null) {
3730 this.showSaveFilePicker(mxUtils.bind(this, function (fileHandle, desc) { 3582 this.showSaveFilePicker(mxUtils.bind(this, function (fileHandle, desc) {
3731 file.invalidFileHandle = null; 3583 file.invalidFileHandle = null;
3732 file.fileHandle = fileHandle; 3584 file.fileHandle = fileHandle;
@@ -3734,8 +3586,7 @@ App.prototype.saveFile = function (forceDialog, success) { @@ -3734,8 +3586,7 @@ App.prototype.saveFile = function (forceDialog, success) {
3734 file.desc = desc; 3586 file.desc = desc;
3735 this.save(desc.name, done); 3587 this.save(desc.name, done);
3736 }), null, this.createFileSystemOptions(file.getTitle())); 3588 }), null, this.createFileSystemOptions(file.getTitle()));
3737 - }  
3738 - else { 3589 + } else {
3739 var filename = (file.getTitle() != null) ? file.getTitle() : this.defaultFilename; 3590 var filename = (file.getTitle() != null) ? file.getTitle() : this.defaultFilename;
3740 var allowTab = !mxClient.IS_IOS || !navigator.standalone; 3591 var allowTab = !mxClient.IS_IOS || !navigator.standalone;
3741 var prev = this.mode; 3592 var prev = this.mode;
@@ -3760,13 +3611,11 @@ App.prototype.saveFile = function (forceDialog, success) { @@ -3760,13 +3611,11 @@ App.prototype.saveFile = function (forceDialog, success) {
3760 3611
3761 if (mxClient.IS_GC || mxClient.IS_FF || document.documentMode >= 5) { 3612 if (mxClient.IS_GC || mxClient.IS_FF || document.documentMode >= 5) {
3762 input.select(); 3613 input.select();
3763 - }  
3764 - else { 3614 + } else {
3765 document.execCommand('selectAll', false, null); 3615 document.execCommand('selectAll', false, null);
3766 } 3616 }
3767 }), mxResources.get('yes'), mxResources.get('no')); 3617 }), mxResources.get('yes'), mxResources.get('no'));
3768 - }  
3769 - else { 3618 + } else {
3770 this.hideDialog(); 3619 this.hideDialog();
3771 3620
3772 if (prev == null && mode == App.MODE_DEVICE) { 3621 if (prev == null && mode == App.MODE_DEVICE) {
@@ -3784,17 +3633,14 @@ App.prototype.saveFile = function (forceDialog, success) { @@ -3784,17 +3633,14 @@ App.prototype.saveFile = function (forceDialog, success) {
3784 this.handleError(e); 3633 this.handleError(e);
3785 } 3634 }
3786 }), this.createFileSystemOptions(name)); 3635 }), this.createFileSystemOptions(name));
3787 - }  
3788 - else { 3636 + } else {
3789 this.setMode(App.MODE_DEVICE); 3637 this.setMode(App.MODE_DEVICE);
3790 this.save(name, done); 3638 this.save(name, done);
3791 } 3639 }
3792 - }  
3793 - else if (mode == 'download') { 3640 + } else if (mode == 'download') {
3794 var tmp = new LocalFile(this, null, name); 3641 var tmp = new LocalFile(this, null, name);
3795 tmp.save(); 3642 tmp.save();
3796 - }  
3797 - else if (mode == '_blank') { 3643 + } else if (mode == '_blank') {
3798 window.openFile = new OpenFile(function () { 3644 window.openFile = new OpenFile(function () {
3799 window.openFile = null; 3645 window.openFile = null;
3800 }); 3646 });
@@ -3802,16 +3648,14 @@ App.prototype.saveFile = function (forceDialog, success) { @@ -3802,16 +3648,14 @@ App.prototype.saveFile = function (forceDialog, success) {
3802 // Do not use a filename to use undefined mode 3648 // Do not use a filename to use undefined mode
3803 window.openFile.setData(this.getFileData(true)); 3649 window.openFile.setData(this.getFileData(true));
3804 this.openLink(this.getUrl(window.location.pathname), null, true); 3650 this.openLink(this.getUrl(window.location.pathname), null, true);
3805 - }  
3806 - else if (prev != mode) { 3651 + } else if (prev != mode) {
3807 this.pickFolder(mode, mxUtils.bind(this, function (folderId) { 3652 this.pickFolder(mode, mxUtils.bind(this, function (folderId) {
3808 this.createFile(name, this.getFileData(/(\.xml)$/i.test(name) || 3653 this.createFile(name, this.getFileData(/(\.xml)$/i.test(name) ||
3809 name.indexOf('.') < 0 || /(\.drawio)$/i.test(name), 3654 name.indexOf('.') < 0 || /(\.drawio)$/i.test(name),
3810 /(\.svg)$/i.test(name), /(\.html)$/i.test(name)), 3655 /(\.svg)$/i.test(name), /(\.html)$/i.test(name)),
3811 null, mode, done, this.mode == null, folderId); 3656 null, mode, done, this.mode == null, folderId);
3812 })); 3657 }));
3813 - }  
3814 - else if (mode != null) { 3658 + } else if (mode != null) {
3815 this.save(name, done); 3659 this.save(name, done);
3816 } 3660 }
3817 } 3661 }
@@ -3857,8 +3701,7 @@ App.prototype.loadTemplate = function (url, onload, onerror, templateFilename, a @@ -3857,8 +3701,7 @@ App.prototype.loadTemplate = function (url, onload, onerror, templateFilename, a
3857 if (!isVisioFilename) { 3701 if (!isVisioFilename) {
3858 if (asLibrary) { 3702 if (asLibrary) {
3859 filterFn = this.isRemoteVisioData(data) ? 'raw.vss' : 'raw.vssx'; 3703 filterFn = this.isRemoteVisioData(data) ? 'raw.vss' : 'raw.vssx';
3860 - }  
3861 - else { 3704 + } else {
3862 filterFn = this.isRemoteVisioData(data) ? 'raw.vsd' : 'raw.vsdx'; 3705 filterFn = this.isRemoteVisioData(data) ? 'raw.vsd' : 'raw.vsdx';
3863 } 3706 }
3864 } 3707 }
@@ -3866,8 +3709,7 @@ App.prototype.loadTemplate = function (url, onload, onerror, templateFilename, a @@ -3866,8 +3709,7 @@ App.prototype.loadTemplate = function (url, onload, onerror, templateFilename, a
3866 this.importVisio(this.base64ToBlob(responseData.substring(responseData.indexOf(',') + 1)), function (xml) { 3709 this.importVisio(this.base64ToBlob(responseData.substring(responseData.indexOf(',') + 1)), function (xml) {
3867 onload(xml); 3710 onload(xml);
3868 }, onerror, filterFn); 3711 }, onerror, filterFn);
3869 - }  
3870 - else if (new XMLHttpRequest().upload && this.isRemoteFileFormat(data, filterFn)) { 3712 + } else if (new XMLHttpRequest().upload && this.isRemoteFileFormat(data, filterFn)) {
3871 if (this.isExternalDataComms()) { 3713 if (this.isExternalDataComms()) {
3872 // Asynchronous parsing via server 3714 // Asynchronous parsing via server
3873 this.parseFileData(data, mxUtils.bind(this, function (xhr) { 3715 this.parseFileData(data, mxUtils.bind(this, function (xhr) {
@@ -3876,27 +3718,23 @@ App.prototype.loadTemplate = function (url, onload, onerror, templateFilename, a @@ -3876,27 +3718,23 @@ App.prototype.loadTemplate = function (url, onload, onerror, templateFilename, a
3876 onload(xhr.responseText); 3718 onload(xhr.responseText);
3877 } 3719 }
3878 }), url); 3720 }), url);
3879 - }  
3880 - else { 3721 + } else {
3881 this.showError(mxResources.get('error'), mxResources.get('notInOffline'), null, onerror); 3722 this.showError(mxResources.get('error'), mxResources.get('notInOffline'), null, onerror);
3882 } 3723 }
3883 - }  
3884 - else if (this.isLucidChartData(data)) { 3724 + } else if (this.isLucidChartData(data)) {
3885 this.convertLucidChart(data, mxUtils.bind(this, function (xml) { 3725 this.convertLucidChart(data, mxUtils.bind(this, function (xml) {
3886 onload(xml); 3726 onload(xml);
3887 }), mxUtils.bind(this, function (e) { 3727 }), mxUtils.bind(this, function (e) {
3888 onerror(e); 3728 onerror(e);
3889 })); 3729 }));
3890 - }  
3891 - else { 3730 + } else {
3892 if (/(\.png)($|\?)/i.test(filterFn) || Editor.isPngData(data)) { 3731 if (/(\.png)($|\?)/i.test(filterFn) || Editor.isPngData(data)) {
3893 data = Editor.extractGraphModelFromPng(responseData); 3732 data = Editor.extractGraphModelFromPng(responseData);
3894 } 3733 }
3895 3734
3896 onload(data); 3735 onload(data);
3897 } 3736 }
3898 - }  
3899 - catch (e) { 3737 + } catch (e) {
3900 onerror(e); 3738 onerror(e);
3901 } 3739 }
3902 }), onerror, /(\.png)($|\?)/i.test(filterFn) || /(\.v(dx|sdx?))($|\?)/i.test(filterFn) || 3740 }), onerror, /(\.png)($|\?)/i.test(filterFn) || /(\.v(dx|sdx?))($|\?)/i.test(filterFn) ||
@@ -3912,23 +3750,17 @@ App.prototype.loadTemplate = function (url, onload, onerror, templateFilename, a @@ -3912,23 +3750,17 @@ App.prototype.loadTemplate = function (url, onload, onerror, templateFilename, a
3912 App.prototype.getPeerForMode = function (mode) { 3750 App.prototype.getPeerForMode = function (mode) {
3913 if (mode == App.MODE_GOOGLE) { 3751 if (mode == App.MODE_GOOGLE) {
3914 return this.drive; 3752 return this.drive;
3915 - }  
3916 - else if (mode == App.MODE_GITHUB) { 3753 + } else if (mode == App.MODE_GITHUB) {
3917 return this.gitHub; 3754 return this.gitHub;
3918 - }  
3919 - else if (mode == App.MODE_GITLAB) { 3755 + } else if (mode == App.MODE_GITLAB) {
3920 return this.gitLab; 3756 return this.gitLab;
3921 - }  
3922 - else if (mode == App.MODE_DROPBOX) { 3757 + } else if (mode == App.MODE_DROPBOX) {
3923 return this.dropbox; 3758 return this.dropbox;
3924 - }  
3925 - else if (mode == App.MODE_ONEDRIVE) { 3759 + } else if (mode == App.MODE_ONEDRIVE) {
3926 return this.oneDrive; 3760 return this.oneDrive;
3927 - }  
3928 - else if (mode == App.MODE_TRELLO) { 3761 + } else if (mode == App.MODE_TRELLO) {
3929 return this.trello; 3762 return this.trello;
3930 - }  
3931 - else { 3763 + } else {
3932 return null; 3764 return null;
3933 } 3765 }
3934 }; 3766 };
@@ -3954,8 +3786,7 @@ App.prototype.createFile = function (title, data, libs, mode, done, replace, fol @@ -3954,8 +3786,7 @@ App.prototype.createFile = function (title, data, libs, mode, done, replace, fol
3954 3786
3955 if (resp == null && this.getCurrentFile() == null && this.dialog == null) { 3787 if (resp == null && this.getCurrentFile() == null && this.dialog == null) {
3956 this.showSplash(); 3788 this.showSplash();
3957 - }  
3958 - else if (resp != null) { 3789 + } else if (resp != null) {
3959 this.handleError(resp); 3790 this.handleError(resp);
3960 } 3791 }
3961 }); 3792 });
@@ -3970,44 +3801,37 @@ App.prototype.createFile = function (title, data, libs, mode, done, replace, fol @@ -3970,44 +3801,37 @@ App.prototype.createFile = function (title, data, libs, mode, done, replace, fol
3970 complete(); 3801 complete();
3971 this.fileCreated(file, libs, replace, done, clibs); 3802 this.fileCreated(file, libs, replace, done, clibs);
3972 }), error); 3803 }), error);
3973 - }  
3974 - else if (mode == App.MODE_GITHUB && this.gitHub != null) { 3804 + } else if (mode == App.MODE_GITHUB && this.gitHub != null) {
3975 this.gitHub.insertFile(title, data, mxUtils.bind(this, function (file) { 3805 this.gitHub.insertFile(title, data, mxUtils.bind(this, function (file) {
3976 complete(); 3806 complete();
3977 this.fileCreated(file, libs, replace, done, clibs); 3807 this.fileCreated(file, libs, replace, done, clibs);
3978 }), error, false, folderId); 3808 }), error, false, folderId);
3979 - }  
3980 - else if (mode == App.MODE_GITLAB && this.gitLab != null) { 3809 + } else if (mode == App.MODE_GITLAB && this.gitLab != null) {
3981 this.gitLab.insertFile(title, data, mxUtils.bind(this, function (file) { 3810 this.gitLab.insertFile(title, data, mxUtils.bind(this, function (file) {
3982 complete(); 3811 complete();
3983 this.fileCreated(file, libs, replace, done, clibs); 3812 this.fileCreated(file, libs, replace, done, clibs);
3984 }), error, false, folderId); 3813 }), error, false, folderId);
3985 - }  
3986 - else if (mode == App.MODE_TRELLO && this.trello != null) { 3814 + } else if (mode == App.MODE_TRELLO && this.trello != null) {
3987 this.trello.insertFile(title, data, mxUtils.bind(this, function (file) { 3815 this.trello.insertFile(title, data, mxUtils.bind(this, function (file) {
3988 complete(); 3816 complete();
3989 this.fileCreated(file, libs, replace, done, clibs); 3817 this.fileCreated(file, libs, replace, done, clibs);
3990 }), error, false, folderId); 3818 }), error, false, folderId);
3991 - }  
3992 - else if (mode == App.MODE_DROPBOX && this.dropbox != null) { 3819 + } else if (mode == App.MODE_DROPBOX && this.dropbox != null) {
3993 this.dropbox.insertFile(title, data, mxUtils.bind(this, function (file) { 3820 this.dropbox.insertFile(title, data, mxUtils.bind(this, function (file) {
3994 complete(); 3821 complete();
3995 this.fileCreated(file, libs, replace, done, clibs); 3822 this.fileCreated(file, libs, replace, done, clibs);
3996 }), error); 3823 }), error);
3997 - }  
3998 - else if (mode == App.MODE_ONEDRIVE && this.oneDrive != null) { 3824 + } else if (mode == App.MODE_ONEDRIVE && this.oneDrive != null) {
3999 this.oneDrive.insertFile(title, data, mxUtils.bind(this, function (file) { 3825 this.oneDrive.insertFile(title, data, mxUtils.bind(this, function (file) {
4000 complete(); 3826 complete();
4001 this.fileCreated(file, libs, replace, done, clibs); 3827 this.fileCreated(file, libs, replace, done, clibs);
4002 }), error, false, folderId); 3828 }), error, false, folderId);
4003 - }  
4004 - else if (mode == App.MODE_BROWSER) { 3829 + } else if (mode == App.MODE_BROWSER) {
4005 StorageFile.insertFile(this, title, data, mxUtils.bind(this, function (file) { 3830 StorageFile.insertFile(this, title, data, mxUtils.bind(this, function (file) {
4006 complete(); 3831 complete();
4007 this.fileCreated(file, libs, replace, done, clibs); 3832 this.fileCreated(file, libs, replace, done, clibs);
4008 }), error); 3833 }), error);
4009 - }  
4010 - else if (!tempFile && mode == App.MODE_DEVICE && EditorUi.nativeFileSupport) { 3834 + } else if (!tempFile && mode == App.MODE_DEVICE && EditorUi.nativeFileSupport) {
4011 complete(); 3835 complete();
4012 3836
4013 this.showSaveFilePicker(mxUtils.bind(this, function (fileHandle, desc) { 3837 this.showSaveFilePicker(mxUtils.bind(this, function (fileHandle, desc) {
@@ -4021,13 +3845,11 @@ App.prototype.createFile = function (title, data, libs, mode, done, replace, fol @@ -4021,13 +3845,11 @@ App.prototype.createFile = function (title, data, libs, mode, done, replace, fol
4021 error(e); 3845 error(e);
4022 } 3846 }
4023 }), this.createFileSystemOptions(title)); 3847 }), this.createFileSystemOptions(title));
4024 - }  
4025 - else { 3848 + } else {
4026 complete(); 3849 complete();
4027 this.fileCreated(new LocalFile(this, data, title, mode == null), libs, replace, done, clibs); 3850 this.fileCreated(new LocalFile(this, data, title, mode == null), libs, replace, done, clibs);
4028 } 3851 }
4029 - }  
4030 - catch (e) { 3852 + } catch (e) {
4031 complete(); 3853 complete();
4032 this.handleError(e); 3854 this.handleError(e);
4033 } 3855 }
@@ -4121,8 +3943,7 @@ App.prototype.fileCreated = function (file, libs, replace, done, clibs) { @@ -4121,8 +3943,7 @@ App.prototype.fileCreated = function (file, libs, replace, done, clibs) {
4121 var fn2 = mxUtils.bind(this, function () { 3943 var fn2 = mxUtils.bind(this, function () {
4122 if (replace || currentFile == null || !currentFile.isModified()) { 3944 if (replace || currentFile == null || !currentFile.isModified()) {
4123 fn3(); 3945 fn3();
4124 - }  
4125 - else { 3946 + } else {
4126 this.confirm(mxResources.get('allChangesLost'), null, fn3, 3947 this.confirm(mxResources.get('allChangesLost'), null, fn3,
4127 mxResources.get('cancel'), mxResources.get('discardChanges')); 3948 mxResources.get('cancel'), mxResources.get('discardChanges'));
4128 } 3949 }
@@ -4148,8 +3969,7 @@ App.prototype.fileCreated = function (file, libs, replace, done, clibs) { @@ -4148,8 +3969,7 @@ App.prototype.fileCreated = function (file, libs, replace, done, clibs) {
4148 } 3969 }
4149 3970
4150 window.openWindow(url, null, fn2); 3971 window.openWindow(url, null, fn2);
4151 - }  
4152 - else { 3972 + } else {
4153 fn2(); 3973 fn2();
4154 } 3974 }
4155 }); 3975 });
@@ -4157,8 +3977,7 @@ App.prototype.fileCreated = function (file, libs, replace, done, clibs) { @@ -4157,8 +3977,7 @@ App.prototype.fileCreated = function (file, libs, replace, done, clibs) {
4157 // Updates data in memory for local files 3977 // Updates data in memory for local files
4158 if (file.constructor == LocalFile) { 3978 if (file.constructor == LocalFile) {
4159 fn(); 3979 fn();
4160 - }  
4161 - else { 3980 + } else {
4162 file.saveFile(file.getTitle(), false, mxUtils.bind(this, function () { 3981 file.saveFile(file.getTitle(), false, mxUtils.bind(this, function () {
4163 fn(); 3982 fn();
4164 }), mxUtils.bind(this, function (resp) { 3983 }), mxUtils.bind(this, function (resp) {
@@ -4185,6 +4004,11 @@ App.prototype.loadFile = function (id, sameWindow, file, success, force) { @@ -4185,6 +4004,11 @@ App.prototype.loadFile = function (id, sameWindow, file, success, force) {
4185 } 4004 }
4186 4005
4187 function getToken() { 4006 function getToken() {
  4007 +
  4008 + /**
  4009 + * @description
  4010 + * @type {{userId: string, dev?: string, share?: string, configuration: string, publicId?: string }}
  4011 + */
4188 const urlParams = (function () { 4012 const urlParams = (function () {
4189 var result = new Object(); 4013 var result = new Object();
4190 var params = window.location.search.slice(1).split('&'); 4014 var params = window.location.search.slice(1).split('&');
@@ -4199,7 +4023,7 @@ App.prototype.loadFile = function (id, sameWindow, file, success, force) { @@ -4199,7 +4023,7 @@ App.prototype.loadFile = function (id, sameWindow, file, success, force) {
4199 4023
4200 return result; 4024 return result;
4201 })(); 4025 })();
4202 - 4026 + console.log(urlParams)
4203 if (urlParams.userId) { 4027 if (urlParams.userId) {
4204 axios.get(`/api/yt/third/login/id/${urlParams.userId}`) 4028 axios.get(`/api/yt/third/login/id/${urlParams.userId}`)
4205 .then(res => { 4029 .then(res => {
@@ -4230,6 +4054,7 @@ App.prototype.loadFile = function (id, sameWindow, file, success, force) { @@ -4230,6 +4054,7 @@ App.prototype.loadFile = function (id, sameWindow, file, success, force) {
4230 // } 4054 // }
4231 }) 4055 })
4232 } 4056 }
  4057 +
4233 var pageFormat = this.editor.graph.pageFormat 4058 var pageFormat = this.editor.graph.pageFormat
4234 4059
4235 // 调用API,获取保存的内容 4060 // 调用API,获取保存的内容
@@ -4245,7 +4070,11 @@ App.prototype.loadFile = function (id, sameWindow, file, success, force) { @@ -4245,7 +4070,11 @@ App.prototype.loadFile = function (id, sameWindow, file, success, force) {
4245 { key: 'iPhone 8', title: 'iPhone 8', format: new mxRectangle(0, 0, 375, 667) }, 4070 { key: 'iPhone 8', title: 'iPhone 8', format: new mxRectangle(0, 0, 375, 667) },
4246 { key: 'iPhone 8 Plus', title: 'iPhone 8 Plus', format: new mxRectangle(0, 0, 415, 737) }, 4071 { key: 'iPhone 8 Plus', title: 'iPhone 8 Plus', format: new mxRectangle(0, 0, 415, 737) },
4247 { key: 'iPhone X/XS', title: 'iPhone X/XS', format: new mxRectangle(0, 0, 376, 813) }, 4072 { key: 'iPhone X/XS', title: 'iPhone X/XS', format: new mxRectangle(0, 0, 376, 813) },
4248 - { key: 'iPhone XR/XS Max', title: 'iPhone XR/XS Max', format: new mxRectangle(0, 0, 415, 897) }, 4073 + {
  4074 + key: 'iPhone XR/XS Max',
  4075 + title: 'iPhone XR/XS Max',
  4076 + format: new mxRectangle(0, 0, 415, 897)
  4077 + },
4249 { key: 'iPad 4', title: 'iPad 4', format: new mxRectangle(0, 0, 709, 1025) }, 4078 { key: 'iPad 4', title: 'iPad 4', format: new mxRectangle(0, 0, 709, 1025) },
4250 { key: 'Galaxy S9', title: 'Galaxy S9', format: new mxRectangle(0, 0, 361, 741) }, 4079 { key: 'Galaxy S9', title: 'Galaxy S9', format: new mxRectangle(0, 0, 361, 741) },
4251 { key: 'Galaxy S10E', title: 'Galaxy S10E', format: new mxRectangle(0, 0, 361, 741) }, 4080 { key: 'Galaxy S10E', title: 'Galaxy S10E', format: new mxRectangle(0, 0, 361, 741) },
@@ -4710,23 +4539,17 @@ App.prototype.getLibraryStorageHint = function (file) { @@ -4710,23 +4539,17 @@ App.prototype.getLibraryStorageHint = function (file) {
4710 4539
4711 if (file.constructor == DriveLibrary) { 4540 if (file.constructor == DriveLibrary) {
4712 tip += ' (' + mxResources.get('googleDrive') + ')'; 4541 tip += ' (' + mxResources.get('googleDrive') + ')';
4713 - }  
4714 - else if (file.constructor == GitHubLibrary) { 4542 + } else if (file.constructor == GitHubLibrary) {
4715 tip += ' (' + mxResources.get('github') + ')'; 4543 tip += ' (' + mxResources.get('github') + ')';
4716 - }  
4717 - else if (file.constructor == TrelloLibrary) { 4544 + } else if (file.constructor == TrelloLibrary) {
4718 tip += ' (' + mxResources.get('trello') + ')'; 4545 tip += ' (' + mxResources.get('trello') + ')';
4719 - }  
4720 - else if (file.constructor == DropboxLibrary) { 4546 + } else if (file.constructor == DropboxLibrary) {
4721 tip += ' (' + mxResources.get('dropbox') + ')'; 4547 tip += ' (' + mxResources.get('dropbox') + ')';
4722 - }  
4723 - else if (file.constructor == OneDriveLibrary) { 4548 + } else if (file.constructor == OneDriveLibrary) {
4724 tip += ' (' + mxResources.get('oneDrive') + ')'; 4549 tip += ' (' + mxResources.get('oneDrive') + ')';
4725 - }  
4726 - else if (file.constructor == StorageLibrary) { 4550 + } else if (file.constructor == StorageLibrary) {
4727 tip += ' (' + mxResources.get('browser') + ')'; 4551 tip += ' (' + mxResources.get('browser') + ')';
4728 - }  
4729 - else if (file.constructor == LocalLibrary) { 4552 + } else if (file.constructor == LocalLibrary) {
4730 tip += ' (' + mxResources.get('device') + ')'; 4553 tip += ' (' + mxResources.get('device') + ')';
4731 } 4554 }
4732 4555
@@ -4831,19 +4654,16 @@ App.prototype.loadLibraries = function (libs, done) { @@ -4831,19 +4654,16 @@ App.prototype.loadLibraries = function (libs, done) {
4831 4654
4832 if (xml != null) { 4655 if (xml != null) {
4833 onload(new StorageLibrary(this, xml, name)); 4656 onload(new StorageLibrary(this, xml, name));
4834 - }  
4835 - else { 4657 + } else {
4836 onerror(); 4658 onerror();
4837 } 4659 }
4838 }), onerror); 4660 }), onerror);
4839 - }  
4840 - catch (e) { 4661 + } catch (e) {
4841 onerror(); 4662 onerror();
4842 } 4663 }
4843 }), 0); 4664 }), 0);
4844 } 4665 }
4845 - }  
4846 - else if (service == 'U') { 4666 + } else if (service == 'U') {
4847 var url = decodeURIComponent(id.substring(1)); 4667 var url = decodeURIComponent(id.substring(1));
4848 4668
4849 if (!this.isOffline()) { 4669 if (!this.isOffline()) {
@@ -4851,16 +4671,14 @@ App.prototype.loadLibraries = function (libs, done) { @@ -4851,16 +4671,14 @@ App.prototype.loadLibraries = function (libs, done) {
4851 if (text != null && text.length > 0) { 4671 if (text != null && text.length > 0) {
4852 // LATER: Convert mxfile to mxlibrary using code from libraryLoaded 4672 // LATER: Convert mxfile to mxlibrary using code from libraryLoaded
4853 onload(new UrlLibrary(this, text, url)); 4673 onload(new UrlLibrary(this, text, url));
4854 - }  
4855 - else { 4674 + } else {
4856 onerror(); 4675 onerror();
4857 } 4676 }
4858 }), function () { 4677 }), function () {
4859 onerror(); 4678 onerror();
4860 }, null, true); 4679 }, null, true);
4861 } 4680 }
4862 - }  
4863 - else if (service == 'R') { 4681 + } else if (service == 'R') {
4864 var libDesc = decodeURIComponent(id.substring(1)); 4682 var libDesc = decodeURIComponent(id.substring(1));
4865 4683
4866 try { 4684 try {
@@ -4874,52 +4692,43 @@ App.prototype.loadLibraries = function (libs, done) { @@ -4874,52 +4692,43 @@ App.prototype.loadLibraries = function (libs, done) {
4874 this.remoteInvoke('getFileContent', [libObj.downloadUrl], null, mxUtils.bind(this, function (libContent) { 4692 this.remoteInvoke('getFileContent', [libObj.downloadUrl], null, mxUtils.bind(this, function (libContent) {
4875 try { 4693 try {
4876 onload(new RemoteLibrary(this, libContent, libObj)); 4694 onload(new RemoteLibrary(this, libContent, libObj));
4877 - }  
4878 - catch (e) { 4695 + } catch (e) {
4879 onerror(); 4696 onerror();
4880 } 4697 }
4881 }), function () { 4698 }), function () {
4882 onerror(); 4699 onerror();
4883 }); 4700 });
4884 - }  
4885 - catch (e) { 4701 + } catch (e) {
4886 onerror(); 4702 onerror();
4887 } 4703 }
4888 - }  
4889 - else if (service == 'S' && this.loadDesktopLib != null) { 4704 + } else if (service == 'S' && this.loadDesktopLib != null) {
4890 try { 4705 try {
4891 this.loadDesktopLib(decodeURIComponent(id.substring(1)), function (desktopLib) { 4706 this.loadDesktopLib(decodeURIComponent(id.substring(1)), function (desktopLib) {
4892 onload(desktopLib); 4707 onload(desktopLib);
4893 }, onerror); 4708 }, onerror);
4894 - }  
4895 - catch (e) { 4709 + } catch (e) {
4896 onerror(); 4710 onerror();
4897 } 4711 }
4898 - }  
4899 - else { 4712 + } else {
4900 var peer = null; 4713 var peer = null;
4901 4714
4902 if (service == 'G') { 4715 if (service == 'G') {
4903 if (this.drive != null && this.drive.user != null) { 4716 if (this.drive != null && this.drive.user != null) {
4904 peer = this.drive; 4717 peer = this.drive;
4905 } 4718 }
4906 - }  
4907 - else if (service == 'H') { 4719 + } else if (service == 'H') {
4908 if (this.gitHub != null && this.gitHub.getUser() != null) { 4720 if (this.gitHub != null && this.gitHub.getUser() != null) {
4909 peer = this.gitHub; 4721 peer = this.gitHub;
4910 } 4722 }
4911 - }  
4912 - else if (service == 'T') { 4723 + } else if (service == 'T') {
4913 if (this.trello != null && this.trello.isAuthorized()) { 4724 if (this.trello != null && this.trello.isAuthorized()) {
4914 peer = this.trello; 4725 peer = this.trello;
4915 } 4726 }
4916 - }  
4917 - else if (service == 'D') { 4727 + } else if (service == 'D') {
4918 if (this.dropbox != null && this.dropbox.getUser() != null) { 4728 if (this.dropbox != null && this.dropbox.getUser() != null) {
4919 peer = this.dropbox; 4729 peer = this.dropbox;
4920 } 4730 }
4921 - }  
4922 - else if (service == 'W') { 4731 + } else if (service == 'W') {
4923 if (this.oneDrive != null && this.oneDrive.getUser() != null) { 4732 if (this.oneDrive != null && this.oneDrive.getUser() != null) {
4924 peer = this.oneDrive; 4733 peer = this.oneDrive;
4925 } 4734 }
@@ -4929,15 +4738,13 @@ App.prototype.loadLibraries = function (libs, done) { @@ -4929,15 +4738,13 @@ App.prototype.loadLibraries = function (libs, done) {
4929 peer.getLibrary(decodeURIComponent(id.substring(1)), mxUtils.bind(this, function (file) { 4738 peer.getLibrary(decodeURIComponent(id.substring(1)), mxUtils.bind(this, function (file) {
4930 try { 4739 try {
4931 onload(file); 4740 onload(file);
4932 - }  
4933 - catch (e) { 4741 + } catch (e) {
4934 onerror(); 4742 onerror();
4935 } 4743 }
4936 }), function (resp) { 4744 }), function (resp) {
4937 onerror(); 4745 onerror();
4938 }); 4746 });
4939 - }  
4940 - else { 4747 + } else {
4941 onerror(true); 4748 onerror(true);
4942 } 4749 }
4943 } 4750 }
@@ -4946,8 +4753,7 @@ App.prototype.loadLibraries = function (libs, done) { @@ -4946,8 +4753,7 @@ App.prototype.loadLibraries = function (libs, done) {
4946 } 4753 }
4947 4754
4948 checkDone(); 4755 checkDone();
4949 - }  
4950 - else { 4756 + } else {
4951 checkDone(); 4757 checkDone();
4952 } 4758 }
4953 } 4759 }
@@ -4968,8 +4774,7 @@ App.prototype.updateButtonContainer = function () { @@ -4968,8 +4774,7 @@ App.prototype.updateButtonContainer = function () {
4968 this.buttonContainer.style.paddingRight = '12px'; 4774 this.buttonContainer.style.paddingRight = '12px';
4969 this.buttonContainer.style.paddingTop = '6px'; 4775 this.buttonContainer.style.paddingTop = '6px';
4970 this.buttonContainer.style.right = urlParams['noLangIcon'] == '1' ? '0' : '25px'; 4776 this.buttonContainer.style.right = urlParams['noLangIcon'] == '1' ? '0' : '25px';
4971 - }  
4972 - else if (uiTheme != 'min') { 4777 + } else if (uiTheme != 'min') {
4973 this.buttonContainer.style.paddingRight = '38px'; 4778 this.buttonContainer.style.paddingRight = '38px';
4974 this.buttonContainer.style.paddingTop = '6px'; 4779 this.buttonContainer.style.paddingTop = '6px';
4975 } 4780 }
@@ -4989,14 +4794,11 @@ App.prototype.updateButtonContainer = function () { @@ -4989,14 +4794,11 @@ App.prototype.updateButtonContainer = function () {
4989 if (uiTheme == 'atlas') { 4794 if (uiTheme == 'atlas') {
4990 this.commentButton.style.marginRight = '10px'; 4795 this.commentButton.style.marginRight = '10px';
4991 this.commentButton.style.marginTop = '-3px'; 4796 this.commentButton.style.marginTop = '-3px';
4992 - }  
4993 - else if (uiTheme == 'min') { 4797 + } else if (uiTheme == 'min') {
4994 this.commentButton.style.marginTop = '1px'; 4798 this.commentButton.style.marginTop = '1px';
4995 - }  
4996 - else if (urlParams['atlas'] == '1') { 4799 + } else if (urlParams['atlas'] == '1') {
4997 this.commentButton.style.marginTop = '-2px'; 4800 this.commentButton.style.marginTop = '-2px';
4998 - }  
4999 - else { 4801 + } else {
5000 this.commentButton.style.marginTop = '-5px'; 4802 this.commentButton.style.marginTop = '-5px';
5001 } 4803 }
5002 4804
@@ -5010,8 +4812,7 @@ App.prototype.updateButtonContainer = function () { @@ -5010,8 +4812,7 @@ App.prototype.updateButtonContainer = function () {
5010 this.commentButton.style.filter = 'invert(100%)'; 4812 this.commentButton.style.filter = 'invert(100%)';
5011 } 4813 }
5012 } 4814 }
5013 - }  
5014 - else if (this.commentButton != null) { 4815 + } else if (this.commentButton != null) {
5015 this.commentButton.parentNode.removeChild(this.commentButton); 4816 this.commentButton.parentNode.removeChild(this.commentButton);
5016 this.commentButton = null; 4817 this.commentButton = null;
5017 } 4818 }
@@ -5140,8 +4941,7 @@ App.prototype.updateButtonContainer = function () { @@ -5140,8 +4941,7 @@ App.prototype.updateButtonContainer = function () {
5140 this.rightContainer.appendChild(this.saveButton); 4941 this.rightContainer.appendChild(this.saveButton);
5141 4942
5142 } 4943 }
5143 - }  
5144 - else if (this.shareButton != null) { 4944 + } else if (this.shareButton != null) {
5145 this.shareButton.parentNode.removeChild(this.shareButton); 4945 this.shareButton.parentNode.removeChild(this.shareButton);
5146 this.shareButton = null; 4946 this.shareButton = null;
5147 this.saveButton.parentNode.removeChild(this.saveButton); 4947 this.saveButton.parentNode.removeChild(this.saveButton);
@@ -5160,8 +4960,7 @@ App.prototype.updateButtonContainer = function () { @@ -5160,8 +4960,7 @@ App.prototype.updateButtonContainer = function () {
5160 // TODO thingskit close notify bell 4960 // TODO thingskit close notify bell
5161 // this.fetchAndShowNotification('online', this.mode); 4961 // this.fetchAndShowNotification('online', this.mode);
5162 } 4962 }
5163 - }  
5164 - else if (urlParams['notif'] != null) //Notif for embed mode 4963 + } else if (urlParams['notif'] != null) //Notif for embed mode
5165 { 4964 {
5166 // TODO thingskit close notify bell 4965 // TODO thingskit close notify bell
5167 // this.fetchAndShowNotification(urlParams['notif']); 4966 // this.fetchAndShowNotification(urlParams['notif']);
@@ -5204,8 +5003,8 @@ App.prototype.fetchAndShowNotification = function (target, subtarget) { @@ -5204,8 +5003,8 @@ App.prototype.fetchAndShowNotification = function (target, subtarget) {
5204 if (localStorage != null) { 5003 if (localStorage != null) {
5205 cachedNotif = JSON.parse(localStorage.getItem(cachedNotifKey)); 5004 cachedNotif = JSON.parse(localStorage.getItem(cachedNotifKey));
5206 } 5005 }
5207 - }  
5208 - catch (e) { } //Ignore 5006 + } catch (e) {
  5007 + } //Ignore
5209 5008
5210 if (cachedNotif == null || cachedNotif.ts + 24 * 60 * 60 * 1000 < Date.now()) //Cache for one day 5009 if (cachedNotif == null || cachedNotif.ts + 24 * 60 * 60 * 1000 < Date.now()) //Cache for one day
5211 { 5010 {
@@ -5228,8 +5027,7 @@ App.prototype.fetchAndShowNotification = function (target, subtarget) { @@ -5228,8 +5027,7 @@ App.prototype.fetchAndShowNotification = function (target, subtarget) {
5228 processNotif(notifs); 5027 processNotif(notifs);
5229 } 5028 }
5230 })); 5029 }));
5231 - }  
5232 - else { 5030 + } else {
5233 processNotif(cachedNotif.notifs); 5031 processNotif(cachedNotif.notifs);
5234 } 5032 }
5235 }; 5033 };
@@ -5291,8 +5089,7 @@ App.prototype.showNotification = function (notifs, lsReadFlag) { @@ -5291,8 +5089,7 @@ App.prototype.showNotification = function (notifs, lsReadFlag) {
5291 if (uiTheme == 'min') { 5089 if (uiTheme == 'min') {
5292 this.notificationBtn.style.width = '30px'; 5090 this.notificationBtn.style.width = '30px';
5293 this.notificationBtn.style.top = '4px'; 5091 this.notificationBtn.style.top = '4px';
5294 - }  
5295 - else if (urlParams['atlas'] == '1') { 5092 + } else if (urlParams['atlas'] == '1') {
5296 this.notificationBtn.style.top = '2px'; 5093 this.notificationBtn.style.top = '2px';
5297 } 5094 }
5298 5095
@@ -5353,15 +5150,13 @@ App.prototype.showNotification = function (notifs, lsReadFlag) { @@ -5353,15 +5150,13 @@ App.prototype.showNotification = function (notifs, lsReadFlag) {
5353 this.notificationWin.style.top = (r.top + this.notificationBtn.clientHeight) + 'px'; 5150 this.notificationWin.style.top = (r.top + this.notificationBtn.clientHeight) + 'px';
5354 this.notificationWin.style.left = (r.right - this.notificationWin.clientWidth) + 'px'; 5151 this.notificationWin.style.left = (r.right - this.notificationWin.clientWidth) + 'px';
5355 shouldAnimate(0); //Stop animation once notifications are open 5152 shouldAnimate(0); //Stop animation once notifications are open
5356 - }  
5357 - else { 5153 + } else {
5358 markAllAsRead(); 5154 markAllAsRead();
5359 } 5155 }
5360 })); 5156 }));
5361 5157
5362 mxEvent.addListener(winClose, 'click', markAllAsRead); 5158 mxEvent.addListener(winClose, 'click', markAllAsRead);
5363 - }  
5364 - else { 5159 + } else {
5365 this.notificationBtn.style.display = ''; //In case it was hidden 5160 this.notificationBtn.style.display = ''; //In case it was hidden
5366 } 5161 }
5367 5162
@@ -5370,8 +5165,7 @@ App.prototype.showNotification = function (notifs, lsReadFlag) { @@ -5370,8 +5165,7 @@ App.prototype.showNotification = function (notifs, lsReadFlag) {
5370 5165
5371 if (notifListEl == null) { 5166 if (notifListEl == null) {
5372 return; //This shouldn't happen and no meaning of continuing 5167 return; //This shouldn't happen and no meaning of continuing
5373 - }  
5374 - else { 5168 + } else {
5375 notifListEl.innerHTML = '<div class="line"></div>'; 5169 notifListEl.innerHTML = '<div class="line"></div>';
5376 5170
5377 for (var i = 0; i < notifs.length; i++) { 5171 for (var i = 0; i < notifs.length; i++) {
@@ -5442,14 +5236,12 @@ App.prototype.save = function (name, done) { @@ -5442,14 +5236,12 @@ App.prototype.save = function (name, done) {
5442 try { 5236 try {
5443 if (name == file.getTitle()) { 5237 if (name == file.getTitle()) {
5444 file.save(true, success, error); 5238 file.save(true, success, error);
5445 - }  
5446 - else { 5239 + } else {
5447 file.saveAs(name, success, error) 5240 file.saveAs(name, success, error)
5448 } 5241 }
5449 5242
5450 console.log('file', file) 5243 console.log('file', file)
5451 - }  
5452 - catch (err) { 5244 + } catch (err) {
5453 error(err); 5245 error(err);
5454 } 5246 }
5455 } 5247 }
@@ -5479,8 +5271,7 @@ App.prototype.pickFolder = function (mode, fn, enabled, direct, force) { @@ -5479,8 +5271,7 @@ App.prototype.pickFolder = function (mode, fn, enabled, direct, force) {
5479 fn(folderId); 5271 fn(folderId);
5480 } 5272 }
5481 }), force); 5273 }), force);
5482 - }  
5483 - else if (enabled && mode == App.MODE_ONEDRIVE && this.oneDrive != null) { 5274 + } else if (enabled && mode == App.MODE_ONEDRIVE && this.oneDrive != null) {
5484 this.oneDrive.pickFolder(mxUtils.bind(this, function (files) { 5275 this.oneDrive.pickFolder(mxUtils.bind(this, function (files) {
5485 var folderId = null; 5276 var folderId = null;
5486 resume(); 5277 resume();
@@ -5490,26 +5281,22 @@ App.prototype.pickFolder = function (mode, fn, enabled, direct, force) { @@ -5490,26 +5281,22 @@ App.prototype.pickFolder = function (mode, fn, enabled, direct, force) {
5490 fn(folderId); 5281 fn(folderId);
5491 } 5282 }
5492 }), direct); 5283 }), direct);
5493 - }  
5494 - else if (enabled && mode == App.MODE_GITHUB && this.gitHub != null) { 5284 + } else if (enabled && mode == App.MODE_GITHUB && this.gitHub != null) {
5495 this.gitHub.pickFolder(mxUtils.bind(this, function (folderPath) { 5285 this.gitHub.pickFolder(mxUtils.bind(this, function (folderPath) {
5496 resume(); 5286 resume();
5497 fn(folderPath); 5287 fn(folderPath);
5498 })); 5288 }));
5499 - }  
5500 - else if (enabled && mode == App.MODE_GITLAB && this.gitLab != null) { 5289 + } else if (enabled && mode == App.MODE_GITLAB && this.gitLab != null) {
5501 this.gitLab.pickFolder(mxUtils.bind(this, function (folderPath) { 5290 this.gitLab.pickFolder(mxUtils.bind(this, function (folderPath) {
5502 resume(); 5291 resume();
5503 fn(folderPath); 5292 fn(folderPath);
5504 })); 5293 }));
5505 - }  
5506 - else if (enabled && mode == App.MODE_TRELLO && this.trello != null) { 5294 + } else if (enabled && mode == App.MODE_TRELLO && this.trello != null) {
5507 this.trello.pickFolder(mxUtils.bind(this, function (cardId) { 5295 this.trello.pickFolder(mxUtils.bind(this, function (cardId) {
5508 resume(); 5296 resume();
5509 fn(cardId); 5297 fn(cardId);
5510 })); 5298 }));
5511 - }  
5512 - else { 5299 + } else {
5513 EditorUi.prototype.pickFolder.apply(this, arguments); 5300 EditorUi.prototype.pickFolder.apply(this, arguments);
5514 } 5301 }
5515 }; 5302 };
@@ -5529,8 +5316,7 @@ App.prototype.exportFile = function (data, filename, mimeType, base64Encoded, mo @@ -5529,8 +5316,7 @@ App.prototype.exportFile = function (data, filename, mimeType, base64Encoded, mo
5529 this.handleError(resp); 5316 this.handleError(resp);
5530 })); 5317 }));
5531 } 5318 }
5532 - }  
5533 - else if (mode == App.MODE_GOOGLE) { 5319 + } else if (mode == App.MODE_GOOGLE) {
5534 if (this.drive != null && this.spinner.spin(document.body, mxResources.get('saving'))) { 5320 if (this.drive != null && this.spinner.spin(document.body, mxResources.get('saving'))) {
5535 this.drive.insertFile(filename, data, folderId, mxUtils.bind(this, function (resp) { 5321 this.drive.insertFile(filename, data, folderId, mxUtils.bind(this, function (resp) {
5536 // TODO: Add callback with url param for clickable status message 5322 // TODO: Add callback with url param for clickable status message
@@ -5563,8 +5349,7 @@ App.prototype.exportFile = function (data, filename, mimeType, base64Encoded, mo @@ -5563,8 +5349,7 @@ App.prototype.exportFile = function (data, filename, mimeType, base64Encoded, mo
5563 this.handleError(resp); 5349 this.handleError(resp);
5564 }), mimeType, base64Encoded); 5350 }), mimeType, base64Encoded);
5565 } 5351 }
5566 - }  
5567 - else if (mode == App.MODE_ONEDRIVE) { 5352 + } else if (mode == App.MODE_ONEDRIVE) {
5568 if (this.oneDrive != null && this.spinner.spin(document.body, mxResources.get('saving'))) { 5353 if (this.oneDrive != null && this.spinner.spin(document.body, mxResources.get('saving'))) {
5569 // KNOWN: OneDrive does not show .svg extension 5354 // KNOWN: OneDrive does not show .svg extension
5570 this.oneDrive.insertFile(filename, (base64Encoded) ? this.base64ToBlob(data, mimeType) : 5355 this.oneDrive.insertFile(filename, (base64Encoded) ? this.base64ToBlob(data, mimeType) :
@@ -5575,8 +5360,7 @@ App.prototype.exportFile = function (data, filename, mimeType, base64Encoded, mo @@ -5575,8 +5360,7 @@ App.prototype.exportFile = function (data, filename, mimeType, base64Encoded, mo
5575 this.handleError(resp); 5360 this.handleError(resp);
5576 }), false, folderId); 5361 }), false, folderId);
5577 } 5362 }
5578 - }  
5579 - else if (mode == App.MODE_GITHUB) { 5363 + } else if (mode == App.MODE_GITHUB) {
5580 if (this.gitHub != null && this.spinner.spin(document.body, mxResources.get('saving'))) { 5364 if (this.gitHub != null && this.spinner.spin(document.body, mxResources.get('saving'))) {
5581 // Must insert file as library to force the file to be written 5365 // Must insert file as library to force the file to be written
5582 this.gitHub.insertFile(filename, data, mxUtils.bind(this, function () { 5366 this.gitHub.insertFile(filename, data, mxUtils.bind(this, function () {
@@ -5586,8 +5370,7 @@ App.prototype.exportFile = function (data, filename, mimeType, base64Encoded, mo @@ -5586,8 +5370,7 @@ App.prototype.exportFile = function (data, filename, mimeType, base64Encoded, mo
5586 this.handleError(resp); 5370 this.handleError(resp);
5587 }), true, folderId, base64Encoded); 5371 }), true, folderId, base64Encoded);
5588 } 5372 }
5589 - }  
5590 - else if (mode == App.MODE_GITLAB) { 5373 + } else if (mode == App.MODE_GITLAB) {
5591 if (this.gitHub != null && this.spinner.spin(document.body, mxResources.get('saving'))) { 5374 if (this.gitHub != null && this.spinner.spin(document.body, mxResources.get('saving'))) {
5592 // Must insert file as library to force the file to be written 5375 // Must insert file as library to force the file to be written
5593 this.gitLab.insertFile(filename, data, mxUtils.bind(this, function () { 5376 this.gitLab.insertFile(filename, data, mxUtils.bind(this, function () {
@@ -5597,8 +5380,7 @@ App.prototype.exportFile = function (data, filename, mimeType, base64Encoded, mo @@ -5597,8 +5380,7 @@ App.prototype.exportFile = function (data, filename, mimeType, base64Encoded, mo
5597 this.handleError(resp); 5380 this.handleError(resp);
5598 }), true, folderId, base64Encoded); 5381 }), true, folderId, base64Encoded);
5599 } 5382 }
5600 - }  
5601 - else if (mode == App.MODE_TRELLO) { 5383 + } else if (mode == App.MODE_TRELLO) {
5602 if (this.trello != null && this.spinner.spin(document.body, mxResources.get('saving'))) { 5384 if (this.trello != null && this.spinner.spin(document.body, mxResources.get('saving'))) {
5603 this.trello.insertFile(filename, (base64Encoded) ? this.base64ToBlob(data, mimeType) : 5385 this.trello.insertFile(filename, (base64Encoded) ? this.base64ToBlob(data, mimeType) :
5604 data, mxUtils.bind(this, function () { 5386 data, mxUtils.bind(this, function () {
@@ -5608,16 +5390,14 @@ App.prototype.exportFile = function (data, filename, mimeType, base64Encoded, mo @@ -5608,16 +5390,14 @@ App.prototype.exportFile = function (data, filename, mimeType, base64Encoded, mo
5608 this.handleError(resp); 5390 this.handleError(resp);
5609 }), false, folderId); 5391 }), false, folderId);
5610 } 5392 }
5611 - }  
5612 - else if (mode == App.MODE_BROWSER) { 5393 + } else if (mode == App.MODE_BROWSER) {
5613 var fn = mxUtils.bind(this, function () { 5394 var fn = mxUtils.bind(this, function () {
5614 localStorage.setItem(filename, data); 5395 localStorage.setItem(filename, data);
5615 }); 5396 });
5616 5397
5617 if (localStorage.getItem(filename) == null) { 5398 if (localStorage.getItem(filename) == null) {
5618 fn(); 5399 fn();
5619 - }  
5620 - else { 5400 + } else {
5621 this.confirm(mxResources.get('replaceIt', [filename]), fn); 5401 this.confirm(mxResources.get('replaceIt', [filename]), fn);
5622 } 5402 }
5623 } 5403 }
@@ -5657,8 +5437,7 @@ App.prototype.descriptorChanged = function () { @@ -5657,8 +5437,7 @@ App.prototype.descriptorChanged = function () {
5657 5437
5658 if (newHash.length > 0) { 5438 if (newHash.length > 0) {
5659 window.location.hash = newHash; 5439 window.location.hash = newHash;
5660 - }  
5661 - else if (window.location.hash.length > 0) { 5440 + } else if (window.location.hash.length > 0) {
5662 window.location.hash = ''; 5441 window.location.hash = '';
5663 } 5442 }
5664 } 5443 }
@@ -5691,8 +5470,7 @@ App.prototype.showAuthDialog = function (peer, showRememberOption, fn, closeFn) @@ -5691,8 +5470,7 @@ App.prototype.showAuthDialog = function (peer, showRememberOption, fn, closeFn)
5691 resume(); 5470 resume();
5692 })); 5471 }));
5693 } 5472 }
5694 - }  
5695 - catch (e) { 5473 + } catch (e) {
5696 this.editor.setStatus(mxUtils.htmlEntities(e.message)); 5474 this.editor.setStatus(mxUtils.htmlEntities(e.message));
5697 } 5475 }
5698 })).container, 300, (showRememberOption) ? 180 : 140, true, true, mxUtils.bind(this, function (cancel) { 5476 })).container, 300, (showRememberOption) ? 180 : 140, true, true, mxUtils.bind(this, function (cancel) {
@@ -5748,24 +5526,21 @@ App.prototype.convertFile = function (url, filename, mimeType, extension, succes @@ -5748,24 +5526,21 @@ App.prototype.convertFile = function (url, filename, mimeType, extension, succes
5748 if (gitHubUrl) { 5526 if (gitHubUrl) {
5749 var file = JSON.parse(req.responseText); 5527 var file = JSON.parse(req.responseText);
5750 blob = this.base64ToBlob(file.content, 'application/octet-stream'); 5528 blob = this.base64ToBlob(file.content, 'application/octet-stream');
5751 - }  
5752 - else { 5529 + } else {
5753 blob = new Blob([req.response], { type: 'application/octet-stream' }); 5530 blob = new Blob([req.response], { type: 'application/octet-stream' });
5754 } 5531 }
5755 5532
5756 this.importVisio(blob, mxUtils.bind(this, function (xml) { 5533 this.importVisio(blob, mxUtils.bind(this, function (xml) {
5757 success(new LocalFile(this, xml, name, true)); 5534 success(new LocalFile(this, xml, name, true));
5758 }), error, filename) 5535 }), error, filename)
5759 - }  
5760 - else if (error != null) { 5536 + } else if (error != null) {
5761 error({ message: mxResources.get('errorLoadingFile') }); 5537 error({ message: mxResources.get('errorLoadingFile') });
5762 } 5538 }
5763 }); 5539 });
5764 5540
5765 req.onerror = error; 5541 req.onerror = error;
5766 req.send(); 5542 req.send();
5767 - }  
5768 - else { 5543 + } else {
5769 var handleData = mxUtils.bind(this, function (data) { 5544 var handleData = mxUtils.bind(this, function (data) {
5770 try { 5545 try {
5771 if (/\.pdf$/i.test(filename)) { 5546 if (/\.pdf$/i.test(filename)) {
@@ -5774,34 +5549,28 @@ App.prototype.convertFile = function (url, filename, mimeType, extension, succes @@ -5774,34 +5549,28 @@ App.prototype.convertFile = function (url, filename, mimeType, extension, succes
5774 if (temp != null && temp.length > 0) { 5549 if (temp != null && temp.length > 0) {
5775 success(new LocalFile(this, temp, name, true)); 5550 success(new LocalFile(this, temp, name, true));
5776 } 5551 }
5777 - }  
5778 - else if (/\.png$/i.test(filename)) { 5552 + } else if (/\.png$/i.test(filename)) {
5779 var temp = this.extractGraphModelFromPng(data); 5553 var temp = this.extractGraphModelFromPng(data);
5780 5554
5781 if (temp != null) { 5555 if (temp != null) {
5782 success(new LocalFile(this, temp, name, true)); 5556 success(new LocalFile(this, temp, name, true));
5783 - }  
5784 - else { 5557 + } else {
5785 success(new LocalFile(this, data, filename, true)); 5558 success(new LocalFile(this, data, filename, true));
5786 } 5559 }
5787 - }  
5788 - else if (Graph.fileSupport && new XMLHttpRequest().upload && this.isRemoteFileFormat(data, url)) { 5560 + } else if (Graph.fileSupport && new XMLHttpRequest().upload && this.isRemoteFileFormat(data, url)) {
5789 this.parseFileData(data, mxUtils.bind(this, function (xhr) { 5561 this.parseFileData(data, mxUtils.bind(this, function (xhr) {
5790 if (xhr.readyState == 4) { 5562 if (xhr.readyState == 4) {
5791 if (xhr.status >= 200 && xhr.status <= 299) { 5563 if (xhr.status >= 200 && xhr.status <= 299) {
5792 success(new LocalFile(this, xhr.responseText, name, true)); 5564 success(new LocalFile(this, xhr.responseText, name, true));
5793 - }  
5794 - else if (error != null) { 5565 + } else if (error != null) {
5795 error({ message: mxResources.get('errorLoadingFile') }); 5566 error({ message: mxResources.get('errorLoadingFile') });
5796 } 5567 }
5797 } 5568 }
5798 }), filename); 5569 }), filename);
5799 - }  
5800 - else { 5570 + } else {
5801 success(new LocalFile(this, data, name, true)); 5571 success(new LocalFile(this, data, name, true));
5802 } 5572 }
5803 - }  
5804 - catch (e) { 5573 + } catch (e) {
5805 if (error != null) { 5574 if (error != null) {
5806 error(e); 5575 error(e);
5807 } 5576 }
@@ -5824,11 +5593,9 @@ App.prototype.convertFile = function (url, filename, mimeType, extension, succes @@ -5824,11 +5593,9 @@ App.prototype.convertFile = function (url, filename, mimeType, extension, succes
5824 if (file.encoding === 'base64') { 5593 if (file.encoding === 'base64') {
5825 if (/\.png$/i.test(filename)) { 5594 if (/\.png$/i.test(filename)) {
5826 data = 'data:image/png;base64,' + data; 5595 data = 'data:image/png;base64,' + data;
5827 - }  
5828 - else if (/\.pdf$/i.test(filename)) { 5596 + } else if (/\.pdf$/i.test(filename)) {
5829 data = 'data:application/pdf;base64,' + data; 5597 data = 'data:application/pdf;base64,' + data;
5830 - }  
5831 - else { 5598 + } else {
5832 // Workaround for character encoding issues in IE10/11 5599 // Workaround for character encoding issues in IE10/11
5833 data = (window.atob && !mxClient.IS_IE && !mxClient.IS_IE11) ? atob(data) : Base64.decode(data); 5600 data = (window.atob && !mxClient.IS_IE && !mxClient.IS_IE11) ? atob(data) : Base64.decode(data);
5834 } 5601 }
@@ -5836,8 +5603,7 @@ App.prototype.convertFile = function (url, filename, mimeType, extension, succes @@ -5836,8 +5603,7 @@ App.prototype.convertFile = function (url, filename, mimeType, extension, succes
5836 5603
5837 handleData(data); 5604 handleData(data);
5838 } 5605 }
5839 - }  
5840 - else if (error != null) { 5606 + } else if (error != null) {
5841 error({ code: App.ERROR_UNKNOWN }); 5607 error({ code: App.ERROR_UNKNOWN });
5842 } 5608 }
5843 }), function () { 5609 }), function () {
@@ -5849,11 +5615,9 @@ App.prototype.convertFile = function (url, filename, mimeType, extension, succes @@ -5849,11 +5615,9 @@ App.prototype.convertFile = function (url, filename, mimeType, extension, succes
5849 error({ code: App.ERROR_TIMEOUT, retry: fn }); 5615 error({ code: App.ERROR_TIMEOUT, retry: fn });
5850 } 5616 }
5851 }, headers); 5617 }, headers);
5852 - }  
5853 - else if (executeRequest != null) { 5618 + } else if (executeRequest != null) {
5854 executeRequest(url, handleData, error, binary); 5619 executeRequest(url, handleData, error, binary);
5855 - }  
5856 - else { 5620 + } else {
5857 this.editor.loadUrl(url, handleData, error, binary, null, null, null, headers); 5621 this.editor.loadUrl(url, handleData, error, binary, null, null, null, headers);
5858 } 5622 }
5859 } 5623 }
@@ -5908,24 +5672,19 @@ App.prototype.updateHeader = function () { @@ -5908,24 +5672,19 @@ App.prototype.updateHeader = function () {
5908 if (mode == App.MODE_GOOGLE) { 5672 if (mode == App.MODE_GOOGLE) {
5909 this.appIcon.style.backgroundImage = 'url(' + IMAGE_PATH + '/google-drive-logo-white.svg)'; 5673 this.appIcon.style.backgroundImage = 'url(' + IMAGE_PATH + '/google-drive-logo-white.svg)';
5910 this.appIcon.style.backgroundSize = '70% 70%'; 5674 this.appIcon.style.backgroundSize = '70% 70%';
5911 - }  
5912 - else if (mode == App.MODE_DROPBOX) { 5675 + } else if (mode == App.MODE_DROPBOX) {
5913 this.appIcon.style.backgroundImage = 'url(' + IMAGE_PATH + '/dropbox-logo-white.svg)'; 5676 this.appIcon.style.backgroundImage = 'url(' + IMAGE_PATH + '/dropbox-logo-white.svg)';
5914 this.appIcon.style.backgroundSize = '70% 70%'; 5677 this.appIcon.style.backgroundSize = '70% 70%';
5915 - }  
5916 - else if (mode == App.MODE_ONEDRIVE) { 5678 + } else if (mode == App.MODE_ONEDRIVE) {
5917 this.appIcon.style.backgroundImage = 'url(' + IMAGE_PATH + '/onedrive-logo-white.svg)'; 5679 this.appIcon.style.backgroundImage = 'url(' + IMAGE_PATH + '/onedrive-logo-white.svg)';
5918 this.appIcon.style.backgroundSize = '70% 70%'; 5680 this.appIcon.style.backgroundSize = '70% 70%';
5919 - }  
5920 - else if (mode == App.MODE_GITHUB) { 5681 + } else if (mode == App.MODE_GITHUB) {
5921 this.appIcon.style.backgroundImage = 'url(' + IMAGE_PATH + '/github-logo-white.svg)'; 5682 this.appIcon.style.backgroundImage = 'url(' + IMAGE_PATH + '/github-logo-white.svg)';
5922 this.appIcon.style.backgroundSize = '70% 70%'; 5683 this.appIcon.style.backgroundSize = '70% 70%';
5923 - }  
5924 - else if (mode == App.MODE_GITLAB) { 5684 + } else if (mode == App.MODE_GITLAB) {
5925 this.appIcon.style.backgroundImage = 'url(' + IMAGE_PATH + '/gitlab-logo-white.svg)'; 5685 this.appIcon.style.backgroundImage = 'url(' + IMAGE_PATH + '/gitlab-logo-white.svg)';
5926 this.appIcon.style.backgroundSize = '100% 100%'; 5686 this.appIcon.style.backgroundSize = '100% 100%';
5927 - }  
5928 - else if (mode == App.MODE_TRELLO) { 5687 + } else if (mode == App.MODE_TRELLO) {
5929 this.appIcon.style.backgroundImage = 'url(' + IMAGE_PATH + '/trello-logo-white-orange.svg)'; 5688 this.appIcon.style.backgroundImage = 'url(' + IMAGE_PATH + '/trello-logo-white-orange.svg)';
5930 this.appIcon.style.backgroundSize = '70% 70%'; 5689 this.appIcon.style.backgroundSize = '70% 70%';
5931 } 5690 }
@@ -6037,8 +5796,7 @@ App.prototype.updateHeader = function () { @@ -6037,8 +5796,7 @@ App.prototype.updateHeader = function () {
6037 var toggleFormatPanel = mxUtils.bind(this, function () { 5796 var toggleFormatPanel = mxUtils.bind(this, function () {
6038 if (this.formatWidth > 0) { 5797 if (this.formatWidth > 0) {
6039 this.toggleFormatElement.style.backgroundImage = 'url(\'' + this.formatShowImage + '\')'; 5798 this.toggleFormatElement.style.backgroundImage = 'url(\'' + this.formatShowImage + '\')';
6040 - }  
6041 - else { 5799 + } else {
6042 this.toggleFormatElement.style.backgroundImage = 'url(\'' + this.formatHideImage + '\')'; 5800 this.toggleFormatElement.style.backgroundImage = 'url(\'' + this.formatHideImage + '\')';
6043 } 5801 }
6044 }); 5802 });
@@ -6180,8 +5938,7 @@ App.prototype.toggleCompactMode = function (visible) { @@ -6180,8 +5938,7 @@ App.prototype.toggleCompactMode = function (visible) {
6180 this.menubarHeight = App.prototype.menubarHeight; 5938 this.menubarHeight = App.prototype.menubarHeight;
6181 this.refresh(); 5939 this.refresh();
6182 this.toggleElement.style.backgroundImage = 'url(\'' + this.chevronUpImage + '\')'; 5940 this.toggleElement.style.backgroundImage = 'url(\'' + this.chevronUpImage + '\')';
6183 - }  
6184 - else { 5941 + } else {
6185 this.menubar.container.style.position = 'relative'; 5942 this.menubar.container.style.position = 'relative';
6186 this.menubar.container.style.paddingLeft = '4px'; 5943 this.menubar.container.style.paddingLeft = '4px';
6187 this.menubar.container.style.paddingTop = '0px'; 5944 this.menubar.container.style.paddingTop = '0px';
@@ -6216,8 +5973,7 @@ App.prototype.updateUserElement = function () { @@ -6216,8 +5973,7 @@ App.prototype.updateUserElement = function () {
6216 this.userElement.parentNode.removeChild(this.userElement); 5973 this.userElement.parentNode.removeChild(this.userElement);
6217 this.userElement = null; 5974 this.userElement = null;
6218 } 5975 }
6219 - }  
6220 - else { 5976 + } else {
6221 if (this.userElement == null) { 5977 if (this.userElement == null) {
6222 this.userElement = document.createElement('a'); 5978 this.userElement = document.createElement('a');
6223 this.userElement.className = 'geItem'; 5979 this.userElement.className = 'geItem';
@@ -6259,8 +6015,7 @@ App.prototype.updateUserElement = function () { @@ -6259,8 +6015,7 @@ App.prototype.updateUserElement = function () {
6259 6015
6260 if (this.userPanel.parentNode != null) { 6016 if (this.userPanel.parentNode != null) {
6261 this.userPanel.parentNode.removeChild(this.userPanel); 6017 this.userPanel.parentNode.removeChild(this.userPanel);
6262 - }  
6263 - else { 6018 + } else {
6264 var connected = false; 6019 var connected = false;
6265 this.userPanel.innerHTML = ''; 6020 this.userPanel.innerHTML = '';
6266 6021
@@ -6300,8 +6055,7 @@ App.prototype.updateUserElement = function () { @@ -6300,8 +6055,7 @@ App.prototype.updateUserElement = function () {
6300 this.spinner.stop(); 6055 this.spinner.stop();
6301 callback(); 6056 callback();
6302 }), 2000); 6057 }), 2000);
6303 - }  
6304 - else { 6058 + } else {
6305 callback(); 6059 callback();
6306 } 6060 }
6307 }); 6061 });
@@ -6531,13 +6285,11 @@ App.prototype.updateUserElement = function () { @@ -6531,13 +6285,11 @@ App.prototype.updateUserElement = function () {
6531 6285
6532 if (!file.isModified()) { 6286 if (!file.isModified()) {
6533 doLogout(); 6287 doLogout();
6534 - }  
6535 - else { 6288 + } else {
6536 this.confirm(mxResources.get('allChangesLost'), null, doLogout, 6289 this.confirm(mxResources.get('allChangesLost'), null, doLogout,
6537 mxResources.get('cancel'), mxResources.get('discardChanges')); 6290 mxResources.get('cancel'), mxResources.get('discardChanges'));
6538 } 6291 }
6539 - }  
6540 - else { 6292 + } else {
6541 this.dropbox.logout(); 6293 this.dropbox.logout();
6542 } 6294 }
6543 }), mxResources.get('dropbox')); 6295 }), mxResources.get('dropbox'));
@@ -6555,13 +6307,11 @@ App.prototype.updateUserElement = function () { @@ -6555,13 +6307,11 @@ App.prototype.updateUserElement = function () {
6555 6307
6556 if (!file.isModified()) { 6308 if (!file.isModified()) {
6557 doLogout(); 6309 doLogout();
6558 - }  
6559 - else { 6310 + } else {
6560 this.confirm(mxResources.get('allChangesLost'), null, doLogout, 6311 this.confirm(mxResources.get('allChangesLost'), null, doLogout,
6561 mxResources.get('cancel'), mxResources.get('discardChanges')); 6312 mxResources.get('cancel'), mxResources.get('discardChanges'));
6562 } 6313 }
6563 - }  
6564 - else { 6314 + } else {
6565 this.oneDrive.logout(); 6315 this.oneDrive.logout();
6566 } 6316 }
6567 }), mxResources.get('oneDrive')); 6317 }), mxResources.get('oneDrive'));
@@ -6579,13 +6329,11 @@ App.prototype.updateUserElement = function () { @@ -6579,13 +6329,11 @@ App.prototype.updateUserElement = function () {
6579 6329
6580 if (!file.isModified()) { 6330 if (!file.isModified()) {
6581 doLogout(); 6331 doLogout();
6582 - }  
6583 - else { 6332 + } else {
6584 this.confirm(mxResources.get('allChangesLost'), null, doLogout, 6333 this.confirm(mxResources.get('allChangesLost'), null, doLogout,
6585 mxResources.get('cancel'), mxResources.get('discardChanges')); 6334 mxResources.get('cancel'), mxResources.get('discardChanges'));
6586 } 6335 }
6587 - }  
6588 - else { 6336 + } else {
6589 this.gitHub.logout(); 6337 this.gitHub.logout();
6590 } 6338 }
6591 }), mxResources.get('github')); 6339 }), mxResources.get('github'));
@@ -6603,13 +6351,11 @@ App.prototype.updateUserElement = function () { @@ -6603,13 +6351,11 @@ App.prototype.updateUserElement = function () {
6603 6351
6604 if (!file.isModified()) { 6352 if (!file.isModified()) {
6605 doLogout(); 6353 doLogout();
6606 - }  
6607 - else { 6354 + } else {
6608 this.confirm(mxResources.get('allChangesLost'), null, doLogout, 6355 this.confirm(mxResources.get('allChangesLost'), null, doLogout,
6609 mxResources.get('cancel'), mxResources.get('discardChanges')); 6356 mxResources.get('cancel'), mxResources.get('discardChanges'));
6610 } 6357 }
6611 - }  
6612 - else { 6358 + } else {
6613 this.gitLab.logout(); 6359 this.gitLab.logout();
6614 } 6360 }
6615 }), mxResources.get('gitlab')); 6361 }), mxResources.get('gitlab'));
@@ -6628,13 +6374,11 @@ App.prototype.updateUserElement = function () { @@ -6628,13 +6374,11 @@ App.prototype.updateUserElement = function () {
6628 6374
6629 if (!file.isModified()) { 6375 if (!file.isModified()) {
6630 doLogout(); 6376 doLogout();
6631 - }  
6632 - else { 6377 + } else {
6633 this.confirm(mxResources.get('allChangesLost'), null, doLogout, 6378 this.confirm(mxResources.get('allChangesLost'), null, doLogout,
6634 mxResources.get('cancel'), mxResources.get('discardChanges')); 6379 mxResources.get('cancel'), mxResources.get('discardChanges'));
6635 } 6380 }
6636 - }  
6637 - else { 6381 + } else {
6638 this.trello.logout(); 6382 this.trello.logout();
6639 } 6383 }
6640 }), mxResources.get('trello')); 6384 }), mxResources.get('trello'));
@@ -6672,8 +6416,7 @@ App.prototype.updateUserElement = function () { @@ -6672,8 +6416,7 @@ App.prototype.updateUserElement = function () {
6672 div.appendChild(btn); 6416 div.appendChild(btn);
6673 this.userPanel.appendChild(div); 6417 this.userPanel.appendChild(div);
6674 } 6418 }
6675 - }  
6676 - else { 6419 + } else {
6677 var btn = mxUtils.button(mxResources.get('close'), mxUtils.bind(this, function () { 6420 var btn = mxUtils.button(mxResources.get('close'), mxUtils.bind(this, function () {
6678 if (!mxEvent.isConsumed(evt) && this.userPanel != null && this.userPanel.parentNode != null) { 6421 if (!mxEvent.isConsumed(evt) && this.userPanel != null && this.userPanel.parentNode != null) {
6679 this.userPanel.parentNode.removeChild(this.userPanel); 6422 this.userPanel.parentNode.removeChild(this.userPanel);
@@ -6701,17 +6444,13 @@ App.prototype.updateUserElement = function () { @@ -6701,17 +6444,13 @@ App.prototype.updateUserElement = function () {
6701 6444
6702 if (this.drive != null && this.drive.getUser() != null) { 6445 if (this.drive != null && this.drive.getUser() != null) {
6703 user = this.drive.getUser(); 6446 user = this.drive.getUser();
6704 - }  
6705 - else if (this.oneDrive != null && this.oneDrive.getUser() != null) { 6447 + } else if (this.oneDrive != null && this.oneDrive.getUser() != null) {
6706 user = this.oneDrive.getUser(); 6448 user = this.oneDrive.getUser();
6707 - }  
6708 - else if (this.dropbox != null && this.dropbox.getUser() != null) { 6449 + } else if (this.dropbox != null && this.dropbox.getUser() != null) {
6709 user = this.dropbox.getUser(); 6450 user = this.dropbox.getUser();
6710 - }  
6711 - else if (this.gitHub != null && this.gitHub.getUser() != null) { 6451 + } else if (this.gitHub != null && this.gitHub.getUser() != null) {
6712 user = this.gitHub.getUser(); 6452 user = this.gitHub.getUser();
6713 - }  
6714 - else if (this.gitLab != null && this.gitLab.getUser() != null) { 6453 + } else if (this.gitLab != null && this.gitLab.getUser() != null) {
6715 user = this.gitLab.getUser(); 6454 user = this.gitLab.getUser();
6716 } 6455 }
6717 //TODO Trello no user issue 6456 //TODO Trello no user issue
@@ -6723,8 +6462,7 @@ App.prototype.updateUserElement = function () { @@ -6723,8 +6462,7 @@ App.prototype.updateUserElement = function () {
6723 mxUtils.write(this.userElement, user.displayName); 6462 mxUtils.write(this.userElement, user.displayName);
6724 this.userElement.style.display = 'block'; 6463 this.userElement.style.display = 'block';
6725 } 6464 }
6726 - }  
6727 - else { 6465 + } else {
6728 this.userElement.style.display = 'none'; 6466 this.userElement.style.display = 'none';
6729 } 6467 }
6730 } 6468 }
@@ -6736,14 +6474,11 @@ App.prototype.getCurrentUser = function () { @@ -6736,14 +6474,11 @@ App.prototype.getCurrentUser = function () {
6736 6474
6737 if (this.drive != null && this.drive.getUser() != null) { 6475 if (this.drive != null && this.drive.getUser() != null) {
6738 user = this.drive.getUser(); 6476 user = this.drive.getUser();
6739 - }  
6740 - else if (this.oneDrive != null && this.oneDrive.getUser() != null) { 6477 + } else if (this.oneDrive != null && this.oneDrive.getUser() != null) {
6741 user = this.oneDrive.getUser(); 6478 user = this.oneDrive.getUser();
6742 - }  
6743 - else if (this.dropbox != null && this.dropbox.getUser() != null) { 6479 + } else if (this.dropbox != null && this.dropbox.getUser() != null) {
6744 user = this.dropbox.getUser(); 6480 user = this.dropbox.getUser();
6745 - }  
6746 - else if (this.gitHub != null && this.gitHub.getUser() != null) { 6481 + } else if (this.gitHub != null && this.gitHub.getUser() != null) {
6747 user = this.gitHub.getUser(); 6482 user = this.gitHub.getUser();
6748 } 6483 }
6749 //TODO Trello no user issue 6484 //TODO Trello no user issue