appcache needs to be set so that it syncs new tweets

This commit is contained in:
Kai Hendry
2012-07-15 21:25:45 +02:00
parent 054109b0ec
commit 86dfd044aa
3 changed files with 9 additions and 15 deletions

View File

@@ -103,8 +103,8 @@ cat <<END
END
fi
ln -sf $id.txt tweets.txt # Application cache greptweet.appcache
ln -sf ../../greptweet.appcache
ln -sf $id.txt tweets.txt
sed -e "s,TIMESTAMP,$(date)," ../../greptweet.appcache > greptweet.appcache
else
rm -rf $oldpwd/u/$id

View File

@@ -1,4 +1,5 @@
CACHE MANIFEST
# TIMESTAMP
CACHE:
index.html
tweets.txt

19
main.js
View File

@@ -1,24 +1,18 @@
var l = []; // avoid expensive $.get
var l = []; // avoid expensive $.get for local searches
function search(query, lines) {
var results = "<p class=\"label\">Searched for: " + query + "</p><ol>";
for (var i = 0; i < lines.length; i++) {
tweet = lines[i].split('|');
var re = new RegExp(query, 'i');
switch (tweet.length)
{
case 3:
if (tweet[2].match(re)) {
results += "<li><a href=\"http://twitter.com/" + NAME + "/status/" + tweet[0] + "\">" + tweet.slice(2) + "</a></li>";
}
break;
case 2:
if (tweet.length == 2) {
if (tweet[1].match(re)) {
results += "<li><a href=\"http://twitter.com/" + NAME + "/status/" + tweet[0] + "\">" + tweet.slice(1) + "</a></li>";
}
break;
default:
console.log('ODD: ' + tweet);
} else {
if (tweet[2] !== undefined && tweet[2].match(re)) {
results += "<li><a href=\"http://twitter.com/" + NAME + "/status/" + tweet[0] + "\">" + tweet.slice(2) + "</a></li>";
}
}
}
@@ -33,7 +27,6 @@ function grep(query) {
q: query
},
function(data) {
console.log("from grep.php: " + data);
search(query, data);
});