From 29ad8d25821416a8464603b99afacd3847551e89 Mon Sep 17 00:00:00 2001 From: psychobunny Date: Tue, 11 Mar 2014 14:41:32 -0400 Subject: [PATCH] closes #1192 --- public/src/app.js | 60 +++++++++++++++++++++-------------------- public/src/templates.js | 2 ++ 2 files changed, 33 insertions(+), 29 deletions(-) diff --git a/public/src/app.js b/public/src/app.js index 554a6ad4f3..f3d5459bb1 100644 --- a/public/src/app.js +++ b/public/src/app.js @@ -630,43 +630,45 @@ var socket, } - $('document').ready(function () { - var url = window.location.pathname.slice(1), - tpl_url = ajaxify.getTemplateMapping(url); + app.load = function() { + $('document').ready(function () { + var url = window.location.pathname.slice(1), + tpl_url = ajaxify.getTemplateMapping(url); - $(window).trigger('action:ajaxify.start', { - url: url - }); + $(window).trigger('action:ajaxify.start', { + url: url + }); - $('#search-form').on('submit', function () { - var input = $(this).find('input'); - ajaxify.go("search/" + input.val()); - input.val(''); - return false; - }); + $('#search-form').on('submit', function () { + var input = $(this).find('input'); + ajaxify.go("search/" + input.val()); + input.val(''); + return false; + }); - $(window).blur(function(){ - app.isFocused = false; - }); + $(window).blur(function(){ + app.isFocused = false; + }); - $(window).focus(function(){ - app.isFocused = true; + $(window).focus(function(){ + app.isFocused = true; - app.alternatingTitle(''); - }); + app.alternatingTitle(''); + }); - createHeaderTooltips(); - templates.parseTemplateVariables(); - app.processPage(); + createHeaderTooltips(); + templates.parseTemplateVariables(); + app.processPage(); - ajaxify.renderWidgets(tpl_url, url); - - ajaxify.loadScript(tpl_url, function() { - $(window).trigger('action:ajaxify.end', { - url: url - }); + ajaxify.renderWidgets(tpl_url, url); + + ajaxify.loadScript(tpl_url, function() { + $(window).trigger('action:ajaxify.end', { + url: url + }); + }); }); - }); + }; showWelcomeMessage = location.href.indexOf('loggedin') !== -1; diff --git a/public/src/templates.js b/public/src/templates.js index 46a77e5052..2e31e6a4ab 100644 --- a/public/src/templates.js +++ b/public/src/templates.js @@ -357,6 +357,8 @@ $.when($.getJSON(RELATIVE_PATH + '/templates/config.json'), $.getJSON(RELATIVE_PATH + '/api/get_templates_listing')).done(function (config_data, templates_data) { config = config_data[0]; available_templates = templates_data[0]; + + app.load(); }); } }