Add last usage graphs menu.

This commit is contained in:
Oleg Sh 2025-02-15 20:35:37 +01:00
parent c03b2bf32b
commit 5477f2afe8
23 changed files with 168 additions and 27 deletions

View File

@ -93,5 +93,5 @@
$g_config['vote'] = "./tmp/vote/vote.txt"; $g_config['vote'] = "./tmp/vote/vote.txt";
$g_config['voteTopics'] = "./tmp/vote/voteTopics.txt_"; $g_config['voteTopics'] = "./tmp/vote/voteTopics.txt_";
$g_config['use_js_cache'] = true; $g_config['use_js_cache'] = true;
$g_config['engine_version'] = 93; $g_config['engine_version'] = 94;
?> ?>

View File

@ -288,6 +288,11 @@
background-color: #999; background-color: #999;
} }
#navigation .navbar-toggler-icon
{
background: url(/i/image/menu.svg) no-repeat;
}
@media (max-width: 767px) { @media (max-width: 767px) {
.dropdown-menu.multi-column { .dropdown-menu.multi-column {
min-width: 240px !important; min-width: 240px !important;

1
i/image/menu.svg Normal file
View File

@ -0,0 +1 @@
<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'><path stroke='rgba(0, 0, 0, 0.55)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/></svg>

After

Width:  |  Height:  |  Size: 193 B

View File

@ -313,4 +313,6 @@ We have added Dutch translation 🇳🇱. Thank you Willie de Wit</a>";
$g_lang['use_mouse_for_moving'] = "Use🖱for moving"; $g_lang['use_mouse_for_moving'] = "Use🖱for moving";
$g_lang['original_graph'] = "Original graph"; $g_lang['original_graph'] = "Original graph";
$g_lang['autosaved_graph'] = "Autosaved graph"; $g_lang['autosaved_graph'] = "Autosaved graph";
$g_lang['open_last_used_graph'] = "Open Recent Graph";
?> ?>

View File

@ -315,4 +315,6 @@
$g_lang['use_mouse_for_moving'] = "Use🖱for moving"; $g_lang['use_mouse_for_moving'] = "Use🖱for moving";
$g_lang['original_graph'] = "Original graph"; $g_lang['original_graph'] = "Original graph";
$g_lang['autosaved_graph'] = "Autosaved graph"; $g_lang['autosaved_graph'] = "Autosaved graph";
$g_lang['open_last_used_graph'] = "Open Recent Graph";
?> ?>

View File

@ -319,4 +319,6 @@
$g_lang['use_mouse_for_moving'] = "Use🖱for moving"; $g_lang['use_mouse_for_moving'] = "Use🖱for moving";
$g_lang['original_graph'] = "Original graph"; $g_lang['original_graph'] = "Original graph";
$g_lang['autosaved_graph'] = "Autosaved graph"; $g_lang['autosaved_graph'] = "Autosaved graph";
$g_lang['open_last_used_graph'] = "Open Recent Graph";
?> ?>

View File

@ -277,4 +277,6 @@
$g_lang['use_mouse_for_moving'] = "Use🖱for moving"; $g_lang['use_mouse_for_moving'] = "Use🖱for moving";
$g_lang['original_graph'] = "Original graph"; $g_lang['original_graph'] = "Original graph";
$g_lang['autosaved_graph'] = "Autosaved graph"; $g_lang['autosaved_graph'] = "Autosaved graph";
$g_lang['open_last_used_graph'] = "Open Recent Graph";
?> ?>

View File

@ -316,4 +316,6 @@
$g_lang['use_mouse_for_moving'] = "Use🖱for moving"; $g_lang['use_mouse_for_moving'] = "Use🖱for moving";
$g_lang['original_graph'] = "Original graph"; $g_lang['original_graph'] = "Original graph";
$g_lang['autosaved_graph'] = "Autosaved graph"; $g_lang['autosaved_graph'] = "Autosaved graph";
$g_lang['open_last_used_graph'] = "Open Recent Graph";
?> ?>

View File

@ -321,4 +321,6 @@ We have added Dutch translation 🇳🇱. Thank you Willie de Wit</a>";
$g_lang['use_mouse_for_moving'] = "Use🖱for moving"; $g_lang['use_mouse_for_moving'] = "Use🖱for moving";
$g_lang['original_graph'] = "Original graph"; $g_lang['original_graph'] = "Original graph";
$g_lang['autosaved_graph'] = "Autosaved graph"; $g_lang['autosaved_graph'] = "Autosaved graph";
$g_lang['open_last_used_graph'] = "Open Recent Graph";
?> ?>

View File

@ -320,4 +320,6 @@ Tenemos traducciones en griego 🇬🇷.</a> <a href=\"https://github.com/UnickS
$g_lang['use_mouse_for_moving'] = "Use🖱for moving"; $g_lang['use_mouse_for_moving'] = "Use🖱for moving";
$g_lang['original_graph'] = "Original graph"; $g_lang['original_graph'] = "Original graph";
$g_lang['autosaved_graph'] = "Autosaved graph"; $g_lang['autosaved_graph'] = "Autosaved graph";
$g_lang['open_last_used_graph'] = "Open Recent Graph";
?> ?>

View File

@ -287,4 +287,6 @@
$g_lang['use_mouse_for_moving'] = "Use🖱for moving"; $g_lang['use_mouse_for_moving'] = "Use🖱for moving";
$g_lang['original_graph'] = "Original graph"; $g_lang['original_graph'] = "Original graph";
$g_lang['autosaved_graph'] = "Autosaved graph"; $g_lang['autosaved_graph'] = "Autosaved graph";
$g_lang['open_last_used_graph'] = "Open Recent Graph";
?> ?>

View File

@ -284,4 +284,6 @@
$g_lang['use_mouse_for_moving'] = "Use🖱for moving"; $g_lang['use_mouse_for_moving'] = "Use🖱for moving";
$g_lang['original_graph'] = "Original graph"; $g_lang['original_graph'] = "Original graph";
$g_lang['autosaved_graph'] = "Autosaved graph"; $g_lang['autosaved_graph'] = "Autosaved graph";
$g_lang['open_last_used_graph'] = "Open Recent Graph";
?> ?>

View File

@ -320,4 +320,6 @@ Dodaliśmy polskie tłumaczenie, Patryk</a>";
$g_lang['use_mouse_for_moving'] = "Use🖱for moving"; $g_lang['use_mouse_for_moving'] = "Use🖱for moving";
$g_lang['original_graph'] = "Original graph"; $g_lang['original_graph'] = "Original graph";
$g_lang['autosaved_graph'] = "Autosaved graph"; $g_lang['autosaved_graph'] = "Autosaved graph";
$g_lang['open_last_used_graph'] = "Open Recent Graph";
?> ?>

View File

@ -285,4 +285,6 @@
$g_lang['use_mouse_for_moving'] = "Use🖱for moving"; $g_lang['use_mouse_for_moving'] = "Use🖱for moving";
$g_lang['original_graph'] = "Original graph"; $g_lang['original_graph'] = "Original graph";
$g_lang['autosaved_graph'] = "Autosaved graph"; $g_lang['autosaved_graph'] = "Autosaved graph";
$g_lang['open_last_used_graph'] = "Open Recent Graph";
?> ?>

View File

@ -323,4 +323,6 @@
$g_lang['use_mouse_for_moving'] = "Используйте🖱️для перемещения"; $g_lang['use_mouse_for_moving'] = "Используйте🖱️для перемещения";
$g_lang['original_graph'] = "Оригинальный граф"; $g_lang['original_graph'] = "Оригинальный граф";
$g_lang['autosaved_graph'] = "Автосохранение графа"; $g_lang['autosaved_graph'] = "Автосохранение графа";
$g_lang['open_last_used_graph'] = "Открыть недавний граф";
?> ?>

View File

@ -281,4 +281,6 @@
$g_lang['use_mouse_for_moving'] = "Use🖱for moving"; $g_lang['use_mouse_for_moving'] = "Use🖱for moving";
$g_lang['original_graph'] = "Original graph"; $g_lang['original_graph'] = "Original graph";
$g_lang['autosaved_graph'] = "Autosaved graph"; $g_lang['autosaved_graph'] = "Autosaved graph";
$g_lang['open_last_used_graph'] = "Open Recent Graph";
?> ?>

View File

@ -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) {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.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() {return new Point(Math.max(this.x,point.x),Math.max(this.y,point.y));};Point.prototype.inverse=function()

View File

@ -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) {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.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() {return new Point(Math.max(this.x,point.x),Math.max(this.y,point.y));};Point.prototype.inverse=function()

View File

@ -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) {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.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() {return new Point(Math.max(this.x,point.x),Math.max(this.y,point.y));};Point.prototype.inverse=function()

View File

@ -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);} 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) function gEncodeToHTML(str)
{if(typeof str!=='string') {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);} {$.ajax({type:"GET",url:"/"+SiteDir+"backend/removeGraph.php?name=autosave_"+graphName}).done(callback);}
var globalApplication=null;function Application(document,window,listener) 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.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};} {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() Application.prototype.redrawGraph=function()
{if(!this.isTimerRender) {if(!this.isTimerRender)
@ -1695,7 +1695,7 @@ document.getElementById('GraphUndo').style.display='none';this.updateMessage();t
{this.startAutoSaveTimer();}} {this.startAutoSaveTimer();}}
Application.prototype.onLoad=function() Application.prototype.onLoad=function()
{this.canvas=this.document.getElementById('canvas');this.SetDefaultHandler() {this.canvas=this.document.getElementById('canvas');this.SetDefaultHandler()
this.updateMessage();this.redrawGraph();} this.updateMessage();this.redrawGraph();this.LoadLastUsedGraphsFromCookie();this.UpdateLastUsedGraphsMenu();}
Application.prototype.NeedRedraw=function() Application.prototype.NeedRedraw=function()
{this.updateMessage();this.redrawGraph();} {this.updateMessage();this.redrawGraph();}
Application.prototype.SetStatus=function(name,value) 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) {var graphAsString=this.graph.SaveToXML(this.SaveUserSettings());var app=this;if(this.savedGraphName.length<=0)
{this.savedGraphName=this.GetNewGraphName();} {this.savedGraphName=this.GetNewGraphName();}
DiskSaveLoad.SaveGraphOnDisk(this.savedGraphName,graphAsString,function(msg) 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) Application.prototype.SaveGraphImageOnDisk=function(showDialogCallback)
{var imageName=this.GetNewName();this.stopRenderTimer();this.redrawGraph();var bbox=this.graph.getGraphBBox();var rectParams="";if(this.IsGraphFitOnViewport()) {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) {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");} {this.LoadGraphFromDisk(graphName);this.startAutoSaveTimer();userAction("LoadGraphFromDisk_userSelect");console.log("User selected original graph");}
Application.prototype.onSelectAutosaveGraph=function() Application.prototype.onSelectAutosaveGraph=function()
{this.loadAutoSave();this.startAutoSaveTimer();userAction("LoadGraphFromAutoSave_userSelect");console.log("User selected auto-save graph");} {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+" "+"<span class=\"bi bi-clock\"></span>"+
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+"<li>"+"<a class=\"dropdown-item btn btn-sm\" href=\"./?graph="+graph.graph+"\" role=\"button\">"+
FormatGraphName(graph)+"</a>"+"</li>";}}
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<this.lastUsedGraphs.length;i++)
{let graph=this.lastUsedGraphs[i];graph.date=new Date(graph.date);}}}
var waitCounter=false;var userAction=function(str) var waitCounter=false;var userAction=function(str)
{if(typeof window.yaCounter25827098!=="undefined") {if(typeof window.yaCounter25827098!=="undefined")
{console.log(g_language+"/"+str);window.yaCounter25827098.hit(window.location.protocol+"//"+window.location.hostname+(g_language!="ru"?"/"+g_language:"")+"/UserAction#"+str);} {console.log(g_language+"/"+str);window.yaCounter25827098.hit(window.location.protocol+"//"+window.location.hostname+(g_language!="ru"?"/"+g_language:"")+"/UserAction#"+str);}
@ -2151,11 +2174,7 @@ document.getElementById('ExportGraph').onclick=function()
document.getElementById('ImportGraph').onclick=function() document.getElementById('ImportGraph').onclick=function()
{userAction(this.id);if(ImportGraphFiles){ImportGraphFiles.click();}} {userAction(this.id);if(ImportGraphFiles){ImportGraphFiles.click();}}
document.getElementById('openAlgorithmList').onclick=function() document.getElementById('openAlgorithmList').onclick=function()
{return;setTimeout(function() {return;}
{var button=document.getElementById('openAlgorithmList');var buttonRect=button.getBoundingClientRect();var algorithmList=document.getElementById('algorithmList');var delta=buttonRect.right-algorithmList.offsetWidth;if(delta<0)
{var value=(delta-4)+"px";algorithmList.style.right=value;}
else
{algorithmList.style.right="0";}},1);document.getElementById('openAlgorithmList').removeAttribute("onclick");}
document.getElementById('Fullscreen').onclick=function() document.getElementById('Fullscreen').onclick=function()
{var idList=["h1Header","h1Text","navigation","footerContent","bottom_adv"];self.fullscreen=!self.fullscreen {var idList=["h1Header","h1Text","navigation","footerContent","bottom_adv"];self.fullscreen=!self.fullscreen
userAction(self.fullscreen?"fullscreen_on":"fullscreen_off");for(var i=0;i<idList.length;i++){let element=document.getElementById(idList[i]);if(!element)continue;if(self.fullscreen) userAction(self.fullscreen?"fullscreen_on":"fullscreen_off");for(var i=0;i<idList.length;i++){let element=document.getElementById(idList[i]);if(!element)continue;if(self.fullscreen)

View File

@ -56,6 +56,8 @@ function Application(document, window, listener)
this.lastSavedAutoSave = ""; this.lastSavedAutoSave = "";
this.lastGraphName = ""; // It could be last loaded or last saved graph. this.lastGraphName = ""; // It could be last loaded or last saved graph.
this.lastUsedGraphs = [];
}; };
// Current dragged object. // Current dragged object.
@ -75,6 +77,8 @@ Application.prototype.maxAutosaveSizeForCookie = 2000; // Max cookie size is at
Application.prototype.autosaveTimeInterval = 1000 * 60; // in ms. 1 minutes. Application.prototype.autosaveTimeInterval = 1000 * 60; // in ms. 1 minutes.
// We add postfix into name of graphs with styles. // We add postfix into name of graphs with styles.
Application.prototype.styliedGraphNamePostfix = "ZZcst"; Application.prototype.styliedGraphNamePostfix = "ZZcst";
// Max size of last used graph list. It is saved into cookie and takes about 300 bytes.
Application.prototype.maxLastUsedGraphCount = 5;
Application.prototype.getMousePos = function(canvas, e) Application.prototype.getMousePos = function(canvas, e)
{ {
@ -818,6 +822,10 @@ Application.prototype.onLoad = function()
this.updateMessage(); this.updateMessage();
this.redrawGraph(); this.redrawGraph();
// Updated last used graphs.
this.LoadLastUsedGraphsFromCookie();
this.UpdateLastUsedGraphsMenu();
} }
Application.prototype.NeedRedraw = function() Application.prototype.NeedRedraw = function()
@ -1006,6 +1014,8 @@ Application.prototype.SaveGraphOnDisk = function ()
// Remove cookie after save, beacuse we have this graph name in cookies. // Remove cookie after save, beacuse we have this graph name in cookies.
app.removeAutosave(); app.removeAutosave();
app.lastGraphName = app.savedGraphName; // Update last graph name after save. app.lastGraphName = app.savedGraphName; // Update last graph name after save.
// Update last used graphs.
app.PushLastUsedGraph(app.savedGraphName);
}); });
} }
@ -1902,4 +1912,86 @@ Application.prototype.onSelectAutosaveGraph = function()
this.startAutoSaveTimer(); this.startAutoSaveTimer();
userAction("LoadGraphFromAutoSave_userSelect"); userAction("LoadGraphFromAutoSave_userSelect");
console.log("User selected auto-save graph"); 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 + " " + "<span class=\"bi bi-clock\"></span>" +
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 +
"<li>" +
"<a class=\"dropdown-item btn btn-sm\" href=\"./?graph=" + graph.graph + "\" role=\"button\">" +
FormatGraphName(graph) +
"</a>" +
"</li>";
}
}
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);
}
}
} }

