Revert "Revert "add splash page to try to reduce server load""

This reverts commit 517ed68598.
This commit is contained in:
Tyler Renelle 2013-01-16 13:07:01 -05:00
parent 517ed68598
commit 30fe5cd744
6 changed files with 1197 additions and 10 deletions

File diff suppressed because one or more lines are too long

9
public/css/bootstrap.min.css vendored Normal file

File diff suppressed because one or more lines are too long

1064
public/css/docs.css Normal file

File diff suppressed because it is too large Load diff

96
public/splash.html Normal file
View file

@ -0,0 +1,96 @@
<html>
<head>
<meta charset="utf-8">
<title>HabitRPG | Gamify Your Life</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Le styles -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/bootstrap-responsive.min.css" rel="stylesheet">
<link href="css/docs.css" rel="stylesheet">
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript">
$.getScript("https://s7.addthis.com/js/250/addthis_widget.js#pubid=lefnire");
</script>
<style type="text/css">
.jumbotron {
background-color: #1b1b1b;
background-image: -moz-linear-gradient(top, #222222, #111111);
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#222222), to(#111111));
background-image: -webkit-linear-gradient(top, #222222, #111111);
background-image: -o-linear-gradient(top, #222222, #111111);
background-image: linear-gradient(to bottom, #222222, #111111);
background-repeat: repeat-x;
border-color: #252525;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff222222', endColorstr='#ff111111', GradientType=0);
}
</style>
</head>
<body>
<div class='jumbotron masthead'>
<div class='container'>
<h1>HabitRPG</h1>
<p>A habit tracker app which treats your goals like a Role Playing Game. Level up as you succeed, lose HP as you fail, earn money to buy weapons and armor.</p>
<a href="/?play=1" class='btn btn-primary btn-large'>Play</a>
</div>
</div>
<div class="bs-docs-social">
<div class="container">
<ul class="bs-docs-social-buttons">
<li>
<table>
<tr>
<td><!-- Github -->
<iframe src="/github-btns/github-btn.html?user=lefnire&repo=habitrpg&type=watch&count=true"
allowtransparency="true" frameborder="0" scrolling="0" width="85px" height="20px"></iframe>
</td>
<td>
<div class="addthis_toolbox addthis_default_style "
addthis:url="http://habitrpg.com"
addthis:title="HabitRPG: Role Playing Game for Self Improvement">
<a class="addthis_button_facebook_like" fb:like:layout="button_count"></a>
<a class="addthis_button_tweet" tw:via="lefnire"></a>
</td>
<td><a href="https://github.com/lefnire/habitrpg#faq">FAQ</a>&nbsp;-&nbsp;</td>
<td><a href="https://github.com/lefnire/habitrpg#roadmap">Roadmap</a>&nbsp;-&nbsp;</td>
<td><a href="https://github.com/lefnire/habitrpg#api">API</a>&nbsp;-&nbsp;</td>
<td><a href="https://github.com/lefnire/habitrpg#contact">Contact</a></td>
</tr>
</table>
</li>
</ul>
</div>
</div>
<div class='container'>
<div class='marketing'>
<p>&nbsp;</p>
<p><img src='https://raw.github.com/lefnire/habitrpg/master/public/img/screenshot.jpeg' /></p>
<h2>How Does it Work</h2>
<p class=''>Watch the <a href="http://www.youtube.com/watch?feature=player_detailpage&v=uF8ZuN_xxjw#t=261s">video tutorial here</a>.</p>
<h2>Habits</h2>
<p>Habits are goals that you constantly track. For some habits, it only makes sense to gain points (eg, "1h Productive Work"). For others, it only makes sense to lose points (like "Eat Junk Food"). For the rest, both gain and loss apply (eg, for "Take The Stairs", stairs is a gain, elevator is a loss).</p>
<h2>Dailies</h2>
<p>Dailies are goals that you want to complete once a day. At the end of each day, non-completed Dailies dock you points. If you are doing well, they turn green and are less valuable (experience, gold) and less damaging (HP). This means you can ease up on them for a bit. But if you are doing poorly, they turn red. The worse you do, the more valuable (exp, gold) and more damaging (HP) these goals become. This encourages you to focus on your shortcomings, the reds.</p>
<h2>Todos</h2>
<p>Todos are one-off goals which need to be completed eventually. Non-completed Todos wont hurt you, but they will become more valuable over time. This will encourage you to wrap up stale Todos.</p>
<h2>Rewards</h2>
<p>As you complete goals, you earn gold to buy rewards. Buy them liberally - rewards are integral in forming good habits. But only buy if you have enough gold - you lose HP otherwise.</p>
<p>After youve played for a while, you unlock the <strong>Item Store</strong> under the rewards column. You can now buy weapons, armor, potions, etc. Armor decreases HP loss (by an increasing amount wich each upgrade). Weapons increase experience gain. Potions recover 15 HP.</p>
Watch the video tutorial here.
<h4>License</h4>
<p>Code is licensed under GNU GPL v3. Content is licensed under CC-BY-SA 3.0. See the LICENSE file for details.</p>
<h4>Credits</h4>
<p>Content comes from Mozillas <a href="http://browserquest.mozilla.org/">BrowserQuest</a></p>
<ul>
<li><a href="http://mozilla.org">Mozilla</a></li>
<li><a href="http://www.littleworkshop.fr">Little Workshop</a></li>
</ul>
</div>
</div>
</body>
</html>

View file

@ -32,13 +32,6 @@ ONE_YEAR = 1000 * 60 * 60 * 24 * 365
root = path.dirname path.dirname __dirname
publicPath = path.join root, 'public'
habitrpgMiddleware = (req, res, next) ->
model = req.getModel()
## Set _mobileDevice to true or false so view can exclude portions from mobile device
model.set '_mobileDevice', /Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(req.header 'User-Agent')
model.set '_nodeEnv', process.env.NODE_ENV
next()
# Authentication setup
strategies =
facebook:
@ -72,12 +65,28 @@ mongo_store = new MongoStore {url: process.env.NODE_DB_URI}, ->
store: mongo_store
)
#show splash page for newcomers
.use (req, res, next) ->
console.log(req)
if !req.session.userId? and !req.query?.play?
res.redirect('/splash.html')
else
next()
# Adds req.getModel method
.use(store.modelMiddleware())
# Middelware can be inserted after the modelMiddleware and before
# the app router to pass server accessible data to a model
.use(priv.middleware)
.use(habitrpgMiddleware)
# HabitRPG Custom Middleware
.use (req, res, next) ->
model = req.getModel()
## Set _mobileDevice to true or false so view can exclude portions from mobile device
model.set '_mobileDevice', /Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(req.header 'User-Agent')
model.set '_nodeEnv', process.env.NODE_ENV
next()
.use(auth(store, strategies, options))
# Creates an express middleware from the app's routes
.use(app.router())

View file

@ -285,7 +285,7 @@
<td>
<div class="addthis_toolbox addthis_default_style "
addthis:url="http://habitrpg.com"
addthis:title="HabitRPG: Role Playing Game for Self Improvement">
addthis:title="HabitRPG: Role Playing Game for Self Improvement">
<a class="addthis_button_facebook_like" fb:like:layout="button_count"></a>
<a class="addthis_button_tweet" tw:via="lefnire"></a>
</div>
@ -296,7 +296,7 @@
</table>
</div>
{/}
<div>
<ul>
<li>Copyright &copy; 2012 OCDevel LLC</li>