Created
March 29, 2014 21:33
-
-
Save S0c5/9863412 to your computer and use it in GitHub Desktop.
adasdasdasdasdasd
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
<html> | |
<head><title>Hello</title></head> | |
<body> | |
<script src="bower_components/socket.io-client/dist/socket.io.js"></script> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> | |
<script> | |
var User={ | |
times: 0, | |
state: "out" | |
} | |
var i_total = 0 | |
var route = [ { location: [ 6, 4 ] }, | |
{ location: [ 7, 4 ] }, | |
{ location: [ 8, 4 ] }, | |
{ location: [ 9, 4 ] }, | |
{ location: [ 10, 4 ] }, | |
{ location: [ 11, 4 ] }, | |
{ location: [ 12, 4 ] }, | |
{ location: [ 13, 4 ] }, | |
{ location: [ 14, 4 ] }, | |
{ location: [ 15, 4 ] }, | |
{ location: [ 16, 4 ] }, | |
{ location: [ 17, 4 ] }, | |
{ location: [ 18, 4 ] }, | |
{ location: [ 19, 4 ] }, | |
{ location: [ 20, 4 ] }, | |
{ location: [ 21, 4 ] }, | |
{ location: [ 22, 4 ] }, | |
{ location: [ 23, 4 ] }, | |
{ location: [ 24, 4 ] }, | |
{ location: [ 25, 4 ] }, | |
{ location: [ 26, 4 ] } ] | |
var direction = true | |
function send() | |
{ | |
console.log("send => ") | |
console.log(route[i_total].location) | |
console.log(User.times); | |
console.log(User.state); | |
socket.emit('push_location',{location: route[i_total].location, times: User.times}) | |
if (direction) | |
{ | |
i_total++; | |
} | |
else | |
{ | |
i_total--; | |
} | |
if (i_total>=route.length) | |
{ | |
direction=false; | |
i_total--; | |
} | |
if (i_total<=0) | |
{ | |
i_total++; | |
direction=true; | |
} | |
} | |
var pasos = [ | |
[1,2], | |
[1,2] | |
] | |
var send_potition = function () | |
{ | |
//navigator.geolocation.getCurrentPosition(onSucessLocation, | |
} | |
var onErrorLocation = function(data) | |
{ | |
console.log("error :( Al enviar tu ubicacion, Enciende Tu GPS"); | |
} | |
var onSuccesLocation = function(data) | |
{ | |
var lat = position.coords.latitude; | |
var lon = position.coords.longitude; | |
socket.emit('push_location',{location: [ 6, 4 ], times: 2}) | |
} | |
var socket = io.connect("http://localhost:81"); | |
var log = function(data){ | |
console.log(data) | |
} | |
socket.on('error',log); | |
socket.on('success_login',log); | |
socket.on('success_logout',log); | |
socket.on('need_login',log) | |
socket.on('change_status',log) | |
socket.on('success_push_location',function(data) | |
{ | |
if (data.state_user != User.state) | |
{ | |
User.state=data.state_user; | |
User.times=0; | |
} | |
else | |
{ | |
User.times++; | |
} | |
console.log(data) | |
}) | |
socket.emit('login', { email: '[email protected]', name: "david_barinas" }); | |
socket.emit('logout'); | |
// location [logitud, latitud], | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment