myjavascript.js:
function initialize() {
var waStyle = [
{
featureType: "all",
stylers: [
{ saturation: -100 }
]
}
];
var mysiteMap = new google.maps.StyledMapType(waStyle,{name: "Nuance"});
var img = new google.maps.MarkerImage("/themes/nuance/img/pin.png");
var myLatlng = new google.maps.LatLng(41.061833,28.997948);
var mapOptions = {
zoom: 16,
center: myLatlng,
disableDefaultUI: true,
mapTypeControlOptions: {
mapTypeIds: [google.maps.MapTypeId.ROADMAP, 'mysite_map'],
}
};
var map = new google.maps.Map(document.getElementById('mainmap'), mapOptions);
var point = new google.maps.LatLng(41.061833,28.997948);
var marker = new google.maps.Marker({
position: point,
map: map,
animation: google.maps.Animation.DROP,
icon: img
})
map.mapTypes.set('mysite_map', mysiteMap);
map.setMapTypeId('mysite_map');
}
function loadScript() {
var script = document.createElement("script");
script.type = "text/javascript";
script.src = "http://maps.googleapis.com/maps/api/js?sensor=false&callback=initialize";
document.body.appendChild(script);
}
window.onload = loadScript;
And include in my node via field. (text format: php code)
<?php include('themes/mytheme/scripts/maps/myjavascript.js'); ?>
But get error.
On site:
function initialize() { var waStyle = [ { featureType: "all", stylers: [ { saturation: -100 } ]
...
What's my problem and how can i fix it?