Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Super performance improvements, lazy load images, dynamically pull st…

…aff html
  • Loading branch information...
commit 8671d3ae5d3f18f3ecd155a629230eebc5e600ac 1 parent b06903c
@dustball dustball authored
View
1  app.yaml
@@ -12,5 +12,6 @@ handlers:
upload: static/root/robots.txt
- url: /static
static_dir: static
+ expiration: "1d"
- url: .*
script: main.py
View
9 main.py
@@ -66,6 +66,14 @@ def get(self):
cdn = CDN_HOSTNAME
self.response.out.write(template.render('templates/index.html', locals()))
+class StaffHandler(webapp.RequestHandler):
+ def get(self):
+ staff = _request('http://hackerdojo-signin.appspot.com/staffjson')
+ version = os.environ['CURRENT_VERSION_ID']
+ if CDN_ENABLED:
+ cdn = CDN_HOSTNAME
+ self.response.out.write(template.render('templates/event_staff.html', locals()))
+
class MainHandler(webapp.RequestHandler):
def get(self, pagename, site = PB_WIKI):
skip_cache = self.request.get('cache') == '0'
@@ -87,6 +95,7 @@ def get(self, pagename, site = PB_WIKI):
def main():
application = webapp.WSGIApplication([
('/api/pbwebhook', PBWebHookHandler),
+ ('/api/event_staff', StaffHandler),
('/', IndexHandler),
('/(.+)', MainHandler)],
debug=True)
View
42 static/js/hackerdojo.prod.pack.js
@@ -163,23 +163,35 @@ function mycarousel_initCallback(carousel) {
});
};
+
+
jQuery(document).ready(function() {
- jQuery("#mycarousel").jcarousel({
- scroll: 1,
- initCallback: mycarousel_initCallback,
- itemVisibleInCallback: {
- onAfterAnimation: mycarousel_itemVisibleInCallbackAfterAnimation
- },
- itemVisibleOutCallback: {
- onAfterAnimation: mycarousel_itemVisibleOutCallbackAfterAnimation
- },
- buttonNextHTML: null,
- buttonPrevHTML: null,
- auto: 5,
- wrap: 'last',
- });
+
+ lazyload = function() {
+ jQuery(".lazyload").each(function() {
+ $(this).attr("src",$(this).attr("futuresrc"));
+ });
+ };
+ setTimeout("lazyload();",1000);
+
+ jQuery("#mycarousel").jcarousel({
+ scroll: 1,
+ initCallback: mycarousel_initCallback,
+ itemVisibleInCallback: {
+ onAfterAnimation: mycarousel_itemVisibleInCallbackAfterAnimation
+ },
+ itemVisibleOutCallback: {
+ onAfterAnimation: mycarousel_itemVisibleOutCallbackAfterAnimation
+ },
+ buttonNextHTML: null,
+ buttonPrevHTML: null,
+ auto: 4,
+ wrap: 'last',
+ });
+
$("#open").simpletip({
- content:jQuery("#opencontent").html()
+ onBeforeShow: function(){ this.load('/api/event_staff'); },
+ content:"<p>Hacker Dojo is currently open,<br> and being staffed by the following<br>volunteers:</p><p>loading...</p>"
});
$("#closed").simpletip({
content:"The Dojo is usually open 9AM-10PM<br/>on weekdays. Weekend coverage will vary."
View
2  templates/base.html
@@ -3,7 +3,7 @@
<meta charset="utf-8">
<title>{% block title %}Hacker Dojo{% endblock %}</title>
<link href="{{cdn}}/static/style/hackerdojo.css?v=v{{version}}" type="text/css" rel="stylesheet">
- <link href="{{cdn}}/static/style/mobile.css?v=v{{version}}" media="screen and (max-width: 480px)" type="text/css" rel="stylesheet">
+ {% comment %}<link href="{{cdn}}/static/style/mobile.css?v=v{{version}}" media="screen and (max-width: 480px)" type="text/css" rel="stylesheet">{% endcomment %}
<!--[if lt IE 9]><script src="{{cdn}}/static/js/ie.html5.shim.js"></script><![endif]-->
{% block extrahead %}{% endblock %}
</head>
View
4 templates/event_staff.html
@@ -0,0 +1,4 @@
+<p>Hacker Dojo is currently open,<br> and being staffed by the following<br>volunteers:</p>
+{% for s in staff %}
+ <p><img src='{{s.image_url}}' height="24" width="24" align="absmiddle" hspace="3">{{s.name}}{% comment %}, {s.created|timesince} ago{% endcomment %}</p>
+{% endfor %}
View
19 templates/index.html
@@ -6,13 +6,6 @@
{% endcomment %}
{% block extrahead %}<script type="text/javascript" src="{{cdn}}/static/js/hackerdojo.prod.pack.js?v=v{{version}}"></script>{% endblock %}
{% block content %}
-
- <div id="opencontent" style="display:none">
- <p>Hacker Dojo is currently open,<br> and being staffed by the following<br>volunteers:</p>
- {% for s in staff %}
- <p><img src='{{s.image_url}}' height="24" width="24" align="absmiddle" hspace="3">{{s.name}}{% comment %}, {s.created|timesince} ago{% endcomment %}</p>
- {% endfor %}
- </div>
<section class="hero-image" >
<div id="mycarousel" style="overflow:hidden">
@@ -22,27 +15,27 @@
<div class="hero-caption">Group hack day, March 11, 2010</div>
</li>
<li>
- <img width="960" height="235" src="{{cdn}}/static/images/hero2.jpeg" alt="" />
+ <img width="960" height="235" class="lazyload" src="{{cdn}}/static/images/transparent-80.png" futuresrc="{{cdn}}/static/images/hero2.jpeg" alt="" />
<div class="hero-caption">Opening Party</div>
</li>
<li>
- <img width="960" height="235" src="{{cdn}}/static/images/hero3.jpeg" alt="" />
+ <img width="960" height="235" class="lazyload" src="{{cdn}}/static/images/transparent-80.png" futuresrc="{{cdn}}/static/images/hero3.jpeg" alt="" />
<div class="hero-caption">TIGJam: Indie Game Developers Confernce</div>
</li>
<li>
- <img width="960" height="235" src="{{cdn}}/static/images/hero4.jpeg" alt="" />
+ <img width="960" height="235" class="lazyload" src="{{cdn}}/static/images/transparent-80.png" futuresrc="{{cdn}}/static/images/hero4.jpeg" alt="" />
<div class="hero-caption">Interaction Design Class</div>
</li>
<li>
- <img width="960" height="235" src="{{cdn}}/static/images/hero5.jpeg" alt="" />
+ <img width="960" height="235" class="lazyload" src="{{cdn}}/static/images/transparent-80.png" futuresrc="{{cdn}}/static/images/hero5.jpeg" alt="" />
<div class="hero-caption">Hackers getting some sunshine =D</div>
</li>
<li>
- <img width="960" height="235" src="{{cdn}}/static/images/hero6.jpg" alt="" />
+ <img width="960" height="235" class="lazyload" src="{{cdn}}/static/images/transparent-80.png" futuresrc="{{cdn}}/static/images/hero6.jpg" alt="" />
<div class="hero-caption">Our Official Policy Bear Meeting</div>
</li>
<li>
- <img width="960" height="235" src="{{cdn}}/static/images/hero7.jpg" alt="" />
+ <img width="960" height="235" class="lazyload" src="{{cdn}}/static/images/transparent-80.png" futuresrc="{{cdn}}/static/images/hero7.jpg" alt="" />
<div class="hero-caption">Designing a TARDIS - wanna help?</div>
</li>
</ul>
Please sign in to comment.
Something went wrong with that request. Please try again.