View File

@ -34,18 +34,11 @@
<span class="bi bi-plus"></span> <?= L('new_graph')?> <span class="bi bi-plus"></span> <?= L('new_graph')?>
</a> </a>
</li> </li>
<li><hr class="dropdown-divider hidden-phone"></li> <li style="display:none;" id="LastUsedGraphsMenu">
<li>
<a class="dropdown-item btn btn-sm btn-submenu" href="javascript:;" role="button" id="SaveGraph">
<span class="bi bi-floppy"></span> <?= L('save')?>
</a>
</li>
<!--
<li class="hidden-phone">
<a class="dropdown-item dropdown-toggle btn btn-sm btn-submenu" href="javascript:;" role="button"> <a class="dropdown-item dropdown-toggle btn btn-sm btn-submenu" href="javascript:;" role="button">
<span class="bi bi-clock-history"></span> Last used graphs <span class="bi bi-clock-history"></span> <?= L('open_last_used_graph') ?>
</a> </a>
<ul class="dropdown-menu dropdown-submenu"> <ul class="dropdown-menu dropdown-submenu" id="LastUsedGraphsList">
<li> <li>
<a class="dropdown-item btn btn-sm" href="javascript:;" role="button">Graph 1</a> <a class="dropdown-item btn btn-sm" href="javascript:;" role="button">Graph 1</a>
</li> </li>
@ -54,7 +47,12 @@
</li> </li>
</ul> </ul>
</li> </li>
--> <li><hr class="dropdown-divider hidden-phone"></li>
<li>
<a class="dropdown-item btn btn-sm btn-submenu" href="javascript:;" role="button" id="SaveGraph">
<span class="bi bi-floppy"></span> <?= L('save')?>
</a>
</li>
<li><hr class="dropdown-divider hidden-phone"></li> <li><hr class="dropdown-divider hidden-phone"></li>
<li> <li>
<a class="dropdown-item btn btn-sm btn-submenu" href="javascript:;" role="button" id="SaveFullGraphImage"> <a class="dropdown-item btn btn-sm btn-submenu" href="javascript:;" role="button" id="SaveFullGraphImage">

