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 END
fi fi
ln -sf $id.txt tweets.txt # Application cache greptweet.appcache ln -sf $id.txt tweets.txt
ln -sf ../../greptweet.appcache sed -e "s,TIMESTAMP,$(date)," ../../greptweet.appcache > greptweet.appcache
else else
rm -rf $oldpwd/u/$id rm -rf $oldpwd/u/$id

View File

@@ -1,4 +1,5 @@
CACHE MANIFEST CACHE MANIFEST
# TIMESTAMP
CACHE: CACHE:
index.html index.html
tweets.txt 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) { function search(query, lines) {
var results = "<p class=\"label\">Searched for: " + query + "</p><ol>"; var results = "<p class=\"label\">Searched for: " + query + "</p><ol>";
for (var i = 0; i < lines.length; i++) { for (var i = 0; i < lines.length; i++) {
tweet = lines[i].split('|'); tweet = lines[i].split('|');
var re = new RegExp(query, 'i'); var re = new RegExp(query, 'i');
switch (tweet.length) if (tweet.length == 2) {
{
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[1].match(re)) { if (tweet[1].match(re)) {
results += "<li><a href=\"http://twitter.com/" + NAME + "/status/" + tweet[0] + "\">" + tweet.slice(1) + "</a></li>"; results += "<li><a href=\"http://twitter.com/" + NAME + "/status/" + tweet[0] + "\">" + tweet.slice(1) + "</a></li>";
} }
break; } else {
default: if (tweet[2] !== undefined && tweet[2].match(re)) {
console.log('ODD: ' + tweet); 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 q: query
}, },
function(data) { function(data) {
console.log("from grep.php: " + data);
search(query, data); search(query, data);
}); });