copy dari repo om Irfan
This commit is contained in:
@@ -0,0 +1,107 @@
|
||||
|
||||
(function( $ ) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var initBasic = function() {
|
||||
new GMaps({
|
||||
div: '#gmap-basic',
|
||||
lat: -12.043333,
|
||||
lng: -77.028333
|
||||
});
|
||||
};
|
||||
|
||||
var initBasicWithMarkers = function() {
|
||||
var map = new GMaps({
|
||||
div: '#gmap-basic-marker',
|
||||
lat: -12.043333,
|
||||
lng: -77.028333,
|
||||
markers: [{
|
||||
lat: -12.043333,
|
||||
lng: -77.028333,
|
||||
infoWindow: {
|
||||
content: '<p>Basic</p>'
|
||||
}
|
||||
}]
|
||||
});
|
||||
|
||||
map.addMarker({
|
||||
lat: -12.043333,
|
||||
lng: -77.028333,
|
||||
infoWindow: {
|
||||
content: '<p>Example</p>'
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
var initStatic = function() {
|
||||
var url = GMaps.staticMapURL({
|
||||
size: [725, 500],
|
||||
lat: -12.043333,
|
||||
lng: -77.028333,
|
||||
scale: 1
|
||||
});
|
||||
|
||||
$('#gmap-static')
|
||||
.css({
|
||||
backgroundImage: 'url(' + url + ')',
|
||||
backgroundSize: 'cover'
|
||||
});
|
||||
};
|
||||
|
||||
var initContextMenu = function() {
|
||||
var map = new GMaps({
|
||||
div: '#gmap-context-menu',
|
||||
lat: -12.043333,
|
||||
lng: -77.028333
|
||||
});
|
||||
|
||||
map.setContextMenu({
|
||||
control: 'map',
|
||||
options: [
|
||||
{
|
||||
title: 'Add marker',
|
||||
name: 'add_marker',
|
||||
action: function(e) {
|
||||
this.addMarker({
|
||||
lat: e.latLng.lat(),
|
||||
lng: e.latLng.lng(),
|
||||
title: 'New marker'
|
||||
});
|
||||
}
|
||||
},
|
||||
{
|
||||
title: 'Center here',
|
||||
name: 'center_here',
|
||||
action: function(e) {
|
||||
this.setCenter(e.latLng.lat(), e.latLng.lng());
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
};
|
||||
|
||||
var initStreetView = function() {
|
||||
var gmap = GMaps.createPanorama({
|
||||
el: '#gmap-street-view',
|
||||
lat : 48.85844,
|
||||
lng : 2.294514
|
||||
});
|
||||
|
||||
$(window).on( 'sidebar-left-toggle', function() {
|
||||
google.maps.event.trigger( gmap, 'resize' );
|
||||
});
|
||||
};
|
||||
|
||||
// auto initialize
|
||||
$(function() {
|
||||
|
||||
initBasic();
|
||||
initBasicWithMarkers();
|
||||
initStatic();
|
||||
initContextMenu();
|
||||
initStreetView();
|
||||
|
||||
});
|
||||
|
||||
}).apply(this, [ jQuery ]);
|
||||
@@ -0,0 +1,38 @@
|
||||
|
||||
|
||||
(function( $ ) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var $window = $(window);
|
||||
|
||||
/* Fix Map size on Mobile */
|
||||
function fixMapListener() {
|
||||
|
||||
fixMapSize();
|
||||
|
||||
$(window).on('load resize orientationchange', function() {
|
||||
fixMapSize();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function fixMapSize() {
|
||||
if ( $window.width() <= 767 ) {
|
||||
|
||||
var windowHeight = $(window).height(),
|
||||
offsetTop = $('#gmap').offset().top,
|
||||
contentPadding = parseInt($('.content-body').css('padding-bottom'), 10);
|
||||
|
||||
$('#gmap').height( windowHeight - offsetTop - contentPadding );
|
||||
}
|
||||
}
|
||||
|
||||
// auto initialize
|
||||
$(function() {
|
||||
|
||||
fixMapListener();
|
||||
|
||||
});
|
||||
|
||||
}).apply(this, [ jQuery ]);
|
||||
@@ -0,0 +1,31 @@
|
||||
|
||||
|
||||
(function( $ ) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var initMap = function( $el, options ) {
|
||||
var defaults = {
|
||||
backgroundColor: null,
|
||||
color: '#FFFFFF',
|
||||
hoverOpacity: 0.7,
|
||||
selectedColor: '#005599',
|
||||
enableZoom: true,
|
||||
borderWidth:1,
|
||||
showTooltip: true,
|
||||
values: sample_data,
|
||||
scaleColors: ['#1AA2E6', '#0088CC'],
|
||||
normalizeFunction: 'polynomial'
|
||||
};
|
||||
|
||||
$el.vectorMap( $.extend( defaults, options ) );
|
||||
};
|
||||
|
||||
$(function() {
|
||||
$( '[data-vector-map]' ).each(function() {
|
||||
var $this = $(this);
|
||||
initMap( $this, ($this.data( 'plugin-options' ) || {}) )
|
||||
});
|
||||
});
|
||||
|
||||
}).apply( this, [ jQuery ]);
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user