View File

@ -49,9 +49,9 @@
<body> <body>
<div class="container page-wrap" id="mainContainer"> <div class="container page-wrap" id="mainContainer">
<!-- <div class="header"> --> <!-- <div class="header"> -->
<nav class="navbar navbar-expand-lg navbar-default" id="navigation"> <nav class="navbar navbar-expand-lg navbar-default navbar-light" id="navigation">
<div class="container-fluid"> <div class="container-fluid">
<a class="navbar-brand" href="<?= SiteRoot()?>"><span class="fa fa-sitemap fa-fw"></span> Graph Online</a> <a class="navbar-brand" href="<?= SiteRoot()?>"><span class="bi bi-share"></span> Graph Online</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarMainContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation"> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarMainContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span> <span class="navbar-toggler-icon"></span>
</button> </button>
@ -104,7 +104,7 @@
<footer class="footer" id="footer" > <footer class="footer" id="footer" >
<div class="container hidden-phone" id="footerContent"> <div class="container hidden-phone" id="footerContent">
<p>© <?= L('footer_info')?> 2015 - <?= date("Y")?></p> <p>© <?= L('footer_info')?> 2015 - <?= date("Y")?><sub>r<?= $g_config['engine_version'] ?></sub></p>
</div> </div>
</footer> </footer>
</div> </div>