-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
166 lines (148 loc) · 7.01 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
<!DOCTYPE html>
<html>
<head>
<title>Restaurants</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<!-- Icons and other mobile things -->
<link rel="apple-touch-icon" sizes="57x57" href="assets/icons/apple-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="assets/icons/apple-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="assets/icons/apple-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="assets/icons/apple-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="assets/icons/apple-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="assets/icons/apple-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="assets/icons/apple-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="assets/icons/apple-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="assets/icons/apple-icon-180x180.png">
<link rel="icon" type="image/png" sizes="192x192" href="assets/icons/android-icon-192x192.png">
<link rel="icon" type="image/png" sizes="32x32" href="assets/icons/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="96x96" href="assets/icons/favicon-96x96.png">
<link rel="icon" type="image/png" sizes="16x16" href="assets/icons/favicon-16x16.png">
<link rel="manifest" href="manifest.json">
<meta name="msapplication-TileColor" content="#ffffff">
<meta name="msapplication-TileImage" content="assets/icons/ms-icon-144x144.png">
<meta name="theme-color" content="#ffffff">
<!-- Styles -->
<link href="https://fonts.googleapis.com/css?family=Damion" rel="stylesheet">
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<link href="https://fonts.googleapis.com/css?family=Roboto+Condensed" rel="stylesheet">
<link rel="stylesheet" href="https://code.getmdl.io/1.3.0/material.indigo-pink.min.css">
<link rel="stylesheet" href="assets/styles.css">
</head>
<body>
<!-- Credits -->
<a href="https://www.zomato.com/uk" class="credits" data-bind="css:{'hide': panelVisible()}">Powered By Zomato</a>
<!-- Google map -->
<main id="map-canvas"></main>
<!-- UI panel -->
<aside class="panel" id="panel-left" data-bind="css:{'hide': !panelVisible()}">
<!-- Logo and mobile nav-bar -->
<nav class="title">
<i class="material-icons">restaurant</i> Restaurants
<button class="nav-icon" data-bind='click: tooglePanel, css: {x : panelVisible() }'>
<span class="navLines"></span>
</button>
</nav>
<!-- Search bar -->
<section class="panel-search">
<input id="location-search" type="text" placeholder="Enter a location" data-bind="value: location.address">
<span id="center-map" data-bind="click: reCenterMap, css: {active: !location.centered()}" title="Center the map">
<i class="material-icons md-24">location_on</i>
</span>
<div class="filter open" title="Filter Cuisines" data-bind="visible: cuisines().length, css:{'open': filterVisible()}">
<div class="filter-title">
<button class="filter-clear-all" data-bind="click: filterSelectToggleAll, visible: filterAllSelected()">
Clear All
</button>
<button class="filter-select-all" data-bind="click: filterSelectToggleAll, visible: !filterAllSelected()">
Select All
</button>
<button class="filter-open" data-bind="click: toogleFilter">
<i class="material-icons md-36" data-badge="1">tune</i>
</button>
</div>
<div class="filter-items" data-bind="foreach: cuisines">
<div class="filter-item" data-bind="click: $parent.filterSelectToggle">
<div class="toggle">
<input type="checkbox" id="toggle2" data-bind="attr: { id: 'tf' + $index(), checked: selected }"/>
<label data-bind="attr: { for: 'tf' + $index() }"></label>
</div>
<span class="filter-name" data-bind="text: name"></span>
<span class="filter-count" data-bind="text: resturants"></span>
</div>
</div>
</div>
</section>
<!-- Loading bar -->
<section data-bind="visible: status().loading" class="mdl-progress mdl-js-progress mdl-progress__indeterminate mdl-progress-pink"></section>
<!-- Status panel only visible when we have status message -->
<section class="panel-status" data-bind="visible: status().text != ''">
<i class="material-icons md-48" data-bind="text: status().icon"></i>
<p data-bind="text: status().text"></p>
</section>
<!-- List of resturants -->
<section class="panel-items" data-bind="foreach: restaurants">
<article class="panel-item" data-bind="click: $parent.openMarkerInfo, attr: { id: 'restaurant_' + restaurant.id }, css: {active: $parent.curentRestaurant() && $parent.curentRestaurant().id == restaurant.id }, visible: visible">
<div class="panel-item-image" data-bind="style: {'backgroundImage': 'url('+ restaurant.thumb +')'}"></div>
<div class="panel-item-content">
<header>
<h4 class="item-title" data-bind="text: restaurant.name"></h4>
</header>
<p class="item-desciption" data-bind="text: restaurant.cuisines"></p>
<div class="item-rating">
<span class="ratings" data-bind="css: restaurant.user_rating.rating_class"></span>
<small>
<span data-bind="text: restaurant.user_rating.aggregate_rating"></span> /
<span data-bind="text: restaurant.user_rating.votes"></span>
</small>
</div>
<div class="item-location">
<small>
<span data-bind="text: restaurant.location.address"></span>
</small>
</div>
</div>
</article>
</section>
</aside>
<!-- Scripts -->
<script defer src="https://code.getmdl.io/1.3.0/material.min.js"></script>
<script defer src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script defer src="https://cdnjs.cloudflare.com/ajax/libs/knockout/3.4.1/knockout-debug.js"></script>
<script defer src="assets/app.js"></script>
<script>
// Register service worker
if('serviceWorker' in navigator) {
navigator.serviceWorker.register('service-worker.js', { scope: '/neighborhood-map/' })
.then(function(registration) {
console.log('Service Worker Registered');
});
navigator.serviceWorker.ready.then(function(registration) {
console.log('Service Worker Ready');
});
}
// Load Google maps asycnronesly when ready start the ko app
window.onload = function() {
$.getScript("https://maps.googleapis.com/maps/api/js?"+
atob('a2V5PUFJemFTeUNVdGpzejVFVktTSEJ3OHJKTUZCZUFTQXlaUUtPa0dBNA==')+"&libraries=places,geometry")
.done(function(script, textStatus){
if(textStatus == 'success'){
ko.applyBindings(new NeighborhoodMapViewModel());
return;
} ErrorLoading();
})
.fail(function(jqxhr, settings, exception){
ErrorLoading();
});
}
// Handle error while loading.
function ErrorLoading(message){
var canvas = document.getElementById("map-canvas");
message = message || 'Oops! We had problem loading, please reload the page.';
canvas.className = 'error';
canvas.innerHTML = '<i class="material-icons">warning</i> \
<p>'+message+'</p>';
}
</script>
</body>
</html>