Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@
display: block;
padding: 5px;
}
.share-button.hidden {
display: none !important;
}
#menu {
left: 0;
top: 0;
Expand Down Expand Up @@ -300,7 +303,7 @@
</button>
<button
id="btn-share-link"
class="btn bts--xs btn--stroke bg-darken25-on-hover inline-block txt-s color-black mx12 my12"
class="btn bts--xs btn--stroke bg-darken25-on-hover inline-block txt-s color-black mx12 my12 share-button"
>
Share Map
</button>
Expand Down Expand Up @@ -334,6 +337,7 @@
const tilejson_endpoint = '{{ tilejson_endpoint }}'
const info_endpoint = '{{ info_endpoint }}'
const stats_endpoint = '{{ statistics_endpoint }}'
const viewer_enabled = '{{ viewer_enabled|tojson }}'

const dtype_ranges = {
'int8': [-128, 127],
Expand All @@ -346,6 +350,28 @@
'float64': [-1.7976931348623157e+308, 1.7976931348623157e+308]
}

function updateShareButtonVisibility() {
console.log('updateShareButtonVisibility called');
console.log('viewer_enabled:', viewer_enabled);

const shareButton = document.getElementById('btn-share-link');
if (!shareButton) {
console.log('Share button not found in the DOM');
return;
}

console.log('shareButton:', shareButton);

if (viewer_enabled === 'true') {
console.log('Setting button to visible');
shareButton.classList.remove('hidden');
} else {
console.log('Setting button to hidden');
shareButton.classList.add('hidden');
}
}
updateShareButtonVisibility();

var map = new maplibregl.Map({
container: 'map',
style: {
Expand Down
2 changes: 2 additions & 0 deletions src/titiler/extensions/titiler/extensions/viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ def cog_viewer(request: Request):
),
"info_endpoint": factory.url_for(request, "info"),
"statistics_endpoint": factory.url_for(request, "statistics"),
"viewer_enabled": hasattr(factory, "add_viewer")
and getattr(factory, "add_viewer", False),
},
media_type="text/html",
)
Expand Down
Loading