Skip to content

Node.js based forum software built for the modern web

actually fixed isPopState error

Julian Lame6701c5a1f5a
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;