Skip to content

Commit

Permalink
Merge pull request #1 from dev-karpov0/frontend-test
Browse files Browse the repository at this point in the history
Frontend test
  • Loading branch information
lapkin25 authored Oct 8, 2023
2 parents 8db5d94 + 66bee9d commit 34755fc
Show file tree
Hide file tree
Showing 9 changed files with 440 additions and 80 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.idea/
51 changes: 26 additions & 25 deletions VVSU/Plan_VVSU.js
Original file line number Diff line number Diff line change
Expand Up @@ -544,31 +544,32 @@ let planXML = `
<Floor num="7.5">
<Stairs id="stairs10" name="Лестница" />
<Path start="stairs10" type="left_walls" dir="up">
<Point id="near_stairs10_7" />
<Stairs id="stairs10" name="Лестница" />
<Path start="near_stairs10_7" rotate="forward" type="left_right_walls">
<Room location="right" id="5708" />
<Room location="left" id="5709" />
<Room location="right" id="5706" />
<Room location="left" id="5707" />
<Room location="right" id="5704" />
<Room location="left" id="5705" />
<Room location="left" id="5703" />
<Room location="right" id="5702" />
<Path start="5708" rotate="right" type="left_right_walls">
<Room location="left" id="5710" />
<Room location="left" id="5712" />
<Room location="right" id="5713" />
<Room location="left" id="5714" />
<Room location="right" id="5719" />
<Room location="left" id="5716" />
<Room location="right" id="5721" />
<Room location="up" id="5718" />
</Path>
<Path start="5709" rotate="left" type="left_right_walls">
<Room location="right" id="5711" />
<Room location="up" id="5713" />
</Path>
<Point id="near_stairs10_7" />
<Stairs id="stairs10" name="Лестница" />
<Path start="near_stairs10_7" rotate="forward" type="left_right_walls">
<Room location="right" id="5708" />
<Room location="left" id="5709" />
<Room location="right" id="5706" />
<Room location="left" id="5707" />
<Room location="right" id="5704" />
<Room location="left" id="5705" />
<Room location="left" id="5703" />
<Room location="right" id="5702" />
<Path start="5708" rotate="right" type="left_right_walls">
<Room location="left" id="5710" />
<Room location="left" id="5712" />
<Room location="right" id="5713" />
<Room location="left" id="5714" />
<Room location="right" id="5719" />
<Room location="left" id="5716" />
<Room location="right" id="5721" />
<Room location="up" id="5718" />
</Path>
<Path start="5709" rotate="left" type="left_right_walls">
<Room location="right" id="5711" />
<Room location="up" id="5713" />
</Path>
</Path>
</Path>
</Floor>
Expand Down
30 changes: 30 additions & 0 deletions VVSU/images/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
96 changes: 52 additions & 44 deletions VVSU/index.html
Original file line number Diff line number Diff line change
@@ -1,62 +1,70 @@
<!DOCTYPE html>
<html>
<html xmlns="http://www.w3.org/1999/html">
<head>
<title>Навигатор ВВГУ</title>
<title>ВВГУ.Ориентир</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
body {
background: url('bg.jpg');
background-size: 100%
}
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />

<link rel="stylesheet" href="nullstyle.css">
<link rel="stylesheet" href="styles.css">

button.new {
background: -moz-linear-gradient(#70d7e7, #7bccd8, #ffffff);
background: -webkit-gradient(linear, 0 0, 0 100%, from(#b8e2e1), to(#b6abdf), color-stop(0.5, #91d5e3));
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FF1493', endColorstr='#EBFFFF');
padding: 3px 7px;
color: #000000;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
border: 1px solid #0e0c0c;
}
</style>
<script type="text/javascript" src="Plan_VVSU.js"></script>
<script type="text/javascript" src="../read_plan.js"></script>
<script type="text/javascript" src="../process_plan.js"></script>
<script type="text/javascript" src="../find_route.js"></script>
<script type="text/javascript" src="show_route.js" defer></script>
</head>

<body>
<center>

<h3>Навигатор ВВГУ</h3>
<form name="frm">
<p>Откуда: <input type="text" size="8" name="from" /></p>
<p>Куда: <input type="text" size="8" name="to" /></p>
<p><button type="button" class="new" onClick="showRoute();">Маршрут</button></p>
</form>
<div class="background"> </div>
<div class="container">
<div class="header">
<div class="header__logo">
<img src="images/logo.svg" alt=""/>
</div>
<div class="header__title">Ориентир</div>
<div class="header__subtitle">Упрощенный навигатор по университету.</div>
</div>
<div class="form">
<form name="frm">
<input type="text" id="from" placeholder="Откуда" class="form__input"/>
<input type="text" id="to" placeholder="Куда" class="form__input"/>
<button type="button" id="button" onclick="showRoute();" class="form__button">Проложить маршрут</button>
</form>
<div id="output" class="output" hidden>
<div class="output__header">
<div class="output__line"></div>
<div class="output__title">Маршрут</div>
<div class="output__item-container">
<div id="out-from" class="output__item">ауд. 4407</div>
->
<div id="out-to" class="output__item">ауд. 4305</div>
</div>
</div>
<div id="output-container"></div>
</div>
<!-- <div id="route-text" hidden>123</div>-->
<div id="error-text" hidden></div>
</div>
</div>
<!-- <center>-->

<p>&nbsp;</p>
<p>Справка:</p>
<p>Введите номера аудиторий</p>
<p>1 - главный вход, 2 - зимний сад</p>
<!-- <h3>ВВГУ.Ориентир</h3>-->
<!-- <form name="frm">-->
<!-- <p>Откуда: <input type="text" size="8" name="from" /></p>-->
<!-- <p>Куда: <input type="text" size="8" name="to" /></p>-->
<!-- <p><button type="button" class="new" onClick="showRoute();">Маршрут</button></p>-->
<!-- </form>-->

<p>&nbsp;</p>
<p id="route_text"></p>
<!-- <p>&nbsp;</p>-->
<!-- <p>Справка:</p>-->
<!-- <p>Введите номера аудиторий</p>-->
<!-- <p>1 - главный вход, 2 - зимний сад</p> -->

</center>
<!-- <p>&nbsp;</p>-->
<!-- <p id="route_text"></p>-->

<script type="text/javascript">
function showRoute()
{
let from_point = frm.from.value;
let to_point = frm.to.value;
let route = findRoute(from_point, to_point);
let route_str = route.join("<br/>");
document.getElementById("route_text").innerHTML = route_str;
}
</script>
<!-- </center>-->
</body>
</html>
38 changes: 38 additions & 0 deletions VVSU/nullstyle.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*Обнуление*/
*{
padding: 0;
margin: 0;
border: 0;
}
*,*:before,*:after{
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
:focus,:active{outline: none;}
a:focus,a:active{outline: none;}

nav,footer,header,aside{display: block;}

html,body{
height: 100%;
width: 100%;
font-size: 100%;
line-height: 1;
font-size: 14px;
-ms-text-size-adjust: 100%;
-moz-text-size-adjust: 100%;
-webkit-text-size-adjust: 100%;
}
input,button,textarea{font-family:inherit;}

input::-ms-clear{display: none;}
button{cursor: pointer;}
button::-moz-focus-inner {padding:0;border:0;}
a, a:visited{text-decoration: none;}
a:hover{text-decoration: none;}
ul li{list-style: none;}
img{vertical-align: top;}

h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight: 400;}
/*--------------------*/
80 changes: 80 additions & 0 deletions VVSU/show_route.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@


let toField = document.getElementById("to");
let fromField = document.getElementById("from");
let button = document.getElementById("button");
//let routeText = document.getElementById("route-text");
let errorText = document.getElementById("error-text");
let outputContainer = document.getElementById("output-container");
let outputBlock = document.getElementById("output");
let outFrom = document.getElementById("out-from");
let outTo = document.getElementById("out-to");
let state = false;

function showRoute()
{
if (!state) {
let from_point = fromField.value;
let to_point = toField.value;

let route = '';
try {
route = findRoute(from_point, to_point);
} catch (e) {
errorText.innerHTML = e.message;
errorText.hidden = false;
return;
}

//let route_str = route.join("<br/>");
let route_str = route.map((val, idx) => {
return `<div class="output__step">${val}</div>`;
}).join(' ');

outputContainer.innerHTML = route_str;
//routeText.hidden = false;
//routeText.innerHTML = route_str;

outFrom.innerHTML = from_point;
outTo.innerHTML = to_point;

toField.hidden = true;
fromField.hidden = true;

errorText.hidden = true;

button.innerHTML = "Проложить новый маршрут";

outputBlock.hidden = false;

// toField.classList.add("collapsed");
// fromField.classList.add("collapsed");

state = true;
} else {
toField.hidden = false;
toField.value = "";

fromField.hidden = false;
fromField.value = "";

//routeText.hidden = true;

button.innerHTML = "Проложить маршрут";

outputBlock.hidden = true;

state = false;
}
}

/*При нажатии ENTER в текстовом поле*/
const clickEvent = function(event) {
if (event.key === "Enter") {
event.preventDefault();
showRoute();
}
}

toField.addEventListener("keypress", clickEvent);
fromField.addEventListener("keypress", clickEvent);
Loading

0 comments on commit 34755fc

Please sign in to comment.