diff --git a/static/js/map.js b/static/js/map.js index 52e492161..8ae5f55ed 100644 --- a/static/js/map.js +++ b/static/js/map.js @@ -2401,173 +2401,44 @@ function getPokestopMarkerIcon(item) { lastMidnight = 0 } var lureStr = '' + if (item['lure_expiration'] > Date.now()) { + lureStr = 'Lured_' + item['lure_id'] + } var stopQuestIcon = 'PstopQuest.png' var pokemonIdStr = '' var formStr = '' var shinyStr = '' - if (Store.get(['showPokestops']) && !Store.get(['showQuests']) && !Store.get(['showLures']) && !Store.get(['showRocket']) && !Store.get(['showAllPokestops'])) { - stopMarker = L.divIcon({ - iconSize: [31, 31], - iconAnchor: [25, 45], - popupAnchor: [0, -35], - className: 'stop-marker', - html: '
' - }) - } else if (Store.get(['showAllPokestops']) && !noAllPokestops) { - if (!noTeamRocket && item['incident_expiration'] > Date.now()) { - if (!noLures && item['lure_expiration'] > Date.now()) { - lureStr = 'Lured_' + item['lure_id'] - } - html = '
' - if (item['grunt_type'] > 0) { - html += '
' - } else { - html += '' - } - if (noRocketTimer === false && Store.get(['showRocketTimer'])) { - html += '
' - } - stopMarker = L.divIcon({ - iconSize: [31, 31], - iconAnchor: [25, 45], - popupAnchor: [0, -35], - className: 'stop-rocket-marker', - html: html - }) - } else if (!noQuests && item['quest_reward_type'] !== null && lastMidnight < Number(item['quest_timestamp'])) { - if (!noLures && item['lure_expiration'] > Date.now()) { - stopQuestIcon = 'PstopLured_' + item['lure_id'] + '.png' - } - if (item['quest_reward_type'] === 12) { - html = '
' + - '' + - '' + - '
' - stopMarker = L.divIcon({ - iconSize: [31, 31], - iconAnchor: [25, 45], - popupAnchor: [0, -35], - className: 'stop-quest-marker', - html: html - }) - } else if (item['quest_reward_type'] === 7) { - if (item['quest_pokemon_id'] <= 9) { - pokemonIdStr = '00' + item['quest_pokemon_id'] - } else if (item['quest_pokemon_id'] <= 99) { - pokemonIdStr = '0' + item['quest_pokemon_id'] - } else { - pokemonIdStr = item['quest_pokemon_id'] - } - if (item['quest_pokemon_formid'] === 0) { - formStr = '00' - } else { - formStr = item['quest_pokemon_formid'] - } - if (item['quest_pokemon_shiny'] === 'true') { - shinyStr = '_shiny' - } - html = '
' + - '' + - '' + - '
' - stopMarker = L.divIcon({ - iconSize: [31, 31], - iconAnchor: [25, 45], - popupAnchor: [0, -35], - className: 'stop-quest-marker', - html: html - }) - } else if (item['quest_reward_type'] === 4) { - html = '
' + - '' + - '' + - '
' - stopMarker = L.divIcon({ - iconSize: [31, 31], - iconAnchor: [25, 45], - popupAnchor: [0, -35], - className: 'stop-quest-marker', - html: html - }) - } else if (item['quest_reward_type'] === 3) { - html = '
' + - '' + - '' + - '
' - stopMarker = L.divIcon({ - iconSize: [31, 31], - iconAnchor: [25, 45], - popupAnchor: [0, -35], - className: 'stop-quest-marker', - html: html - }) - } else if (item['quest_reward_type'] === 2) { - html = '
' + - '' + - '' + - '
' - stopMarker = L.divIcon({ - iconSize: [31, 31], - iconAnchor: [25, 45], - popupAnchor: [0, -35], - className: 'stop-quest-marker', - html: html - }) - } - } else if (!noLures && item['lure_expiration'] > Date.now()) { - html = '
' - stopMarker = L.divIcon({ - iconSize: [31, 31], - iconAnchor: [25, 45], - popupAnchor: [0, -35], - className: 'stop-lured-marker', - html: html - }) - } else { - stopMarker = L.divIcon({ - iconSize: [31, 31], - iconAnchor: [25, 45], - popupAnchor: [0, -35], - className: 'stop-marker', - html: '
' - }) - } - } else if (Store.get(['showRocket']) && !noTeamRocket && item['incident_expiration'] > Date.now()) { - if (!noLures && item['lure_expiration'] > Date.now()) { - lureStr = 'Lured_' + item['lure_id'] - } - html = '
' + var hasRocket = item['incident_expiration'] > Date.now(); + var hasQuest = item['quest_reward_type'] !== null && lastMidnight < Number(item['quest_timestamp']); + + var showRocket = false; + var showQuest = false; + var showLures = false; + + //TODO also factor in the "no*" stuff. + if (Store.get(['showQuests']) || Store.get(['showAllPokestops'])){ + showQuest = true; + } + if (Store.get(['showRocket']) || Store.get(['showAllPokestops'])){ + showRocket = true; + } + if (Store.get(['showLures']) || Store.get(['showAllPokestops'])){ + showLures = true; + } + + var html = '
' + if (hasRocket){ + html += '' if (item['grunt_type'] > 0) { - html += '
' - } else { - html += '
' - } - if (noRocketTimer === false && Store.get(['showRocketTimer'])) { - html += '
' - } - stopMarker = L.divIcon({ - iconSize: [31, 31], - iconAnchor: [25, 45], - popupAnchor: [0, -35], - className: 'stop-rocket-marker', - html: html - }) - } else if (Store.get(['showQuests']) && !noQuests && item['quest_reward_type'] !== null && lastMidnight < Number(item['quest_timestamp'])) { - if (!noLures && item['lure_expiration'] > Date.now()) { - stopQuestIcon = 'PstopLured_' + item['lure_id'] + '.png' + html += '' } + } else { + html += '' + } + + if (hasQuest) { if (item['quest_reward_type'] === 12) { - html = '
' + - '' + - '' + - '
' - stopMarker = L.divIcon({ - iconSize: [31, 31], - iconAnchor: [25, 45], - popupAnchor: [0, -35], - className: 'stop-quest-marker', - html: html - }) + html += '' } else if (item['quest_reward_type'] === 7) { if (item['quest_pokemon_id'] <= 9) { pokemonIdStr = '00' + item['quest_pokemon_id'] @@ -2584,61 +2455,27 @@ function getPokestopMarkerIcon(item) { if (item['quest_pokemon_shiny'] === 'true') { shinyStr = '_shiny' } - html = '
' + - '' + - '' + - '
' - stopMarker = L.divIcon({ - iconSize: [31, 31], - iconAnchor: [25, 45], - popupAnchor: [0, -35], - className: 'stop-quest-marker', - html: html - }) + html += '' } else if (item['quest_reward_type'] === 4) { - html = '
' + - '' + - '' + - '
' - stopMarker = L.divIcon({ - iconSize: [31, 31], - iconAnchor: [25, 45], - popupAnchor: [0, -35], - className: 'stop-quest-marker', - html: html - }) + html += '' } else if (item['quest_reward_type'] === 3) { - html = '
' + - '' + - '' + - '
' - stopMarker = L.divIcon({ - iconSize: [31, 31], - iconAnchor: [25, 45], - popupAnchor: [0, -35], - className: 'stop-quest-marker', - html: html - }) + html += '' } else if (item['quest_reward_type'] === 2) { - html = '
' + - '' + - '' + - '
' - stopMarker = L.divIcon({ - iconSize: [31, 31], - iconAnchor: [25, 45], - popupAnchor: [0, -35], - className: 'stop-quest-marker', - html: html - }) + html += '' + } + } + + html += "
" + + if (hasRocket){ + if (noRocketTimer === false && Store.get(['showRocketTimer'])) { + html += '
' } - } else if (Store.get(['showLures']) && !noLures && item['lure_expiration'] > Date.now()) { - html = '
' stopMarker = L.divIcon({ iconSize: [31, 31], iconAnchor: [25, 45], popupAnchor: [0, -35], - className: 'stop-lured-marker', + className: 'stop-rocket-marker', html: html }) } else { @@ -2647,9 +2484,10 @@ function getPokestopMarkerIcon(item) { iconAnchor: [25, 45], popupAnchor: [0, -35], className: 'stop-marker', - html: '
' + html: html }) } + return stopMarker } function setupPokestopMarker(item) {