maxGraph/javascript/examples/grapheditor/www/index.html

116 lines
4.0 KiB
HTML
Raw Normal View History

2012-05-21 20:32:26 +00:00
<!--[if IE]><meta http-equiv="X-UA-Compatible" content="IE=5,IE=9" ><![endif]-->
<!DOCTYPE html>
<html>
<head>
2013-11-11 12:31:46 +00:00
<title>Grapheditor</title>
2013-09-09 13:25:52 +00:00
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
2012-05-21 20:32:26 +00:00
<link rel="stylesheet" type="text/css" href="styles/grapheditor.css">
<script type="text/javascript">
// Public global variables
var MAX_REQUEST_SIZE = 10485760;
2013-05-23 16:14:48 +00:00
var MAX_AREA = 10000 * 10000;
2012-05-21 20:32:26 +00:00
// URLs for save and export
var EXPORT_URL = '/export';
var SAVE_URL = '/save';
var OPEN_URL = '/open';
var RESOURCES_PATH = 'resources';
var RESOURCE_BASE = RESOURCES_PATH + '/grapheditor';
var STENCIL_PATH = 'stencils';
var IMAGE_PATH = 'images';
var STYLE_PATH = 'styles';
var CSS_PATH = 'styles';
var OPEN_FORM = 'open.html';
// Specifies connection mode for touch devices (at least one should be true)
2013-06-28 19:07:06 +00:00
var tapAndHoldStartsConnection = false;
2012-05-21 20:32:26 +00:00
var showConnectorImg = true;
// Parses URL parameters. Supported parameters are:
// - lang=xy: Specifies the language of the user interface.
// - touch=1: Enables a touch-style user interface.
// - storage=local: Enables HTML5 local storage.
2014-11-28 08:55:09 +00:00
// - chrome=0: Chromeless mode.
2012-05-21 20:32:26 +00:00
var urlParams = (function(url)
{
var result = new Object();
var idx = url.lastIndexOf('?');
if (idx > 0)
{
var params = url.substring(idx + 1).split('&');
for (var i = 0; i < params.length; i++)
{
idx = params[i].indexOf('=');
if (idx > 0)
{
result[params[i].substring(0, idx)] = params[i].substring(idx + 1);
}
}
}
return result;
})(window.location.href);
// 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
2012-08-31 11:06:48 +00:00
// each properties file since only one file is loaded.
2012-05-21 20:32:26 +00:00
mxLoadResources = false;
mxBasePath = '../../../src';
mxLanguage = urlParams['lang'];
mxLanguages = ['de'];
</script>
2014-10-03 12:49:36 +00:00
<script type="text/javascript" src="jscolor/jscolor.js"></script>
<script type="text/javascript" src="sanitizer/sanitizer.min.js"></script>
2012-05-21 20:32:26 +00:00
<script type="text/javascript" src="../../../src/js/mxClient.js"></script>
2014-05-15 19:58:36 +00:00
<script type="text/javascript" src="js/EditorUi.js"></script>
2012-05-21 20:32:26 +00:00
<script type="text/javascript" src="js/Editor.js"></script>
2014-10-09 13:52:12 +00:00
<script type="text/javascript" src="js/Sidebar.js"></script>
2012-05-21 20:32:26 +00:00
<script type="text/javascript" src="js/Graph.js"></script>
2012-07-31 14:06:36 +00:00
<script type="text/javascript" src="js/Shapes.js"></script>
2012-05-21 20:32:26 +00:00
<script type="text/javascript" src="js/Actions.js"></script>
<script type="text/javascript" src="js/Menus.js"></script>
2015-01-05 14:01:01 +00:00
<script type="text/javascript" src="js/Format.js"></script>
2012-05-21 20:32:26 +00:00
<script type="text/javascript" src="js/Toolbar.js"></script>
<script type="text/javascript" src="js/Dialogs.js"></script>
</head>
2012-06-14 12:43:20 +00:00
<body class="geEditor">
2012-05-21 20:32:26 +00:00
<script type="text/javascript">
// Extends EditorUi to update I/O action states
(function()
{
var editorUiInit = EditorUi.prototype.init;
EditorUi.prototype.init = function()
{
editorUiInit.apply(this, arguments);
this.actions.get('export').setEnabled(false);
// Updates action states which require a backend
if (!useLocalStorage)
{
mxUtils.post(OPEN_URL, '', mxUtils.bind(this, function(req)
{
var enabled = req.getStatus() != 404;
this.actions.get('open').setEnabled(enabled || fileSupport);
2012-05-30 16:26:17 +00:00
this.actions.get('import').setEnabled(enabled || fileSupport);
2012-05-21 20:32:26 +00:00
this.actions.get('save').setEnabled(enabled);
this.actions.get('saveAs').setEnabled(enabled);
this.actions.get('export').setEnabled(enabled);
}));
}
};
})();
2014-11-28 08:55:09 +00:00
new EditorUi(new Editor(urlParams['chrome'] == '0'));
2012-05-21 20:32:26 +00:00
</script>
</body>
</html>