Skip to content

Commit 1491a9b

Browse files
fix load page
1 parent a0c085f commit 1491a9b

File tree

5 files changed

+25
-19
lines changed

5 files changed

+25
-19
lines changed

web/index.html

+1
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ <h2 style=" line-height: 0.7;">Abab.io
110110
width: 100%;">
111111

112112
</div>
113+
113114
</body>
114115

115116
</html>

web/src/js/ABAB.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -237,9 +237,11 @@ function updatePlugins() {
237237
});
238238
}
239239
function initMap() {
240+
console.log('[google maps] init;');
240241
ABAB.map.fn(true);
241242
ABAB.map.init=true;
242243

244+
243245
}
244246
var ABAB = {
245247
map:{
@@ -252,7 +254,9 @@ var ABAB = {
252254
fn();
253255
}
254256
},
255-
fn:function(){}
257+
fn:function(){
258+
for(var i_f in ABAB.map.cb_function_arr) ABAB.map.cb_function_arr[i_f]();
259+
}
256260
},
257261
event: {},
258262
page: null,
@@ -279,7 +283,8 @@ var ABAB = {
279283
ABAB.pageObj.page = page;
280284
ABAB.pageObj.tab_page = tabPage;
281285
ractiveComponent.rootApp.set('pageActive', 'contentApplication');
282-
if ('Rooms' == page) {
286+
console.log('Start page:',page);
287+
if ('Rooms' === page) {
283288
if (!tabPage) tabPage = 'all';
284289
requireElement({name: 'Rooms', ver: '1.1.0', element: '#content_block'}, {
285290
cnt: 0,

web/src/views/App/App.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -547,8 +547,8 @@
547547

548548
</main>
549549

550-
<script async defer src="https://maps.googleapis.com/maps/api/js?key=AIzaSyBdhvXM0GiPDf6_-KdeHZmxrtbR4hG8bIc&callback=initMap"/>
551550
<script src="https://developers.google.com/maps/documentation/javascript/examples/markerclusterer/markerclusterer.js"/>
551+
<script async defer src="https://maps.googleapis.com/maps/api/js?key=AIzaSyBdhvXM0GiPDf6_-KdeHZmxrtbR4hG8bIc&callback=initMap"/>
552552

553553

554554

web/src/views/App/App.js

+14-15
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1-
2-
var geocode =false;
1+
var geocode = false;
32
var reactiveApp = Ractive.extend({
43
oninit: function () {
54

65
console.log('reactiveApp oninit');
76
procent = 0.23;
87
if (location.hash.replace('#', '').split('-')[0] && location.hash.replace('#', '').split('-')[0] != '') {
98
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;
1110
}
1211
else
1312
ABAB.setPage('Rooms');
@@ -71,8 +70,8 @@ if (localStorage.getItem('auth')) {
7170
localStorage.removeItem('auth');
7271
}
7372
}
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();
7675
var form_obj = {};
7776
for (var i in formarr) {
7877
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) {
8281
} else
8382
form_obj[formarr[i].name] = formarr[i].value
8483
}
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);
8887
});
8988
ractiveComponent['rootApp'].on('location_input_scan', function () {
9089

@@ -225,9 +224,9 @@ $('#location_input_scan').flexdatalist({
225224

226225
if (json && json.city) {
227226

228-
if(json.city === 'Moscow'){
227+
if (json.city === 'Moscow') {
229228
console.error('One and the same city can have several names');
230-
json.city = 'Moskva';
229+
json.city = 'Moskva';
231230
}
232231
find = {
233232
$or: [{
@@ -238,16 +237,16 @@ $('#location_input_scan').flexdatalist({
238237
}, {"address.country": {'$regex': json.city, '$options': 'i'}}]
239238
};
240239
}
241-
if(json && json.city && json.city === 'Russia') json.city = 'Москва';
240+
if (json && json.city && json.city === 'Russia') json.city = 'Москва';
242241
geocode.geocode({address: (json.city || '') + ',' + (json.country || '')}, function (results, status) {
243242
console.log(results);
244-
if(results.length >0) {
243+
if (results.length > 0) {
245244
map.setCenter({lng: results[0].geometry.location.lng(), lat: results[0].geometry.location.lat()});
246245
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)
249248
}
250249
});
251-
ABAB.event['update_filter'](find,true);
250+
ABAB.event['update_filter'](find, true);
252251

253252
});

web/src/views/Rooms/Rooms.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ var map = false;
22
var markers = [];
33
var reactiveRooms = Ractive.extend({
44
oninit: function () {
5+
console.log('reactiveRooms oninit');
6+
57
ABAB.map.call_wait_auth(function () {
68
geocode = new google.maps.Geocoder();
79
map = new google.maps.Map(document.getElementById('map-canvas'), {
@@ -12,7 +14,6 @@ var reactiveRooms = Ractive.extend({
1214
procent = 0.25;
1315
});
1416

15-
console.log('reactiveRooms oninit');
1617

1718
}
1819
});

0 commit comments

Comments
 (0)