From 5477f2afe8f60c95ddf225a6378fcdb4022f6e19 Mon Sep 17 00:00:00 2001 From: Oleg Sh Date: Sat, 15 Feb 2025 20:35:37 +0100 Subject: [PATCH] Add last usage graphs menu. --- core/config/main.php | 2 +- i/css/main_tpl.css | 5 + i/image/menu.svg | 1 + lang/bg/home.php | 2 + lang/ch/home.php | 2 + lang/cs/home.php | 2 + lang/de/home.php | 2 + lang/el/home.php | 2 + lang/en/home.php | 2 + lang/es/home.php | 2 + lang/fr/home.php | 2 + lang/nl/home.php | 2 + lang/pl/home.php | 2 + lang/pt/home.php | 2 + lang/ru/home.php | 2 + lang/sv/home.php | 2 + .../api/index.js.cache | 2 +- .../api/index.js.cache | 2 +- .../create_graph_by_matrix/api/index.js.cache | 2 +- script/pages/editor/api/index.js.cache | 37 ++++++-- script/pages/editor/model/Application.js | 92 +++++++++++++++++++ tpl/home.php | 20 ++-- tpl/main_tpl.php | 6 +- 23 files changed, 168 insertions(+), 27 deletions(-) create mode 100644 i/image/menu.svg diff --git a/core/config/main.php b/core/config/main.php index a9a0564..f7c301b 100755 --- a/core/config/main.php +++ b/core/config/main.php @@ -93,5 +93,5 @@ $g_config['vote'] = "./tmp/vote/vote.txt"; $g_config['voteTopics'] = "./tmp/vote/voteTopics.txt_"; $g_config['use_js_cache'] = true; - $g_config['engine_version'] = 93; + $g_config['engine_version'] = 94; ?> diff --git a/i/css/main_tpl.css b/i/css/main_tpl.css index fbd9780..decd67e 100755 --- a/i/css/main_tpl.css +++ b/i/css/main_tpl.css @@ -288,6 +288,11 @@ background-color: #999; } +#navigation .navbar-toggler-icon +{ + background: url(/i/image/menu.svg) no-repeat; +} + @media (max-width: 767px) { .dropdown-menu.multi-column { min-width: 240px !important; diff --git a/i/image/menu.svg b/i/image/menu.svg new file mode 100644 index 0000000..62e68ae --- /dev/null +++ b/i/image/menu.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/lang/bg/home.php b/lang/bg/home.php index 9e35877..66db867 100644 --- a/lang/bg/home.php +++ b/lang/bg/home.php @@ -313,4 +313,6 @@ We have added Dutch translation 🇳🇱. Thank you Willie de Wit"; $g_lang['use_mouse_for_moving'] = "Use🖱️for moving"; $g_lang['original_graph'] = "Original graph"; $g_lang['autosaved_graph'] = "Autosaved graph"; + + $g_lang['open_last_used_graph'] = "Open Recent Graph"; ?> diff --git a/lang/ch/home.php b/lang/ch/home.php index e9f058d..b456063 100644 --- a/lang/ch/home.php +++ b/lang/ch/home.php @@ -315,4 +315,6 @@ $g_lang['use_mouse_for_moving'] = "Use🖱️for moving"; $g_lang['original_graph'] = "Original graph"; $g_lang['autosaved_graph'] = "Autosaved graph"; + + $g_lang['open_last_used_graph'] = "Open Recent Graph"; ?> diff --git a/lang/cs/home.php b/lang/cs/home.php index 0a387d5..1298b05 100644 --- a/lang/cs/home.php +++ b/lang/cs/home.php @@ -319,4 +319,6 @@ $g_lang['use_mouse_for_moving'] = "Use🖱️for moving"; $g_lang['original_graph'] = "Original graph"; $g_lang['autosaved_graph'] = "Autosaved graph"; + + $g_lang['open_last_used_graph'] = "Open Recent Graph"; ?> \ No newline at end of file diff --git a/lang/de/home.php b/lang/de/home.php index 472cac9..fa7abb1 100644 --- a/lang/de/home.php +++ b/lang/de/home.php @@ -277,4 +277,6 @@ $g_lang['use_mouse_for_moving'] = "Use🖱️for moving"; $g_lang['original_graph'] = "Original graph"; $g_lang['autosaved_graph'] = "Autosaved graph"; + + $g_lang['open_last_used_graph'] = "Open Recent Graph"; ?> diff --git a/lang/el/home.php b/lang/el/home.php index 1d51dc5..7695d74 100644 --- a/lang/el/home.php +++ b/lang/el/home.php @@ -316,4 +316,6 @@ $g_lang['use_mouse_for_moving'] = "Use🖱️for moving"; $g_lang['original_graph'] = "Original graph"; $g_lang['autosaved_graph'] = "Autosaved graph"; + + $g_lang['open_last_used_graph'] = "Open Recent Graph"; ?> diff --git a/lang/en/home.php b/lang/en/home.php index 6f8df09..62717ca 100755 --- a/lang/en/home.php +++ b/lang/en/home.php @@ -321,4 +321,6 @@ We have added Dutch translation 🇳🇱. Thank you Willie de Wit"; $g_lang['use_mouse_for_moving'] = "Use🖱️for moving"; $g_lang['original_graph'] = "Original graph"; $g_lang['autosaved_graph'] = "Autosaved graph"; + + $g_lang['open_last_used_graph'] = "Open Recent Graph"; ?> diff --git a/lang/es/home.php b/lang/es/home.php index 3df78ab..524eda6 100755 --- a/lang/es/home.php +++ b/lang/es/home.php @@ -320,4 +320,6 @@ Tenemos traducciones en griego 🇬🇷. diff --git a/lang/fr/home.php b/lang/fr/home.php index 30010fa..c107e11 100644 --- a/lang/fr/home.php +++ b/lang/fr/home.php @@ -287,4 +287,6 @@ $g_lang['use_mouse_for_moving'] = "Use🖱️for moving"; $g_lang['original_graph'] = "Original graph"; $g_lang['autosaved_graph'] = "Autosaved graph"; + + $g_lang['open_last_used_graph'] = "Open Recent Graph"; ?> diff --git a/lang/nl/home.php b/lang/nl/home.php index d1aa5d1..d1adc5a 100644 --- a/lang/nl/home.php +++ b/lang/nl/home.php @@ -284,4 +284,6 @@ $g_lang['use_mouse_for_moving'] = "Use🖱️for moving"; $g_lang['original_graph'] = "Original graph"; $g_lang['autosaved_graph'] = "Autosaved graph"; + + $g_lang['open_last_used_graph'] = "Open Recent Graph"; ?> diff --git a/lang/pl/home.php b/lang/pl/home.php index 1ee474a..d12c439 100644 --- a/lang/pl/home.php +++ b/lang/pl/home.php @@ -320,4 +320,6 @@ Dodaliśmy polskie tłumaczenie, Patryk"; $g_lang['use_mouse_for_moving'] = "Use🖱️for moving"; $g_lang['original_graph'] = "Original graph"; $g_lang['autosaved_graph'] = "Autosaved graph"; + + $g_lang['open_last_used_graph'] = "Open Recent Graph"; ?> diff --git a/lang/pt/home.php b/lang/pt/home.php index 4855cca..9c8e4ed 100644 --- a/lang/pt/home.php +++ b/lang/pt/home.php @@ -285,4 +285,6 @@ $g_lang['use_mouse_for_moving'] = "Use🖱️for moving"; $g_lang['original_graph'] = "Original graph"; $g_lang['autosaved_graph'] = "Autosaved graph"; + + $g_lang['open_last_used_graph'] = "Open Recent Graph"; ?> diff --git a/lang/ru/home.php b/lang/ru/home.php index 100f923..0d32a91 100755 --- a/lang/ru/home.php +++ b/lang/ru/home.php @@ -323,4 +323,6 @@ $g_lang['use_mouse_for_moving'] = "Используйте🖱️для перемещения"; $g_lang['original_graph'] = "Оригинальный граф"; $g_lang['autosaved_graph'] = "Автосохранение графа"; + + $g_lang['open_last_used_graph'] = "Открыть недавний граф"; ?> diff --git a/lang/sv/home.php b/lang/sv/home.php index d0783f5..94052e3 100644 --- a/lang/sv/home.php +++ b/lang/sv/home.php @@ -281,4 +281,6 @@ $g_lang['use_mouse_for_moving'] = "Use🖱️for moving"; $g_lang['original_graph'] = "Original graph"; $g_lang['autosaved_graph'] = "Autosaved graph"; + + $g_lang['open_last_used_graph'] = "Open Recent Graph"; ?> diff --git a/script/pages/create_graph_by_edge_list/api/index.js.cache b/script/pages/create_graph_by_edge_list/api/index.js.cache index f0d61bb..a0094e6 100644 --- a/script/pages/create_graph_by_edge_list/api/index.js.cache +++ b/script/pages/create_graph_by_edge_list/api/index.js.cache @@ -1,4 +1,4 @@ -moduleLoader.beginCacheLoading(["/script/entities/graph/api/index.js?v=93","/script/shared/point.js?v=93","/script/entities/edge/api/index.js?v=93","/script/entities/edge/model/BaseEdge.js?v=93","/script/entities/edge/model/EdgeModel.js?v=93","/script/entities/vertex/api/index.js?v=93","/script/entities/vertex/model/BaseVertex.js?v=93","/script/entities/vertex/model/VertexModel.js?v=93","/script/entities/graph/model/Graph.js?v=93",]);{let modulDir="pages/create_graph_by_edge_list/";doInclude([include("entities/graph/api/index.js")]);} +moduleLoader.beginCacheLoading(["/script/entities/graph/api/index.js?v=94","/script/shared/point.js?v=94","/script/entities/edge/api/index.js?v=94","/script/entities/edge/model/BaseEdge.js?v=94","/script/entities/edge/model/EdgeModel.js?v=94","/script/entities/vertex/api/index.js?v=94","/script/entities/vertex/model/BaseVertex.js?v=94","/script/entities/vertex/model/VertexModel.js?v=94","/script/entities/graph/model/Graph.js?v=94",]);{let modulDir="pages/create_graph_by_edge_list/";doInclude([include("entities/graph/api/index.js")]);} {let modulDir="entities/graph/";doInclude([include("shared/point.js"),include("entities/edge/api/index.js"),include("entities/vertex/api/index.js"),include("model/Graph.js",modulDir)])}function Point(x,y){this.x=x||0;this.y=y||0;};Point.prototype.x=null;Point.prototype.y=null;Point.prototype.add=function(v){return new Point(this.x+v.x,this.y+v.y);};Point.prototype.addValue=function(v){return new Point(this.x+v,this.y+v);};Point.prototype.clone=function(){return new Point(this.x,this.y);};Point.prototype.degreesTo=function(v){var dx=this.x-v.x;var dy=this.y-v.y;var angle=Math.atan2(dy,dx);return angle*(180/Math.PI);};Point.prototype.distance=function(v){return Math.sqrt(this.distanceSqr(v));};Point.prototype.distanceSqr=function(v){var x=this.x-v.x;var y=this.y-v.y;return x*x+y*y;};Point.prototype.equals=function(toCompare){return this.x==toCompare.x&&this.y==toCompare.y;};Point.prototype.interpolate=function(v,f){return new Point((this.x+v.x)*f,(this.y+v.y)*f);};Point.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y);};Point.prototype.normalize=function(thickness){var l=this.length();this.x=this.x/l*thickness;this.y=this.y/l*thickness;return new Point(this.x,this.y);};Point.prototype.normalizeCopy=function(thickness){var l=this.length();return new Point(this.x/l*thickness,this.y/l*thickness);};Point.prototype.orbit=function(origin,arcWidth,arcHeight,degrees){var radians=degrees*(Math.PI/180);this.x=origin.x+arcWidth*Math.cos(radians);this.y=origin.y+arcHeight*Math.sin(radians);};Point.prototype.rotate=function(center,degrees){var radians=degrees*(Math.PI/180);offset=this.subtract(center);this.x=offset.x*Math.cos(radians)-offset.y*Math.sin(radians);this.y=offset.x*Math.sin(radians)+offset.y*Math.cos(radians);this.x=this.x+center.x;this.y=this.y+center.y;return this;};Point.prototype.offset=function(dx,dy){this.x+=dx;this.y+=dy;};Point.prototype.subtract=function(v){return new Point(this.x-v.x,this.y-v.y);};Point.prototype.subtractValue=function(value){return new Point(this.x-value,this.y-value);};Point.prototype.multiply=function(value){return new Point(this.x*value,this.y*value);};Point.prototype.toString=function(){return"(x="+this.x+", y="+this.y+")";};Point.prototype.normal=function(){return new Point(-this.y,this.x);};Point.prototype.min=function(point) {return new Point(Math.min(this.x,point.x),Math.min(this.y,point.y));};Point.prototype.max=function(point) {return new Point(Math.max(this.x,point.x),Math.max(this.y,point.y));};Point.prototype.inverse=function() diff --git a/script/pages/create_graph_by_incidence_matrix/api/index.js.cache b/script/pages/create_graph_by_incidence_matrix/api/index.js.cache index 25bc87c..1745c61 100644 --- a/script/pages/create_graph_by_incidence_matrix/api/index.js.cache +++ b/script/pages/create_graph_by_incidence_matrix/api/index.js.cache @@ -1,4 +1,4 @@ -moduleLoader.beginCacheLoading(["/script/entities/graph/api/index.js?v=93","/script/shared/point.js?v=93","/script/entities/edge/api/index.js?v=93","/script/entities/edge/model/BaseEdge.js?v=93","/script/entities/edge/model/EdgeModel.js?v=93","/script/entities/vertex/api/index.js?v=93","/script/entities/vertex/model/BaseVertex.js?v=93","/script/entities/vertex/model/VertexModel.js?v=93","/script/entities/graph/model/Graph.js?v=93",]);{let modulDir="pages/create_graph_by_matrix/";doInclude([include("entities/graph/api/index.js")]);} +moduleLoader.beginCacheLoading(["/script/entities/graph/api/index.js?v=94","/script/shared/point.js?v=94","/script/entities/edge/api/index.js?v=94","/script/entities/edge/model/BaseEdge.js?v=94","/script/entities/edge/model/EdgeModel.js?v=94","/script/entities/vertex/api/index.js?v=94","/script/entities/vertex/model/BaseVertex.js?v=94","/script/entities/vertex/model/VertexModel.js?v=94","/script/entities/graph/model/Graph.js?v=94",]);{let modulDir="pages/create_graph_by_matrix/";doInclude([include("entities/graph/api/index.js")]);} {let modulDir="entities/graph/";doInclude([include("shared/point.js"),include("entities/edge/api/index.js"),include("entities/vertex/api/index.js"),include("model/Graph.js",modulDir)])}function Point(x,y){this.x=x||0;this.y=y||0;};Point.prototype.x=null;Point.prototype.y=null;Point.prototype.add=function(v){return new Point(this.x+v.x,this.y+v.y);};Point.prototype.addValue=function(v){return new Point(this.x+v,this.y+v);};Point.prototype.clone=function(){return new Point(this.x,this.y);};Point.prototype.degreesTo=function(v){var dx=this.x-v.x;var dy=this.y-v.y;var angle=Math.atan2(dy,dx);return angle*(180/Math.PI);};Point.prototype.distance=function(v){return Math.sqrt(this.distanceSqr(v));};Point.prototype.distanceSqr=function(v){var x=this.x-v.x;var y=this.y-v.y;return x*x+y*y;};Point.prototype.equals=function(toCompare){return this.x==toCompare.x&&this.y==toCompare.y;};Point.prototype.interpolate=function(v,f){return new Point((this.x+v.x)*f,(this.y+v.y)*f);};Point.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y);};Point.prototype.normalize=function(thickness){var l=this.length();this.x=this.x/l*thickness;this.y=this.y/l*thickness;return new Point(this.x,this.y);};Point.prototype.normalizeCopy=function(thickness){var l=this.length();return new Point(this.x/l*thickness,this.y/l*thickness);};Point.prototype.orbit=function(origin,arcWidth,arcHeight,degrees){var radians=degrees*(Math.PI/180);this.x=origin.x+arcWidth*Math.cos(radians);this.y=origin.y+arcHeight*Math.sin(radians);};Point.prototype.rotate=function(center,degrees){var radians=degrees*(Math.PI/180);offset=this.subtract(center);this.x=offset.x*Math.cos(radians)-offset.y*Math.sin(radians);this.y=offset.x*Math.sin(radians)+offset.y*Math.cos(radians);this.x=this.x+center.x;this.y=this.y+center.y;return this;};Point.prototype.offset=function(dx,dy){this.x+=dx;this.y+=dy;};Point.prototype.subtract=function(v){return new Point(this.x-v.x,this.y-v.y);};Point.prototype.subtractValue=function(value){return new Point(this.x-value,this.y-value);};Point.prototype.multiply=function(value){return new Point(this.x*value,this.y*value);};Point.prototype.toString=function(){return"(x="+this.x+", y="+this.y+")";};Point.prototype.normal=function(){return new Point(-this.y,this.x);};Point.prototype.min=function(point) {return new Point(Math.min(this.x,point.x),Math.min(this.y,point.y));};Point.prototype.max=function(point) {return new Point(Math.max(this.x,point.x),Math.max(this.y,point.y));};Point.prototype.inverse=function() diff --git a/script/pages/create_graph_by_matrix/api/index.js.cache b/script/pages/create_graph_by_matrix/api/index.js.cache index a9d8d47..a7614af 100644 --- a/script/pages/create_graph_by_matrix/api/index.js.cache +++ b/script/pages/create_graph_by_matrix/api/index.js.cache @@ -1,4 +1,4 @@ -moduleLoader.beginCacheLoading(["/script/entities/graph/api/index.js?v=93","/script/shared/point.js?v=93","/script/entities/edge/api/index.js?v=93","/script/entities/edge/model/BaseEdge.js?v=93","/script/entities/edge/model/EdgeModel.js?v=93","/script/entities/vertex/api/index.js?v=93","/script/entities/vertex/model/BaseVertex.js?v=93","/script/entities/vertex/model/VertexModel.js?v=93","/script/entities/graph/model/Graph.js?v=93","/script/pages/create_graph_by_matrix/model/createByMatrixMain.js?v=93","/script/pages/create_graph_by_matrix/model/main.js?v=93",]);{let modulDir="pages/create_graph_by_matrix/";doInclude([include("entities/graph/api/index.js"),include("model/createByMatrixMain.js",modulDir),include("model/main.js",modulDir)]);} +moduleLoader.beginCacheLoading(["/script/entities/graph/api/index.js?v=94","/script/shared/point.js?v=94","/script/entities/edge/api/index.js?v=94","/script/entities/edge/model/BaseEdge.js?v=94","/script/entities/edge/model/EdgeModel.js?v=94","/script/entities/vertex/api/index.js?v=94","/script/entities/vertex/model/BaseVertex.js?v=94","/script/entities/vertex/model/VertexModel.js?v=94","/script/entities/graph/model/Graph.js?v=94","/script/pages/create_graph_by_matrix/model/createByMatrixMain.js?v=94","/script/pages/create_graph_by_matrix/model/main.js?v=94",]);{let modulDir="pages/create_graph_by_matrix/";doInclude([include("entities/graph/api/index.js"),include("model/createByMatrixMain.js",modulDir),include("model/main.js",modulDir)]);} {let modulDir="entities/graph/";doInclude([include("shared/point.js"),include("entities/edge/api/index.js"),include("entities/vertex/api/index.js"),include("model/Graph.js",modulDir)])}function Point(x,y){this.x=x||0;this.y=y||0;};Point.prototype.x=null;Point.prototype.y=null;Point.prototype.add=function(v){return new Point(this.x+v.x,this.y+v.y);};Point.prototype.addValue=function(v){return new Point(this.x+v,this.y+v);};Point.prototype.clone=function(){return new Point(this.x,this.y);};Point.prototype.degreesTo=function(v){var dx=this.x-v.x;var dy=this.y-v.y;var angle=Math.atan2(dy,dx);return angle*(180/Math.PI);};Point.prototype.distance=function(v){return Math.sqrt(this.distanceSqr(v));};Point.prototype.distanceSqr=function(v){var x=this.x-v.x;var y=this.y-v.y;return x*x+y*y;};Point.prototype.equals=function(toCompare){return this.x==toCompare.x&&this.y==toCompare.y;};Point.prototype.interpolate=function(v,f){return new Point((this.x+v.x)*f,(this.y+v.y)*f);};Point.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y);};Point.prototype.normalize=function(thickness){var l=this.length();this.x=this.x/l*thickness;this.y=this.y/l*thickness;return new Point(this.x,this.y);};Point.prototype.normalizeCopy=function(thickness){var l=this.length();return new Point(this.x/l*thickness,this.y/l*thickness);};Point.prototype.orbit=function(origin,arcWidth,arcHeight,degrees){var radians=degrees*(Math.PI/180);this.x=origin.x+arcWidth*Math.cos(radians);this.y=origin.y+arcHeight*Math.sin(radians);};Point.prototype.rotate=function(center,degrees){var radians=degrees*(Math.PI/180);offset=this.subtract(center);this.x=offset.x*Math.cos(radians)-offset.y*Math.sin(radians);this.y=offset.x*Math.sin(radians)+offset.y*Math.cos(radians);this.x=this.x+center.x;this.y=this.y+center.y;return this;};Point.prototype.offset=function(dx,dy){this.x+=dx;this.y+=dy;};Point.prototype.subtract=function(v){return new Point(this.x-v.x,this.y-v.y);};Point.prototype.subtractValue=function(value){return new Point(this.x-value,this.y-value);};Point.prototype.multiply=function(value){return new Point(this.x*value,this.y*value);};Point.prototype.toString=function(){return"(x="+this.x+", y="+this.y+")";};Point.prototype.normal=function(){return new Point(-this.y,this.x);};Point.prototype.min=function(point) {return new Point(Math.min(this.x,point.x),Math.min(this.y,point.y));};Point.prototype.max=function(point) {return new Point(Math.max(this.x,point.x),Math.max(this.y,point.y));};Point.prototype.inverse=function() diff --git a/script/pages/editor/api/index.js.cache b/script/pages/editor/api/index.js.cache index 6f3f554..2b6314f 100644 --- a/script/pages/editor/api/index.js.cache +++ b/script/pages/editor/api/index.js.cache @@ -1,4 +1,4 @@ -moduleLoader.beginCacheLoading(["/script/shared/utils.js?v=93","/script/shared/gzip.js?v=93","/script/entities/graph/api/index.js?v=93","/script/shared/point.js?v=93","/script/entities/edge/api/index.js?v=93","/script/entities/edge/model/BaseEdge.js?v=93","/script/entities/edge/model/EdgeModel.js?v=93","/script/entities/vertex/api/index.js?v=93","/script/entities/vertex/model/BaseVertex.js?v=93","/script/entities/vertex/model/VertexModel.js?v=93","/script/entities/graph/model/Graph.js?v=93","/script/features/draw_graph/api/index.js?v=93","/script/features/draw_graph/model/BaseBackgroundDrawer.js?v=93","/script/features/draw_graph/model/EdgeStyle.js?v=93","/script/features/draw_graph/model/BaseEdgeDrawer.js?v=93","/script/features/draw_graph/model/VertexShape.js?v=93","/script/features/draw_graph/model/VertexStyle.js?v=93","/script/features/draw_graph/model/BaseVertexDrawer.js?v=93","/script/features/draw_graph/model/GraphFullStyle.js?v=93","/script/features/algorithms/api/index.js?v=93","/script/features/algorithms/model/Algorithms.js?v=93","/script/features/algorithms/model/BaseTraversal.js?v=93","/script/features/base_handler/index.js?v=93","/script/features/default_handler/index.js?v=93","/script/features/add_vertices_handler/index.js?v=93","/script/features/connect_vertices_handler/index.js?v=93","/script/features/delete_objects_handler/index.js?v=93","/script/features/algorithm_handler/index.js?v=93","/script/features/select_auto_save_graph_or_not/index.js?v=93","/script/features/graph_preview/index.js?v=93","/script/features/serialization/api/index.js?v=93","/script/features/serialization/model/GraphMLCreator.js?v=93","/script/features/enum_vertices/EnumVertices.js?v=93","/script/pages/editor/model/texts.js?v=93","/script/pages/editor/model/UndoStack.js?v=93","/script/pages/editor/model/DiskSaveLoad.js?v=93","/script/pages/editor/model/Application.js?v=93","/script/pages/editor/ui/ya_metrika.js?v=93","/script/pages/editor/ui/editor.js?v=93","/script/pages/editor/ui/main.js?v=93",]);{function onloadEditor(){console.log("onload() call");doIncludeAsync([include("shared/canvas2svg.js"),include("features/group_rename_handler/index.js"),include("features/saved_graph_handler/index.js"),include("features/saved_graph_image_handler/index.js"),include("features/show_adjacency_matrix/index.js"),include("features/show_distance_matrix/index.js"),include("features/show_incidence_matrix/index.js"),include("features/setup_background_style/index.js"),include("features/setup_edge_style/index.js"),include("features/setup_vertex_style/index.js"),]);postLoadPage();} +moduleLoader.beginCacheLoading(["/script/shared/utils.js?v=94","/script/shared/gzip.js?v=94","/script/entities/graph/api/index.js?v=94","/script/shared/point.js?v=94","/script/entities/edge/api/index.js?v=94","/script/entities/edge/model/BaseEdge.js?v=94","/script/entities/edge/model/EdgeModel.js?v=94","/script/entities/vertex/api/index.js?v=94","/script/entities/vertex/model/BaseVertex.js?v=94","/script/entities/vertex/model/VertexModel.js?v=94","/script/entities/graph/model/Graph.js?v=94","/script/features/draw_graph/api/index.js?v=94","/script/features/draw_graph/model/BaseBackgroundDrawer.js?v=94","/script/features/draw_graph/model/EdgeStyle.js?v=94","/script/features/draw_graph/model/BaseEdgeDrawer.js?v=94","/script/features/draw_graph/model/VertexShape.js?v=94","/script/features/draw_graph/model/VertexStyle.js?v=94","/script/features/draw_graph/model/BaseVertexDrawer.js?v=94","/script/features/draw_graph/model/GraphFullStyle.js?v=94","/script/features/algorithms/api/index.js?v=94","/script/features/algorithms/model/Algorithms.js?v=94","/script/features/algorithms/model/BaseTraversal.js?v=94","/script/features/base_handler/index.js?v=94","/script/features/default_handler/index.js?v=94","/script/features/add_vertices_handler/index.js?v=94","/script/features/connect_vertices_handler/index.js?v=94","/script/features/delete_objects_handler/index.js?v=94","/script/features/algorithm_handler/index.js?v=94","/script/features/select_auto_save_graph_or_not/index.js?v=94","/script/features/graph_preview/index.js?v=94","/script/features/serialization/api/index.js?v=94","/script/features/serialization/model/GraphMLCreator.js?v=94","/script/features/enum_vertices/EnumVertices.js?v=94","/script/pages/editor/model/texts.js?v=94","/script/pages/editor/model/UndoStack.js?v=94","/script/pages/editor/model/DiskSaveLoad.js?v=94","/script/pages/editor/model/Application.js?v=94","/script/pages/editor/ui/ya_metrika.js?v=94","/script/pages/editor/ui/editor.js?v=94","/script/pages/editor/ui/main.js?v=94",]);{function onloadEditor(){console.log("onload() call");doIncludeAsync([include("shared/canvas2svg.js"),include("features/group_rename_handler/index.js"),include("features/saved_graph_handler/index.js"),include("features/saved_graph_image_handler/index.js"),include("features/show_adjacency_matrix/index.js"),include("features/show_distance_matrix/index.js"),include("features/show_incidence_matrix/index.js"),include("features/setup_background_style/index.js"),include("features/setup_edge_style/index.js"),include("features/setup_vertex_style/index.js"),]);postLoadPage();} let modulDir="pages/editor/";doInclude([include("shared/utils.js"),include("shared/gzip.js"),include("entities/graph/api/index.js"),include("features/draw_graph/api/index.js"),include("features/algorithms/api/index.js"),include("features/base_handler/index.js"),include("features/default_handler/index.js"),include("features/add_vertices_handler/index.js"),include("features/connect_vertices_handler/index.js"),include("features/delete_objects_handler/index.js"),include("features/algorithm_handler/index.js"),include("features/select_auto_save_graph_or_not/index.js"),include("features/serialization/api/index.js"),include("features/enum_vertices/EnumVertices.js"),include("model/texts.js",modulDir),include("model/UndoStack.js",modulDir),include("model/DiskSaveLoad.js",modulDir),include("model/Application.js",modulDir),include("ui/ya_metrika.js",modulDir),include("ui/editor.js",modulDir),include("ui/main.js",modulDir)],onloadEditor);} function gEncodeToHTML(str) {if(typeof str!=='string') @@ -1498,7 +1498,7 @@ DiskSaveLoad.RemoveAutoSaveGraphFromDisk=function(graphName,callback) {$.ajax({type:"GET",url:"/"+SiteDir+"backend/removeGraph.php?name=autosave_"+graphName}).done(callback);} var globalApplication=null;function Application(document,window,listener) {this.document=document;this.listener=listener;this.canvas=this.document.getElementById('canvas');this.handler=new DefaultHandler(this);this.savedGraphName="";this.currentEnumVerticesType=new BaseEnumVertices(this,1);this.findPathReport=1;this.isTimerRender=false;globalApplication=this;this.renderPath=[];this.renderTimer=0;this.renderPathLength=0;this.renderPathCounter=0;this.renderPathLoops=0;this.enumVerticesTextList=[new BaseEnumVertices(this,1),new BaseEnumVertices(this,0),new TextEnumVertices(this),new TextEnumVerticesCyr(this),new TextEnumVerticesGreek(this),new TextEnumVerticesCustom(this)];this.SetDefaultTransformations();this.algorithmsValues={};this.undoStack=new UndoStack(this.maxUndoStackSize);this.style=new GraphFullStyle(function() -{this.redrawGraph();}.bind(this));this.edgePrintCommonStyle=new CommonPrintEdgeStyle();this.edgePrintSelectedStyles=FullArrayCopy(DefaultPrintSelectedEdgeStyles);this.vertexPrintCommonStyle=new CommonPrintVertexStyle();this.vertexPrintSelectedVertexStyles=FullArrayCopy(DefaultPrintSelectedGraphStyles);this.backgroundPrintStyle=new PrintBackgroundStyle();this.renderPathWithEdges=false;this.edgePresets=[1,3,5,7,11,42];this.maxEdgePresets=6;this.selectionRect=null;this.processEmscriptenFunction=null;this.defaultEdge=null;this.useDefaultEdge=false;this.lastSavedAutoSave="";this.lastGraphName="";};Application.prototype.graph=new Graph();Application.prototype.dragObject=-1;Application.prototype.handler=null;Application.prototype.status={};Application.prototype.graphNameLength=16;Application.prototype.maxUndoStackSize=8;Application.prototype.maxAutosaveSizeForCookie=2000;Application.prototype.autosaveTimeInterval=1000*60;Application.prototype.styliedGraphNamePostfix="ZZcst";Application.prototype.getMousePos=function(canvas,e) +{this.redrawGraph();}.bind(this));this.edgePrintCommonStyle=new CommonPrintEdgeStyle();this.edgePrintSelectedStyles=FullArrayCopy(DefaultPrintSelectedEdgeStyles);this.vertexPrintCommonStyle=new CommonPrintVertexStyle();this.vertexPrintSelectedVertexStyles=FullArrayCopy(DefaultPrintSelectedGraphStyles);this.backgroundPrintStyle=new PrintBackgroundStyle();this.renderPathWithEdges=false;this.edgePresets=[1,3,5,7,11,42];this.maxEdgePresets=6;this.selectionRect=null;this.processEmscriptenFunction=null;this.defaultEdge=null;this.useDefaultEdge=false;this.lastSavedAutoSave="";this.lastGraphName="";this.lastUsedGraphs=[];};Application.prototype.graph=new Graph();Application.prototype.dragObject=-1;Application.prototype.handler=null;Application.prototype.status={};Application.prototype.graphNameLength=16;Application.prototype.maxUndoStackSize=8;Application.prototype.maxAutosaveSizeForCookie=2000;Application.prototype.autosaveTimeInterval=1000*60;Application.prototype.styliedGraphNamePostfix="ZZcst";Application.prototype.maxLastUsedGraphCount=5;Application.prototype.getMousePos=function(canvas,e) {var rect=canvas.getBoundingClientRect();return{x:(e.clientX-rect.left)/this.canvasScale-this.canvasPosition.x,y:(e.clientY-rect.top)/this.canvasScale-this.canvasPosition.y};} Application.prototype.redrawGraph=function() {if(!this.isTimerRender) @@ -1695,7 +1695,7 @@ document.getElementById('GraphUndo').style.display='none';this.updateMessage();t {this.startAutoSaveTimer();}} Application.prototype.onLoad=function() {this.canvas=this.document.getElementById('canvas');this.SetDefaultHandler() -this.updateMessage();this.redrawGraph();} +this.updateMessage();this.redrawGraph();this.LoadLastUsedGraphsFromCookie();this.UpdateLastUsedGraphsMenu();} Application.prototype.NeedRedraw=function() {this.updateMessage();this.redrawGraph();} Application.prototype.SetStatus=function(name,value) @@ -1758,7 +1758,7 @@ Application.prototype.SaveGraphOnDisk=function() {var graphAsString=this.graph.SaveToXML(this.SaveUserSettings());var app=this;if(this.savedGraphName.length<=0) {this.savedGraphName=this.GetNewGraphName();} DiskSaveLoad.SaveGraphOnDisk(this.savedGraphName,graphAsString,function(msg) -{document.cookie="graphName="+app.savedGraphName;app.removeAutosave();app.lastGraphName=app.savedGraphName;});} +{document.cookie="graphName="+app.savedGraphName;app.removeAutosave();app.lastGraphName=app.savedGraphName;app.PushLastUsedGraph(app.savedGraphName);});} Application.prototype.SaveGraphImageOnDisk=function(showDialogCallback) {var imageName=this.GetNewName();this.stopRenderTimer();this.redrawGraph();var bbox=this.graph.getGraphBBox();var rectParams="";if(this.IsGraphFitOnViewport()) {var canvasWidth=this.GetRealWidth();var canvasHeight=this.GetRealHeight();var canvasPositionInverse=this.canvasPosition.inverse();var pos=bbox.minPoint.subtract(canvasPositionInverse);rectParams="&x="+Math.round(pos.x*this.canvasScale)+"&y="+Math.round(pos.y*this.canvasScale) @@ -2029,6 +2029,29 @@ Application.prototype.onSelectOgirinalGraph=function(graphName) {this.LoadGraphFromDisk(graphName);this.startAutoSaveTimer();userAction("LoadGraphFromDisk_userSelect");console.log("User selected original graph");} Application.prototype.onSelectAutosaveGraph=function() {this.loadAutoSave();this.startAutoSaveTimer();userAction("LoadGraphFromAutoSave_userSelect");console.log("User selected auto-save graph");} +Application.prototype.UpdateLastUsedGraphsMenu=function() +{let isEmpty=this.lastUsedGraphs.length==0;document.getElementById('LastUsedGraphsMenu').style.display=isEmpty?'none':'block';let graphsList=document.getElementById('LastUsedGraphsList');graphsList.innerHTML='';if(isEmpty) +{return;} +let FormatGraphName=function(graph) +{let MAX_GRAPH_NAME_LENGTH=20;let graphName=graph.graph;if(graphName.length>MAX_GRAPH_NAME_LENGTH) +{graphName=graphName.substring(0,MAX_GRAPH_NAME_LENGTH/2)+"..."+ +graphName.substring(graphName.length-MAX_GRAPH_NAME_LENGTH/2);} +return graphName+" "+""+ +graph.date.toLocaleDateString(g_language+"-"+g_language);};for(let i=0;i"+""+ +FormatGraphName(graph)+""+"";}} +Application.prototype.PushLastUsedGraph=function(graphName) +{let graph={graph:graphName,date:new Date()};let index=this.lastUsedGraphs.findIndex(function(item){return item.graph==graphName;});if(index>=0) +{this.UpdateLastUsedGraphsMenu();return;} +this.lastUsedGraphs.unshift(graph);if(this.lastUsedGraphs.length>this.maxLastUsedGraphCount) +{this.lastUsedGraphs.pop();} +this.SaveLastUsedGraphsToCookie();this.UpdateLastUsedGraphsMenu();} +Application.prototype.SaveLastUsedGraphsToCookie=function() +{let graphs=JSON.stringify(this.lastUsedGraphs);var now=new Date();var time=now.getTime();var expireTime=time+1000*3600*24*7;now.setTime(expireTime);document.cookie="lastUsedGraphs="+graphs+';expires='+now.toUTCString()+";path=/";} +Application.prototype.LoadLastUsedGraphsFromCookie=function() +{let graphs=document.cookie.replace(/(?:(?:^|.*;\s*)lastUsedGraphs\s*\=\s*([^;]*).*$)|^.*$/,"$1");if(graphs.length>0) +{this.lastUsedGraphs=JSON.parse(graphs);for(let i=0;i MAX_GRAPH_NAME_LENGTH) + { + graphName = graphName.substring(0, MAX_GRAPH_NAME_LENGTH / 2) + "..." + + graphName.substring(graphName.length - MAX_GRAPH_NAME_LENGTH / 2); + } + return graphName + " " + "" + + graph.date.toLocaleDateString(g_language + "-" + g_language); + }; + + for (let i = 0; i < this.lastUsedGraphs.length; i++) + { + let graph = this.lastUsedGraphs[i]; + + graphsList.innerHTML = graphsList.innerHTML + + "
  • " + + "" + + FormatGraphName(graph) + + "" + + "
  • "; + } +} + +Application.prototype.PushLastUsedGraph = function(graphName) +{ + let graph = {graph: graphName, date: new Date()}; + let index = this.lastUsedGraphs.findIndex(function(item) { return item.graph == graphName; }); + if (index >= 0) + { + this.UpdateLastUsedGraphsMenu(); + return; + } + + this.lastUsedGraphs.unshift(graph); + if (this.lastUsedGraphs.length > this.maxLastUsedGraphCount) + { + this.lastUsedGraphs.pop(); + } + + this.SaveLastUsedGraphsToCookie(); + this.UpdateLastUsedGraphsMenu(); +} + +Application.prototype.SaveLastUsedGraphsToCookie = function() +{ + let graphs = JSON.stringify(this.lastUsedGraphs); + var now = new Date(); + var time = now.getTime(); + var expireTime = time + 1000 * 3600 * 24 * 7; // In a week. + now.setTime(expireTime); + document.cookie = "lastUsedGraphs=" + graphs + ';expires=' + now.toUTCString() + ";path=/"; +} + +Application.prototype.LoadLastUsedGraphsFromCookie = function() +{ + let graphs = document.cookie.replace(/(?:(?:^|.*;\s*)lastUsedGraphs\s*\=\s*([^;]*).*$)|^.*$/, "$1"); + if (graphs.length > 0) + { + this.lastUsedGraphs = JSON.parse(graphs); + for (let i = 0; i < this.lastUsedGraphs.length; i++) + { + let graph = this.lastUsedGraphs[i]; + graph.date = new Date(graph.date); + } + } } \ No newline at end of file diff --git a/tpl/home.php b/tpl/home.php index f0d2168..a03f296 100755 --- a/tpl/home.php +++ b/tpl/home.php @@ -34,18 +34,11 @@ -
  • -
  • - - - -
  • - +
  • +
  • + + + +
  • diff --git a/tpl/main_tpl.php b/tpl/main_tpl.php index 1a32b9d..e934d20 100755 --- a/tpl/main_tpl.php +++ b/tpl/main_tpl.php @@ -49,9 +49,9 @@
    -