Skip to content

Commit 85dadf6

Browse files
committed
Add tooltip #22 + Add new items in contextmenu
1 parent fa2ca48 commit 85dadf6

1 file changed

Lines changed: 80 additions & 52 deletions

File tree

template/osm-map2.tpl

100755100644
Lines changed: 80 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -172,38 +172,39 @@ html, body {
172172
}
173173

174174
a.tooltips {
175-
position: relative;
176-
display: inline;
175+
position: relative;
176+
display: inline;
177177
}
178178
a.tooltips span {
179-
position: absolute;
180-
width:140px;
181-
color: #FFFFFF;
182-
background: #000000;
183-
height: 30px;
184-
line-height: 30px;
185-
text-align: center;
186-
visibility: hidden;
187-
border-radius: 6px;
179+
position: absolute;
180+
padding: 5px;
181+
color: #FFFFFF;
182+
background: rgba(0,0,0,0.8);
183+
height: 30px;
184+
line-height: 30px;
185+
text-align: center;
186+
visibility: hidden;
187+
border-radius: 6px;
188188
}
189189
a.tooltips span:after {
190-
content: '';
191-
position: absolute;
192-
top: 100%;
193-
left: 50%;
194-
margin-left: -8px;
195-
width: 0; height: 0;
196-
border-top: 8px solid #000000;
197-
border-right: 8px solid transparent;
198-
border-left: 8px solid transparent;
190+
content: '';
191+
position: absolute;
192+
top: 100%;
193+
left: 50%;
194+
margin-left: -8px;
195+
width: 0;
196+
height: 0;
197+
border-top: 8px solid #000000;
198+
border-right: 8px solid transparent;
199+
border-left: 8px solid transparent;
199200
}
200201
a:hover.tooltips span {
201-
visibility: visible;
202-
opacity: 0.8;
203-
bottom: 30px;
204-
left: 50%;
205-
margin-left: -76px;
206-
z-index: 999;
202+
visibility: visible;
203+
opacity: 0.8;
204+
bottom: 30px;
205+
left: 50%;
206+
margin-left: -76px;
207+
z-index: 999;
207208
}
208209

