Commit bd431c83 authored by Eric Rasmussen's avatar Eric Rasmussen
Browse files

[gh-403] Use a cookie to preserve css/js syntax highlighting

parent 207edd57
/**
* 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();
}
}
};
......
......@@ -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.'),
),
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment