Skip to content

Commit ccb79fd

Browse files
committed
Added new UI features
Fix travis errors
1 parent 3a116fb commit ccb79fd

File tree

3 files changed

+61
-5
lines changed

3 files changed

+61
-5
lines changed

static/js/map.common.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -946,6 +946,14 @@ var StoreOptions = {
946946
default: false,
947947
type: StoreTypes.Boolean
948948
},
949+
'hideNotNotified': {
950+
default: false,
951+
type: StoreTypes.Boolean
952+
},
953+
'showPopups': {
954+
default: true,
955+
type: StoreTypes.Boolean
956+
},
949957
'playSound': {
950958
default: false,
951959
type: StoreTypes.Boolean

static/js/map.js

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,9 @@ function initSidebar() {
475475
$('#spawnpoints-switch').prop('checked', Store.get('showSpawnpoints'))
476476
$('#ranges-switch').prop('checked', Store.get('showRanges'))
477477
$('#notify-perfection-wrapper').toggle(Store.get('showPokemonStats'))
478+
$('#hideunnotified-switch').prop('checked', Store.get('hideNotNotified'))
479+
$('#popups-switch').prop('checked', Store.get('showPopups'))
480+
$('#bounce-switch').prop('checked', Store.get('isBounceDisabled'))
478481
$('#sound-switch').prop('checked', Store.get('playSound'))
479482
$('#pokemoncries').toggle(Store.get('playSound'))
480483
$('#cries-switch').prop('checked', Store.get('playCries'))
@@ -1677,17 +1680,17 @@ function processPokemon(item) {
16771680

16781681
if (!(item['encounter_id'] in mapData.pokemons) &&
16791682
!isPokeExcluded && !isRarityExcluded && isPokeAlive) {
1680-
// Add marker to map and item to dict.
1681-
if (!item.hidden) {
1683+
// Add marker to map and item to dict.
1684+
const isNotifyPkmn = isNotifyPoke(item)
1685+
if (!item.hidden && (!Store.get('hideNotNotified') || isNotifyPkmn)) {
16821686
const isBounceDisabled = Store.get('isBounceDisabled')
16831687
const scaleByRarity = Store.get('scaleByRarity')
1684-
const isNotifyPkmn = isNotifyPoke(item)
16851688

16861689
if (item.marker) {
16871690
updatePokemonMarker(item.marker, map, scaleByRarity, isNotifyPkmn)
16881691
} else {
16891692
newMarker = setupPokemonMarker(item, map, isBounceDisabled, scaleByRarity, isNotifyPkmn)
1690-
customizePokemonMarker(newMarker, item)
1693+
customizePokemonMarker(newMarker, item, !Store.get('showPopups'))
16911694
item.marker = newMarker
16921695
}
16931696

@@ -2529,11 +2532,11 @@ $(function () {
25292532
$switchActiveRaidGymsOnly.on('change', function () {
25302533
Store.set('showActiveRaidsOnly', this.checked)
25312534
lastgyms = false
2535+
25322536
updateMap()
25332537
})
25342538

25352539
$switchRaidMinLevel = $('#raid-min-level-only-switch')
2536-
25372540
$switchRaidMinLevel.select2({
25382541
placeholder: 'Minimum raid level',
25392542
minimumResultsForSearch: Infinity
@@ -3019,6 +3022,21 @@ $(function () {
30193022
}
30203023
})
30213024

3025+
$('#bounce-switch').change(function () {
3026+
Store.set('isBounceDisabled', this.checked)
3027+
location.reload()
3028+
})
3029+
3030+
$('#hideunnotified-switch').change(function () {
3031+
Store.set('hideNotNotified', this.checked)
3032+
location.reload()
3033+
})
3034+
3035+
$('#popups-switch').change(function () {
3036+
Store.set('showPopups', this.checked)
3037+
location.reload()
3038+
})
3039+
30223040
$('#cries-switch').change(function () {
30233041
Store.set('playCries', this.checked)
30243042
})

templates/map.html

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,36 @@ <h3>Notify of Level</h3>
385385
</label>
386386
</div>
387387
{% endif %}
388+
<div class="form-control switch-container">
389+
<h3>Hide unnotified pokemon</h3>
390+
<div class="onoffswitch">
391+
<input id="hideunnotified-switch" type="checkbox" name="hideunnotified-switch" class="onoffswitch-checkbox" checked>
392+
<label class="onoffswitch-label" for="hideunnotified-switch">
393+
<span class="switch-label" data-on="On" data-off="Off"></span>
394+
<span class="switch-handle"></span>
395+
</label>
396+
</div>
397+
</div>
398+
<div class="form-control switch-container">
399+
<h3>Show browser popups</h3>
400+
<div class="onoffswitch">
401+
<input id="popups-switch" type="checkbox" name="popups-switch" class="onoffswitch-checkbox" checked>
402+
<label class="onoffswitch-label" for="popups-switch">
403+
<span class="switch-label" data-on="On" data-off="Off"></span>
404+
<span class="switch-handle"></span>
405+
</label>
406+
</div>
407+
</div>
408+
<div class="form-control switch-container">
409+
<h3>Disable bouncing</h3>
410+
<div class="onoffswitch">
411+
<input id="bounce-switch" type="checkbox" name="bounce-switch" class="onoffswitch-checkbox" checked>
412+
<label class="onoffswitch-label" for="bounce-switch">
413+
<span class="switch-label" data-on="On" data-off="Off"></span>
414+
<span class="switch-handle"></span>
415+
</label>
416+
</div>
417+
</div>
388418
<div class="form-control switch-container">
389419
<h3>Notify with sound</h3>
390420
<div class="onoffswitch">

0 commit comments

Comments
 (0)