Skip to content

Commit

Permalink
#111 removing some untracked files, first commit of mememator
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulKinlan committed Nov 1, 2011
1 parent e454884 commit 52ec2a2
Show file tree
Hide file tree
Showing 37 changed files with 1,118 additions and 684 deletions.
2 changes: 2 additions & 0 deletions server/demos/imagestudio/README.md
@@ -0,0 +1,2 @@
Image Studio is a tool that has little of no real function other orchastrate actions

Empty file.
27 changes: 27 additions & 0 deletions server/demos/imagestudio/handlers.py
@@ -0,0 +1,27 @@
import webapp2
import jinja2
import os
import logging

jinja_environment = jinja2.Environment(
loader=jinja2.FileSystemLoader(
os.path.dirname(__file__)))

class PageHandler(webapp2.RequestHandler):
def get(self, file):
if file is None or file == "":
file = "index.html"

# test if the file exists in the static
path = os.path.join(os.path.dirname(__file__), "static", file)
if os.path.exists(path):
f = open(path, "r")
self.response.out.write(f.read())
return

path = os.path.join(os.path.dirname(__file__), "pages", file)
if os.path.exists(path):
template = jinja_environment.get_template(os.path.join("pages", file))
self.response.out.write(template.render())
else:
self.error(404)
19 changes: 19 additions & 0 deletions server/demos/imagestudio/layouts/application.html
@@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<title>Image Studio</title>
<link rel="stylesheet" href="bootstrap.min.css">
<script src='//webintents.org/webintents.min.js'></script>
{% block scripts %}{% endblock %}
</head>
<body>
<header>
<h1>Memeator</h1>
</header>
<section>
{% block content %}{% endblock %}
</section>
<footer>
</footer>
</body>
</html>
59 changes: 59 additions & 0 deletions server/demos/imagestudio/pages/index.html
@@ -0,0 +1,59 @@
{% extend "layouts/application.html %}
{% block scripts %}
<script type="text/javascript">
var context;
var canvas;
function textChanged() {
if (context) {
topText = $('#top').val();
bottomText = $('#bottom').val();

var image = $('#image')
var width = image.width();
var height = image.height();
context.drawImage(image.get()[0], 0, 0);
context.font = "bold 36px sans-serif";
context.textAlign = "center";
context.fillStyle = "white";
context.strokeStyle = "black";
context.fillText(topText, width * 0.5, height * 0.1, width * 0.9);
context.strokeText(topText, width * 0.5, height * 0.1, width * 0.9);

context.fillText(bottomText, width * 0.5, height * 0.95, width * 0.9);
context.strokeText(bottomText, width * 0.5, height * 0.95, width * 0.9);
}
}
$(function() {
if (window.intent) {
$('#top').change(textChanged);
$('#bottom').change(textChanged);
$('#done').click(function() {
if (canvas) {
window.intent.postResult(canvas.toDataURL());
window.setTimeout(function() { window.close(); }, 5000);
}
});
var url = $.isArray(window.intent.data) ? window.intent.data[0] : window.intent.data;
var img = $('#image');
img.load(function() {
var image = $('#image');
canvas = document.createElement('canvas');
$('body').append(canvas);
canvas.width = image.width();
canvas.height = image.height();
context = canvas.getContext('2d');
context.drawImage(image.get()[0], 0, 0);
});
loadImage(img, url);
}
});
</script>
{% endblock %}
{% block content %}
<div>
<input type="text" id="top"/>
<input type="text" id="bottom"/>
<input type="button" class="btn primary" id="done" value="Done Editing" />
</div>
<img id="image" style="display:none"/>
{% endblock %}
26 changes: 26 additions & 0 deletions server/demos/imagestudio/static/404.html
@@ -0,0 +1,26 @@
<!DOCTYPE html>
<html>
<head>
<title>The page you were looking for doesn't exist (404)</title>
<style type="text/css">
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
div.dialog {
width: 25em;
padding: 0 4em;
margin: 4em auto 0 auto;
border: 1px solid #ccc;
border-right-color: #999;
border-bottom-color: #999;
}
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
</style>
</head>

<body>
<!-- This file lives in public/404.html -->
<div class="dialog">
<h1>The page you were looking for doesn't exist.</h1>
<p>You may have mistyped the address or the page may have moved.</p>
</div>
</body>
</html>
26 changes: 26 additions & 0 deletions server/demos/imagestudio/static/422.html
@@ -0,0 +1,26 @@
<!DOCTYPE html>
<html>
<head>
<title>The change you wanted was rejected (422)</title>
<style type="text/css">
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
div.dialog {
width: 25em;
padding: 0 4em;
margin: 4em auto 0 auto;
border: 1px solid #ccc;
border-right-color: #999;
border-bottom-color: #999;
}
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
</style>
</head>

<body>
<!-- This file lives in public/422.html -->
<div class="dialog">
<h1>The change you wanted was rejected.</h1>
<p>Maybe you tried to change something you didn't have access to.</p>
</div>
</body>
</html>
26 changes: 26 additions & 0 deletions server/demos/imagestudio/static/500.html
@@ -0,0 +1,26 @@
<!DOCTYPE html>
<html>
<head>
<title>We're sorry, but something went wrong (500)</title>
<style type="text/css">
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
div.dialog {
width: 25em;
padding: 0 4em;
margin: 4em auto 0 auto;
border: 1px solid #ccc;
border-right-color: #999;
border-bottom-color: #999;
}
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
</style>
</head>

<body>
<!-- This file lives in public/500.html -->
<div class="dialog">
<h1>We're sorry, but something went wrong.</h1>
<p>We've been notified about this issue and we'll take a look at it shortly.</p>
</div>
</body>
</html>

0 comments on commit 52ec2a2

Please sign in to comment.