From b119a90996ef2e62bc6ff77328bbcfc9923176e0 Mon Sep 17 00:00:00 2001 From: David Baumgold Date: Fri, 1 Nov 2013 15:22:25 -0400 Subject: [PATCH] Do JS setup immediately when possible --- cms/static/coffee/src/main.coffee | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/cms/static/coffee/src/main.coffee b/cms/static/coffee/src/main.coffee index 1ad5fbb8dd..fef7ce9871 100644 --- a/cms/static/coffee/src/main.coffee +++ b/cms/static/coffee/src/main.coffee @@ -2,17 +2,16 @@ define ["domReady", "jquery", "underscore.string", "backbone", "gettext", "js/views/feedback_notification", "coffee/src/ajax_prefix", "jquery.cookie"], (domReady, $, str, Backbone, gettext, NotificationView) -> - AjaxPrefix.addAjaxPrefix jQuery, -> - $("meta[name='path_prefix']").attr('content') - - window.CMS = window.CMS or {} - CMS.URL = CMS.URL or {} - window.onTouchBasedDevice = -> - navigator.userAgent.match /iPhone|iPod|iPad/i - - _.extend CMS, Backbone.Events - main = -> + AjaxPrefix.addAjaxPrefix jQuery, -> + $("meta[name='path_prefix']").attr('content') + + window.CMS = window.CMS or {} + CMS.URL = CMS.URL or {} + window.onTouchBasedDevice = -> + navigator.userAgent.match /iPhone|iPod|iPad/i + + _.extend CMS, Backbone.Events Backbone.emulateHTTP = true $.ajaxSetup @@ -48,8 +47,9 @@ define ["domReady", "jquery", "underscore.string", "backbone", "gettext", data: JSON.stringify(data) success: callback - if onTouchBasedDevice() - $('body').addClass 'touch-based-device' + domReady -> + if onTouchBasedDevice() + $('body').addClass 'touch-based-device' - domReady(main) + main() return main