window.addEventListener('load' , function (){ var metaData = document.head.children; var metaLength = metaData.length; var mapsApiKey = ''; for(var i = 0;i < metaLength;i++){ var propertyName = metaData[i].getAttribute('name'); if( propertyName === 'c2googleMapsApiKey'){ mapsApiKey = metaData[i].getAttribute('content'); } } /* for googleAPI Key exists */ if( mapsApiKey.length > 0 ){ function initialize149() { var latlng149 = new google.maps.LatLng(34.51537, 135.77933); var pan=149; var myOptions149 = { zoom: 16, center: latlng149, mapTypeId: google.maps.MapTypeId.ROADMAP }; //centering if( document.getElementById(pan).children.length == 1 ) { if( document.getElementById(pan).children[0].children[0].tagName == 'BR' ) { var gmapDiv = document.getElementById(pan).children[0].children[3].children[0] } else { var gmapDiv = document.getElementById(pan).children[0].children[2].children[0] } } else { //beforeBR if( document.getElementById(pan).children[0].tagName == 'BR' ) { var gmapDiv = document.getElementById(pan).children[3].children[0] } else { var gmapDiv = document.getElementById(pan).children[2].children[0] } } var google_map149 = new google.maps.Map( gmapDiv, myOptions149 ); var marker149 = new google.maps.Marker({ position: latlng149, map: google_map149 }) } initialize149(); /* for googleAPI Key not exists(openStreetMap) */ }else{ var attr = document.getElementById(149); attr = attr.getElementsByTagName('center'); attr = attr[0].getElementsByTagName('div'); attr[0].setAttribute('id' , 'openStreetMap149'); var map149 = L.map( 'openStreetMap149' ).setView([34.51537,135.77933], 17 ); var tileLayer = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',{ attribution: '(c) OpenStreetMap contributors, CC-BY-SA', maxZoom: 19 }); tileLayer.addTo(map149); L.marker([34.51537,135.77933]).addTo(map149); } });