Various tweaks

This commit is contained in:
Kai Hendry
2012-01-28 13:29:27 +08:00
parent ea17dad6a4
commit 7dcafe5abd
5 changed files with 20 additions and 11 deletions

View File

@@ -100,17 +100,26 @@ else
fi
echo "</pre>"
# Clean up in case it went wrong (e.g. trying to retrieve from an account with protected tweets)
test -s $oldpwd/u/$id/$id.txt || rm -rf $oldpwd/u/$id
if test -s "$oldpwd/u/$id/$id.txt"
then
cd $oldpwd; ./users.sh > users.shtml
cat <<END
</pre>
<h1 class="alert-message success">Now to grep fetched tweets, goto <a href="http://$HTTP_HOST/u/$id">http://$HTTP_HOST/u/$id</a></h1>
END
else
rm -rf $oldpwd/u/$id
echo '<h1 class="alert-message error">Sorry the Twitter API is failing. Try again later.</h1>'
fi
cat <<END
</div>
</div>
</body>
</html>
END

View File

@@ -1,4 +1,5 @@
<?php
header('Content-type: application/json');
if (empty($_GET['q'])) { die(); }
$QUERY=urldecode(escapeshellarg(urlencode($_GET['q'])));
//$fp = fopen('debug.log', 'a');

View File

@@ -17,7 +17,7 @@
<li id="name" class="active">You are here</li>
</ul>
<input type="text" name="q" class="xlarge" />
<input type="search" name="q" class="xlarge" />
<button class="btn primary">Greptweet</button>
<div id="results"></div>
@@ -26,7 +26,7 @@
<p class="help-inline">Type a search query like <a href="?foo">foo</a></p>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script async src="/main.js"></script>
<footer><span id="source"></span></footer>

View File

@@ -5,7 +5,7 @@
<title>GrepTweet</title>
<link rel="stylesheet" href="http://twitter.github.com/bootstrap/1.4.0/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="style.css">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script src="bootstrap-buttons.js"></script>
<script src="index.js"></script>
</head>
@@ -16,7 +16,7 @@
<div class="content">
<div class="page-header">
<h1><a href="http://twitter.com/greptweet">@Greptweet</a> <small>Grep your tweets</small></h1>
<h1><a href="http://twitter.com/greptweet">@Greptweet</a> <small>you can search your tweets</small></h1>
</div>
<form name="f" action="create.cgi" method="get" class="form-stacked">
@@ -48,8 +48,7 @@
</form>
<a href="https://twitter.com/greptweet" class="twitter-follow-button" data-show-count="false" data-lang="en" data-size="large">Follow @greptweet</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
<p><span class="label success">New</span> Try <a href="http://grepbook.co.uk/">Grepbook</a> for grepping Facebook.</p>
<h3>Greppable tweeters</h3>

View File

@@ -1,6 +1,6 @@
function grep(query) {
$.getJSON("/u/" + NAME + "/grep.php?q=" + query + "&jsoncallback=?", function(data) {
$.getJSON("/u/" + NAME + "/grep.php?jsoncallback=?", { q: query }, function(data) {
var results = "<p class=\"label\">Searched for: " + query + "</p><ol>";
for (var i in data) {
tweet = data[i].split('|');
@@ -20,7 +20,7 @@ $(document).ready(function() {
NAME = window.location.pathname.split('/')[2];
$("#name").html(NAME);
$("input[type=text]").change(function() {
$("input[type=search]").change(function() {
query = this.value;
window.location.search = query;
grep(query);