diff --git a/cms/static/js/base.js b/cms/static/js/base.js index 98c793de35..0ac9932599 100644 --- a/cms/static/js/base.js +++ b/cms/static/js/base.js @@ -1,6 +1,6 @@ -require(["jquery", "underscore", "gettext", "js/views/feedback_notification", "js/views/feedback_prompt", +require(["domReady", "jquery", "underscore", "gettext", "js/views/feedback_notification", "js/views/feedback_prompt", "jquery.ui", "jquery.timepicker", "jquery.leanModal", "jquery.form", "jquery.smoothScroll"], - function($, _, gettext, NotificationView, PromptView) { + function(domReady, $, _, gettext, NotificationView, PromptView) { var $body; var $modal; @@ -12,7 +12,7 @@ var $newComponentTypePicker; var $newComponentTemplatePickers; var $newComponentButton; -$(document).ready(function() { +domReady(function() { $body = $('body'); $modal = $('.history-modal'); $modalCover = $('.modal-cover'); diff --git a/cms/templates/base.html b/cms/templates/base.html index df17017bc9..9bb7ae2285 100644 --- a/cms/templates/base.html +++ b/cms/templates/base.html @@ -159,9 +159,14 @@ var require = { deps: ["coffee/src/ajax_prefix"] } }, - // load these automatically - deps: ["jquery", "js/base", "coffee/src/main", "coffee/src/logger", "datepair"] - // we need "datepair" because it dynamically modifies the page when it is loaded -- yuck! + // load jquery automatically + deps: ["jquery"], + callback: function() { + // load other scripts on every page, after jquery loads + require(["js/base", "coffee/src/main", "coffee/src/logger", "datepair"]); + // we need "datepair" because it dynamically modifies the page + // when it is loaded -- yuck! + } };