Skip to content

Commit

Permalink
Fix bot-list scroll and height (#166)
Browse files Browse the repository at this point in the history
* Add collapse on bots menu(similar to Settings) - hide/show bot(names).

* Fix bot-list scroll and height(optimise for mobile devices).

* Add configurable request frequency.
  • Loading branch information
alxnegrila authored and Reaver01 committed Aug 11, 2016
1 parent 56f79b6 commit 1d95163
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
6 changes: 6 additions & 0 deletions config/userdata.js.example
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,9 @@ var userInfo = {
botPath: true,
actionsEnabled: false
};
//milliseconds
var dataUpdates = {
updateTrainer: 1000,
addCatchable: 1000,
addInventory: 5000
};
3 changes: 2 additions & 1 deletion css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ html, body {
float: left;
}
#bots-list {
max-height: 80vh;
max-height: 70vh;
overflow-y: scroll;
}
#bots-list::-webkit-scrollbar {
display: none;
Expand Down
16 changes: 10 additions & 6 deletions js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ var mapView = {
settings: {},
init: function() {
var self = this;
self.settings = $.extend(true, self.settings, userInfo);
self.settings = $.extend(true, self.settings, userInfo, dataUpdates);
self.bindUi();

$.getScript('https://maps.googleapis.com/maps/api/js?key={0}&libraries=drawing'.format(self.settings.gMapsAPIKey), function() {
Expand Down Expand Up @@ -290,9 +290,9 @@ var mapView = {
});
self.placeTrainer();
self.addCatchable();
setInterval(self.updateTrainer, 1000);
setInterval(self.addCatchable, 1000);
setInterval(self.addInventory, 5000);
setInterval(self.updateTrainer, self.settings.updateTrainer);
setInterval(self.addCatchable, self.settings.addCatchable);
setInterval(self.addInventory, self.settings.addInventory);
},
addCatchable: function() {
var self = mapView;
Expand Down Expand Up @@ -979,8 +979,12 @@ var mapView = {
xhr.onreadystatechange = function() {
if (xhr.readyState === XMLHttpRequest.DONE) {
if (xhr.status === 200) {
if (success)
success(JSON.parse(xhr.responseText.replace(/\bNaN\b/g, 'null')), successData);
if (success) {
try {
success(JSON.parse(xhr.responseText.replace(/\bNaN\b/g, 'null')), successData);
} catch (err) {
}
}
} else {
if (error)
error(xhr);
Expand Down

0 comments on commit 1d95163

Please sign in to comment.