forked from dhruval161/Where_should_you_live
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
594 lines (517 loc) · 25.2 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
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
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
<!DOCTYPE html>
<html lang="zxx">
<head>
<title>Dream Home</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta charset="UTF-8">
<!-- External CSS libraries -->
<link type="text/css" rel="stylesheet" href="assets/css/bootstrap.min.css">
<link type="text/css" rel="stylesheet" href="assets/css/magnific-popup.css">
<link type="text/css" rel="stylesheet" href="assets/css/jquery.selectBox.css">
<link type="text/css" rel="stylesheet" href="assets/css/dropzone.css">
<link type="text/css" rel="stylesheet" href="assets/css/rangeslider.css">
<link type="text/css" rel="stylesheet" href="assets/css/animate.min.css">
<link type="text/css" rel="stylesheet" href="assets/css/leaflet.css">
<link type="text/css" rel="stylesheet" href="assets/css/slick.css">
<link type="text/css" rel="stylesheet" href="assets/css/slick-theme.css">
<link type="text/css" rel="stylesheet" href="assets/css/map.css">
<link type="text/css" rel="stylesheet" href="assets/css/jquery.mCustomScrollbar.css">
<link type="text/css" rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.min.css">
<link type="text/css" rel="stylesheet" href="assets/fonts/flaticon/font/flaticon.css">
<!-- Favicon icon -->
<link rel="shortcut icon" href="assets/img/favicon.ico" type="image/x-icon" >
<!-- Custom Stylesheet -->
<link type="text/css" rel="stylesheet" href="assets/css/style.css">
<link rel="stylesheet" type="text/css" id="style_sheet" href="assets/css/skins/default.css">
</head>
<body id="top">
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-PDTWJ3Z"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->
<div class="page_loader"></div>
<!-- main header start -->
<header class="main-header sticky-header" id="main-header-2">
<div class="container">
<div class="row">
<div class="col-12">
<nav class="navbar navbar-expand-lg navbar-light rounded">
<a class="navbar-brand logo navbar-brand d-flex w-50 mr-auto" href="index.html">
<img src="assets/img/logos/black-logo.png" alt="logo">
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation">
<span class="fa fa-bars"></span>
</button>
<div class="navbar-collapse collapse w-100" id="navbar">
<ul class="navbar-nav ml-auto">
<li class="nav-item dropdown active">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Properties
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
<li><a class="dropdown-item" href="properties-list-rightside.html">List view</a></li>
<li><a class="dropdown-item" href="coming-soon.html">Map view</a></li>
<li><a class="dropdown-item" href="properties-comparison.html">Compare</a></li>
</ul>
</li>
<li class="nav-item dropdown">
<a class="nav-link" href="blog-columns-3col.html" id="navbarDropdownMenuLink5" aria-haspopup="true" aria-expanded="false">
News
</a>
</li>
<li class="nav-item dropdown megamenu-li">
<a class="nav-link " href="faq-1.html" id="dropdown01" aria-haspopup="true" aria-expanded="false">FAQ</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link " href="about-2.html" id="navbarDropdown3" role="button" aria-haspopup="true" aria-expanded="false">
About
</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link " href="contact-2.html" id="navbarDropdown3" role="button" aria-haspopup="true" aria-expanded="false">
Contact
</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link" href="login.html" id="logincheck" role="button" aria-haspopup="true" aria-expanded="false">
Log in
</a>
</li>
<li class="nav-item dropdown">
<a class="open-offcanvas nav-link" href="#">
<span></span>
<span class="fa fa-bars"></span>
</a>
</li>
</ul>
</div>
</nav>
</div>
</div>
</div>
</header>
<!-- main header end -->
<!-- Banner start -->
<div class="banner" id="banner">
<div id="carouselExampleIndicators" class="carousel slide" data-ride="carousel">
<div class="carousel-inner">
<div class="carousel-item active">
<img class="d-block w-100" src="assets/img/banner-1.jpg" alt="banner">
<div class="carousel-caption banner-slider-inner d-flex h-100 text-center">
<div class="carousel-content container">
<div class="t-center">
<h1 data-animation="animated fadeInDown delay-05s">Find your Dream Properties</h1>
<p data-animation="animated fadeInUp delay-10s">
We provide you with the best options in real estate.
</p>
<a data-animation="animated fadeInUp delay-10s" href="properties-list-rightside.html" class="btn btn-lg btn-round btn-theme">See Properties</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- banner end -->
<!-- services start -->
<div class="services content-area-20 bg-white">
<div class="container">
<div class="main-title">
<h1>What We Provide</h1>
<p>Dream Home provides you with</p>
</div>
<div class="row">
<div class="col-lg-3 col-md-6 col-sm-6 services-info-3 s-brd-2 wow fadeInLeft delay-04s">
<i class="flaticon-hotel-building"></i>
<h5>Rentals</h5>
<p>Properties listed for Rent</p>
</div>
<div class="col-lg-3 col-md-6 col-sm-6 services-info-3 s-brd-1 wow fadeInUp delay-04s">
<i class="flaticon-house"></i>
<h5>Properties On Sale</h5>
<p>A wide range of properties to choose from</p>
</div>
<div class="col-lg-3 col-md-6 col-sm-6 services-info-3 s-brd-3 wow fadeInDown delay-04s">
<i class="flaticon-call-center-agent"></i>
<h5>Support 24/7</h5>
<p>Get in touch with customer service for any need that you have at any time</p>
</div>
<div class="col-lg-3 col-md-6 col-sm-6 services-info-3 wow fadeInRight delay-04s">
<i class="flaticon-office-block"></i>
<h5>House agents</h5>
<p>Professional Agents to guide you towards selecting your dream property</p>
</div>
</div>
</div>
</div>
<!-- services end -->
<!-- Recent Properties start -->
<div class="recent-properties content-area-2">
<div class="container">
<div class="main-title">
<h1>Properties You May Like</h1>
<p>Our smart technology provides what you may like</p>
</div>
<div class="row">
<div class="col-lg-3 col-md-6 col-sm-6 wow fadeInLeft delay-04s">
<div class="property-box-8">
<div class="property-photo">
<img id="img1" src="assets/img/property-3.jpg" alt="property-6" class="img-fluid">
<!--<div class="date-box">For Sale</div>-->
</div>
<div class="detail">
<div class="heading">
<h3>
<a href="#" id="recname1"></a>
</h3>
<div class="location">
<a href="properties-details.html">
<i class="flaticon-facebook-placeholder-for-locate-places-on-maps"></i><h7 id="recloc1">123 Kathal St. Tampa City,</h7>
</a>
</div>
</div>
<div class="properties-listing">
<span id="recbed1">3 Beds</span>
<span id="recbath1">2 Baths</span>
<span id="recarea1">980 sqft</span>
</div>
</div>
</div>
</div>
<div class="col-lg-3 col-md-6 col-sm-6 wow fadeInUp delay-04s">
<div class="property-box-8">
<div class="property-photo">
<img id="img2" src="assets/img/property-6.jpg" alt="property-6" class="img-fluid">
<!--<div class="date-box">For Sale</div>-->
</div>
<div class="detail">
<div class="heading">
<h3>
<a href="#" id="recname2"></a>
</h3>
<div class="location">
<a href="properties-details.html">
<i class="flaticon-facebook-placeholder-for-locate-places-on-maps"></i><h7 id="recloc2">123 Kathal St. Tampa City,</h7>
</a>
</div>
</div>
<div class="properties-listing">
<span id="recbed2">3 Beds</span>
<span id="recbath2">2 Baths</span>
<span id="recarea2">980 sqft</span>
</div>
</div>
</div>
</div>
<div class="col-lg-3 col-md-6 col-sm-6 wow fadeInUp delay-04s">
<div class="property-box-8">
<div class="property-photo">
<img id="img3" src="assets/img/property-2.jpg" alt="property-2" class="img-fluid">
<!--<div class="date-box">For Sale</div>-->
</div>
<div class="detail">
<div class="heading">
<h3>
<a href="#" id="recname3"></a>
</h3>
<div class="location">
<a href="properties-details.html">
<i class="flaticon-facebook-placeholder-for-locate-places-on-maps"></i><h7 id="recloc3">123 Kathal St. Tampa City,</h7>
</a>
</div>
</div>
<div class="properties-listing">
<span id="recbed3">3 Beds</span>
<span id="recbath3">2 Baths</span>
<span id="recarea3">980 sqft</span>
</div>
</div>
</div>
</div>
<div class="col-lg-3 col-md-6 col-sm-6 wow fadeInRight delay-04s">
<div class="property-box-8">
<div class="property-photo">
<img id="img4" src="assets/img/property-1.jpg" alt="property-6" class="img-fluid">
<!--<div class="date-box">For Sale</div>-->
</div>
<div class="detail">
<div class="heading">
<h3>
<a href="#" id="recname4"></a>
</h3>
<div class="location">
<a href="properties-details.html">
<i class="flaticon-facebook-placeholder-for-locate-places-on-maps"></i><h7 id="recloc4">123 Kathal St. Tampa City,</h7>
</a>
</div>
</div>
<div class="properties-listing">
<span id="recbed4">3 Beds</span>
<span id="recbath4">2 Baths</span>
<span id="recarea4">980 sqft</span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Recent Properties end -->
<!-- intro section start -->
<div class="intro-section">
<div class="container">
<div class="row">
<div class="col-lg-2 col-md-2 col-sm-12">
</div>
<div class="col-lg-7 col-md-7 col-sm-12">
<div class="intro-text">
<h3>Looking To Sell Or Rent Your Property?</h3>
</div>
</div>
<div class="col-lg-3 col-md-3 col-sm-12">
<a href="submit-property.html" id="submitnow" class="btn btn-md sn">Submit Now</a>
</div>
</div>
</div>
</div>
<!-- intro section end -->
<!-- Footer start -->
<footer class="footer">
<div class="container footer-inner">
<div class="row">
<div class="col-xl-3 col-lg-3 col-md-6 col-sm-6">
</div>
<div class="col-xl-2 col-lg-2 col-md-6 col-sm-6">
<div class="footer-item">
<h4>
Useful Links
</h4>
<ul class="links">
<li>
<a href="about-2.html"><i class="fa fa-angle-right"></i>About us</a>
</li>
<li>
<a href="properties-list-rightside.html"><i class="fa fa-angle-right"></i>Properties Listing</a>
</li>
<li>
<a href="contact-2.html"><i class="fa fa-angle-right"></i>Contact Us</a>
</li>
<li>
<a href="blog-columns-3col.html"><i class="fa fa-angle-right"></i>News</a>
</li>
</ul>
</div>
</div>
<div class="col-xl-4 col-lg-4 col-md-6 col-sm-6">
<div class="footer-item">
<h4>Contact Us</h4>
<ul class="contact-info">
<li>
Address: DA-IICT, Near Reliance Chowkdi, Gandhinagar, Gujarat 382007
</li>
<li>
Email: <a href="mailto:[email protected]">[email protected]</a>
</li>
<li>
Phone: <a href="tel:+917874788021">+91 78747 88021</a>
</li>
</ul>
<ul class="social-list clearfix">
<li><a href="#" class="facebook"><i class="fa fa-facebook"></i></a></li>
<li><a href="#" class="twitter"><i class="fa fa-twitter"></i></a></li>
<li><a href="#" class="google"><i class="fa fa-google-plus"></i></a></li>
<li><a href="#" class="rss"><i class="fa fa-rss"></i></a></li>
<li><a href="#" class="linkedin"><i class="fa fa-linkedin"></i></a></li>
</ul>
</div>
</div>
</div>
</footer>
<!-- Footer end -->
<!-- Off-canvas sidebar -->
<div class="off-canvas-sidebar">
<div class="off-canvas-sidebar-wrapper">
<div class="off-canvas-header">
<a class="close-offcanvas" href="#"><span class="fa fa-times"></span></a>
</div>
<div class="off-canvas-content">
<aside class="canvas-widget">
<div class="logo-sitebar text-center">
<img src="assets/img/logos/logo.png" alt="logo">
</div>
</aside>
<aside class="canvas-widget">
<ul class="menu">
<li class="menu-item menu-item-has-children"><a href="index.html">Home</a></li>
<li class="menu-item"><a href="properties-list-rightside.html">Properties List</a></li>
<li class="menu-item"><a href="blog-columns-3col.html">Blog</a></li>
<li class="menu-item"><a href="about-2.html">About Us</a></li>
<li class="menu-item"><a href="contact-2.html">Contact Us</a></li>
</ul>
</aside>
<aside class="canvas-widget">
<ul class="social-icons">
<li><a href="#"><i class="fa fa-facebook"></i></a></li>
<li><a href="#"><i class="fa fa-twitter"></i></a></li>
<li><a href="#"><i class="fa fa-google-plus"></i></a></li>
<li><a href="#"><i class="fa fa-linkedin"></i></a></li>
<li><a href="#"><i class="fa fa-vk"></i></a></li>
</ul>
</aside>
</div>
</div>
</div>
<!-- External JS libraries -->
<script src="assets/js/jquery-2.2.0.min.js"></script>
<script src="assets/js/popper.min.js"></script>
<script src="assets/js/bootstrap.min.js"></script>
<script src="assets/js/jquery.selectBox.js"></script>
<script src="assets/js/rangeslider.js"></script>
<script src="assets/js/jquery.magnific-popup.min.js"></script>
<script src="assets/js/jquery.filterizr.js"></script>
<script src="assets/js/wow.min.js"></script>
<script src="assets/js/backstretch.js"></script>
<script src="assets/js/jquery.countdown.js"></script>
<script src="assets/js/jquery.scrollUp.js"></script>
<script src="assets/js/particles.min.js"></script>
<script src="assets/js/typed.min.js"></script>
<script src="assets/js/dropzone.js"></script>
<script src="assets/js/jquery.mb.YTPlayer.js"></script>
<script src="assets/js/leaflet.js"></script>
<script src="assets/js/leaflet-providers.js"></script>
<script src="assets/js/leaflet.markercluster.js"></script>
<script src="assets/js/slick.min.js"></script>
<script src="assets/js/maps.js"></script>
<script src="assets/js/jquery.mCustomScrollbar.concat.min.js"></script>
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyB0N5pbJN10Y1oYFRd0MJ_v2g8W2QT74JE"></script>
<script src="assets/js/ie-emulation-modes-warning.js"></script>
<script src="https://www.gstatic.com/firebasejs/5.9.2/firebase.js"></script>
<script src="assets/js/initilize.js"></script>
<script src="assets/js/userdetails.js"></script>
<!-- Custom JS Script -->
<script src="assets/js/app.js"></script>
<script>
$('document').ready(function(){
let arr = [];
let num_child;
var cosine_sim = 0;
let indexes = [];
console.log("from user properties");
if(loggedin())
{
console.log(getuserdetails());
$("#logincheck").attr('href',"user-profile.html");
$("#logincheck").text("Profile");
// read user properties
console.log("users/" + getuserdetails() + "/property/");
var userdet = firebase.database().ref("users/" + getuserdetails() + "/favorites/");
let iterator = 1;
user_houses = [];
userdet.on("value", function(data) {
console.log(data.numChildren());
if(data.numChildren()==0){show_random_properties();}
let val = data.val();
for(x in val)
{
indexes.push(val[x]);
console.log(data.numChildren());
let propdet = firebase.database().ref("properties/" + val[x] )
propdet.on("value", function(propdata) {
console.log(propdata.val().name);
//console.log(iterator);
arr.push(propdata.val())
if(iterator==data.numChildren())
{
addmyprop(arr,data.numChildren(),indexes);
return;}
iterator+=1;
});
}
});
}
else
{
console.log("Not logged in");
$("#submitnow").attr('href',"login.html");
show_random_properties();
}
});
</script>
<script>
function find_similar_houses(arr,n_child,indexes)
{
console.log(arr);
console.log(n_child);
console.log(indexes);
var best_prop=null,best_prop_index=null;
var long1,lat1,long2,lat2,long3,lat3;
var i;
var index;
//console.log(iterator);
var propdet = firebase.database().ref("properties/");
propdet.on("value", function(data) {
for(i=0;i<4;i++)
{
console.log(i);
max = -1;
let val = data.val();
for(x in val)
{
//console.log(x);
//console.log(property);
cosine_sim = 0;
for(prop in arr)
{
// if no properties of the user
if(arr[prop]==null)
{return;}
//console.log(val[x].age);
//console.log(!indexes.includes(x));
//console.log(!indexes.includes(x));
if(!indexes.includes(x))
{
//console.log(x);
if(arr[prop].city==val[x].city){cosine_sim+=1;}
cosine_sim+=(1/(1 + Math.abs(arr[prop].age-val[x].age)));
cosine_sim+=(1/(1 + Math.abs(arr[prop].area-val[x].area)));
cosine_sim+=(1 - (Math.abs(arr[prop].bedroom-val[x].bedroom))/(7-1));
cosine_sim+=(1 - (Math.abs(arr[prop].bathroom-val[x].bathroom))/(7-1));
cosine_sim+=(1/(1 + Math.abs(arr[prop].latitude-val[x].latitude)));
cosine_sim+=(1/(1 + Math.abs(arr[prop].longitude-val[x].longitude)));
cosine_sim+=(1/(1 + Math.abs(arr[prop].price-val[x].price)));
cosine_sim = cosine_sim/7;
//console.log(cosine_sim/7);
}
}
cosine_sim = cosine_sim/n_child;
if(cosine_sim<1 && cosine_sim>max && isNaN(cosine_sim)==false && ((val[x].longitude!=long1) && (val[x].latitude!=lat1)) && ((val[x].longitude!=long2) && (val[x].latitude!=lat2)) && ((val[x].longitude!=long3) && (val[x].latitude!=lat3)))
{
max = cosine_sim;
best_prop = val[x];
best_prop_index = x;
}
}
if(best_prop!=null)
{
if(i==0)
{lat1 = best_prop.latitude;long1 = best_prop.longitude;}
if(i==1)
{lat2 = best_prop.latitude;long2 = best_prop.longitude;}
if(i==2)
{lat3 = best_prop.latitude;long3 = best_prop.longitude;}
document.getElementById("recname" + (i+1).toString()).innerText = best_prop.name;
document.getElementById("recloc" + (i+1).toString()).innerText = best_prop.address;
document.getElementById("recbed" + (i+1).toString()).innerText = best_prop.bedroom + " Beds";
document.getElementById("recbath" + (i+1).toString()).innerText = best_prop.bathroom + " Baths";
document.getElementById("recarea" + (i+1).toString()).innerText = best_prop.area;
document.getElementById("img" + (i+1).toString()).src = "https://firebasestorage.googleapis.com/v0/b/where-should-you-live.appspot.com/o/images%2F"+ best_prop_index +"?alt=media&token=3e4b4997-6a52-4106-bc9e-34b0cd025e04";
document.getElementById("recname" + (i+1).toString()).href = "properties-details.html?id=" + best_prop_index;
console.log(max);
console.log(i);
}
}
});
}
</script>
</body>
</html>