Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


                	<button onClick="initialize()">Iniciar!</button>
	<input type="text" id="endereco" />
	<select name="avaliacao" id="avaliacao">
		<option name="avaliacao" value="0">Muito Bom</option>	
		<option name="avaliacao" value="1">Bom</option>	
		<option name="avaliacao" value="2">Meh</option>	
		<option name="avaliacao" value="3">Ruim</option>	
		<option name="avaliacao" value="4">Péssimo</option>	
	<button onclick="novoLocal()">Avaliar</button>
	<div id="map_canvas" style="width:600px; height:300px"></div>
	<div id="listaDeMarcadores">
<p>Veja o artigo em <a href=""></a></p>




                console.log('testando o arquivo :)');
var inicial = {
	latitude: -25.428777
	, longitude: -49.3435829
var divDoMapa = document.getElementById("map_canvas")
var opcoes = { 
  center: new google.maps.LatLng(inicial.latitude, inicial.longitude)
  , zoom: 10
  , mapTypeId: google.maps.MapTypeId.HYBRID

function initialize() {
	 			geocoder = new google.maps.Geocoder();
        map = new google.maps.Map(divDoMapa, opcoes);
        var autoCompleteInput = document.getElementById('endereco');
				var autoCompleteOpcoes = {types: ['geocode']};
				autocomplete = new google.maps.places.Autocomplete(autoCompleteInput,autoCompleteOpcoes);

var imagens = {
	muitoBom: ''
	, bom: ''
	, medio: ''
	, ruim: ''
	, pessimo: ''

var marcadores = [];
var criaMarcador = function(marcador, mapa) {
  var posicao = new google.maps.LatLng(marcador.latitude, marcador.longitude);
  var opcoes = {
    position: posicao
    , title: marcador.titulo
    , animation: google.maps.Animation.DROP
    , icon:{
    		url: marcador.imagem
    		, scaledSize: new google.maps.Size(50, 50)
    , map: mapa
	var novoMarcador = new google.maps.Marker(opcoes);

function converteEndereco(endereco, avaliacao) {
  geocoder.geocode( { 'address': endereco}, function(resultado, status) {
    if (status == google.maps.GeocoderStatus.OK) {
      var marcador = {
		      	latitude: resultado[0].geometry.location.k
				, longitude: resultado[0].geometry.location.D	
				, titulo: 'Novo marcador'
				, imagem: avaliacao
	     criaMarcador(marcador, map)
    } else {
      alert('Erro ao converter endereço: ' + status);

var imgArray = [imagens.muitoBom,, imagens.medio, imagens.ruim, imagens.pessimo]

function novoLocal() {
	var local = autocomplete.getPlace();
	var seletor = document.getElementById("avaliacao");
	var avaliacao = seletor.options[seletor.selectedIndex].value;
	var imagemMarcador = imgArray[avaliacao];
	var marcador = {
		latitude: local.geometry.location.k
		, longitude: local.geometry.location.D	
		, titulo:
		, imagem: imagemMarcador
	criaMarcador(marcador, map);

function listaMarcadores(){
	var qtdMarcadores = marcadores.length;
	var listaDeMarcadores = document.getElementById('listaDeMarcadores');
	listaDeMarcadores.innerHTML = "";
	for (var i = 0; i < qtdMarcadores; i++) {
	  var btn = document.createElement('button');