209210
#dialog {
@@ -229,18 +230,18 @@ a:hover.tooltips span {
229230

230231
<div id="ribbon-map-toggle" class="show">
231232
<div id="ribbon-map-nav">
232-
<span class="osm-home"></span><a href="{$HOME}">{$HOME_NAME}</a><br/>
233-
<span class="osm-left-big"></span><a href="{$HOME_PREV}">{$HOME_PREV_NAME}</a>
233+
<span class="osm-home"></span><a href="{$HOME}" class="tooltips">{$HOME_NAME}<span>Go to Piwigo gallery</span></a><br/>
234+
<span class="osm-left-big"></span><a href="{$HOME_PREV}" class="tooltips">{$HOME_PREV_NAME}<span>Go to back one page</span></a>
234235
</div>
235236

236237
<div id="ribbon-map-results">
237238
<b id="nb_showall" style="color: rgb(204, 0, 0);">{$TOTAL}</b><br/>
238-
<span class="osm-link-ext"></span><a id="map-showall" target="_blank" href="">Show All</a>
239+
<span class="osm-link-ext"></span><a id="map-showall" target="_blank" href="" class="tooltips">Show All<span>Show all items in Piwigo gallery</span></a>
239240
</div>
240241

241242
<div id="ribbon-map-location">
242-
<span class="osm-link"></span><a href="#" onclick="linkToThisMap();" id="opener" >Link to this map</a><br/>
243-
<span class="osm-direction"></span><a href="#" onclick="findMyLocation();">Find my position</a>
243+
<span class="osm-link"></span><a href="#" onclick="linkToThisMap();" id="opener" class="tooltips">Link to this map<span>Share this view</span></a><br/>
244+
<span class="osm-direction"></span><a href="#" onclick="findMyLocation();" class="tooltips">Find my position<span>Search my position on the map</span></a>
244245
</div>
245246

246247
<div id="ribbon-map-wrapper" style="visibility:hidden; max-width: 0px;">
@@ -250,7 +251,7 @@ a:hover.tooltips span {
250251
<!-- <li><img class="morph pic" src="http://placehold.it/40x40&text=FooBar1"><span>FooBar1</span></a></li> -->
251252
<!-- <li><img src="http://placehold.it/40x40&text=FooBar2" alt="FooBar2"></li> -->
252253
<!-- <li><img class="morph pic" src="http://placehold.it/40x40&text=FooBar3"></li> -->
253-
<!-- <li class="tooltips"><img class="morph pic" src="http://placehold.it/40x40&text=FooBar3"><span>FooBar4</span></li> -->
254+
<!-- <li class="tooltips"><span>Tooltip</span><img class="morph pic" src="http://placehold.it/40x40&text=FooBar3"></li> -->
254255
</ul>
255256
</div>
256257

@@ -346,6 +347,14 @@ function toggle(arrow)
346347
/* END leaflet-locatecontrol */
347348
348349
/* BEGIN leaflet-contextmenu https://github.com/aratcliffe/Leaflet.contextmenu */
350+
function goHome (){
351+
window.location.assign('{/literal}{$HOME}{literal}');
352+
}
353+
354+
function goBack (){
355+
window.location.assign('{/literal}{$HOME_PREV}{literal}');
356+
}
357+
349358
function showCoordinates (e) {
350359
var popup = L.popup();
351360
popup
@@ -359,6 +368,40 @@ function toggle(arrow)
359368
getMarkers(); /* Center on Map is not consider as Move so we have to update the data ourself */
360369
}
361370
371+
function goShowAll (e) {
372+
/* Get coordonates */
373+
var bounds = map.getBounds();
374+
var min = bounds.getSouthWest().wrap();
375+
var max = bounds.getNorthEast().wrap();
376+
377+
/* Update ShowAll link */
378+
var root_url = '{/literal}{$MYROOT_URL}{literal}';
379+
var myurl = root_url+"osmmap.php?min_lat="+min.lat+"&min_lng="+min.lng+"&max_lat="+max.lat+"&max_lng="+max.lng;
380+
//console.log("ShowAll:"+myurl);
381+
//window.location.assign(myurl);
382+
window.open(url,'_blank');
383+
}
384+
385+
function linkToThisMap (){
386+
var center = map.getCenter();
387+
var zoom = map.getZoom();
388+
389+
var centerlat = center.lat;
390+
var centerlng = center.lng;
391+
392+
var root_url = '{/literal}{$MYROOT_URL}{literal}';
393+
var myurl = root_url+"osmmap.php?zoom="+zoom+"&center_lat="+centerlat+"&center_lng="+centerlng;
394+
//console.log(myurl);
395+
document.getElementById('textfield').value = myurl;
396+
$('#dialog').dialog('open');
397+
}
398+
399+
function findMyLocation (){
400+
/* http://leafletjs.com/examples/mobile-example.html */
401+
/* http://www.bennadel.com/blog/2023-Geocoding-A-User-s-Location-Using-Javascript-s-GeoLocation-API.htm */
402+
map.locate({setView: true, maxZoom: 16});
403+
}
404+
362405
function zoomIn (e) {
363406
map.zoomIn();
364407
}
@@ -367,9 +410,13 @@ function toggle(arrow)
367410
map.zoomOut();
368411
}
369412
413+
map.contextmenu.addItem({text: '{/literal}{$HOME_NAME}{literal}', iconCls: 'osm-home', callback: goHome});
414+
map.contextmenu.addItem({text: '{/literal}{$HOME_PREV_NAME}{literal}', iconCls: 'osm-left-big', callback: goBack});
415+
map.contextmenu.addItem('-');
370416
map.contextmenu.addItem({text: 'Show coordinates', iconCls: 'osm-pin', callback: showCoordinates});
371417
map.contextmenu.addItem({text: 'Center map here', iconCls: 'osm-location', callback: centerMap});
372418
map.contextmenu.addItem('-');
419+
map.contextmenu.addItem({text: 'Show all items', iconCls: 'osm-link-ext', callback: goShowAll});
373420
map.contextmenu.addItem({text: 'Link to this map', iconCls: 'osm-link', callback: linkToThisMap});
374421
map.contextmenu.addItem({text: 'Find my position', iconCls: 'osm-direction', callback: findMyLocation});
375422
map.contextmenu.addItem({separator: true});
@@ -384,6 +431,7 @@ function toggle(arrow)
384431
getMarkers();
385432
}
386433
434+
/* Generate the carrousel */
387435
function getMarkers(){
388436
/* Get coordonates */
389437
var bounds = map.getBounds();
@@ -480,26 +528,6 @@ function toggle(arrow)
480528
}
481529
}
482530
483-
function linkToThisMap (){
484-
var center = map.getCenter();
485-
var zoom = map.getZoom();
486-
487-
var centerlat = center.lat;
488-
var centerlng = center.lng;
489-
490-
var root_url = '{/literal}{$MYROOT_URL}{literal}';
491-
var myurl = root_url+"osmmap.php?zoom="+zoom+"&center_lat="+centerlat+"&center_lng="+centerlng;
492-
//console.log(myurl);
493-
document.getElementById('textfield').value = myurl;
494-
$('#dialog').dialog('open');
495-
}
496-
497-
function findMyLocation (){
498-
/* http://leafletjs.com/examples/mobile-example.html */
499-
/* http://www.bennadel.com/blog/2023-Geocoding-A-User-s-Location-Using-Javascript-s-GeoLocation-API.htm */
500-
map.locate({setView: true, maxZoom: 16});
501-
}
502-
503531
/* BEGIN leaflet Location */
504532
function onLocationFound(e) {
505533
var radius = e.accuracy / 2;

0 commit comments

Comments
 (0)