Skip to content
Browse files

Merge branch 'master' of github.com:leecrossley/appsassin

  • Loading branch information...
2 parents b225e03 + f92001e commit 4badb11edae4dd77454afcd620a983036598987a @leecrossley committed
View
1 app.js
@@ -21,5 +21,6 @@ var app = express();
require('./config/express')(app, config);
require('./config/routes')(app);
+
app.listen(config.port);
View
1 app/controllers/home.js
@@ -1,4 +1,5 @@
var mongoose = require('mongoose');
exports.index = function(req, res){
+ res.render('home', {title: 'express'});
};
View
29 app/controllers/location.js
@@ -48,6 +48,35 @@ var nearTo = function(lon1, lat1, lon2, lat2) {
return d/1000; // distance in m
};
+exports.god = function(req, res) {
+
+ var gameId = "526ca9fdc039fa2521000007";
+
+ Game.find({}, function(err, games){
+
+ Location.aggregate(
+ { $group: { _id: '$userId' , maxDate: { $max: '$date' },
+ locations: { $push: '$loc' } }}
+ //, { $sort : { name : 1 } }
+ ,
+ function(err, locations){
+ res.json({
+ games: games,
+ players: locations,
+ })
+ });
+ /*console.log(err);
+ if (err) return handleError(err);
+ console.log(res); // [ { maxAge: 98 } ]*/
+ });
+
+ /*Location.find ({ gameId: gameId },
+
+ });*/
+
+
+};
+
exports.track = function(req, res) {
var gameId = req.body.gameId;
View
BIN app/public/css/brfont.woff
Binary file not shown.
View
181 app/public/css/index.css
@@ -0,0 +1,181 @@
+* {
+ -webkit-tap-highlight-color: rgba(0,0,0,0); /* make transparent link selection, adjust last value opacity 0 to 1.0 */
+}
+
+@font-face {
+ font-family: "brfont";
+ font-style: normal;
+ font-weight: 400;
+ src: local("brfont"), url(brfont.woff) format("woff");
+ src: local("brfont"), url("brfont.ttf") format("truetype");
+}
+
+body {
+ -webkit-touch-callout: none; /* prevent callout to copy image, etc when tap to hold */
+ -webkit-text-size-adjust: none; /* prevent webkit from resizing text to fit */
+ -webkit-user-select: none; /* prevent copy paste, to allow, change 'none' to 'text' */
+ background-color: #000;
+ background-image: url("../img/back2.jpg");
+ background-repeat: no-repeat;
+ background-size: cover;
+ background-position: center;
+ color: #FFF;
+ background-attachment: fixed;
+ font-family: "HelveticaNeue-Light", "HelveticaNeue", Helvetica, Arial, sans-serif;
+ font-size: 12px;
+ height: 100%;
+ margin: 0px;
+ padding: 0px;
+ width: 100%;
+}
+
+.ios7 header {
+ border-top: 20px solid #B60101;
+}
+
+header {
+ background-color: #B60101;
+ position: relative;
+ left: 0px;
+ top: 0px;
+ zoom: 1;
+ width: 100%;
+ margin: 0px;
+ padding: 0px;
+ height: 44px;
+ overflow: hidden;
+}
+
+header h1 {
+ color: #FFF;
+ font-weight: normal;
+ min-height: 44px;
+ line-height: 44px;
+ text-align: center;
+ font-size: 30px;
+ display: block;
+ margin: 2px 50px;
+ padding: 0;
+ text-overflow: ellipsis;
+ text-transform: uppercase;
+ overflow: hidden;
+ white-space: nowrap;
+ zoom: 1;
+ outline: 0 !important;
+ font-family: "brfont";
+}
+
+div.container {
+ margin: 15px;
+}
+
+div.container h3 {
+ margin: 50px 0;
+ text-align: center;
+ font-size: 16px;
+}
+
+.map {
+ height: 100%;
+ width: 100%;
+ position: absolute;
+}
+
+div.olControlZoom {
+ display: none!important;
+}
+
+div.olMapViewport {
+ -ms-touch-action: none;
+}
+
+.olLayerGrid .olTileImage {
+ -webkit-transition: opacity 0.2s linear;
+ -moz-transition: opacity 0.2s linear;
+ -o-transition: opacity 0.2s linear;
+ transition: opacity 0.2s linear;
+}
+
+.olTileImage {
+ -webkit-transform: translateZ(0);
+ -moz-transform: translateZ(0);
+ -o-transform: translateZ(0);
+ -ms-transform: translateZ(0);
+ transform: translateZ(0);
+ -webkit-backface-visibility: hidden;
+ -moz-backface-visibility: hidden;
+ -ms-backface-visibility: hidden;
+ backface-visibility: hidden;
+ -webkit-perspective: 1000;
+ -moz-perspective: 1000;
+ -ms-perspective: 1000;
+ perspective: 1000;
+}
+
+button {
+ font-family: "brfont";
+ display: block;
+ padding: 0.5em 1em;
+ font-size: 2em;
+ text-transform: uppercase;
+ border-radius: .3em;
+ border: 1px solid black;
+ background-color: #000;
+ background-image: url("../img/button.jpg");
+ background-repeat: no-repeat;
+ background-size: cover;
+ background-position: center;
+ /*box-shadow: inset 0 .1em rgba(255,255,255,0.1), 0 .1em .1em black, 0 0.2em rgba(255,255,255,0.1), 0 0 0 .2em rgba(0,0,0,0.1);*/
+ color: #B60101;
+ margin: 75px auto;
+}
+
+button:hover {
+ text-shadow: 0 0 .3em #B60101;
+}
+
+button:active {
+ text-shadow: 0 0 .3em #B60101;
+ top: 0.1em;
+ /*box-shadow: inset 0 .1em rgba(255,255,255,0.1), 0 0.1em rgba(255,255,255,0.1), 0 -0.1em 0 .2em rgba(0,0,0,0.1);*/
+}
+
+input {
+ display: block;
+ font-size: 14px;
+ width: 240px;
+ margin: 25px auto;
+ padding: 10px 8px 10px 8px;
+ border-radius: 5px;
+ box-shadow: inset 0 1px 2px rgba(0,0,0, .55), 0px 1px 1px rgba(255,255,255,.5);
+ border: 1px solid #666;
+ opacity: 0.5;
+}
+
+input:hover,
+input:focus {
+ opacity: 0.8;
+ color: #B60101;
+ font-weight: bold;
+ box-shadow: inset 0 1px 2px rgba(255,255,255, .35), 0px 1px 15px rgba(0,246,255,.5);
+ border: 1px solid #B60101;
+ outline: none;
+}
+
+footer {
+ z-index: 1000;
+ height: 44px;
+ width: 100%;
+ overflow: hidden;
+ background: transparent url("../img/footer.jpg");
+ background-size: cover;
+ background-position: right;
+ position: absolute;
+ bottom: 0;
+ left: 0;
+}
+
+footer button {
+ margin: 2px;
+ padding: 0.24em 1em;
+}
View
81 app/views/home/index.jade
@@ -1,4 +1,79 @@
-extends ../layout
+!!! 5
+html
+ head
+ title Appsassin - God View
+ meta(name='viewport', content='initial-scale=1.0, user-scalable=no')
+ meta(charset='utf-8')
+ style
+ html, body, #map-canvas {
+ height: 100%;
+ margin: 0px;
+ padding: 0px
+ }
+ script(src='https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false')
+ script(src='http://codeorigin.jquery.com/jquery-2.0.3.min.js')
+ script.
+ var map;
+ var gameCentre = new google.maps.LatLng(53.47740162040098, -2.255028915204226);
-block content
- h1 I'm using generator-express MVC!
+ function initialize() {
+ var mapOptions = {
+ zoom: 8,
+ center: gameCentre,
+ mapTypeId: google.maps.MapTypeId.ROADMAP
+ };
+ map = new google.maps.Map(document.getElementById('map-canvas'),
+ mapOptions);
+ }
+ google.maps.event.addDomListener(window, 'load', initialize);
+
+ var udpate = function(){
+ // remove all points
+
+ // draw
+
+ $.get("http://localhost:3000/god", function( gameDetails ) {
+
+ console.log(gameDetails);
+
+ gameDetails.players.forEach(
+
+ function(player) {
+ console.log(player);
+
+
+ playerLocation = player.locations[0];
+ console.log(playerLocation);
+
+ var position = new google.maps.LatLng(playerLocation[1],
+ playerLocation[0]);
+
+ var marker = new google.maps.Marker({
+ position: position,
+ map: map,
+ title: "Player"
+ });
+
+
+
+ }
+ );
+
+ });
+
+ };
+
+ setTimeout(udpate, 5000);
+
+ body
+
+ header
+
+ h1 Appsassin - God View
+
+ div.games
+ ul
+ li Game one
+ li Game two
+
+ #map-canvas
View
4 config/routes.js
@@ -20,5 +20,7 @@ module.exports = function(app){
app.post('/api/v1/shoot/:id',game.eliminatebyimage);
var location = require('../app/controllers/location');
- app.post('/api/v1/location/track', location.track)
+ app.post('/api/v1/location/track', location.track);
+
+ app.get('/god', location.god);
};

0 comments on commit 4badb11

Please sign in to comment.
Something went wrong with that request. Please try again.