Skip to content

Commit 4fa9df3

Browse files
committed
Added dialog box
1 parent 251f415 commit 4fa9df3

File tree

9 files changed

+69
-9
lines changed

9 files changed

+69
-9
lines changed

astar.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ astarE:function(startNode , finishNode , grid){
6060
}
6161

6262
}
63+
animate("No Path found") ;
64+
enable() ;
6365
} ,
6466

6567
astarM:function(startNode , finishNode , grid){
@@ -121,7 +123,7 @@ astarM:function(startNode , finishNode , grid){
121123
}
122124

123125
}
124-
alert("Path not found")
126+
animate("No Path found") ;
125127
enable() ;
126128
} ,
127129

bfs.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ bfs : function(startNode , finishNode){
2828
}
2929
}
3030
}
31-
alert("Path Not found") ;
31+
animate("No Path found") ;
3232
enable();
3333

3434
} ,

biDijkstra.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ BiDijkstra:async function (start, finish , grid ) {
6666
}
6767

6868
}
69-
alert("Path Not found") ;
69+
animate("No Path found") ;
7070
enable();
7171

7272
},

concurrent.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ var CD = {
132132
}
133133
}
134134
}
135-
alert("Path Not found") ;
135+
animate("No Path found") ;
136136
enable();
137137
} ,
138138
mysetPath : async function (parent , finishNode){

dfs.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ dfs:function(startNode , finishNode){
2828
}
2929
}
3030
}
31-
alert("Path Not found") ;
31+
animate("No Path found") ;
3232
enable();
3333
},
3434

dijkstra.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ dijkstra : async function(start , finish){
3131
}
3232
}
3333
}
34-
alert("Path Not found") ;
34+
animate("No Path found") ;
3535
enable();
3636

3737
} ,

grid.css

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,4 +91,41 @@
9191
border : 1px solid white ;
9292
}
9393

94+
.block{
95+
pointer-events: none;
96+
opacity : 0 ;
97+
display : grid ;
98+
grid-template-rows: 2fr 1fr;
99+
grid-gap : 1px ;
100+
background: #f8f6f6;
101+
border : 1px solid #171d2d ;
102+
margin: auto;
103+
width: 20%;
104+
height: 20%;
105+
position: absolute;
106+
top: 40%;
107+
left: 40%;
108+
transition : opacity 0.5s ;
109+
}
110+
111+
.text{
112+
padding-top: 20px;
113+
}
114+
115+
p{
116+
117+
text-align: center;
118+
}
119+
#ok{
120+
pointer-events: none;
121+
width : 20% ;
122+
border-radius: 22px;
123+
position: relative;
124+
left: 37%;
125+
margin: 5px;
126+
bottom: 11%;
127+
}
128+
129+
130+
94131

grid.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ var width = window.innerWidth - s;
66
var height = window.innerHeight;
77
document.querySelector("#canvas").width = width - 2;
88
document.querySelector("#canvas").height = height - 2;
9+
document.querySelector("#ok").addEventListener('click' , function(){
10+
document.querySelector(".block").style.opacity = 0 ;
11+
document.querySelector("#ok").style.pointerEvents = "none";
12+
});
913

1014
var startNode;
1115
var finishNode;
@@ -170,6 +174,14 @@ function pressed(e) {
170174
}
171175
}
172176

177+
function animate(s){
178+
document.querySelector(".block").style.opacity = 1 ;
179+
document.querySelector(".text").innerHTML = `<p>${s}</p>`;
180+
document.querySelector("#ok").style.pointerEvents = "all" ;
181+
182+
}
183+
184+
173185
function up() {
174186
canvas.onmousemove = null;
175187
}
@@ -435,7 +447,7 @@ async function RecursiveDivisonH() {
435447

436448
function resetNodes() {
437449
if (startNode == null || finishNode == null) {
438-
alert("Select Start and finsh Node.");
450+
animate("Select start and finish Node.")
439451
}
440452
for (var i = 0; i < total_rows; i++) {
441453
for (var j = 0; j < total_cols; j++) {

index.html

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,18 @@
1414
</head>
1515

1616
<body>
17-
// It works guys
1817

18+
<div class="block">
19+
<div class="text">
20+
<p>
21+
Lorem ipsum dolor, sit amet consectetur adipisicing elit. Illum, praesentium?
22+
</p>
23+
</div>
24+
<button id = "ok" class = "btn btn-sm btn-dark">OK</button>
25+
</div>
26+
1927
<div class="super">
28+
2029
<div class="container">
2130
<img class="image" src="path-finder.png" alt="LOGO">
2231

@@ -112,7 +121,7 @@ <h3 style="font-weight: 100; color: whitesmoke; ">VisitedNode
112121

113122

114123
<canvas id="canvas"></canvas>
115-
</div>
124+
</div>
116125

117126
<script src="Node.js"></script>
118127
<script src="dijkstra.js"></script>

0 commit comments

Comments
 (0)