<commit_before>// CkEditor helper, checks to see if CkEditor editors in the given form are dirty

(function($){
  var ckeditor = {
    ignoreAnchorSelector: '.cke_dialog_ui_button',
    isDirty: function(form){
      editors = ckeditors(form);
      $.DirtyForms.dirtylog('Checking ' + editors.length + ' ckeditors for dirtyness.');
      var dirty = 0;
      editors.each(function() { if (this.checkDirty()) dirty += 1 });
      $.DirtyForms.dirtylog('There were ' + dirty + ' dirty ckeditors.');
      return dirty > 0;
    },
    setClean: function(form){
      ckeditors.each(function() { this.resetDirty() });
    }
  }
  var ckeditors = function(form) {
    editors = new Array();
    try {
      for (var key in CKEDITOR.instances) {
        if (CKEDITOR.instances.hasOwnProperty(key)) {
          editor = CKEDITOR.instances[key];
          if ($(editor.element.$).parents().index($(form)) != -1)
            editors.push(editor)
        }
      }
    }
    catch(e) {<commit_msg>Also included template dialog<commit_after>// CkEditor helper, checks to see if CkEditor editors in the given form are dirty

(function($){
  var ckeditor = {
    ignoreAnchorSelector: '.cke_dialog_ui_button, .cke_tpl_list a',
    isDirty: function(form){
      editors = ckeditors(form);
      $.DirtyForms.dirtylog('Checking ' + editors.length + ' ckeditors for dirtyness.');
      var dirty = 0;
      editors.each(function() { if (this.checkDirty()) dirty += 1 });
      $.DirtyForms.dirtylog('There were ' + dirty + ' dirty ckeditors.');
      return dirty > 0;
    },
    setClean: function(form){
      ckeditors.each(function() { this.resetDirty() });
    }
  }
  var ckeditors = function(form) {
    editors = new Array();
    try {
      for (var key in CKEDITOR.instances) {
        if (CKEDITOR.instances.hasOwnProperty(key)) {
          editor = CKEDITOR.instances[key];
          if ($(editor.element.$).parents().index($(form)) != -1)
            editors.push(editor)
        }
      }
    }
    catch(e) {
{'fraction_non_alphanumeric': 0.1453459432553509, 'fraction_numerical': 0.003982080637132902, 'mean_word_length': 2.66120218579235, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3666559', 'n_tokens_mistral': 663, 'n_tokens_neox': 642, 'n_words': 145}