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