Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/sgreenlay/PYLONS
Browse files Browse the repository at this point in the history
  • Loading branch information
younjin committed Dec 4, 2012
2 parents 83f01f6 + 338dc21 commit 45be12d
Show file tree
Hide file tree
Showing 7 changed files with 95 additions and 17 deletions.
32 changes: 18 additions & 14 deletions iphone/Pylon/PYLViewController.m
Expand Up @@ -43,6 +43,23 @@ - (void)viewDidLoad
[audioRecorder prepareToRecord];
[self.glowView setHidden:YES];
[self.glowProc setHidden:YES];

[self addNewWebViewWithURL:[NSURL URLWithString:@"http://searchapp.herokuapp.com/help.html"]];
}

- (void)addNewWebViewWithURL:(NSURL*)url {
UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, _topY, 320, 1)];
[webView setDelegate:self];
[webView setOpaque:NO];
[webView setBackgroundColor:[UIColor clearColor]];
[[webView subviews] enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
if ([obj isKindOfClass:[UIScrollView class]]) {
[(UIScrollView*)obj setScrollEnabled:NO];
}
}];
[webView.layer setOpacity:0];
[self.scrollView addSubview:webView];
[webView loadRequest:[NSURLRequest requestWithURL:url]];
}

- (void)didReceiveMemoryWarning
Expand Down Expand Up @@ -103,20 +120,7 @@ - (void)stopRecording {
NSString * queryUrl = [NSString stringWithFormat:@"http://searchapp.herokuapp.com/?query=%@&token=%@", text, token];
NSString *acceptableUrl = [queryUrl stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];

NSURL * url = [NSURL URLWithString:acceptableUrl];

UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, _topY, 320, 1)];
[webView setDelegate:self];
[webView setOpaque:NO];
[webView setBackgroundColor:[UIColor clearColor]];
[[webView subviews] enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
if ([obj isKindOfClass:[UIScrollView class]]) {
[(UIScrollView*)obj setScrollEnabled:NO];
}
}];
[webView.layer setOpacity:0];
[self.scrollView addSubview:webView];
[webView loadRequest:[NSURLRequest requestWithURL:url]];
[self addNewWebViewWithURL:[NSURL URLWithString:acceptableUrl]];
} else {
[self fadeOut:self.glowProc];
}
Expand Down
21 changes: 20 additions & 1 deletion server/public/css/app.less
Expand Up @@ -67,4 +67,23 @@ BODY {
height: 45px;
width: 45px;
}
}
}

.title {
text-align: center;
font-size: 100px;
}

.subtitle {
height: 25px;
text-align: center;
font-size: 20px;
}

.help-section {
padding: 15px 0px;

LI {
margin: 15px 10px;
}
}
47 changes: 47 additions & 0 deletions server/public/help.html
@@ -0,0 +1,47 @@
<!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd"
>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml">
<head>
<title></title>

<!-- Require css -->
<link rel="stylesheet" type="text/css" href="css/reset.css">
<link rel="stylesheet/less" type="text/css" href="css/app.less">

<!-- Require libraries -->
<script src="js/lib/jquery.min.js"></script>
<script src="js/lib/less.min.js"></script>

<script type="text/javascript">
function windowHeight() {
return $("BODY").height();
}
$(function($) {
window.location.href = "js-call:layoutWebview";
});
</script>
</head>
<body>
<div id="container">
<h1 class="subtitle">
Welcome to
</h1>
<div class="title">
Quin
</div>
<div class="help-section">
Press the button, ask about:
<ul>
<li>"Friends in {insert city}"</li>
<li>"Friends' relationship statuses"</li>
<li>"Mutual friends"</li>
<li>"Popularity of friends"</li>
<li>"Friends' genders"</li>
</ul>
and press the button again to see the result.
</div>
</div>
</body>
</html>
1 change: 1 addition & 0 deletions server/public/js/models/data.js
Expand Up @@ -40,6 +40,7 @@ $(function($) {

parse: function(res) {
this.set("data", res.data);
this.set("total", res.data.length);
},

extract: function(x) {
Expand Down
2 changes: 1 addition & 1 deletion server/public/js/views/donut.js
Expand Up @@ -79,7 +79,7 @@ $(function($) {
var perc;
perc = d.value / total;
perc = Math.floor(perc * 100);
return d.type.capitalizeFirst() + " (" + perc + "%)";
return d.type.capitalizeFirst() + " (" + d.value + ", " + perc + "%)";
});
}
});
Expand Down
5 changes: 4 additions & 1 deletion server/public/js/views/facepile.js
Expand Up @@ -7,7 +7,7 @@ $(function($) {
initialize: function(a) {
this.el = d3.select("#chart")
.append("div")
.attr("class", "clearfix");
.attr("class", "facepile clearfix");
},

render: function(model) {
Expand All @@ -22,6 +22,9 @@ $(function($) {
.attr("src", function(d) {
return "http://graph.facebook.com/" + d.uid + "/picture?type=square";
});

d3.select("#legend")
.text(model.get("total") + " total friends");
}
});
});
4 changes: 4 additions & 0 deletions server/server.js
Expand Up @@ -14,6 +14,10 @@ app.get('/', function(req, res){
res.render("./public/index.html");
});

app.get('/help', function(req, res){
res.render("./public/help.html");
});

app.get('/typeify', function(req, res) {
query = req.query.query.toLowerCase();
type = tc.classify(query);
Expand Down

0 comments on commit 45be12d

Please sign in to comment.