123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260 |
- // urlParams is null when used for embedding
- window.urlParams = window.urlParams || {};
- // isLocalStorage controls access to local storage
- window.isLocalStorage = window.isLocalStorage || false;
- // Checks for SVG support
- window.isSvgBrowser = window.isSvgBrowser || (navigator.userAgent.indexOf('MSIE') < 0 || document.documentMode >= 9);
- // CUSTOM_PARAMETERS - URLs for save and export
- window.EXPORT_URL = window.EXPORT_URL || 'https://exp.draw.io/ImageExport4/export';
- window.SAVE_URL = window.SAVE_URL || 'save';
- window.OPEN_URL = window.OPEN_URL || 'open';
- window.PROXY_URL = window.PROXY_URL || 'proxy';
- // Paths and files
- window.SHAPES_PATH = window.SHAPES_PATH || 'shapes';
- // Path for images inside the diagram
- window.GRAPH_IMAGE_PATH = window.GRAPH_IMAGE_PATH || 'img';
- window.ICONSEARCH_PATH = window.ICONSEARCH_PATH || (navigator.userAgent.indexOf('MSIE') >= 0 ||
- urlParams['dev']) && window.location.protocol != 'file:' ? 'iconSearch' : 'https://www.draw.io/iconSearch';
- window.TEMPLATE_PATH = window.TEMPLATE_PATH || '/templates';
- // Directory for i18 files and basename for main i18n file
- window.RESOURCES_PATH = window.RESOURCES_PATH || 'resources';
- window.RESOURCE_BASE = window.RESOURCE_BASE || RESOURCES_PATH + '/dia';
- // URL for logging
- window.DRAWIO_LOG_URL = window.DRAWIO_LOG_URL || '';
- // Sets the base path, the UI language via URL param and configures the
- // supported languages to avoid 404s. The loading of all core language
- // resources is disabled as all required resources are in grapheditor.
- // properties. Note that in this example the loading of two resource
- // files (the special bundle and the default bundle) is disabled to
- // save a GET request. This requires that all resources be present in
- // the special bundle.
- window.mxLoadResources = window.mxLoadResources || false;
- window.mxLanguage = window.mxLanguage || (function()
- {
- var lang = (urlParams['offline'] == '1') ? 'en' : urlParams['lang'];
-
- // Known issue: No JSON object at this point in quirks in IE8
- if (lang == null && typeof(JSON) != 'undefined')
- {
- // Cannot use mxSettings here
- if (isLocalStorage)
- {
- try
- {
- var value = localStorage.getItem('.drawio-config');
-
- if (value != null)
- {
- lang = JSON.parse(value).language || null;
- }
- }
- catch (e)
- {
- // cookies are disabled, attempts to use local storage will cause
- // a DOM error at a minimum on Chrome
- isLocalStorage = false;
- }
- }
- }
-
- return lang;
- })();
- // Add new languages here. First entry is translated to [Automatic]
- // in the menu defintion in Diagramly.js.
- window.mxLanguageMap = window.mxLanguageMap ||
- {
- 'i18n': '',
- 'id' : 'Bahasa Indonesia',
- 'ms' : 'Bahasa Melayu',
- 'bs' : 'Bosanski',
- 'bg' : 'Bulgarian',
- 'ca' : 'Català',
- 'cs' : 'Čeština',
- 'da' : 'Dansk',
- 'de' : 'Deutsch',
- 'et' : 'Eesti',
- 'en' : 'English',
- 'es' : 'Español',
- 'fil' : 'Filipino',
- 'fr' : 'Français',
- 'it' : 'Italiano',
- 'hu' : 'Magyar',
- 'nl' : 'Nederlands',
- 'no' : 'Norsk',
- 'pl' : 'Polski',
- 'pt-br' : 'Português (Brasil)',
- 'pt' : 'Português (Portugal)',
- 'ro' : 'Română',
- 'fi' : 'Suomi',
- 'sv' : 'Svenska',
- 'vi' : 'Tiếng Việt',
- 'tr' : 'Türkçe',
- 'el' : 'Ελληνικά',
- 'ru' : 'Русский',
- 'sr' : 'Српски',
- 'uk' : 'Українська',
- 'he' : 'עברית',
- 'ar' : 'العربية',
- 'th' : 'ไทย',
- 'ko' : '한국어',
- 'ja' : '日本語',
- 'zh' : '中文(中国)',
- 'zh-tw' : '中文(台灣)'
- };
- if (typeof window.mxBasePath === 'undefined')
- {
- window.mxBasePath = 'mxgraph';
- }
- if (window.mxLanguages == null)
- {
- window.mxLanguages = [];
-
- // Populates the list of supported special language bundles
- for (var lang in mxLanguageMap)
- {
- // Empty means default (ie. browser language), "en" means English (default for unsupported languages)
- // Since "en" uses no extension this must not be added to the array of supported language bundles.
- if (lang != 'en')
- {
- window.mxLanguages.push(lang);
- }
- }
- }
- /**
- * Returns the global UI setting before runngin static draw.io code
- */
- window.uiTheme = window.uiTheme || (function()
- {
- var ui = urlParams['ui'];
-
- // Known issue: No JSON object at this point in quirks in IE8
- if (ui == null && typeof JSON !== 'undefined')
- {
- // Cannot use mxSettings here
- if (isLocalStorage)
- {
- try
- {
- var value = localStorage.getItem('.drawio-config');
-
- if (value != null)
- {
- ui = JSON.parse(value).ui || null;
- }
- }
- catch (e)
- {
- // cookies are disabled, attempts to use local storage will cause
- // a DOM error at a minimum on Chrome
- isLocalStorage = false;
- }
- }
- }
-
- return ui;
- })();
- /**
- * Global function for loading local files via servlet
- */
- function setCurrentXml(data, filename)
- {
- if (window.parent != null && window.parent.openFile != null)
- {
- window.parent.openFile.setData(data, filename);
- }
- };
- /**
- * Overrides splash URL parameter via local storage
- */
- (function()
- {
- // Known issue: No JSON object at this point in quirks in IE8
- if (typeof JSON !== 'undefined')
- {
- // Cannot use mxSettings here
- if (isLocalStorage)
- {
- try
- {
- var value = localStorage.getItem('.drawio-config');
- var showSplash = true;
-
- if (value != null)
- {
- showSplash = JSON.parse(value).showStartScreen;
- }
-
- // Undefined means true
- if (showSplash == false)
- {
- urlParams['splash'] = '0';
- }
- }
- catch (e)
- {
- // ignore
- }
- }
- }
- })();
- // Customizes export URL
- var ex = urlParams['export'];
- if (ex != null)
- {
- if (ex.substring(0, 7) != 'http://' && ex.substring(0, 8) != 'https://')
- {
- ex = 'http://' + ex;
- }
-
- EXPORT_URL = ex;
- }
- // Enables offline mode
- if (urlParams['offline'] == '1' || urlParams['demo'] == '1' || urlParams['stealth'] == '1' || urlParams['local'] == '1')
- {
- urlParams['analytics'] = '0';
- urlParams['picker'] = '0';
- urlParams['gapi'] = '0';
- urlParams['db'] = '0';
- urlParams['od'] = '0';
- urlParams['gh'] = '0';
- }
- // Disables math in offline mode
- if (urlParams['offline'] == '1' || urlParams['local'] == '1')
- {
- urlParams['math'] = '0';
- }
- // Lightbox enabled chromeless mode
- if (urlParams['lightbox'] == '1')
- {
- urlParams['chrome'] = '0';
- }
- // Adds hard-coded logging domain for draw.io domains
- var host = window.location.host;
- var searchString = 'draw.io';
- var position = host.length - searchString.length;
- var lastIndex = host.lastIndexOf(searchString, position);
- if (lastIndex !== -1 && lastIndex === position && host != 'test.draw.io')
- {
- window.DRAWIO_LOG_URL = 'https://log.draw.io';
- }
|