From: Coleman Watts Date: Sat, 9 Mar 2013 05:42:39 +0000 (-0800) Subject: More consistent results with jquery.noconflict X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=a03524aa1edfa6a8f18fc91c72370946fde95db4;p=civicrm-core.git More consistent results with jquery.noconflict --- diff --git a/CRM/Core/Resources.php b/CRM/Core/Resources.php index 5118d9278b..c008438b01 100644 --- a/CRM/Core/Resources.php +++ b/CRM/Core/Resources.php @@ -440,7 +440,7 @@ class CRM_Core_Resources { } // Give control of jQuery back to the CMS - this loads last - $this->addScript('cj = jQuery.noConflict(true);', 9999, $region); + $this->addScriptFile('civicrm', 'js/noconflict.js', 9999, $region); $this->addCoreStyles($region); } diff --git a/CRM/Utils/System/Drupal6.php b/CRM/Utils/System/Drupal6.php index bdcd7eca7a..2181567417 100644 --- a/CRM/Utils/System/Drupal6.php +++ b/CRM/Utils/System/Drupal6.php @@ -327,10 +327,6 @@ SELECT name, mail * @access public */ public function addScriptUrl($url, $region) { - return FALSE; - // The below code does not prevent drupal's and civi's jquery from getting mixed up - // Dropping D6 support for drupal_add_js seems reasonable since we no longer officially support D6 - // But leaving the code in place in case anyone really wants to tackle it. switch ($region) { case 'html-header': case 'page-footer': @@ -342,12 +338,9 @@ SELECT name, mail // If the path is within the drupal directory we can add in the normal way if (CRM_Utils_System_Drupal::formatResourceUrl($url)) { drupal_add_js($url, 'module', $scope); + return TRUE; } - // D6 hack for external js files - else { - drupal_add_js('document.write(unescape("%3Cscript src=\'' . $url . '\' type=\'text/javascript\'%3E%3C/script%3E"));', 'inline', $scope); - } - return TRUE; + return FALSE; } /** @@ -363,10 +356,6 @@ SELECT name, mail * @access public */ public function addScript($code, $region) { - return FALSE; - // The below code does not prevent drupal's and civi's jquery from getting mixed up - // Dropping D6 support for drupal_add_js seems reasonable since we no longer officially support D6 - // But leaving the code in place in case anyone really wants to tackle it. switch ($region) { case 'html-header': case 'page-footer': diff --git a/js/noconflict.js b/js/noconflict.js new file mode 100644 index 0000000000..7284269128 --- /dev/null +++ b/js/noconflict.js @@ -0,0 +1 @@ +var cj = jQuery.noConflict(true);