closes #2792, closes #2791, closes #2788, closes #2787, closes #2786, closes #2785, closes #2784, closes #2783

Squashed commit of the following:

commit ca5064a4effa3904ce936b521b169bba8d24f1a1
Author: Julian Lam <julian@designcreateplay.com>
Date:   Thu Feb 26 08:19:32 2015 -0500

    Revert "added ajaxify popstate cache, so back/forward will just put back the already loaded page"

    This reverts commit 77d154bb8b.

commit ae07fc56c156074de8048bb627f5d9be849c8ad1
Author: Julian Lam <julian@designcreateplay.com>
Date:   Thu Feb 26 08:19:24 2015 -0500

    Revert "on click, topics are marked read from the unread page. Also fixed an issue where isPopState kept getting set to true, causing issues"

    This reverts commit d8c9ec0d40.

    Conflicts:
    	public/src/client/unread.js

commit 96ee3631d7e4e1fc2c1b7632d86684fecd1e430f
Author: Julian Lam <julian@designcreateplay.com>
Date:   Thu Feb 26 08:18:25 2015 -0500

    Revert "actually fixed isPopState error"

    This reverts commit e6701c5a1f.
This commit is contained in:
Julian Lam
2015-02-26 08:19:57 -05:00
parent 0c8e0ca46f
commit 00f3084b8e
3 changed files with 9 additions and 68 deletions

View File

@@ -1,11 +1,9 @@
"use strict";
var ajaxify = ajaxify || {
isPopState: false
};
var ajaxify = ajaxify || {};
$(document).ready(function() {
require(['templates', 'ajaxifyCache'], function (templatesModule, cache) {
require(['templates'], function (templatesModule) {
/*global app, templates, utils, socket, translator, config, RELATIVE_PATH*/
var location = document.location || window.location,
@@ -15,9 +13,7 @@ $(document).ready(function() {
window.onpopstate = function (event) {
if (event !== null && event.state && event.state.url !== undefined && !ajaxify.initialLoad) {
ajaxify.isPopState = true;
ajaxify.go(event.state.url, function() {
ajaxify.isPopState = false;
$(window).trigger('action:popstate', {url: event.state.url});
}, true);
}
@@ -59,10 +55,6 @@ $(document).ready(function() {
// "quiet": If set to true, will not call pushState
app.enterRoom('');
// If the url is in the cache, load from cache instead
if (cache.get(url, callback)) { return true; }
else { cache.url = ajaxify.currentPage; }
$(window).off('scroll');
if ($('#content').hasClass('ajaxifying') && apiXHR) {
@@ -122,7 +114,6 @@ $(document).ready(function() {
templates.parse(tpl_url, data, function(template) {
translator.translate(template, function(translatedTemplate) {
setTimeout(function() {
cache.set();
$('#content').html(translatedTemplate);
ajaxify.variables.parse();