From a5fb17bb9bb33bd5e8cf5f2394181c8eb7a4b55a Mon Sep 17 00:00:00 2001 From: Oleg Sh Date: Sun, 3 Dec 2023 17:40:52 +0200 Subject: [PATCH] Refactor handlers. --- .../algorithms/model/plugins/GraphReorder.js | 2 +- script/pages/editor/api/index.js.cache | 135 ++++++----------- script/pages/editor/model/Application.js | 143 ++---------------- script/pages/editor/ui/editor.js | 109 ++++++++----- 4 files changed, 136 insertions(+), 253 deletions(-) diff --git a/script/features/algorithms/model/plugins/GraphReorder.js b/script/features/algorithms/model/plugins/GraphReorder.js index 60c79c9..721383d 100644 --- a/script/features/algorithms/model/plugins/GraphReorder.js +++ b/script/features/algorithms/model/plugins/GraphReorder.js @@ -142,7 +142,7 @@ GraphReorder.prototype.result = function(resultCallback) this.app.OnAutoAdjustViewport(); - this.app.SetHandlerMode("default"); + this.app.SetDefaultHandler(); // Looks like somthing going wrong and will use circle algorithm for reposition. //var bbox = this.getGraphBBox(); diff --git a/script/pages/editor/api/index.js.cache b/script/pages/editor/api/index.js.cache index 934e6e6..38720a5 100644 --- a/script/pages/editor/api/index.js.cache +++ b/script/pages/editor/api/index.js.cache @@ -1440,7 +1440,7 @@ currentStyle=selected?selectedStyle[selectedGroup]:commonStyle;this.graph.vertic Application.prototype.RedrawSelectionRect=function(context) {context.lineWidth=1.0/this.canvasScale;context.strokeStyle=this.edgeSelectedStyles[0].strokeStyle;context.setLineDash([6,3]);context.beginPath();context.rect(this.selectionRect.left(),this.selectionRect.top(),this.selectionRect.size().x,this.selectionRect.size().y);context.closePath();context.stroke();context.setLineDash([]);} Application.prototype.updateMessage=function() -{this.document.getElementById('message').innerHTML=this.handler.GetMessage();this.handler.InitControls();} +{this.listener.updateMessage(this.handler.GetMessage());this.handler.InitControls();} Application.prototype.CanvasOnMouseMove=function(e) {var pos=this.getMousePos(this.canvas,e);this.handler.MouseMove(pos);if(this.handler.IsNeedRedraw()) {this.handler.RestRedraw();this.redrawGraph();} @@ -1496,59 +1496,12 @@ Application.prototype.FindEdgeAny=function(id1,id2) {return this.graph.FindEdgeAny(id1,id2);} Application.prototype.FindAllEdges=function(id1,id2) {return this.graph.FindAllEdges(id1,id2);} -Application.prototype.SetHandlerMode=function(mode) -{var manipulationHandlers=["default","addGraph","addArc","delete","findPath","connectedComponent","eulerianLoop"];if(this.handler&&(g_AlgorithmIds.indexOf(mode)>=0||manipulationHandlers.indexOf(mode)>=0)) +Application.prototype.SetHandler=function(newHandler) +{if(this.handler) {this.handler.RestoreAll();} -if(mode=="default") -{this.handler=new DefaultHandler(this);} -else if(mode=="addGraph") -{this.handler=new AddGraphHandler(this);} -else if(mode=="addArc") -{this.handler=new ConnectionGraphHandler(this);} -else if(mode=="delete") -{this.handler=new DeleteGraphHandler(this);} -else if(mode=="deleteAll") -{var removeAll=new DeleteAllHandler(this);removeAll.clear();} -else if(mode=="findPath") -{this.handler=new FindPathGraphHandler(this);} -else if(mode=="showAdjacencyMatrix") -{var showAdjacencyMatrix=new ShowAdjacencyMatrix(this);showAdjacencyMatrix.show();} -else if(mode=="showIncidenceMatrix") -{var showIncidenceMatrix=new ShowIncidenceMatrix(this);showIncidenceMatrix.show();} -else if(mode=="showDistanceMatrix") -{var showDistanceMatrix=new ShowDistanceMatrix(this);showDistanceMatrix.show();} -else if(mode=="connectedComponent") -{this.handler=new ConnectedComponentGraphHandler(this);} -else if(mode=="saveDialog") -{var savedDialogGraphHandler=new SavedDialogGraphHandler(this);savedDialogGraphHandler.show();} -else if(mode=="saveDialogImage") -{var savedDialogGraphImageHandler=new SavedDialogGraphImageHandler(this);savedDialogGraphImageHandler.showWorkspace();} -else if(mode=="saveDialogFullImage") -{var savedDialogGraphImageHandler=new SavedDialogGraphImageHandler(this);savedDialogGraphImageHandler.showFullgraph();} -else if(mode=="savePrintGraphImage") -{var savedDialogGraphImageHandler=new SavedDialogGraphImageHandler(this);savedDialogGraphImageHandler.showPrint();} -else if(mode=="saveSvgGraphImage") -{var savedDialogGraphImageHandler=new SavedDialogGraphImageHandler(this);savedDialogGraphImageHandler.showSvg();} -else if(mode=="eulerianLoop") -{this.handler=new EulerianLoopGraphHandler(this);} -else if(mode=="GroupRename") -{var groupRenameVertices=new GroupRenameVertices(this);groupRenameVertices.show();} -else if(mode=="setupVertexStyle") -{var setupVertexStyle=new SetupVertexStyle(this);setupVertexStyle.show(0);} -else if(mode=="setupVertexStyleSelected") -{var setupVertexStyle=new SetupVertexStyle(this);setupVertexStyle.show(1);} -else if(mode=="setupEdgeStyle") -{var setupEdgeStyle=new SetupEdgeStyle(this);setupEdgeStyle.show(0);} -else if(mode=="setupEdgeStyleSelected") -{var setupEdgeStyle=new SetupEdgeStyle(this);setupEdgeStyle.show(1);} -else if(mode=="setupBackgroundStyle") -{var setupBackgroundStyle=new SetupBackgroundStyle(this);setupBackgroundStyle.show();} -else if(mode=="graphUndo") -{if(!this.undoStack.IsUndoStackEmpty()) -this.Undo();} -else if(g_AlgorithmIds.indexOf(mode)>=0) -{this.handler=new AlgorithmGraphHandler(this,g_Algorithms[g_AlgorithmIds.indexOf(mode)](this.graph,this));} -console.log(mode);this.setRenderPath([]);this.updateMessage();this.redrawGraph();} +this.handler=newHandler;this.ToDefaultStateAndRedraw();} +Application.prototype.ToDefaultStateAndRedraw=function() +{this.setRenderPath([]);this.updateMessage();this.redrawGraph();} Application.prototype.getParameterByName=function(name) {name=name.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var regex=new RegExp("[\\?&]"+name+"=([^&#]*)"),results=regex.exec(location.search);return results===null?"":decodeURIComponent(results[1].replace(/\+/g," "));} Application.prototype.onPostLoadEvent=function() @@ -1671,7 +1624,7 @@ return name;} Application.prototype.GetGraphName=function() {return this.savedGraphName;} Application.prototype.SetDefaultHandler=function() -{this.listener.restButtons('Default');this.SetHandlerMode("default");} +{this.listener.SetDefaultHandler();} Application.prototype.GetEnumVerticesList=function() {var res=[];for(var i=0;i','>');pair=pair.replaceAll('<','<');dialogButtons[g_readMatrixHelp]=function(){window.location.assign(g_language=="ru"?"./wiki/Справка/СписокРебер":"./wiki/Help/EdgeList");};dialogButtons[g_fix]=function(){window.location.assign("./create_graph_by_edge_list?pair="+pair);};dialogButtons[g_close]=function(){$(this).dialog("close");};$("#pairErrorInc").dialog({resizable:false,title:g_pairWrongFormat,width:400,modal:true,dialogClass:'EdgeDialog',buttons:dialogButtons,});} Editor.prototype.ShowAdjacencyMatrixErrorDialog=function(matrix) {var dialogButtons={};matrixRes=matrix.replace(/\n/g,'%0A');dialogButtons[g_readMatrixHelp]=function(){window.location.assign(g_language=="ru"?"./wiki/Справка/МатрицаСмежности#matrixFormat":"./wiki/Help/AdjacencyMatrix#matrixFormat");};dialogButtons[g_fixMatrix]=function(){window.location.assign("./create_graph_by_matrix?matrix="+matrixRes);};dialogButtons[g_close]=function(){$(this).dialog("close");};$("#matrixError").dialog({resizable:false,title:g_matrixWrongFormat,width:400,modal:true,dialogClass:'EdgeDialog',buttons:dialogButtons,});} +Editor.prototype.SetDefaultHandler=function() +{this.restButtons('Default');this.application.SetHandler(new DefaultHandler(this.application));} +Editor.prototype.OnGraphTypeChanged=function(isMulti) +{$("#CanvasMessage").text(isMulti?g_GraphIsMultiMessage:g_GraphIsGeneralMessage);} +Editor.prototype.updateMessage=function(message) +{$("#message").html(message);} let DisableEmscripten=false;let editor=new Editor(document,window);function resizeCanvas() {var adv=document.getElementById('bottom_info');var canvas=document.getElementById('canvas');canvas.width=document.getElementById('canvasSection').offsetWidth;var mainContainer=document.getElementById('mainContainer');var offset=(mainContainer.offsetTop+mainContainer.offsetHeight)-(canvas.offsetTop+canvas.offsetHeight)+ ($("#footerContent").css("display")==='block'?0:24);canvas.height=$(window).height()-document.getElementById('canvas').offsetTop- diff --git a/script/pages/editor/model/Application.js b/script/pages/editor/model/Application.js index 144a858..6ccbe4d 100644 --- a/script/pages/editor/model/Application.js +++ b/script/pages/editor/model/Application.js @@ -470,7 +470,7 @@ Application.prototype.RedrawSelectionRect = function(context) Application.prototype.updateMessage = function() { - this.document.getElementById('message').innerHTML = this.handler.GetMessage(); + this.listener.updateMessage(this.handler.GetMessage()); this.handler.InitControls(); } @@ -668,135 +668,24 @@ Application.prototype.FindAllEdges = function(id1, id2) return this.graph.FindAllEdges(id1, id2); } -Application.prototype.SetHandlerMode = function(mode) +Application.prototype.SetHandler = function(newHandler) { - var manipulationHandlers = ["default", "addGraph", "addArc", "delete", "findPath", "connectedComponent", "eulerianLoop"]; - - if (this.handler && (g_AlgorithmIds.indexOf(mode) >= 0 || manipulationHandlers.indexOf(mode) >= 0)) + if (this.handler) { this.handler.RestoreAll(); - } - - if (mode == "default") - { - this.handler = new DefaultHandler(this); - } - else if (mode == "addGraph") - { - this.handler = new AddGraphHandler(this); - } - else if (mode == "addArc") - { - this.handler = new ConnectionGraphHandler(this); - } - else if (mode == "delete") - { - this.handler = new DeleteGraphHandler(this); - } - else if (mode == "deleteAll") - { - var removeAll = new DeleteAllHandler(this); - removeAll.clear(); - } - else if (mode == "findPath") - { - this.handler = new FindPathGraphHandler(this); - } - else if (mode == "showAdjacencyMatrix") - { - var showAdjacencyMatrix = new ShowAdjacencyMatrix(this); - showAdjacencyMatrix.show(); - } - else if (mode == "showIncidenceMatrix") - { - var showIncidenceMatrix = new ShowIncidenceMatrix(this); - showIncidenceMatrix.show(); - } - else if (mode == "showDistanceMatrix") - { - var showDistanceMatrix = new ShowDistanceMatrix(this); - showDistanceMatrix.show(); - } - else if (mode == "connectedComponent") - { - this.handler = new ConnectedComponentGraphHandler(this); - } - else if (mode == "saveDialog") - { - var savedDialogGraphHandler = new SavedDialogGraphHandler(this); - savedDialogGraphHandler.show(); - } - else if (mode == "saveDialogImage") - { - var savedDialogGraphImageHandler = new SavedDialogGraphImageHandler(this); - savedDialogGraphImageHandler.showWorkspace(); - } - else if (mode == "saveDialogFullImage") - { - var savedDialogGraphImageHandler = new SavedDialogGraphImageHandler(this); - savedDialogGraphImageHandler.showFullgraph(); - } - else if (mode == "savePrintGraphImage") - { - var savedDialogGraphImageHandler = new SavedDialogGraphImageHandler(this); - savedDialogGraphImageHandler.showPrint(); - } - else if (mode == "saveSvgGraphImage") - { - var savedDialogGraphImageHandler = new SavedDialogGraphImageHandler(this); - savedDialogGraphImageHandler.showSvg(); - } - else if (mode == "eulerianLoop") - { - this.handler = new EulerianLoopGraphHandler(this); - } - else if (mode == "GroupRename") - { - var groupRenameVertices = new GroupRenameVertices(this); - groupRenameVertices.show(); - } - else if (mode == "setupVertexStyle") - { - var setupVertexStyle = new SetupVertexStyle(this); - setupVertexStyle.show(0); - } - else if (mode == "setupVertexStyleSelected") - { - var setupVertexStyle = new SetupVertexStyle(this); - setupVertexStyle.show(1); - } - else if (mode == "setupEdgeStyle") - { - var setupEdgeStyle = new SetupEdgeStyle(this); - setupEdgeStyle.show(0); - } - else if (mode == "setupEdgeStyleSelected") - { - var setupEdgeStyle = new SetupEdgeStyle(this); - setupEdgeStyle.show(1); - } - else if (mode == "setupBackgroundStyle") - { - var setupBackgroundStyle = new SetupBackgroundStyle(this); - setupBackgroundStyle.show(); - } - else if (mode == "graphUndo") - { - if (!this.undoStack.IsUndoStackEmpty()) - this.Undo(); - } - else if (g_AlgorithmIds.indexOf(mode) >= 0) - { - this.handler = new AlgorithmGraphHandler(this, g_Algorithms[g_AlgorithmIds.indexOf(mode)](this.graph, this)); - } - - console.log(mode); + } - this.setRenderPath([]); - this.updateMessage(); - this.redrawGraph(); + this.handler = newHandler; + + this.ToDefaultStateAndRedraw(); } +Application.prototype.ToDefaultStateAndRedraw = function() +{ + this.setRenderPath([]); + this.updateMessage(); + this.redrawGraph(); +} Application.prototype.getParameterByName = function (name) { @@ -1218,11 +1107,9 @@ Application.prototype.GetGraphName = function() return this.savedGraphName; } - Application.prototype.SetDefaultHandler = function() { - this.listener.restButtons ('Default'); - this.SetHandlerMode("default"); + this.listener.SetDefaultHandler(); } Application.prototype.GetEnumVerticesList = function() @@ -1665,7 +1552,7 @@ Application.prototype.GetAvailableCurveValue = function(neighborEdges, originalE Application.prototype.GraphTypeChanged = function() { - $("#CanvasMessage").text(this.graph.isMulti() ? g_GraphIsMultiMessage : g_GraphIsGeneralMessage); + this.listener.OnGraphTypeChanged(this.graph.isMulti()); } Application.prototype.UpdateEdgePresets = function(weight) diff --git a/script/pages/editor/ui/editor.js b/script/pages/editor/ui/editor.js index 64eaccd..afcb9be 100644 --- a/script/pages/editor/ui/editor.js +++ b/script/pages/editor/ui/editor.js @@ -60,11 +60,11 @@ Editor.prototype.initKeyActions = function() { return String.fromCharCode(getCharCode(event)); // остальные } - function selectHandler(buttonName, handlerName) + function selectHandler(buttonName, handler) { userAction(buttonName + "_shortcut"); self.restButtons (buttonName); - self.application.SetHandlerMode(handlerName); + self.application.SetHandler(handler); } document.onkeypress = function (e) @@ -118,15 +118,15 @@ Editor.prototype.initKeyActions = function() { } else if (key == 'v' || key == 'м') // vertex { - selectHandler('AddGraph', 'addGraph'); + selectHandler('AddGraph', new AddGraphHandler(self.application)); } else if (key == 'e' || key == 'у') // edge { - selectHandler('ConnectGraphs', 'addArc'); + selectHandler('ConnectGraphs', new ConnectionGraphHandler(self.application)); } else if (key == 'r' || key == 'к') // delete { - selectHandler('DeleteObject', 'delete'); + selectHandler('DeleteObject', new DeleteGraphHandler(self.application)); } // Disabled because it is easy to lose graph, when you press miss letter. //else if (key == 'n' || key == 'т') // new @@ -137,12 +137,12 @@ Editor.prototype.initKeyActions = function() { //} else if (key == 'm' || key == 'ь') // move { - selectHandler('Default', 'default'); + selectHandler('Default', new DefaultHandler(self.application)); } else if (code == 26 && isCtrl) { userAction("Key_GraphUndo"); - self.application.SetHandlerMode("graphUndo"); + self.application.Undo(); } } @@ -158,40 +158,45 @@ Editor.prototype.initKeyActions = function() { Editor.prototype.initButtonActions = function() { - let self = this; + let self = this; document.getElementById('ShowAdjacencyMatrix').onclick = function () { userAction(this.id); - self.application.SetHandlerMode("showAdjacencyMatrix"); + var showAdjacencyMatrix = new ShowAdjacencyMatrix(self.application); + showAdjacencyMatrix.show(); } document.getElementById('ShowIncidenceMatrix').onclick = function () { userAction(this.id); - self.application.SetHandlerMode("showIncidenceMatrix"); + var showIncidenceMatrix = new ShowIncidenceMatrix(self.application); + showIncidenceMatrix.show(); } document.getElementById('ShowDistanceMatrix').onclick = function () { userAction(this.id); - self.application.SetHandlerMode("showDistanceMatrix"); + var showDistanceMatrix = new ShowDistanceMatrix(self.application); + showDistanceMatrix.show(); } document.getElementById('GroupRename').onclick = function () { userAction(this.id); - self.application.SetHandlerMode("GroupRename"); + var groupRenameVertices = new GroupRenameVertices(self.application); + groupRenameVertices.show(); } document.getElementById('groupRenameButton').onclick = function () { userAction(this.id); - self.application.SetHandlerMode("GroupRename"); + var groupRenameVertices = new GroupRenameVertices(self.application); + groupRenameVertices.show(); } document.getElementById('Default').onclick = function () { userAction(this.id); self.restButtons ('Default'); - self.application.SetHandlerMode("default"); + self.application.SetHandler(new DefaultHandler(self.application)); document.getElementById('Default').className = "btn btn-primary btn-sm"; } @@ -199,64 +204,73 @@ Editor.prototype.initButtonActions = function() { userAction(this.id); self.restButtons ('AddGraph'); - self.application.SetHandlerMode(document.getElementById('AddGraph').className != "" ? "addGraph" : "default"); + self.application.SetHandler(document.getElementById('AddGraph').className != "" ? new AddGraphHandler(self.application) : new DefaultHandler(self.application)); } document.getElementById('ConnectGraphs').onclick = function () { userAction(this.id); self.restButtons ('ConnectGraphs'); - self.application.SetHandlerMode(document.getElementById('ConnectGraphs').className != "" ? "addArc" : "default"); + self.application.SetHandler(document.getElementById('ConnectGraphs').className != "" ? new ConnectionGraphHandler(self.application) : new DefaultHandler(self.application)); } document.getElementById('DeleteObject').onclick = function () { userAction(this.id); self.restButtons ('DeleteObject'); - self.application.SetHandlerMode(document.getElementById('DeleteObject').className != "" ? "delete" : "default"); + self.application.SetHandler(document.getElementById('DeleteObject').className != "" ? new DeleteGraphHandler(tself.applicationhis) : new DefaultHandler(self.application)); } document.getElementById('DeleteAll').onclick = function () { userAction(this.id); - self.application.SetHandlerMode("deleteAll"); - } + var removeAll = new DeleteAllHandler(self.application); + removeAll.clear(); + self.application.ToDefaultStateAndRedraw(); + } document.getElementById('SaveGraph').onclick = function () { userAction(this.id); - self.application.SetHandlerMode("saveDialog"); + var savedDialogGraphHandler = new SavedDialogGraphHandler(self.application); + savedDialogGraphHandler.show(); } document.getElementById('NewGraph').onclick = function () { userAction(this.id); - self.application.SetHandlerMode("deleteAll"); + var removeAll = new DeleteAllHandler(self.application); + removeAll.clear(); + self.application.ToDefaultStateAndRedraw(); self.application.SetDefaultTransformations(); } document.getElementById('SaveGraphImage').onclick = function () { userAction(this.id); - self.application.SetHandlerMode("saveDialogImage"); + var savedDialogGraphImageHandler = new SavedDialogGraphImageHandler(self.application); + savedDialogGraphImageHandler.showWorkspace(); } document.getElementById('SaveFullGraphImage').onclick = function () { userAction(this.id); - self.application.SetHandlerMode("saveDialogFullImage"); + var savedDialogGraphImageHandler = new SavedDialogGraphImageHandler(self.application); + savedDialogGraphImageHandler.showFullgraph(); } document.getElementById('SavePrintGraphImage').onclick = function () { userAction(this.id); - self.application.SetHandlerMode("savePrintGraphImage"); + var savedDialogGraphImageHandler = new SavedDialogGraphImageHandler(self.application); + savedDialogGraphImageHandler.showPrint(); } document.getElementById('SaveSvgGraphImage').onclick = function () { userAction(this.id); - self.application.SetHandlerMode("saveSvgGraphImage"); + var savedDialogGraphImageHandler = new SavedDialogGraphImageHandler(self.application); + savedDialogGraphImageHandler.showSvg(); } document.getElementById('Zoom100').onclick = function () @@ -299,43 +313,50 @@ Editor.prototype.initButtonActions = function() { userAction(this.id); self.restButtons ('Default'); - self.application.SetHandlerMode("default"); + self.application.SetHandler(new DefaultHandler(self.application)); document.getElementById('Default').className = "btn btn-primary btn-sm"; } + document.getElementById('SetupVertexStyle').onclick = function () { userAction(this.id); - self.application.SetHandlerMode("setupVertexStyle"); + var setupVertexStyle = new SetupVertexStyle(self.application); + setupVertexStyle.show(0); } document.getElementById('SetupVertexStyleSelected').onclick = function () { userAction(this.id); - self.application.SetHandlerMode("setupVertexStyleSelected"); + var setupVertexStyle = new SetupVertexStyle(self.application); + setupVertexStyle.show(1); } document.getElementById('SetupEdgeStyle').onclick = function () { userAction(this.id); - self.application.SetHandlerMode("setupEdgeStyle"); + var setupEdgeStyle = new SetupEdgeStyle(self.application); + setupEdgeStyle.show(0); } document.getElementById('SetupEdgeStyleSelected').onclick = function () { userAction(this.id); - self.application.SetHandlerMode("setupEdgeStyleSelected"); + var setupEdgeStyle = new SetupEdgeStyle(self.application); + setupEdgeStyle.show(1); } document.getElementById('SetupBackgroundStyle').onclick = function () { userAction(this.id); - self.application.SetHandlerMode("setupBackgroundStyle"); + var setupBackgroundStyle = new SetupBackgroundStyle(self.application); + setupBackgroundStyle.show(); } document.getElementById('GraphUndo').onclick = function () { userAction(this.id); - self.application.SetHandlerMode("graphUndo"); - } + self.application.Undo(); + } document.getElementById('runUserScript').onclick = function () { + /* TODO Currently is not supported. var el = document.getElementById('userScript'); var oldScript = document.getElementById("userScriptSource"); @@ -351,6 +372,7 @@ Editor.prototype.initButtonActions = function() document.head.appendChild(script); self.application.SetHandlerMode("user.algorithm"); + */ } document.getElementById('submitUserScript').onclick = function () @@ -601,7 +623,8 @@ Editor.prototype.createAlgorithmMenu = function() e["closeThisMenu"] = true; userAction(this.id); self.restButtons (this.id); - self.application.SetHandlerMode(this.id); + self.application.SetHandler(new AlgorithmGraphHandler(self.application, + g_Algorithms[g_AlgorithmIds.indexOf(this.id)](self.application.graph, self.application))); } var eventData = {}; @@ -727,4 +750,20 @@ Editor.prototype.ShowAdjacencyMatrixErrorDialog = function(matrix) dialogClass: 'EdgeDialog', buttons: dialogButtons, }); -} \ No newline at end of file +} + +Editor.prototype.SetDefaultHandler = function() +{ + this.restButtons ('Default'); + this.application.SetHandler(new DefaultHandler(this.application)); +} + +Editor.prototype.OnGraphTypeChanged = function(isMulti) +{ + $("#CanvasMessage").text(isMulti ? g_GraphIsMultiMessage : g_GraphIsGeneralMessage); +} + +Editor.prototype.updateMessage = function(message) +{ + $("#message").html(message); +}