-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
183 lines (147 loc) · 5.35 KB
/
index.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
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width" />
<title> Abevents </title>
<link rel="stylesheet" href="mainstyle.css"/>
<script src="https://code.jquery.com/jquery-1.11.2.min.js"></script>
</head>
<body class="body">
<!-- Seperate body into frame which is black border around elements(form_frame), form elements that have to be centered(form_elements) and logo/header -->
<div align="center">
<img class ="logo">
<div class="form_frame">
<div class="form_elements">
<h1> For Everything Aberdeen </h1>
<!-- All choices that will sort the event out on result page -->
<!-- Date Choices -->
<div>
<input id="radio-1" class="radio-custom" name="radio-group" type="radio" checked>
<label for="radio-1" class="radio-custom-label">Today</label>
</div>
<div>
<input id="radio-2" class="radio-custom"name="radio-group" type="radio">
<label for="radio-2" class="radio-custom-label">Tomorrow</label>
</div>
<div>
<input id="radio-3" class="radio-custom" name="radio-group" type="radio">
<label for="radio-3" class="radio-custom-label">Weekend</label>
</div>
<div>
<input id="radio-4" class="radio-custom" name="radio-group" type="radio">
<label for="radio-4" class="radio-custom-label">Weeknights</label>
</div>
<!-- Genre Choices -->
<div class="CustomCombo">
<p onclick="toggleOpen(this)"> Choose Genre... </p>
<ul class="dropdown-menu">
<li onclick="selectOption(this)"> Nightclubs </li>
<li onclick="selectOption(this)"> Gigs </li>
<li onclick="selectOption(this)"> Comedy </li>
<li onclick="selectOption(this)"> Theatre </li>
<li onclick="selectOption(this)"> Festivals </li>
</ul>
</div>
<!-- Keywords -->
<input id="keywords" class="search_box" value="Enter keywords..." />
<script src='https://use.edgefonts.net/amaranth.js'></script>
<a onclick="Search()" class="searchButton"> > </a>
</div>
</div>
</div>
<script>
/*
Function passing search query to results page
*/
function Search() {
var search_params = "";
var keywords = $('input[id="keywords"]').val();
if(keywords != "Enter keywords..." && keywords != "") {
search_params += "&Keywords=" + keywords;
}
window.location.href = "results.html?" + search_params;
};
/*
Declaring array of background images
*/
var images = ["images/backgrounds/1.jpg", "images/backgrounds/2.jpg" ,
"images/backgrounds/3.jpg", "images/backgrounds/4.jpg" ,
"images/backgrounds/5.jpg", "images/backgrounds/6.jpg" ,
"images/backgrounds/7.jpg", "images/backgrounds/8.jpg" ,
"images/backgrounds/9.jpg", "images/backgrounds/10.jpg" ,
"images/backgrounds/11.jpg", "images/backgrounds/12.jpg" ,
"images/backgrounds/13.jpg", "images/backgrounds/14.jpg" ,
"images/backgrounds/15.jpg", "images/backgrounds/16.jpg"];
/*
Setting the background to random one from the array above
*/
$('html').css({'background-image': 'url(' + images[Math.floor(Math.random() * images.length)] + ")"});
/*
Close custom combo box if user presses on the page instead of one of the choices.
*/
$(document).ready(function () {
$(".body").click(function(){
closeAll();
});
$(".CustomCombo").click(function(event){
event.stopPropagation();
});
});
/*
For keeping/clearing searchbox on focus and loosing focus
*/
var field = document.getElementById('keywords');
field.addEventListener("keydown", function(e) {
if (e.keyCode === 13) {
Search();
}
});
field.onfocus = function(){
if(this.value == "Enter keywords..."){
this.value="";
}else{
this.value=this.value;
}
}
field.onblur = function(){
if(this.value == ""){
this.value="Enter keywords...";
}else{
this.value=this.value;
}
}
/*
Open custom combo box function
*/
function toggleOpen(box)
{
console.log("Toggle");
if(box.parentElement.className === "CustomCombo") {
box.parentElement.className = "CustomComboOpen";
}
else {
box.parentElement.className = "CustomCombo";
}
}
/*
Close custom combo box function
*/
function closeAll()
{
boxes = document.getElementsByClassName("CustomComboOpen");
for(var i = 0; i < boxes.length; i ++) {
boxes[i].className = "CustomCombo";
}
}
/*
Select one of the options from custom combo box
*/
function selectOption(option)
{
console.log("Select");
option.parentElement.parentElement.firstElementChild.innerHTML = option.innerHTML;
toggleOpen(option.parentElement);
}
</script>
</body>
</html>