From 1de2ee8b8887b8fcbc26d8834ac7b02289fd8ebd Mon Sep 17 00:00:00 2001
From: Mark Carver <mark.carver@me.com>
Date: Sun, 31 Mar 2013 20:38:36 -0500
Subject: [PATCH] Fixes [#1846736] - Remove jQuery CDN setting in favor of
 using jQuery Update module

---
 README.txt         |  2 +-
 bootstrap.info     |  1 -
 includes/theme.inc | 20 +++-----------------
 js/switch.js       |  7 -------
 theme-settings.php |  9 ---------
 5 files changed, 4 insertions(+), 35 deletions(-)
 delete mode 100644 js/switch.js

diff --git a/README.txt b/README.txt
index 710f13b..30ed6ec 100644
--- a/README.txt
+++ b/README.txt
@@ -3,6 +3,6 @@ Bootstrap theme for Drupal
 1. Download the Bootstrap library v2 (http://twitter.github.com/bootstrap/), make sure the resulting folder is named "bootstrap." If you are using the Github master branch, you will need to also find a way to compile the LESS and JS files since this module looks for bootstrap.css and bootstrap.js. 
 2. Place the bootstrap folder inside the bootstrap theme folder or your subtheme folder: [path_to_themes]/bootstrap/bootstrap/js…
 3. Put any plugin files into [path_to_themes]/bootstrap/bootstrap/js/
-4. Make sure you have jQuery 1.7, which is available through the jQuery Update module (http://drupal.org/project/jquery_update/) 7.x-2.x-dev version. You need to make sure the 1.7 version is selected on the configuration page for it to work.
+4. Make sure you have jQuery 1.7, which is available through the jQuery Update module (http://drupal.org/project/jquery_update/) 7.x-2.3 version or higher. You need to make sure the 1.7 version is selected on the configuration page for it to work.
 
 Author: http://drupal.org/node/259843/committers
\ No newline at end of file
diff --git a/bootstrap.info b/bootstrap.info
index b293396..7d0e2b0 100644
--- a/bootstrap.info
+++ b/bootstrap.info
@@ -18,7 +18,6 @@ settings[toggle_name] = 0
 settings[toggle_search] = 1
 settings[cdn_bootstrap] = 0
 settings[cdn_bootstrap_version] = 2.3.0
-settings[cdn_jquery] = 0
 
 ;Exclude
 ;javascript
diff --git a/includes/theme.inc b/includes/theme.inc
index 054f30f..36296c5 100644
--- a/includes/theme.inc
+++ b/includes/theme.inc
@@ -306,25 +306,11 @@ function bootstrap_js_alter(&$js) {
   }
 
   $js = array_diff_key($js, $excludes);
-  if (theme_get_setting('cdn_jquery')) {
-    // Add jQuery and the switch script to the $files array
-    $files[] = '//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js';
-
-    if (theme_get_setting('cdn_bootstrap')) {
-      $files[] = '//netdna.bootstrapcdn.com/twitter-bootstrap/'. theme_get_setting('cdn_bootstrap_version')  .'/js/bootstrap.min.js';
-    }
-    else {
-      $files[] = $theme_path . '/bootstrap/js/bootstrap.js';
-    }
-    $files[] = $theme_path . '/js/switch.js';
+  if (theme_get_setting('cdn_bootstrap')) {
+    $files[] = '//netdna.bootstrapcdn.com/twitter-bootstrap/'. theme_get_setting('cdn_bootstrap_version')  .'/js/bootstrap.min.js';
   }
   else {
-    if (theme_get_setting('cdn_bootstrap')) {
-      $files[] = '//netdna.bootstrapcdn.com/twitter-bootstrap/'. theme_get_setting('cdn_bootstrap_version')  .'/js/bootstrap.min.js';
-    }
-    else {
-      $files[] = $theme_path . '/bootstrap/js/bootstrap.js';
-    }
+    $files[] = $theme_path . '/bootstrap/js/bootstrap.js';
   }
 
   // Rearrange / Add JS
diff --git a/js/switch.js b/js/switch.js
deleted file mode 100644
index 53d1cd8..0000000
--- a/js/switch.js
+++ /dev/null
@@ -1,7 +0,0 @@
-(function($) {
-  // put together the name of the new jQuery variable
-  var version = $().jquery;
-  var versionName = version.replace(/\./g, '');
-  // save the new version of jQuery globally and restore Drupal version
-  window.jq_bootstrap = jQuery.noConflict(true);
-})(jQuery);
diff --git a/theme-settings.php b/theme-settings.php
index a28ddf6..ca7e012 100644
--- a/theme-settings.php
+++ b/theme-settings.php
@@ -56,14 +56,5 @@ function bootstrap_form_system_theme_settings_alter(&$form, $form_state, $form_i
     '#default_value' => theme_get_setting('cdn_bootstrap_version'),
   );
 
-  $form['cdn']['cdn_jquery'] = array(
-    '#type'          => 'checkbox',
-    '#title'         => t('Use CDN to load in a newer version of jQuery using the no-conflict solution.'),
-    '#default_value' => theme_get_setting('cdn_jquery'),
-    '#description'   => t('Use cdn to host the latest version of jquery and load the newer version using the ') . l('no-conflict', 'http://api.jquery.com/jQuery.noConflict/') . t(' solution.')
-                          . '<div class="alert alert-error">' .
-                            ('WARNING: this technique will load 2 versions of jQuery, which is bad for front-end performance and adds an extra whopping 90kb (not gziped) to your download (aka not mobile friendly).
-                             Also this solution uses CDN and this will make you dependant on a third party who has no obligations towards you concerning uptime and service quality.') . '</div>',
-  );
 }
 
-- 
1.7.11.5

