{"id":1469,"date":"2025-07-24T10:36:39","date_gmt":"2025-07-24T16:36:39","guid":{"rendered":"https:\/\/luxelare.com\/?page_id=1469"},"modified":"2025-07-24T11:50:39","modified_gmt":"2025-07-24T17:50:39","slug":"geolocation","status":"publish","type":"page","link":"https:\/\/luxelare.com\/en\/geolocation\/","title":{"rendered":""},"content":{"rendered":"<div id=\"geoApp\">\n  <h2>Obtener tu ubicaci\u00f3n<\/h2>\n  <p id=\"status\">Solicitando tu ubicaci\u00f3n&#8230;<\/p>\n  <p id=\"coordinates\"><\/p>\n  <button id=\"copyButton\" onclick=\"copyCoordinates()\" style=\"display: none;\">Copiar coordenadas<\/button>\n  <button id=\"manualCopyButton\" onclick=\"confirmManualCopy()\" style=\"display: none;\">Confirmar copia manual<\/button>\n  <p id=\"error\"><\/p>\n  <button onclick=\"retryGeolocation()\">Reintentar<\/button>\n  <button onclick=\"window.close()\">Cerrar<\/button>\n<\/div>\n\n<style>\n  #geoApp { font-family: Arial, sans-serif; margin: 20px; text-align: center; }\n  #status { margin-top: 20px; color: #333; }\n  #error { color: red; margin-top: 10px; }\n  #coordinates { margin-top: 10px; font-weight: bold; padding: 10px; border: 1px solid #ccc; background: #f9f9f9; }\n  #copyButton, #manualCopyButton, button {\n    padding: 10px 20px; margin: 10px; cursor: pointer; border: none; border-radius: 5px;\n  }\n  #copyButton { background: #4285F4; color: white; }\n  #copyButton:hover { background: #357ae8; }\n  #manualCopyButton { background: #666; color: white; }\n  #manualCopyButton:hover { background: #555; }\n<\/style>\n\n<script>\n  let coords = '';\n  function copyCoordinates() {\n    if (coords) {\n      navigator.clipboard.writeText(coords).then(() => {\n        document.getElementById('status').innerText = \n          '\u00a1Coordenadas copiadas al portapapeles! La pesta\u00f1a se cerrar\u00e1 autom\u00e1ticamente.';\n        document.getElementById('copyButton').innerText = '\u00a1Copiado!';\n        setTimeout(() => {\n          window.close();\n        }, 1000);\n      }).catch(err => {\n        document.getElementById('status').innerText = \n          'No se pudo copiar autom\u00e1ticamente. Selecciona las coordenadas y c\u00f3pialas (Ctrl+C o Cmd+C), luego haz clic en \"Confirmar copia manual\".';\n        document.getElementById('manualCopyButton').style.display = 'inline-block';\n        console.error('Error en portapapeles:', err);\n      });\n    }\n  }\n\n  function confirmManualCopy() {\n    document.getElementById('status').innerText = \n      '\u00a1Copia manual confirmada! La pesta\u00f1a se cerrar\u00e1 autom\u00e1ticamente. Pega las coordenadas en Looker.';\n    setTimeout(() => {\n      window.close();\n    }, 1000);\n  }\n\n  function getGeolocation() {\n    const status = document.getElementById('status');\n    const coordsDiv = document.getElementById('coordinates');\n    const errorDiv = document.getElementById('error');\n    const copyButton = document.getElementById('copyButton');\n    const manualCopyButton = document.getElementById('manualCopyButton');\n\n    if (navigator.geolocation) {\n      navigator.geolocation.getCurrentPosition(\n        position => {\n          const lat = position.coords.latitude.toFixed(6);\n          const lng = position.coords.longitude.toFixed(6);\n          coords = `${lat},${lng}`;\n          coordsDiv.innerText = `Coordenadas: ${coords}`;\n          status.innerText = 'Haz clic en \"Copiar coordenadas\" o selecciona las coordenadas y c\u00f3pialas (Ctrl+C o Cmd+C), luego confirma con \"Confirmar copia manual\".';\n          copyButton.style.display = 'inline-block';\n          errorDiv.innerText = '';\n          navigator.clipboard.writeText(coords).catch(err => {\n            status.innerText = \n              'No se pudo copiar autom\u00e1ticamente. Selecciona las coordenadas y c\u00f3pialas (Ctrl+C o Cmd+C), luego haz clic en \"Confirmar copia manual\".';\n            manualCopyButton.style.display = 'inline-block';\n            console.error('Error en copia autom\u00e1tica:', err);\n          });\n        },\n        error => {\n          status.innerText = '';\n          coordsDiv.innerText = '';\n          copyButton.style.display = 'none';\n          manualCopyButton.style.display = 'none';\n          errorDiv.innerText = 'No se pudo obtener la ubicaci\u00f3n: ' + error.message +\n            '. Aseg\u00farate de que los servicios de ubicaci\u00f3n est\u00e9n habilitados (Configuraci\u00f3n > Privacidad > Servicios de ubicaci\u00f3n > Safari\/Firefox) y reintenta, o usa Google Maps.';\n        },\n        { timeout: 15000, maximumAge: 60000, enableHighAccuracy: true }\n      );\n    } else {\n      status.innerText = '';\n      coordsDiv.innerText = '';\n      copyButton.style.display = 'none';\n      manualCopyButton.style.display = 'none';\n      errorDiv.innerText = 'La geolocalizaci\u00f3n no es compatible con este navegador.';\n    }\n  }\n\n  function retryGeolocation() {\n    document.getElementById('status').innerText = 'Solicitando tu ubicaci\u00f3n...';\n    document.getElementById('coordinates').innerText = '';\n    document.getElementById('error').innerText = '';\n    document.getElementById('copyButton').style.display = 'none';\n    document.getElementById('manualCopyButton').style.display = 'none';\n    getGeolocation();\n  }\n\n  document.addEventListener('DOMContentLoaded', getGeolocation);\n<\/script>\n\n\n\n<p><\/p>","protected":false},"excerpt":{"rendered":"<p>Obtener tu ubicaci\u00f3n Solicitando tu ubicaci\u00f3n&#8230; Copiar coordenadas Confirmar copia manual Reintentar Cerrar<\/p>","protected":false},"author":2,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_et_pb_use_builder":"off","_et_pb_old_content":"","_et_gb_content_width":"","_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0},"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false,"trp-custom-language-flag":false,"et-pb-post-main-image":false,"et-pb-post-main-image-fullwidth":false,"et-pb-portfolio-image":false,"et-pb-portfolio-module-image":false,"et-pb-portfolio-image-single":false,"et-pb-gallery-module-image-portrait":false,"et-pb-post-main-image-fullwidth-large":false,"et-pb-image--responsive--desktop":false,"et-pb-image--responsive--tablet":false,"et-pb-image--responsive--phone":false},"uagb_author_info":{"display_name":"Luxelare","author_link":"https:\/\/luxelare.com\/en\/author\/heberto\/"},"uagb_comment_info":0,"uagb_excerpt":"Obtener tu ubicaci\u00f3n Solicitando tu ubicaci\u00f3n&#8230; Copiar coordenadas Confirmar copia manual Reintentar Cerrar","_links":{"self":[{"href":"https:\/\/luxelare.com\/en\/wp-json\/wp\/v2\/pages\/1469"}],"collection":[{"href":"https:\/\/luxelare.com\/en\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/luxelare.com\/en\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/luxelare.com\/en\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/luxelare.com\/en\/wp-json\/wp\/v2\/comments?post=1469"}],"version-history":[{"count":9,"href":"https:\/\/luxelare.com\/en\/wp-json\/wp\/v2\/pages\/1469\/revisions"}],"predecessor-version":[{"id":1479,"href":"https:\/\/luxelare.com\/en\/wp-json\/wp\/v2\/pages\/1469\/revisions\/1479"}],"wp:attachment":[{"href":"https:\/\/luxelare.com\/en\/wp-json\/wp\/v2\/media?parent=1469"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}