From 1d666bf7f0ee85909da7908d3386704d9f41b83c Mon Sep 17 00:00:00 2001 From: Baris Soner Usakli Date: Thu, 23 Jan 2014 22:45:11 -0500 Subject: [PATCH] possible fix to #840 --- public/src/ajaxify.js | 13 ++++++++----- public/src/forum/topic.js | 1 + 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/public/src/ajaxify.js b/public/src/ajaxify.js index 5401d24ff2..5ce58f34b7 100644 --- a/public/src/ajaxify.js +++ b/public/src/ajaxify.js @@ -34,6 +34,12 @@ var ajaxify = {}; ajaxify.currentPage = null; ajaxify.go = function (url, callback, quiet) { + if ($('#content').hasClass('ajaxifying')) { + return true; + } + + jQuery('#footer, #content').addClass('ajaxifying'); + // start: the following should be set like so: ajaxify.onchange(function(){}); where the code actually belongs $(window).off('scroll'); app.enterRoom('global'); @@ -48,9 +54,6 @@ var ajaxify = {}; window.onscroll = null; // end - if ($('#content').hasClass('ajaxifying')) { - templates.cancelRequest(); - } // Remove trailing slash url = url.replace(/\/$/, ""); @@ -98,11 +101,12 @@ var ajaxify = {}; translator.load(tpl_url); - jQuery('#footer, #content').removeClass('hide').addClass('ajaxifying'); + jQuery('#footer, #content').removeClass('hide'); templates.flush(); templates.load_template(function () { exec_body_scripts(content); + require(['forum/' + tpl_url], function(script) { if (script && script.init) { script.init(); @@ -172,7 +176,6 @@ var ajaxify = {}; var url = this.href.replace(rootUrl + '/', ''); if (ajaxify.go(url)) { - e.preventDefault(); } } else if (window.location.pathname !== '/outgoing') { diff --git a/public/src/forum/topic.js b/public/src/forum/topic.js index a48d8c82cf..223cc25ad1 100644 --- a/public/src/forum/topic.js +++ b/public/src/forum/topic.js @@ -366,6 +366,7 @@ define(['composer'], function(composer) { }); } + $('.topic').on('click', '.post_reply', function() { var selectionText = '', selection = window.getSelection() || document.getSelection();