Update maps

This commit is contained in:
Brian Miyaji
2016-07-08 02:34:38 +10:00
parent 40329320ad
commit 3d91a230c2
5 changed files with 18 additions and 62 deletions

View File

@@ -363,6 +363,7 @@
/* Google Maps */
.sp-google-map {
width: 100%;
height: 320px;
}
.sp-google-map img {

View File

@@ -1,23 +0,0 @@
window.google = window.google || {};
google.maps = google.maps || {};
(function() {
function getScript(src) {
document.write('<' + 'script src="' + src + '"' +
' type="text/javascript"><' + '/script>');
}
var modules = google.maps.modules = {};
google.maps.__gjsload__ = function(name, text) {
modules[name] = text;
};
google.maps.Load = function(apiLoad) {
delete google.maps.Load;
apiLoad([0.009999999776482582,[[["https://mts0.googleapis.com/vt?lyrs=m@248000000\u0026src=api\u0026hl=en-US\u0026","https://mts1.googleapis.com/vt?lyrs=m@248000000\u0026src=api\u0026hl=en-US\u0026"],null,null,null,null,"m@248000000",["https://mts0.google.com/vt?lyrs=m@248000000\u0026src=api\u0026hl=en-US\u0026","https://mts1.google.com/vt?lyrs=m@248000000\u0026src=api\u0026hl=en-US\u0026"]],[["https://khms0.googleapis.com/kh?v=144\u0026hl=en-US\u0026","https://khms1.googleapis.com/kh?v=144\u0026hl=en-US\u0026"],null,null,null,1,"144",["https://khms0.google.com/kh?v=144\u0026hl=en-US\u0026","https://khms1.google.com/kh?v=144\u0026hl=en-US\u0026"]],[["https://mts0.googleapis.com/vt?lyrs=h@248000000\u0026src=api\u0026hl=en-US\u0026","https://mts1.googleapis.com/vt?lyrs=h@248000000\u0026src=api\u0026hl=en-US\u0026"],null,null,null,null,"h@248000000",["https://mts0.google.com/vt?lyrs=h@248000000\u0026src=api\u0026hl=en-US\u0026","https://mts1.google.com/vt?lyrs=h@248000000\u0026src=api\u0026hl=en-US\u0026"]],[["https://mts0.googleapis.com/vt?lyrs=t@132,r@248000000\u0026src=api\u0026hl=en-US\u0026","https://mts1.googleapis.com/vt?lyrs=t@132,r@248000000\u0026src=api\u0026hl=en-US\u0026"],null,null,null,null,"t@132,r@248000000",["https://mts0.google.com/vt?lyrs=t@132,r@248000000\u0026src=api\u0026hl=en-US\u0026","https://mts1.google.com/vt?lyrs=t@132,r@248000000\u0026src=api\u0026hl=en-US\u0026"]],null,null,[["https://cbks0.googleapis.com/cbk?","https://cbks1.googleapis.com/cbk?"]],[["https://khms0.googleapis.com/kh?v=83\u0026hl=en-US\u0026","https://khms1.googleapis.com/kh?v=83\u0026hl=en-US\u0026"],null,null,null,null,"83",["https://khms0.google.com/kh?v=83\u0026hl=en-US\u0026","https://khms1.google.com/kh?v=83\u0026hl=en-US\u0026"]],[["https://mts0.googleapis.com/mapslt?hl=en-US\u0026","https://mts1.googleapis.com/mapslt?hl=en-US\u0026"]],[["https://mts0.googleapis.com/mapslt/ft?hl=en-US\u0026","https://mts1.googleapis.com/mapslt/ft?hl=en-US\u0026"]],[["https://mts0.googleapis.com/vt?hl=en-US\u0026","https://mts1.googleapis.com/vt?hl=en-US\u0026"]],[["https://mts0.googleapis.com/mapslt/loom?hl=en-US\u0026","https://mts1.googleapis.com/mapslt/loom?hl=en-US\u0026"]],[["https://mts0.googleapis.com/mapslt?hl=en-US\u0026","https://mts1.googleapis.com/mapslt?hl=en-US\u0026"]],[["https://mts0.googleapis.com/mapslt/ft?hl=en-US\u0026","https://mts1.googleapis.com/mapslt/ft?hl=en-US\u0026"]]],["en-US","US",null,0,null,null,"https://maps.gstatic.com/mapfiles/","https://csi.gstatic.com","https://maps.googleapis.com","https://maps.googleapis.com"],["https://maps.gstatic.com/intl/en_us/mapfiles/api-3/15/6","3.15.6"],[2178329814],1,null,null,null,null,0,"",null,null,1,"https://khms.googleapis.com/mz?v=144\u0026",null,"https://earthbuilder.googleapis.com","https://earthbuilder.googleapis.com",null,"https://mts.googleapis.com/vt/icon",[["https://mts0.googleapis.com/vt","https://mts1.googleapis.com/vt"],["https://mts0.googleapis.com/vt","https://mts1.googleapis.com/vt"],[null,[[0,"m",248000000]],[null,"en-US","US",null,18,null,null,null,null,null,null,[[47],[37,[["smartmaps"]]]]],0],[null,[[0,"m",248000000]],[null,"en-US","US",null,18,null,null,null,null,null,null,[[47],[37,[["smartmaps"]]]]],3],[null,[[0,"m",248000000]],[null,"en-US","US",null,18,null,null,null,null,null,null,[[50],[37,[["smartmaps"]]]]],0],[null,[[0,"m",248000000]],[null,"en-US","US",null,18,null,null,null,null,null,null,[[50],[37,[["smartmaps"]]]]],3],[null,[[4,"t",132],[0,"r",132000000]],[null,"en-US","US",null,18,null,null,null,null,null,null,[[5],[37,[["smartmaps"]]]]],0],[null,[[4,"t",132],[0,"r",132000000]],[null,"en-US","US",null,18,null,null,null,null,null,null,[[5],[37,[["smartmaps"]]]]],3],[null,null,[null,"en-US","US",null,18],0],[null,null,[null,"en-US","US",null,18],3],[null,null,[null,"en-US","US",null,18],6],[null,null,[null,"en-US","US",null,18],0],["https://mts0.google.com/vt","https://mts1.google.com/vt"],"/maps/vt"],2,500], loadScriptTime);
};
var loadScriptTime = (new Date).getTime();
getScript("https://maps.gstatic.com/intl/en_us/mapfiles/api-3/15/6/main.js");
})();

View File

@@ -1,27 +0,0 @@
(function($) {
function sp_maps() {
$maps = $('.sp-google-map');
$maps.each(function() {
$self = $(this);
address = $self.attr('data-address');
latitude = $self.attr('data-latitude');
longitude = $self.attr('data-longitude');
var ll = new google.maps.LatLng(latitude,longitude);
var mapOptions = {
scrollwheel: false,
zoom: parseInt(vars.zoom),
center: ll,
mapTypeId: google.maps.MapTypeId[vars.map_type]
};
var map = new google.maps.Map($self[0], mapOptions)
var marker = new google.maps.Marker({
position: ll,
map: map,
animation: google.maps.Animation.DROP,
flat: true,
title: address
});
});
}
google.maps.event.addDomListener(window, "load", sp_maps);
})(jQuery);

View File

@@ -75,12 +75,6 @@ class SP_Frontend_Scripts {
wp_enqueue_script( 'jquery-countdown', plugin_dir_url( SP_PLUGIN_FILE ) .'assets/js/jquery.countdown.min.js', array( 'jquery' ), '2.0.2', true );
wp_enqueue_script( 'sportspress', plugin_dir_url( SP_PLUGIN_FILE ) .'assets/js/sportspress.js', array( 'jquery' ), SP()->version, true );
if ( is_singular( 'sp_event' ) || is_tax( 'sp_venue' ) ):
wp_enqueue_script( 'google-maps', '//maps.googleapis.com/maps/api/js?v=3.exp&sensor=false', array(), '3.exp', true );
wp_enqueue_script( 'sp-maps', plugin_dir_url( SP_PLUGIN_FILE ) .'assets/js/sp-maps.js', array( 'jquery', 'google-maps' ), time(), true );
wp_localize_script( 'sp-maps', 'vars', array( 'map_type' => strtoupper( get_option( 'sportspress_map_type', 'ROADMAP' ) ), 'zoom' => get_option( 'sportspress_map_zoom', 15 ) ) );
endif;
// Localize scripts
wp_localize_script( 'sportspress', 'localized_strings', array( 'days' => __( 'days', 'sportspress' ), 'hrs' => __( 'hrs', 'sportspress' ), 'mins' => __( 'mins', 'sportspress' ), 'secs' => __( 'secs', 'sportspress' ), 'previous' => __( 'Previous', 'sportspress' ), 'next' => __( 'Next', 'sportspress' ) ) );

View File

@@ -2,22 +2,33 @@
/**
* Venue Map
*
* @author ThemeBoy
* @package SportsPress/Templates
* @author ThemeBoy
* @package SportsPress/Templates
* @version 0.8
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
if ( ! isset( $meta ) )
return;
return;
$address = sp_array_value( $meta, 'sp_address', null );
$address = urlencode( $address );
$latitude = sp_array_value( $meta, 'sp_latitude', null );
$longitude = sp_array_value( $meta, 'sp_longitude', null );
$zoom = get_option( 'sportspress_map_zoom', 15 );
$maptype = get_option( 'sportspress_map_type', 'roadmap' );
$maptype = strtolower( $maptype );
if ( 'satellite' !== $maptype ) $maptype = 'roadmap';
if ( $latitude != null && $longitude != null ):
?>
<div class="sp-google-map<?php if ( is_tax( 'sp_venue' ) ): ?> sp-venue-map<?php endif; ?>" data-address="<?php echo $address; ?>" data-latitude="<?php echo $latitude; ?>" data-longitude="<?php echo $longitude; ?>"></div>
<?php
?>
<iframe
class="sp-google-map<?php if ( is_tax( 'sp_venue' ) ): ?> sp-venue-map<?php endif; ?>"
width="600"
height="320"
frameborder="0" style="border:0"
src="https://www.google.com/maps/embed/v1/place?key=AIzaSyAWyt_AG0k_Pgz4LuegtHwesA_OMRnSSAE&amp;q=<?php echo $address; ?>&amp;center=<?php echo $latitude; ?>,<?php echo $longitude; ?>&amp;zoom=<?php echo $zoom; ?>" allowfullscreen>
</iframe>
<?php
endif;