mirror of
https://github.com/thewesker/greptweet.git
synced 2025-12-21 12:41:04 -05:00
Various tweaks
This commit is contained in:
15
create.cgi
15
create.cgi
@@ -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
|
||||
|
||||
|
||||
1
grep.php
1
grep.php
@@ -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');
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
|
||||
4
main.js
4
main.js
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user