summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/syntax_highlight.js
diff options
context:
space:
mode:
authorJacob Schatz <jschatz1@gmail.com>2016-07-21 19:16:14 -0400
committerJacob Schatz <jschatz1@gmail.com>2016-07-21 19:16:14 -0400
commit08a2bdc560b949f359008f8c2c8d32a294ac48f8 (patch)
tree2ce8048810eb1e062eae2b27b24fef828a2cac69 /app/assets/javascripts/syntax_highlight.js
parent95c4825a456a4d1df8dba1def8735203368356c9 (diff)
downloadgitlab-ce-vanilla_js_no4.tar.gz
All files now JS instead of CSvanilla_js_no4
Diffstat (limited to 'app/assets/javascripts/syntax_highlight.js')
-rw-r--r--app/assets/javascripts/syntax_highlight.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/app/assets/javascripts/syntax_highlight.js b/app/assets/javascripts/syntax_highlight.js
new file mode 100644
index 00000000000..dba62638c78
--- /dev/null
+++ b/app/assets/javascripts/syntax_highlight.js
@@ -0,0 +1,18 @@
+(function() {
+ $.fn.syntaxHighlight = function() {
+ var $children;
+ if ($(this).hasClass('js-syntax-highlight')) {
+ return $(this).addClass(gon.user_color_scheme);
+ } else {
+ $children = $(this).find('.js-syntax-highlight');
+ if ($children.length) {
+ return $children.syntaxHighlight();
+ }
+ }
+ };
+
+ $(document).on('ready page:load', function() {
+ return $('.js-syntax-highlight').syntaxHighlight();
+ });
+
+}).call(this);