1
-
2
- var geocode = false ;
1
+ var geocode = false ;
3
2
var reactiveApp = Ractive . extend ( {
4
3
oninit : function ( ) {
5
4
6
5
console . log ( 'reactiveApp oninit' ) ;
7
6
procent = 0.23 ;
8
7
if ( location . hash . replace ( '#' , '' ) . split ( '-' ) [ 0 ] && location . hash . replace ( '#' , '' ) . split ( '-' ) [ 0 ] != '' ) {
9
8
ABAB . setPage ( location . hash . replace ( '#' , '' ) . split ( '-' ) [ 0 ] , location . hash . replace ( '#' , '' ) . split ( '-' ) [ 1 ] , true ) ;
10
- procent = 0.30 ;
9
+ if ( location . hash . replace ( '#' , '' ) . split ( '-' ) [ 0 ] !== 'Rooms' ) procent = 0.30 ;
11
10
}
12
11
else
13
12
ABAB . setPage ( 'Rooms' ) ;
@@ -71,8 +70,8 @@ if (localStorage.getItem('auth')) {
71
70
localStorage . removeItem ( 'auth' ) ;
72
71
}
73
72
}
74
- ractiveComponent [ 'rootApp' ] . on ( 'update_filter' , function ( e , id ) {
75
- var formarr = $ ( '#' + id ) . serializeArray ( ) ;
73
+ ractiveComponent [ 'rootApp' ] . on ( 'update_filter' , function ( e , id ) {
74
+ var formarr = $ ( '#' + id ) . serializeArray ( ) ;
76
75
var form_obj = { } ;
77
76
for ( var i in formarr ) {
78
77
if ( form_obj [ formarr [ i ] . name ] && typeof form_obj [ formarr [ i ] . name ] === 'string' ) {
@@ -82,9 +81,9 @@ ractiveComponent['rootApp'].on('update_filter', function (e,id) {
82
81
} else
83
82
form_obj [ formarr [ i ] . name ] = formarr [ i ] . value
84
83
}
85
- form_obj . people_count = { $gte :form_obj . people_count } ;
86
- form_obj . children_count = { $gte :form_obj . children_count } ;
87
- ABAB . event [ 'update_filter' ] ( form_obj , true ) ;
84
+ form_obj . people_count = { $gte : form_obj . people_count } ;
85
+ form_obj . children_count = { $gte : form_obj . children_count } ;
86
+ ABAB . event [ 'update_filter' ] ( form_obj , true ) ;
88
87
} ) ;
89
88
ractiveComponent [ 'rootApp' ] . on ( 'location_input_scan' , function ( ) {
90
89
@@ -225,9 +224,9 @@ $('#location_input_scan').flexdatalist({
225
224
226
225
if ( json && json . city ) {
227
226
228
- if ( json . city === 'Moscow' ) {
227
+ if ( json . city === 'Moscow' ) {
229
228
console . error ( 'One and the same city can have several names' ) ;
230
- json . city = 'Moskva' ;
229
+ json . city = 'Moskva' ;
231
230
}
232
231
find = {
233
232
$or : [ {
@@ -238,16 +237,16 @@ $('#location_input_scan').flexdatalist({
238
237
} , { "address.country" : { '$regex' : json . city , '$options' : 'i' } } ]
239
238
} ;
240
239
}
241
- if ( json && json . city && json . city === 'Russia' ) json . city = 'Москва' ;
240
+ if ( json && json . city && json . city === 'Russia' ) json . city = 'Москва' ;
242
241
geocode . geocode ( { address : ( json . city || '' ) + ',' + ( json . country || '' ) } , function ( results , status ) {
243
242
console . log ( results ) ;
244
- if ( results . length > 0 ) {
243
+ if ( results . length > 0 ) {
245
244
map . setCenter ( { lng : results [ 0 ] . geometry . location . lng ( ) , lat : results [ 0 ] . geometry . location . lat ( ) } ) ;
246
245
map . setZoom ( 8 ) ;
247
- } else {
248
- console . warn ( '[map geocode] address not fount:' , json )
246
+ } else {
247
+ console . warn ( '[map geocode] address not fount:' , json )
249
248
}
250
249
} ) ;
251
- ABAB . event [ 'update_filter' ] ( find , true ) ;
250
+ ABAB . event [ 'update_filter' ] ( find , true ) ;
252
251
253
252
} ) ;
0 commit comments