From bd431c832d4d12f1642a23db2b0c4ecdea92ff01 Mon Sep 17 00:00:00 2001
From: Eric Rasmussen <ericrasmussen1@gmail.com>
Date: Fri, 15 Jun 2012 15:09:41 -0500
Subject: [PATCH] [gh-403] Use a cookie to preserve css/js syntax highlighting

---
 sites/all/themes/unl_wdn/codemirror/unl.js  | 9 ++++++++-
 sites/all/themes/unl_wdn/theme-settings.php | 2 +-
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/sites/all/themes/unl_wdn/codemirror/unl.js b/sites/all/themes/unl_wdn/codemirror/unl.js
index 36910a53..7d3912b1 100644
--- a/sites/all/themes/unl_wdn/codemirror/unl.js
+++ b/sites/all/themes/unl_wdn/codemirror/unl.js
@@ -1,5 +1,5 @@
 /**
- * Adds links to enable syntax highlighting to CSS and JS textareas 
+ * Adds links to enable syntax highlighting to CSS and JS textareas
  *   under admin/appearance/settings/unl_wdn
  * This code from cpn (Code Per Node) module.
  */
@@ -30,6 +30,7 @@
           });
           $(this).data('editor', editor);
           $(this).text(Drupal.t('Disable syntax highlighting')).addClass('enabled');
+          $.cookie('codeHighlight', true);
         }
 
         // Disable
@@ -37,10 +38,16 @@
           $(this).data('editor').toTextArea();
           $grippie.show();
           $(this).text(Drupal.t('Enable syntax highlighting')).removeClass('enabled');
+          $.cookie('codeHighlight', null);
         }
         return false;
       });
 
+      // Enable on page load if cookie is set
+      if ($.cookie('codeHighlight')) {
+        $('.codemirror-toggle').click();
+      }
+
     }
 
   };
diff --git a/sites/all/themes/unl_wdn/theme-settings.php b/sites/all/themes/unl_wdn/theme-settings.php
index 121fb55a..2d057fb1 100644
--- a/sites/all/themes/unl_wdn/theme-settings.php
+++ b/sites/all/themes/unl_wdn/theme-settings.php
@@ -103,7 +103,7 @@ function unl_wdn_form_system_theme_settings_alter(&$form, &$form_state) {
     '#title' => t('Advanced settings'),
     'sidebar_first_width' => array(
       '#type' => 'textfield',
-      '#title' => t('Sidebar first Grid Size'),
+      '#title' => t('Sidebar first grid size'),
       '#default_value' => theme_get_setting('sidebar_first_width'),
       '#description' => t('Enter only the numeral, for grid4 just enter 4.'),
     ),
-- 
GitLab