Commit f02df33a by David Baumgold

Merge pull request #1571 from edx/db/js-main-setup

Do JS setup immediately when possible
parents 3895a3fa b119a909
...@@ -2,17 +2,16 @@ define ["domReady", "jquery", "underscore.string", "backbone", "gettext", ...@@ -2,17 +2,16 @@ define ["domReady", "jquery", "underscore.string", "backbone", "gettext",
"js/views/feedback_notification", "js/views/feedback_notification",
"coffee/src/ajax_prefix", "jquery.cookie"], "coffee/src/ajax_prefix", "jquery.cookie"],
(domReady, $, str, Backbone, gettext, NotificationView) -> (domReady, $, str, Backbone, gettext, NotificationView) ->
AjaxPrefix.addAjaxPrefix jQuery, -> main = ->
$("meta[name='path_prefix']").attr('content') 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 window.CMS = window.CMS or {}
CMS.URL = CMS.URL or {}
window.onTouchBasedDevice = ->
navigator.userAgent.match /iPhone|iPod|iPad/i
main = -> _.extend CMS, Backbone.Events
Backbone.emulateHTTP = true Backbone.emulateHTTP = true
$.ajaxSetup $.ajaxSetup
...@@ -48,8 +47,9 @@ define ["domReady", "jquery", "underscore.string", "backbone", "gettext", ...@@ -48,8 +47,9 @@ define ["domReady", "jquery", "underscore.string", "backbone", "gettext",
data: JSON.stringify(data) data: JSON.stringify(data)
success: callback success: callback
if onTouchBasedDevice() domReady ->
$('body').addClass 'touch-based-device' if onTouchBasedDevice()
$('body').addClass 'touch-based-device'
domReady(main) main()
return main return main
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment