-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathranking.html
219 lines (180 loc) · 7.92 KB
/
ranking.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
<!-- FindMyBorough V1. Frontend Coded by Alex Choi-->
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="generator" content="Hugo 0.84.0">
<title>FindMyBorough! - Rank your preferences</title>
<link rel="canonical" href="https://getbootstrap.com/docs/5.0/examples/navbar-fixed/">
<!-- Favicon -->
<link rel="icon" type="image/x-icon" href="img/icon.ico">
<!-- Bootstrap core CSS -->
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>
<!-- Custom styles for this template -->
<link href="style.css" rel="stylesheet">
<!-- Sortable Javascript -->
<script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/sortablejs@latest/Sortable.min.js"></script>
<!-- PyScript -->
<link rel="stylesheet" href="https://pyscript.net/latest/pyscript.css" />
<script defer src="https://pyscript.net/latest/pyscript.js"></script>
</head>
<body>
<body>
<nav class="navbar navbar-expand-md navbar-light fixed-top" id="navbar">
<div class="container-fluid">
<a class="navbar-brand" href="index.html"><img class="logo-main" src="img/logo.png" /></a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarCollapse" aria-controls="navbarCollapse" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse justify-content-end" id="navbarCollapse">
<ul class="navbar-nav justify-content-end">
<li class="nav-item">
<a class="nav-link active" aria-current="page" href="index.html"><img class="nav-icon" src="img/home.png" /></a>
</li>
<li class="nav-item">
<a class="nav-link" href="budget.html"><img class="nav-icon" src="img/search.png" /></a>
</li>
<li class="nav-item">
<a class="nav-link" href="community.html" tabindex="-1" aria-disabled="true"><img class="nav-icon" src="img/community.png" /></a>
</li>
</ul>
</div>
</div>
</nav>
<center>
<main>
<div class="position-relative overflow-hidden text-center banner-sub">
<div class="col-md-5 mx-auto my-5">
<h1 class="display-16 fw-normal">Rank your preferences</h1>
</div>
<div class="product-device shadow-sm d-none d-md-block"></div>
<div class="product-device product-device-2 shadow-sm d-none d-md-block"></div>
</div>
<div class="position-relative overflow-hidden p-3 p-md-5 text-center bg-light" id="jumbotron-inputs-2">
<div class="col-md-5 p-lg-5 mx-auto my-5">
<!-- INPUT GOES HERE -->
<ul id="sortable-list-mob" class="list-group unstyled">
<li id="1" class="ui-state-default">Crime Rate</li>
<li id="2" class="ui-state-default">Green Spaces</li>
<li id="3" class="ui-state-default">Restaurants</li>
<li id="4" class="ui-state-default">Schools</li>
<li id="5" class="ui-state-default">Transport Links</li>
</ul>
<!-- OLD SORTABLEå
<ul id="sortable1" class="connectedSortable">
<li id="1" class="ui-state-default">Crime Rate</li>
<li id="2" class="ui-state-default">Green Spaces</li>
<li id="3" class="ui-state-default">Restaurants</li>
<li id="4" class="ui-state-default">Schools</li>
<li id="5" class="ui-state-default">Transport Links</li>
</ul>
END OLD SORTABLE -->
<br>
<!-- Next button -->
<button type="button" class="btn next-button" onclick="saveRanking()">FindMyBorough!</button>
<!-- Next button end -->
<!-- END INPUT -->
</div>
<div class="product-device shadow-sm d-none d-md-block"></div>
<div class="product-device product-device-2 shadow-sm d-none d-md-block"></div>
</div>
</main>
</center>
<footer class="container py-5">
<div class="row">
<div class="col-12 col-md">
<img src="img/logo.png" class="footer-logo"/>
<small class="d-block mb-3 text-muted">© 2022</small>
</div>
<div class="col-6 col-md">
<h5>Info</h5>
<ul class="list-unstyled text-small">
<li><a class="link-secondary" href="#">Find your borough</a></li>
<li><a class="link-secondary" href="#">Advertise with us</a></li>
<li><a class="link-secondary" href="#">Team</a></li>
</ul>
</div>
<div class="col-6 col-md">
<h5>Resources</h5>
<ul class="list-unstyled text-small">
<li><a class="link-secondary" href="attributions.html">Attributions</a></li>
</ul>
</div>
</div>
</footer>
<script src="../assets/dist/js/bootstrap.bundle.min.js"></script>
<!-- JQuery -->
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script>
$( function() {
$( "#sortable" ).sortable();
$( "#sortable" ).disableSelection();
} );
</script>
<script>
$( function() {
$( "#sortable1, #sortable2" ).sortable({
connectWith: ".connectedSortable"
}).disableSelection();
} );
</script>
<!-- Import the budget locally from the browser -->
<script>
// get the budget from the browser storage
let budget = sessionStorage.getItem("budget");
document.getElementById('budget').innerHTML = budget;
console.log(budget);
// get the bedrooms from the browser storage
let bedrooms = sessionStorage.getItem("bedrooms");
document.getElementById('bedrooms').innerHTML = bedrooms;
console.log(bedrooms);
</script>
<script>
// if the budget cannot be found locally in the browser then the user will be redirected to the budget page
if(budget == null){
alert('You did not set a budget yet, you must do that first! You will now be redirected to the budget page where you can set a budget.');
window.location.href = "budget.html";
}
// if a negative budget is entered, redirect
if(budget < 0){
alert('You can\'t have a negative budget, please enter a budget greater than 0');
window.location.href = "budget.html";
}
// if the budget is not numeric then redirect back to the budget page
if(typeof budget != numeric) {
alert('Your entered budget is not numeric, please enter your budget again!');
window.location.href = "budget.html";
}
</script>
<!-- Convert the ranked factors into a Javascript Array -->
<script>
function saveRanking() {
let sortable1 = document.querySelectorAll("#sortable-list-mob li"),ranking = [];
sortable1.forEach((e)=> ranking.push(e.id))
console.log(ranking)
sessionStorage.setItem("ranking", ranking);
window.location.href = 'processing.html';
}
</script>
<script>
new Sortable(document.getElementById('sortable-list-mob'), {
animation: 150,
ghostClass: 'background-class'
});
$('#get-order').click(function(){
const items = document.querySelectorAll('li');
const inTexts = [];
for(var i = 0;i<items.length;i++){
inTexts.push($(items[i]).text());
}
alert(inTexts);
})
</script>
</script>
</body>
</html>