From e6701c5a1f5a87a526c860f8e25e68ca1a65492d Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Mon, 23 Feb 2015 11:50:41 -0500 Subject: [PATCH] actually fixed isPopState error --- public/src/ajaxify.js | 7 ++----- public/src/modules/ajaxifyCache.js | 4 +++- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/public/src/ajaxify.js b/public/src/ajaxify.js index 7f99f3d2be..adaef4cb8f 100644 --- a/public/src/ajaxify.js +++ b/public/src/ajaxify.js @@ -60,11 +60,8 @@ $(document).ready(function() { app.enterRoom(''); // If the url is in the cache, load from cache instead - if (cache.get(url)) { return true; } - else { - cache.url = ajaxify.currentPage; - ajaxify.isPopState = false; - } + if (cache.get(url, callback)) { return true; } + else { cache.url = ajaxify.currentPage; } $(window).off('scroll'); diff --git a/public/src/modules/ajaxifyCache.js b/public/src/modules/ajaxifyCache.js index 1e5c63fa5c..02313c3d68 100644 --- a/public/src/modules/ajaxifyCache.js +++ b/public/src/modules/ajaxifyCache.js @@ -12,7 +12,7 @@ define('ajaxifyCache', function() { Cache.DOM = $('#content > *').detach(); }; - Cache.get = function(url) { + Cache.get = function(url, callback) { if (url === Cache.url && ajaxify.isPopState) { // Swap DOM elements // setTimeout(function() { @@ -25,6 +25,8 @@ define('ajaxifyCache', function() { Cache.url = ajaxify.currentPage; ajaxify.currentPage = url; + if (typeof callback === 'function') { callback(); } + return true; } else { return false;