diff --git a/static/js/map.js b/static/js/map.js index 47f95a174..d997b092d 100644 --- a/static/js/map.js +++ b/static/js/map.js @@ -2388,7 +2388,6 @@ function updatePokestopIcons() { function getPokestopMarkerIcon(item) { var stopMarker = '' - var html = '' var d = new Date() var lastMidnight = '' if (mapFork === 'mad') { @@ -2396,228 +2395,76 @@ function getPokestopMarkerIcon(item) { } else { lastMidnight = 0 } + var markerStr = '0' + if (!noLures && item['lure_expiration'] > Date.now()) { + markerStr = item['lure_id'] + } var pokemonid var formid var costumeid var genderid var shiny - 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()) { - markerStr = 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()) { - markerStr = item['lure_id'] - } - 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) { - pokemonid = item['reward_pokemon_id'] - formid = item['reward_pokemon_formid'] - costumeid = item['reward_pokemon_costumeid'] - genderid = item['reward_pokemon_genderid'] - shiny = item['reward_pokemon_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()) { - markerStr = '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()) { - markerStr = item['lure_id'] + 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) { pokemonid = item['reward_pokemon_id'] formid = item['reward_pokemon_formid'] costumeid = item['reward_pokemon_costumeid'] genderid = item['reward_pokemon_genderid'] shiny = item['reward_pokemon_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 { @@ -2626,9 +2473,10 @@ function getPokestopMarkerIcon(item) { iconAnchor: [25, 45], popupAnchor: [0, -35], className: 'stop-marker', - html: '
' + html: html }) } + return stopMarker }