Skip to content

Commit

Permalink
Added new UI features
Browse files Browse the repository at this point in the history
  • Loading branch information
tomballgithub committed Nov 19, 2017
1 parent e54a134 commit f6e2b05
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 5 deletions.
8 changes: 8 additions & 0 deletions static/js/map.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -934,6 +934,14 @@ var StoreOptions = {
default: false,
type: StoreTypes.Boolean
},
'hideNotNotified': {
default: false,
type: StoreTypes.Boolean
},
'showPopups': {
default: true,
type: StoreTypes.Boolean
},
'playSound': {
default: false,
type: StoreTypes.Boolean
Expand Down
29 changes: 24 additions & 5 deletions static/js/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,9 @@ function initSidebar() {
$('#scanned-switch').prop('checked', Store.get('showScanned'))
$('#spawnpoints-switch').prop('checked', Store.get('showSpawnpoints'))
$('#ranges-switch').prop('checked', Store.get('showRanges'))
$('#hideunnotified-switch').prop('checked', Store.get('hideNotNotified'))
$('#popups-switch').prop('checked', Store.get('showPopups'))
$('#bounce-switch').prop('checked', Store.get('isBounceDisabled'))
$('#sound-switch').prop('checked', Store.get('playSound'))
$('#pokemoncries').toggle(Store.get('playSound'))
$('#cries-switch').prop('checked', Store.get('playCries'))
Expand Down Expand Up @@ -1575,17 +1578,18 @@ function processPokemon(item) {

if (!(item['encounter_id'] in mapData.pokemons) &&
!isExcludedPoke && isPokeAlive) {
// Add marker to map and item to dict.
if (!item.hidden) {

// Add marker to map and item to dict.
const isNotifyPkmn = isNotifyPoke(item)
if (!item.hidden && (!Store.get('hideNotNotified') || isNotifyPkmn)) {
const isBounceDisabled = Store.get('isBounceDisabled')
const scaleByRarity = Store.get('scaleByRarity')
const isNotifyPkmn = isNotifyPoke(item)

if (item.marker) {
updatePokemonMarker(item.marker, map, scaleByRarity, isNotifyPkmn)
} else {
newMarker = setupPokemonMarker(item, map, isBounceDisabled, scaleByRarity, isNotifyPkmn)
customizePokemonMarker(newMarker, item)
customizePokemonMarker(newMarker, item, !Store.get('showPopups'))
item.marker = newMarker
}

Expand Down Expand Up @@ -2386,11 +2390,11 @@ $(function () {
$switchActiveRaidGymsOnly.on('change', function () {
Store.set('showActiveRaidsOnly', this.checked)
lastgyms = false

updateMap()
})

$switchRaidMinLevel = $('#raid-min-level-only-switch')

$switchRaidMinLevel.select2({
placeholder: 'Minimum raid level',
minimumResultsForSearch: Infinity
Expand Down Expand Up @@ -2820,6 +2824,21 @@ $(function () {
}
})

$('#bounce-switch').change(function () {
Store.set('isBounceDisabled', this.checked)
location.reload();
})

$('#hideunnotified-switch').change(function () {
Store.set('hideNotNotified', this.checked)
location.reload();
})

$('#popups-switch').change(function () {
Store.set('showPopups', this.checked)
location.reload();
})

$('#cries-switch').change(function () {
Store.set('playCries', this.checked)
})
Expand Down
30 changes: 30 additions & 0 deletions templates/map.html
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,36 @@ <h3>Notify of Perfection</h3>
</label>
</div>
{% endif %}
<div class="form-control switch-container">
<h3>Hide unnotified pokemon</h3>
<div class="onoffswitch">
<input id="hideunnotified-switch" type="checkbox" name="hideunnotified-switch" class="onoffswitch-checkbox" checked>
<label class="onoffswitch-label" for="hideunnotified-switch">
<span class="switch-label" data-on="On" data-off="Off"></span>
<span class="switch-handle"></span>
</label>
</div>
</div>
<div class="form-control switch-container">
<h3>Show browser popups</h3>
<div class="onoffswitch">
<input id="popups-switch" type="checkbox" name="popups-switch" class="onoffswitch-checkbox" checked>
<label class="onoffswitch-label" for="popups-switch">
<span class="switch-label" data-on="On" data-off="Off"></span>
<span class="switch-handle"></span>
</label>
</div>
</div>
<div class="form-control switch-container">
<h3>Disable bouncing</h3>
<div class="onoffswitch">
<input id="bounce-switch" type="checkbox" name="bounce-switch" class="onoffswitch-checkbox" checked>
<label class="onoffswitch-label" for="bounce-switch">
<span class="switch-label" data-on="On" data-off="Off"></span>
<span class="switch-handle"></span>
</label>
</div>
</div>
<div class="form-control switch-container">
<h3>Notify with sound</h3>
<div class="onoffswitch">
Expand Down

0 comments on commit f6e2b05

Please sign in to comment.