Compare commits

..

No commits in common. "0d18486fc779b09239ab5fcef6d7a5c27ed62a49" and "66cfd8dff4014d994b40321b1c8d315182858fb5" have entirely different histories.

4 changed files with 33 additions and 36 deletions

View File

@ -1 +0,0 @@
div.soinumapa-map{ width:100%;height:50vh;}

View File

@ -14,20 +14,27 @@
}, },
init: function (selector, query){ init: function (selector, query){
mapboxUrl = 'https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoibHJ1bGxvIiwiYSI6ImNpaDUydjdoNTAwd3BzdGx5bGlhOTh6bXYifQ.tE8QgNbVSgwP8V5LnJWA3w'; console.log(selector+'.... '+query);
var grayscale = L.tileLayer(mapboxUrl, {id: 'mapbox/light-v10'}), //this.map = L.map(selector,{center: [this.origin.lat, this.origin.lng], zoom: this.origin.zoom, scrollWheelZoom: false});
streets = L.tileLayer(mapboxUrl, {id: 'mapbox/streets-v11'}), L.mapbox.accessToken = 'pk.eyJ1IjoibHJ1bGxvIiwiYSI6ImNpaDUydjdoNTAwd3BzdGx5bGlhOTh6bXYifQ.tE8QgNbVSgwP8V5LnJWA3w';
osm = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'); this.map = L.mapbox.map(selector,'lrullo.cih52v78z00v4krkrzge97rgg',{center: [this.origin.lat, this.origin.lng], zoom: this.origin.zoom, scrollWheelZoom: false});
this.map = L.map(selector,{center: [this.origin.lat, this.origin.lng], zoom: this.origin.zoom, layers: [osm,grayscale,streets]}); /*this.layers.SATELLITE = new L.Google();
this.map.addControl( this.layers.TERRAIN = new L.Google('TERRAIN');
new L.Control.Layers( this.layers.HYBRID = new L.Google('HYBRID');
{ this.layers.ROADMAP = new L.Google('ROADMAP');*/
'OSM': osm, //this.layers.MAPBOX
'Grayscale':grayscale, //this.map.addLayer(this.layers[this.mapType]);
'Streets': streets /*this.map.addControl(
}, {} new L.Control.Layers(
) {
); 'Google':this.layers.SATELLITE,
'Google Terrain': this.layers.TERRAIN,
'Google Hybrid': this.layers.HYBRID,
'Google Roadmap': this.layers.ROADMAP
}, {}
)
);*/
//_.bindAll(this);
options = { options = {
type: 'POST', type: 'POST',
@ -39,8 +46,10 @@
} }
}; };
console.log(options);
// Use with PHP's wp_send_json_success() and wp_send_json_error() // Use with PHP's wp_send_json_success() and wp_send_json_error()
$.ajax( options ).done(this.ajaxDone).fail(this.ajaxFail); $.ajax( options ).done(this.ajaxDone).fail(this.ajaxFail);
console.log(this.infos);
}, },
addMapCallback: function (event, callback){ addMapCallback: function (event, callback){
@ -48,7 +57,7 @@
}, },
onMarkerClick: function(event){ onMarkerClick: function(event){
self = window.Soundmap; self = window.Soundmap;
var id = event.target.feature.properties.id; var id = event.target.feature.properties.id;
self.ajaxMarker = event.target; self.ajaxMarker = event.target;
if(self.infos[id]){ if(self.infos[id]){
@ -91,14 +100,13 @@
}, },
ajaxDone: function(response){ ajaxDone: function(response){
console.log('done'+response);
var self = this; var self = this;
this.markers = L.geoJson(response.data,{ this.markers = L.geoJson(response.data,{
onEachFeature: function(feature, layer){ onEachFeature: function(feature, layer){
layer.on('click', self.onMarkerClick); layer.on('click', self.onMarkerClick);
} }
}).addTo(this.map); }).addTo(this.map);
this.map.fitBounds(this.markers.getBounds());
}, },
ajaxFail: function(){ ajaxFail: function(){
console.log(this); console.log(this);
@ -108,9 +116,8 @@
$(document).ready(function(){ $(document).ready(function(){
//soundmap.initMap(); //soundmap.initMap();
if ($('#map_canvas').length) { soundmap.init('map-content','');
soundmap.init('map_canvas',''); console.log('document.ready');
}
}); });

View File

@ -31,15 +31,6 @@ if (!class_exists('Soundmap')){
//Register hooks and filters //Register hooks and filters
$this->register_hooks(); $this->register_hooks();
$this->register_filters(); $this->register_filters();
$this->register_shortcode();
}
function register_shortcode() {
add_shortcode('soinumapa-map',array($this,'shortcode_map'));
}
function shortcode_map($atts) {
return '<div id="map_canvas" class="soinumapa-map"></div>';
} }
function register_content_type(){ function register_content_type(){
@ -180,8 +171,8 @@ if (!class_exists('Soundmap')){
}// admin_menu }// admin_menu
function enqueue_map_scripts(){ function enqueue_map_scripts(){
wp_enqueue_script('leafletjs','https://unpkg.com/leaflet@1.9.3/dist/leaflet.js',array(),'1.9.3',TRUE); // add Leaflet.js wp_enqueue_script('leafletjs','https://unpkg.com/leaflet@1.6.0/dist/leaflet.js',array(),'1.6.0',TRUE); // add Leaflet.js
wp_enqueue_style('leafletcss',"https://unpkg.com/leaflet@1.9.3/dist/leaflet.css",array(),'1.9.3','all'); // add CSS Leaflet wp_enqueue_style('leafletcss',"https://unpkg.com/leaflet@1.6.0/dist/leaflet.css",array(),'1.6.0','all'); // add CSS Leaflet
} }
function wp_enqueue_scripts(){ function wp_enqueue_scripts(){
@ -409,7 +400,7 @@ if (!class_exists('Soundmap')){
) )
); );
}); });
function marker_get_georeference ($object, $field_name, $request){ function marker_get_georeference ($object, $field_name, $request){
//return $object['id']; //return $object['id'];
$lat = get_post_meta($object['id'], 'soundmap_marker_lat', true); $lat = get_post_meta($object['id'], 'soundmap_marker_lat', true);
@ -425,7 +416,7 @@ if (!class_exists('Soundmap')){
$files = get_post_meta($object['id'], 'soundmap_attachments_id', FALSE); $files = get_post_meta($object['id'], 'soundmap_attachments_id', FALSE);
$files_str = []; $files_str = [];
if ($files) : if ($files) :
foreach($files as $file){ foreach($files as $file){
$data = wp_prepare_attachment_for_js( $file ); $data = wp_prepare_attachment_for_js( $file );
array_push($files_str,$data); array_push($files_str,$data);
} }
@ -438,7 +429,7 @@ if (!class_exists('Soundmap')){
add_action('wp_ajax_nopriv_soundmap_verify_captcha', array($this, 'verify_captcha'));*/ add_action('wp_ajax_nopriv_soundmap_verify_captcha', array($this, 'verify_captcha'));*/
} }
function add_feed(){ function add_feed(){
global $wp_rewrite; global $wp_rewrite;

View File

@ -10,7 +10,7 @@
<?php if(isset($mark->autor) && $mark->autor){ ?> <p class="marker-info"><?php echo __('Author', 'soundmap') . ': ' . $mark->autor; ?></br><?php } ?> <?php if(isset($mark->autor) && $mark->autor){ ?> <p class="marker-info"><?php echo __('Author', 'soundmap') . ': ' . $mark->autor; ?></br><?php } ?>
<hr class="clear"> <hr class="clear">
<!--audio class="soundmap-audio-player not-processed" src="<?php echo $mark->files[0]['url'] ?>"></audio--> <!--audio class="soundmap-audio-player not-processed" src="<?php echo $mark->files[0]['url'] ?>"></audio-->
<audio class="" src="<?php echo $mark->files[0]['url'] ?>" controls=controls style="max-width:100%;" autoplay></audio> <audio class="" src="<?php echo $mark->files[0]['url'] ?>" controls=controls style="max-width:100%;"></audio>
<div class="marker-info"> <div class="marker-info">
<?php the_tags(__('Tags','soundmap') . ': ', ' | ', '</br>'); ?> <?php the_tags(__('Tags','soundmap') . ': ', ' | ', '</br>'); ?>
<?php echo __('Categories','soundmap') . ': '; the_category(' | '); ?> <?php echo __('Categories','soundmap') . ': '; the_category(' | '); ?>