This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var page = null; | |
//Depois que o documento carregar... | |
$(document).ready(function () { | |
//vamos instanciar um objeto Page, que é um model | |
page = new Page(); | |
//quando o documento terminar de carregar, vamos chamar | |
//esse método, necessário para usarmos o Router. | |
//Veja na documentação: http://documentcloud.github.com/backbone/#Router |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Você deve lembrar que PHP é uma tecnologia server-side e realiza processamento antes de entregar | |
//a página para o usuário. Vamos nos aproveitar disso para fazer a solicitação para o twitter... | |
//A primeira parte da url. Vamos usar a busca do twitter e nossa resposta será um json | |
$searchUrl = 'http://search.twitter.com/search.json?'; | |
//o conteúdo da nossa busca é a variável 'searchUrl' concatenada com a string 'q=%23javascript' | |
//que equivale a '#javascript'. Concatenando, temos uma url para busca de hashtags |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Vamos criar uma variável 'myMap' global | |
var myMap = null; | |
//pointsArray guarda o nome de cada imagem que temos. São 13 ao total | |
var pointsArray = ['p1.png', 'p2.png', 'p3.png', 'p4.png', 'p5.png', 'p6.png', 'p7.png', 'p8.png', | |
'p9.png', 'p10.png', 'p11.png', 'p12.png', 'p13.png']; | |
//Quando o documento estiver pronto... | |
window.onload = function () { | |
plotMap(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<meta http-equiv="content-type" content="text/html; charset=UTF-8" /> | |
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false&libraries=geometry"></script> | |
<script type="text/javascript" src="js/jquery-1.9.0.js"></script> | |
<script type="text/javascript" src="js/geolocation-elevation.js"></script> | |
</head> | |
<body> | |
<!--Adicionei o style inline para não mostrar tanto arquivo no blog. Não façam isso. É feio--> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Vamos criar uma variável 'myMap' global | |
var myMap = null; | |
//Quando o documento estiver pronto... | |
window.onload = function () { | |
//A função que plota o mapa é a mesma que já usamos duas vezes. | |
//Não temos nada de novo. No entanto, onde adicionamos o evento | |
//chamamos getInfo passando a coordenada como argumento | |
plotMap(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<meta http-equiv="content-type" content="text/html; charset=UTF-8" /> | |
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> | |
<script type="text/javascript" src="js/jquery-1.9.0.js"></script> | |
<script type="text/javascript" src="js/geolocation-elevation.js"></script> | |
</head> | |
<body> | |
<!--Adicionei o style inline para não mostrar tanto arquivo no blog. Não façam isso. É feio--> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Entenda o motivo desse 'use strict' aqui | |
//http://ejohn.org/blog/ecmascript-5-strict-mode-json-and-more/ | |
//vai ajudar numa série de coisas, uma delas é suporte nativo a JSON | |
"use strict"; | |
//título do processo | |
process.title = 'server'; | |
//a porta que o servidor ouvirá | |
var port = 1337; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//criamos uma variável 'connection' | |
var connection = null; | |
//depois do carregamento da página, chamamos 'setConnection' | |
//e 'setEvents' | |
window.onload = function () { | |
setConnection(); | |
setEvents(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Websocket Server com Node.js</title> | |
<script src="js/websocket-test.js"></script> | |
</head> | |
<body> | |
<div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Entenda o motivo desse 'use strict' aqui | |
//http://ejohn.org/blog/ecmascript-5-strict-mode-json-and-more/ | |
//vai ajudar numa série de coisas, uma delas é suporte nativo a JSON | |
"use strict"; | |
//título do processo | |
process.title = 'server'; | |
//a porta que o servidor ouvirá | |
var port = 1337; |