El botón del lightbox copia la URL de la imagen del mapa (v1.6.0)
Sustituye el botón de compartir por «Copy map URL»: copia al portapapeles la URL del archivo de imagen a tamaño completo del mapa visible, en lugar del enlace con ancla #map-<slug>, que resultaba confuso. Los enlaces #map-<slug> siguen funcionando al abrirlos.
This commit is contained in:
+6
-14
@@ -128,14 +128,6 @@
|
||||
* Shareable URLs: #map-<slug> selects that map on page load.
|
||||
* ---------------------------------------------------------------- */
|
||||
|
||||
function shareUrl() {
|
||||
var base = window.location.href.split('#')[0];
|
||||
if (!current) {
|
||||
return base;
|
||||
}
|
||||
return base + HASH_PREFIX + encodeURIComponent(current.getAttribute('data-slug'));
|
||||
}
|
||||
|
||||
function openFromHash() {
|
||||
if (window.location.hash.indexOf(HASH_PREFIX) !== 0) {
|
||||
return;
|
||||
@@ -185,8 +177,8 @@
|
||||
'<figure class="geep-lightbox-inner">' +
|
||||
'<div class="geep-lightbox-actions">' +
|
||||
'<button type="button" class="geep-lightbox-btn geep-lightbox-share">' +
|
||||
'<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="18" cy="5" r="3"/><circle cx="6" cy="12" r="3"/><circle cx="18" cy="19" r="3"/><line x1="8.6" y1="10.6" x2="15.4" y2="6.4"/><line x1="8.6" y1="13.4" x2="15.4" y2="17.6"/></svg>' +
|
||||
'<span>' + (labels.share || 'Share map') + '</span>' +
|
||||
'<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="9" y="9" width="11" height="11" rx="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg>' +
|
||||
'<span>' + (labels.copy || 'Copy map URL') + '</span>' +
|
||||
'</button>' +
|
||||
'<button type="button" class="geep-lightbox-btn geep-lightbox-close" aria-label="' + (labels.close || 'Close') + '">×</button>' +
|
||||
'</div>' +
|
||||
@@ -262,12 +254,12 @@
|
||||
}
|
||||
|
||||
function share() {
|
||||
var url = shareUrl();
|
||||
var title = current ? current.querySelector('.geep-toggle-title').textContent : document.title;
|
||||
if (navigator.share) {
|
||||
navigator.share({ title: title, url: url }).catch(function () {});
|
||||
// Copy the full-size image URL of the map currently on screen.
|
||||
var active = root.querySelector('.geep-map-img.is-active');
|
||||
if (!active) {
|
||||
return;
|
||||
}
|
||||
var url = active.src; // src attribute holds the full-size file.
|
||||
if (navigator.clipboard && navigator.clipboard.writeText) {
|
||||
navigator.clipboard.writeText(url).then(toast, function () {
|
||||
fallbackCopy(url);
|
||||
|
||||
Reference in New Issue
Block a user