Nouvelle carte

-single.php: chargement map à la demande
This commit is contained in:
2017-02-14 06:59:44 +01:00
parent a722102766
commit 6a29ca3de0
6 changed files with 289 additions and 181 deletions

View File

@@ -56,7 +56,7 @@
<!-- End Piwik Code -->
<?php wp_footer(); ?>
<script async defer src="https://maps.googleapis.com/maps/api/js?key=AIzaSyB7cAx3NSH4dPM3Sx2oQeud7Zr-KaGXmLk&callback=initMap" type="text/javascript"></script>
<!--script async defer src="https://maps.googleapis.com/maps/api/js?key=AIzaSyB7cAx3NSH4dPM3Sx2oQeud7Zr-KaGXmLk&callback=initMap" type="text/javascript"></script-->
</body>
</html>

View File

@@ -9,7 +9,7 @@
<!-- featherlight -->
<script type="text/javascript">
$(document).ready(function(){
$( "button" ).click(function() {
$( "button#togle" ).click(function() {
$( ".comments_cont" ).toggle( "slow");
var $sp = $(this).text().trim().split(" ");

Binary file not shown.

View File

@@ -1,8 +1,8 @@
msgid ""
msgstr ""
"Project-Id-Version: Creator Responsive WordPress Theme Child\n"
"POT-Creation-Date: 2017-01-31 06:26+0100\n"
"PO-Revision-Date: 2017-01-31 06:27+0100\n"
"POT-Creation-Date: 2017-02-14 06:43+0100\n"
"PO-Revision-Date: 2017-02-14 06:43+0100\n"
"Last-Translator: Bruno <bruno@clicclac.info>\n"
"Language-Team: Bruno <bruno@clicclac.info>\n"
"Language: fr_FR\n"
@@ -21,40 +21,6 @@ msgstr ""
"X-Poedit-SearchPathExcluded-0: *.js\n"
"X-Poedit-SearchPathExcluded-1: -child\n"
#: Pagination/ce-mois.php:138 ce-mois-ci.php:145 ce-mois.php:138
msgid "The"
msgstr "Le"
#: Pagination/ce-mois.php:138 ce-mois-ci.php:145 ce-mois.php:138
#: functions.php:1037
msgid "F j, Y, g:i a"
msgstr "d.m.Y à H:i"
#: Pagination/ce-mois.php:139 ce-mois-ci.php:146 ce-mois.php:139
msgid " at "
msgstr " à "
#: Pagination/ce-mois.php:139 ce-mois-ci.php:146 ce-mois.php:139
msgid "Focal"
msgstr "Focale "
#: Pagination/ce-mois.php:211 Pagination/ce-mois.php:212 ce-mois-ci.php:289
#: ce-mois-ci.php:290 ce-mois.php:211 ce-mois.php:212
msgid "Archives"
msgstr "Archives"
#: Pagination/ce-mois.php:212 ce-mois-ci.php:290 ce-mois.php:212
msgid "Help"
msgstr "Aide"
#: Pagination/header.php:63 header-page.php:151
msgid "Tel: "
msgstr "Tél. :"
#: Pagination/header.php:64 header-page.php:152
msgid "Email: "
msgstr "Email :"
#: accueil.php:42
msgid "Previous"
msgstr "Précédent"
@@ -79,6 +45,30 @@ msgstr "Lire plus d'entrées de blog..."
msgid "Sorry, no posts found."
msgstr "Désolé, aucun post trouvé."
#: ce-mois-ci.php:145
msgid "The"
msgstr "Le"
#: ce-mois-ci.php:145 functions.php:1082
msgid "F j, Y, g:i a"
msgstr "d.m.Y à H:i"
#: ce-mois-ci.php:146
msgid " at "
msgstr " à "
#: ce-mois-ci.php:146
msgid "Focal"
msgstr "Focale "
#: ce-mois-ci.php:289 ce-mois-ci.php:290
msgid "Archives"
msgstr "Archives"
#: ce-mois-ci.php:290
msgid "Help"
msgstr "Aide"
#: ce-mois-ci.php:318
msgid "Previous Page"
msgstr "Page précédente"
@@ -91,54 +81,6 @@ msgstr "Page"
msgid "Next Page"
msgstr "Page suivante"
#: fetch_pages.php:105 fonctions.php:116 functions.php:225
msgid "January"
msgstr "Janvier"
#: fetch_pages.php:108 fonctions.php:119 functions.php:228
msgid "February"
msgstr "Février"
#: fetch_pages.php:111 fonctions.php:122 functions.php:231
msgid "March"
msgstr "Mars"
#: fetch_pages.php:114 fonctions.php:125 functions.php:234
msgid "April"
msgstr "Avril"
#: fetch_pages.php:117 fonctions.php:128 functions.php:237
msgid "May"
msgstr "Mai"
#: fetch_pages.php:120 fonctions.php:131 functions.php:240
msgid "June"
msgstr "Juin"
#: fetch_pages.php:123 fonctions.php:134 functions.php:243
msgid "July"
msgstr "Juillet"
#: fetch_pages.php:126 fonctions.php:137 functions.php:246
msgid "August"
msgstr "Aout"
#: fetch_pages.php:129 fonctions.php:140 functions.php:249
msgid "September"
msgstr "Septembre"
#: fetch_pages.php:132 fonctions.php:143 functions.php:252
msgid "October"
msgstr "Octobre"
#: fetch_pages.php:135 fonctions.php:146 functions.php:255
msgid "November"
msgstr "Novembre"
#: fetch_pages.php:138 fonctions.php:149 functions.php:258
msgid "December"
msgstr "Décembre"
#: footer.php:24
msgid "2016 Copyright. Powered by WordPress"
msgstr "2016 Copyright. Propulsé par WordPress"
@@ -147,116 +89,169 @@ msgstr "2016 Copyright. Propulsé par WordPress"
msgid "Your subscription is manually enabled."
msgstr "Votre abonnement est activée manuellement."
#: functions.php:141
#: functions.php:144
msgid "yesterday"
msgstr "hier"
#: functions.php:142
#: functions.php:145
msgid "the day before yesterday"
msgstr "avant-hier"
#: functions.php:143
#: functions.php:146
msgid "two days ago"
msgstr "avant-avant-hier"
#: functions.php:144
#: functions.php:147
#, php-format
msgid "%1$s days ago"
msgstr "il y a %1$s jours"
#: functions.php:147
#: functions.php:150
#, php-format
msgid "%1$s week ago"
msgstr "il y a %1$s semaine"
#: functions.php:148
#: functions.php:151
#, php-format
msgid "%1$s weeks ago"
msgstr "il y a %1$s semaines"
#: functions.php:491
#: functions.php:228
msgid "January"
msgstr "Janvier"
#: functions.php:231
msgid "February"
msgstr "Février"
#: functions.php:234
msgid "March"
msgstr "Mars"
#: functions.php:237
msgid "April"
msgstr "Avril"
#: functions.php:240
msgid "May"
msgstr "Mai"
#: functions.php:243
msgid "June"
msgstr "Juin"
#: functions.php:246
msgid "July"
msgstr "Juillet"
#: functions.php:249
msgid "August"
msgstr "Aout"
#: functions.php:252
msgid "September"
msgstr "Septembre"
#: functions.php:255
msgid "October"
msgstr "Octobre"
#: functions.php:258
msgid "November"
msgstr "Novembre"
#: functions.php:261
msgid "December"
msgstr "Décembre"
#: functions.php:497
msgid "Unknow album."
msgstr "Album inconnu."
#: functions.php:504
#: functions.php:509 functions.php:524
msgid "Unknow image."
msgstr "Image inconnu."
#: functions.php:756
#: functions.php:767
msgid "Post navigation"
msgstr "Navigation"
#: functions.php:759
#: functions.php:770
msgctxt "Previous post link"
msgid "<span class=\"meta-nav\">&larr;</span> %title"
msgstr "<span class=\"meta-nav\">&larr;</span> %title"
#: functions.php:760
#: functions.php:771
msgctxt "Next post link"
msgid "%title <span class=\"meta-nav\">&rarr;</span>"
msgstr "%title <span class=\"meta-nav\">&rarr;</span>"
#: functions.php:779
#: functions.php:790
msgid "Sticky"
msgstr "Épingle"
#: functions.php:785 functions.php:791
#: functions.php:796 functions.php:802
msgid ", "
msgstr ", "
#: functions.php:800
#: functions.php:811
#, php-format
msgid "View all posts by %s"
msgstr "Voir tous les articles de %s"
#: functions.php:821
#: functions.php:832
#, php-format
msgctxt "1: post format name. 2: date"
msgid "%1$s on %2$s"
msgstr ""
#: functions.php:827
#: functions.php:838
#, php-format
msgid "Permalink to %s"
msgstr "Permalien vers %s"
#: functions.php:1585
#: functions.php:1633
msgid "Settings"
msgstr "Paramètres"
#: functions.php:1587
#: functions.php:1635
msgid "Theme settings"
msgstr "Paramètres du thème"
#: functions.php:1598
#: functions.php:1646
msgid "Zenphoto path"
msgstr "Chemin de Zenphoto"
#: functions.php:1609
#: functions.php:1657
msgid "Zenphoto image size (px)"
msgstr "Taille images Zenphoto (px)"
#: functions.php:1668
msgid "Socials icons size (16 or 32px)"
msgstr "Taille icônes sociaux (16 ou 32px)"
#: functions.php:1620
#: functions.php:1679
msgid "Lightbox selector (class=\"xxx\")"
msgstr "Sélecteur pour Lightbox (class = \"xxx\")"
#: functions.php:1628
#: functions.php:1687
msgid "Choice of lightbox"
msgstr "Choix de la lightbox"
#: functions.php:1645
#: functions.php:1704
msgid "Display EXIFs"
msgstr "Afficher les EXIFs"
#: functions.php:1656
#: functions.php:1715
msgid "Display Geo datas"
msgstr "Afficher données GPS"
#: functions.php:1667
#: functions.php:1726
msgid "Display meta (single)"
msgstr "Afficher les metas (single)"
#: header.php:17 header.php:19 header.php:24 single.php:61
#: header.php:17 header.php:19 header.php:24 single.php:233
#: single.php.bak.php:159
msgid "Display"
msgstr "Afficher"
@@ -272,7 +267,7 @@ msgstr "Afficher les commentaires"
msgid "Hide comments"
msgstr "Masquer les commentaires"
#: livre-d-or.php:30 single.php:30
#: livre-d-or.php:30 single.php:202 single.php.bak.php:128
msgid "Pages"
msgstr "Pages"
@@ -296,25 +291,33 @@ msgstr "Rechercher:"
msgid "Search"
msgstr "Rechercher"
#: single.php:36
#: single.php:194
msgid "Show map"
msgstr "Afficher la carte"
#: single.php:195
msgid "Hide map"
msgstr "Masquer la carte"
#: single.php:208 single.php.bak.php:134
msgid "Tags: "
msgstr "Mots-clés: "
#. translators: %s: Name of current post
#: single.php:44
#: single.php:216 single.php.bak.php:142
#, php-format
msgid "Edit post<span class=\"screen-reader-text\"> \"%s\"</span>"
msgstr "Editer l'article<span class=\"screen-reader-text\"> \"%s\"</span>"
#: single.php:62
#: single.php:234 single.php.bak.php:160
msgid " 0 Comment"
msgstr " 0 commentaire"
#: single.php:62
#: single.php:234 single.php.bak.php:160
msgid " 1 Comment"
msgstr " 1 commentaire"
#: single.php:62
#: single.php:234 single.php.bak.php:160
msgid " Comments"
msgstr " Commentaires"
@@ -348,6 +351,12 @@ msgstr ""
msgid "http://dessign.net"
msgstr ""
#~ msgid "Tel: "
#~ msgstr "Tél. :"
#~ msgid "Email: "
#~ msgstr "Email :"
#~ msgid "0 Comment"
#~ msgstr "0 commentaire"

View File

@@ -1,6 +1,5 @@
<?php
get_header();
//include('exifer/exif.php');
?>
<div class="content">
<div class="container">
@@ -9,10 +8,6 @@ get_header();
<article class="post_box" id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<h1><?php the_title(); ?></h1>
<?php //echo get_stylesheet_directory_uri();
//$a = include(get_stylesheet_directory_uri() . '/exifer/exif.php');
//echo "a: " . $a;
?>
<div class="entry-meta">
<?php if (dess_setting('dess_display_meta') == true) creator_entry_meta(); ?>
<?php //edit_post_link( __( 'Edit', 'twentythirteen' ), '<span class="edit-link">', '</span>' ); ?>
@@ -21,23 +16,52 @@ get_header();
<?php
$coord = array();
xdebug_start_trace(null,XDEBUG_TRACE_HTML);
the_content();
xdebug_stop_trace();
?>
<?php //$content = apply_filters('the_content', get_the_content());
//echo $content;
<?php //echo '<div id="map" style="display: ' . ((count($coord) > 0) ? "block" : "none") . ';"></div>'; ?>
//preprint ($coord);
<script type="text/javascript">
echo '<div id="map" style="display: ' . ((count($coord) > 0) ? "block" : "none") . ';"></div>';
?>
jQuery(document).ready(function ($) { // wait until the document is ready
data = false;
<script>
function initMap() {
$('button#showmap').click(function(){
if (data == false) {
$.ajax({
url: "http://maps.googleapis.com/maps/api/js?key=AIzaSyB7cAx3NSH4dPM3Sx2oQeud7Zr-KaGXmLk&sensor=false&callback=MapApiLoaded",
dataType: "script",
timeout:8000,
success: function(data) {
// Run the code here that needs
// to access the data returned
data = true;
return data;
},
error: function() {
alert('Error occured');
}
});
}
$( "#locations" ).toggle( "fast");
$( "button#hidemap" ).show();
$( "button#showmap" ).hide();
}); // button#showmap
$('button#hidemap').click(function(){
$( "#locations" ).toggle( "fast");
$( "button#hidemap" ).hide();
$( "button#showmap" ).show();
data = true;
});
}); // jQuery
var map;
var markers = [];
var cnt;
var locations = [
<?php
$j = (count($coord) - 1);
@@ -45,46 +69,72 @@ get_header();
//echo "['<h4>" . $coord[$i][2] . "</h4>', " . $coord[$i][0] . ", " . $coord[$i][1] . "]" . (($i<$j) ? "," : "")."\r\n";
echo "['<span class\"infowindow\">" . $coord[$i][2] . "</span>', " . $coord[$i][0] . ", " . $coord[$i][1] . "]" . (($i<$j) ? "," : "")."\r\n";
}
?>
?>
];
// Setup the different icons and shadows
var iconURLPrefix = 'https://maps.google.com/mapfiles/ms/icons/';
function MapApiLoaded() {
var icons = [
iconURLPrefix + 'red-dot.png',
iconURLPrefix + 'green-dot.png',
iconURLPrefix + 'blue-dot.png',
iconURLPrefix + 'orange-dot.png',
iconURLPrefix + 'purple-dot.png',
iconURLPrefix + 'pink-dot.png',
iconURLPrefix + 'yellow-dot.png'
]
var iconsLength = icons.length;
// Setup the different icons and shadows
var iconURLPrefix = 'https://maps.google.com/mapfiles/ms/icons/';
window.map = new google.maps.Map(document.getElementById('map'), {
mapTypeId: google.maps.MapTypeId.ROADMAP
});
var icons = [
iconURLPrefix + 'red-dot.png',
iconURLPrefix + 'green-dot.png',
iconURLPrefix + 'blue-dot.png',
iconURLPrefix + 'orange-dot.png',
iconURLPrefix + 'purple-dot.png',
iconURLPrefix + 'pink-dot.png',
iconURLPrefix + 'yellow-dot.png'
]
var iconsLength = icons.length;
var infowindow = new google.maps.InfoWindow();
// Create google map
map = new google.maps.Map($('#gmap')[0], {
zoom:8,
mapTypeId:google.maps.MapTypeId.ROADMAP,
panControl:false,
streetViewControl:false,
mapTypeControl:true
});
var bounds = new google.maps.LatLngBounds();
infowindow = new google.maps.InfoWindow();
var markers = new Array();
var iconCounter = 0;
for (i = 0; i < locations.length; i++) {
marker = new google.maps.Marker({
position: new google.maps.LatLng(locations[i][1], locations[i][2]),
map: map,
icon: icons[iconCounter]
});
var bounds = new google.maps.LatLngBounds();
/*markers.push(marker);*/
var iconCounter = 0;
for (i = 0; i < locations.length; i++) {
marker = new google.maps.Marker({
position: new google.maps.LatLng(locations[i][1], locations[i][2]),
map: map,
icon: icons[iconCounter]
});
bounds.extend(marker.position);
markers.push(marker);
google.maps.event.addListener(marker, 'click', (function (marker, i) {
return function () {
var zoom = 1;
a = map.getZoom();
bounds.extend(marker.position);
// add the double-click event listener
google.maps.event.addListener(marker, 'dblclick', function() {
map.panTo(this.getPosition());
//map.setZoom(9);
if (zoom == 1) {
if (map.getZoom() < (a + 6)) {
map.setZoom(map.getZoom() + 2);
}
else zoom = 0;
}
else if (zoom == 0) {
if (map.getZoom() >= a) {
map.setZoom(map.getZoom() - 2);
}
else zoom = 1;
}
});
google.maps.event.addListener(marker, 'mousemove', (function (marker, i) {
return function () {
/*
var contentString = '<div id="content">'+
'<div id="siteNotice">'+
@@ -95,30 +145,54 @@ get_header();
'</div>';
infowindow.setContent(contentString);
*/
infowindow.setContent(locations[i][0]);
infowindow.open(map, marker);
}
})(marker, i));
infowindow.setContent(locations[i][0]);
infowindow.open(map, marker);
}
})(marker, i));
iconCounter++;
if (iconCounter >= iconsLength) {
iconCounter = 0;
}
iconCounter++;
if (iconCounter >= iconsLength) {
iconCounter = 0;
}
}
} // for
map.fitBounds(bounds);
map.fitBounds(bounds);
var listener = google.maps.event.addListener(map, "idle", function () {
map.setZoom(8);
google.maps.event.removeListener(listener);
});
}
} //MapApiLoaded
function jumpToMarker(cnt){
map.panTo(markers[cnt].getPosition());
if (map.getZoom() < 15) {
map.setZoom(a + 4);
}
setTimeout(function() {
infowindow.setContent(locations[cnt][0]);
infowindow.open(map, markers[cnt]);
}, 300);
} //jumpToMarker
</script>
<div id="locations">
<?php
$j = (count($coord) - 1);
echo "<div id='center_marker'><ul class='list_marker'>";
for ($i = 0; $i <= $j; $i++) {
//<a href="javascript:void(0);" onclick="jumpToMarker(4)" class="button3">PontDArc</a>
echo "<li><i class='ion-ios-location'></i><a href='javascript:void(0);' onclick='jumpToMarker(" . $i . ")'>" . $coord[$i][2] . "</a></li>";
}
echo "</ul></div>";
?>
<div id="gmap" style="width: 950px; height: 400px; border:1px solid black;" class="aligncenter"></div>
</div>
<button type="button" id="showmap"><?php _e('Show map','CreatorThemeRes-child'); ?></button>
<button type="button" id="hidemap"><?php _e('Hide map','CreatorThemeRes-child'); ?></button>

View File

@@ -163,6 +163,31 @@ input.search-field {
font-size: 10px;
}
div#locations {
display: none;
}
button#hidemap {
display: none;
}
div#center_marker {
width: 100%;
text-align: center;
}
ul.list_marker {
padding-left: 0;
margin: 2px auto;
}
.list_marker li {
display: inline;
font-size: 10px;
padding-right: 8px;
padding-left: 8px;
list-style-image: url(images/monde.png);
text-align: center;
}
.list_marker li:hover {
font-weight: bold;
}
.infowindow, .gm-style-iw {
color: #5f5f5f;
font: normal normal 12px "Lucida Grande", Lucida, Verdana, sans-serif;