From c9bb8e126e43c705dec4c89f85eef1588399bf21 Mon Sep 17 00:00:00 2001 From: Kai Hendry Date: Sun, 12 Aug 2012 15:09:52 +0200 Subject: [PATCH] Appcache tweaks to handle queries, hopefully --- greptweet.appcache | 4 ++++ main.js | 9 ++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/greptweet.appcache b/greptweet.appcache index 4ee33e2..f3397bc 100644 --- a/greptweet.appcache +++ b/greptweet.appcache @@ -8,3 +8,7 @@ tweets.txt /bootstrap/docs/assets/img/glyphicons-halflings.png /style.css /jquery-1.7.2.min.js +NETWORK: +/f/* +FALLBACK: +index.html diff --git a/main.js b/main.js index baf2e29..f098751 100644 --- a/main.js +++ b/main.js @@ -24,7 +24,7 @@ function grep(query) { if (typeof applicationCache !== 'undefined' && applicationCache.status == 1) { // If we have a cache, lets do this locally - console.log("Using applicationCache"); + console.log("Using applicationCache"); if (l.length > 0) { search(query, l); } else { @@ -37,13 +37,13 @@ function grep(query) { } else { // Client doesn't support appcache or it's not in sync, so lets search on the server - console.log("Using grep.php"); + console.log("Using grep.php"); $.getJSON("/u/" + NAME + "/grep.php?jsoncallback=?", { q: query }, function(data) { search(query, data); - }); + }).error(function(x) { console.log("AJAX JSON-P error: " + x); }); } } @@ -55,8 +55,7 @@ $(document).ready(function() { $("input[type=search]").change(function() { query = this.value; - // TODO: APPCACHE BUG - // window.location.search = query; // Triggers Reload the page to get source for: http://greptweet/u/kaihendry/?food + window.location.search = query; // Triggers Reload the page to get source for: http://greptweet/u/kaihendry/?food grep(query); });