Merge pull request #11335 from civicrm/4.7.28-rc
[civicrm-core.git] / js / Common.js
index fae46f6495fcaadedc1c642f459c49aeac8b8f7c..15f3528b2d6ebe0a41911306dfe0b52890c946f7 100644 (file)
@@ -243,10 +243,13 @@ if (!CRM.vars) CRM.vars = {};
       var script = document.createElement('script');
       scriptsLoaded[url] = $.Deferred();
       script.onload = function () {
-        if (window.jQuery === CRM.$ && CRM.CMSjQuery) {
-          window.jQuery = CRM.CMSjQuery;
-        }
-        scriptsLoaded[url].resolve();
+        // Give the script time to execute
+        window.setTimeout(function () {
+          if (window.jQuery === CRM.$ && CRM.CMSjQuery) {
+            window.jQuery = CRM.CMSjQuery;
+          }
+          scriptsLoaded[url].resolve();
+        }, 100);
       };
       // Make jQuery global available while script is loading
       if (window.jQuery !== CRM.$) {
@@ -1589,6 +1592,10 @@ if (!CRM.vars) CRM.vars = {};
     return format.replace(/1.*234.*56/, result);
   };
 
+  CRM.angRequires = function(name) {
+    return CRM.angular.requires[name] || [];
+  };
+
   CRM.console = function(method, title, msg) {
     if (window.console) {
       method = $.isFunction(console[method]) ? method : 'log';