- *
- */
-
-var express = require('express')
- , stylus = require('stylus')
- , nib = require('nib')
- , sqlite = require('sqlite3');
-
-var app = express();
-
-var database = new sqlite.Database('/home/reset/tyedye/game.db');
-
-// Custom compile function for using nib alongside stylus
-function compile(str, path) {
- return stylus(str)
- .set('filename', path)
- .use(nib());
-}
-
-function render_index(player_number, stats_number, players) {
- res.render('index',
- {
- title: 'My Game',
- player_num: player_number,
- stats_num: stats_number,
- player_list: players
- });
-}
-
-app.set('views', __dirname + '/views');
-app.set('view engine', 'jade');
-app.use(express.logger('dev'))
-app.use(stylus.middleware(
- { src: __dirname + '/public',
- compile: compile
- }
- ));
-
-// Let express serve static files
-app.use(express.static(__dirname + '/public'));
-
-// Simple test call
-// app.get('/', function (req, res) {
-// res.send('Hi there!!');
-// });
-
-app.get('/', function (req, res) {
- var player_number = 0;
- var stats_number = 0;
- var players = new Array();
-
- console.log('Serializing');
- database.serialize(function() {
- console.log('Querying players');
- database.each("SELECT * FROM players", function(err, row) {
- console.log('Received a player row! Weheeeee!');
- var nextElement = players.length;
- players[nextElement] = row.name;
- console.log(players);
- });
-
- console.log('Statistics');
- database.get("SELECT COUNT(*) FROM players", function (err, row) {
- player_number = row;
- });
- database.get("SELECT COUNT(*) FROM stats", function (err, row) {
- stats_number = row;
- render_index(player_number, stats_number, players);
- });
-
- });
-});
-
-app.listen(3000);
diff --git a/static/main.css b/static/main.css
new file mode 100644
index 0000000..aca6c5b
--- /dev/null
+++ b/static/main.css
@@ -0,0 +1,208 @@
+@import url("http://fonts.googleapis.com/css?family=Source+Code+Pro");
+html,
+body,
+div,
+span,
+applet,
+object,
+iframe,
+h1,
+h2,
+h3,
+h4,
+h5,
+h6,
+p,
+blockquote,
+pre,
+a,
+abbr,
+acronym,
+address,
+big,
+cite,
+code,
+del,
+dfn,
+em,
+img,
+ins,
+kbd,
+q,
+s,
+samp,
+small,
+strike,
+strong,
+sub,
+sup,
+tt,
+var,
+dl,
+dt,
+dd,
+ol,
+ul,
+li,
+fieldset,
+form,
+label,
+legend,
+table,
+caption,
+tbody,
+tfoot,
+thead,
+tr,
+th,
+td {
+ margin: 0;
+ padding: 0;
+ border: 0;
+ outline: 0;
+ font-weight: inherit;
+ font-style: inherit;
+ font-family: inherit;
+ font-size: 100%;
+ vertical-align: baseline;
+}
+body {
+ line-height: 1;
+ color: #000;
+ background: #fff;
+}
+ol,
+ul {
+ list-style: none;
+}
+table {
+ border-collapse: separate;
+ border-spacing: 0;
+ vertical-align: middle;
+}
+caption,
+th,
+td {
+ text-align: left;
+ font-weight: normal;
+ vertical-align: middle;
+}
+a img {
+ border: none;
+}
+body {
+ font-family: 'Arial';
+ background-color: #faf9f0;
+ color: #444;
+}
+header {
+ font-family: 'Source Code Pro';
+ padding: 50px 10px;
+ color: #fff;
+ font-size: 25px;
+ text-align: center;
+ background-color: #4d5bfa;
+ border-bottom: 1px solid #0618df;
+ text-shadow: 2px 2px 4px 2px #333;
+}
+h2 {
+ font-family: 'Source Code Pro';
+ padding: 0px;
+ border-bottom: 1px dotted #ddd;
+ font-family: 'Source Code Pro';
+ padding-bottom: 10px;
+ border-bottom: 1px dotted #ddd;
+ -webkit-border-radius: 2px 2px 0px 0px;
+ border-radius: 2px 2px 0px 0px;
+ margin-bottom: 10px;
+}
+.container {
+ width: 500px;
+ margin: 50px auto;
+ overflow: hidden;
+}
+.main-content {
+ float: left;
+ width: 300px;
+}
+.main-content p {
+ margin-bottom: 20px;
+}
+.sidebar {
+ float: left;
+ width: 200px;
+}
+.sidebar .widget {
+ -webkit-border-radius: 3px;
+ border-radius: 3px;
+ border: 1px solid #ccc;
+ margin-left: 20px;
+ padding-bottom: 10px;
+ background-color: #faf9f0;
+ -webkit-box-shadow: inset 0px 0px 0px 3px rgba(255,255,255,0.8), 0px 3px 0px -2px rgba(0,0,0,0.1);
+ box-shadow: inset 0px 0px 0px 3px rgba(255,255,255,0.8), 0px 3px 0px -2px rgba(0,0,0,0.1);
+}
+.sidebar .widget h1 {
+ font-family: 'Source Code Pro';
+ margin: 13px 10px 4px;
+ padding-bottom: 10px;
+ border-bottom: 1px dotted #ddd;
+ -webkit-border-radius: 2px 2px 0px 0px;
+ border-radius: 2px 2px 0px 0px;
+ margin-bottom: 10px;
+}
+.sidebar .widget p {
+ font-size: 13px;
+ padding: 0px 10px;
+ margin-bottom: 10px;
+}
+.cssmenu {
+ list-style: none;
+ margin: 6px;
+ padding: 0;
+ width: 90%;
+}
+.cssmenu ul {
+ width: 99%;
+ margin: 0;
+}
+.cssmenu li {
+ margin: 0;
+ width: 99%;
+}
+.cssmenu a:link {
+ display: block;
+ text-decoration: none;
+ color: #000;
+ background-color: #faf9f0;
+ padding: 4px 8px;
+ margin: 0;
+ width: 99%;
+}
+.cssmenu a:visited {
+ display: block;
+ text-decoration: none;
+ color: #000;
+ padding: 4px 8px;
+ margin: 0;
+ width: 99%;
+}
+.cssmenu a:hover {
+ display: block;
+ text-decoration: none;
+ color: #fff;
+ background: #4d5bfa;
+ padding: 4px 8px;
+ margin: 0;
+ width: 99%;
+}
+p {
+ line-height: 1.8;
+}
+footer {
+ width: 500px;
+ margin: 50px auto;
+ border-top: 1px dotted #ccc;
+ padding-top: 5px;
+ font-size: 13px;
+}
diff --git a/views/index.jade b/views/index.jade
deleted file mode 100644
index 63d8a1f..0000000
--- a/views/index.jade
+++ /dev/null
@@ -1,32 +0,0 @@
-extend layout
-block content
- h2 Summary
- p
- | Registered players: #{player_num}
- p
- | Stats registered: #{stats_num}
- p
- - if (player_list.length > 0)
- ul
- each player in player_list
- li #{player}
-
-block sidebar
- .widget
- h1 Access
- #cssmenu
- ul
- li
- a(href='/') Main
- ul
- li
- a(href='/register') Register New Player
- ul
- li
- a(href='/remove') Remove Player
- ul
- li
- a(href='/config') Configuration
- ul
- li
- a(href='/stats') Statistics
diff --git a/views/layout.html b/views/layout.html
new file mode 100644
index 0000000..21d2406
--- /dev/null
+++ b/views/layout.html
@@ -0,0 +1,25 @@
+$def with (main_block, sidebar_block, game_name)
+
+
+
+ TyeDye for $game_name
+
+
+
+
+
+
+
+
+
diff --git a/views/layout.jade b/views/layout.jade
deleted file mode 100644
index 0543af3..0000000
--- a/views/layout.jade
+++ /dev/null
@@ -1,15 +0,0 @@
-!!!5
-html
- head
- title TyeDye - Remote Character Server for SL
- link(rel='stylesheet', href='/stylesheets/style.css')
- body
- header
- h1 TyeDye: #{title}
- .container
- .main-content
- block content
- .sidebar
- block sidebar
- footer
- p Running on node with Express, Jade and Stylus
diff --git a/views/sidebar.html b/views/sidebar.html
new file mode 100644
index 0000000..69a8f8a
--- /dev/null
+++ b/views/sidebar.html
@@ -0,0 +1,11 @@
+
+
Access
+
+
diff --git a/views/summary.html b/views/summary.html
new file mode 100644
index 0000000..a5da0ab
--- /dev/null
+++ b/views/summary.html
@@ -0,0 +1,9 @@
+$def with (game_name, player_num, stats_num, player_list)
+$game_name quick summary
+Registered players: $player_num
+Registered stats: $stats_num
+Player list:
+
+$for player in player_list:
+ - $player
+