summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/syntax_highlight.js
blob: dba62638c78143bb71f79eb7fd3a468ae4a219fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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);