<commit_before>// Overwrite this file in your application /app/assets/javascripts/comfortable_mexican_sofa/admin/application.js
//= require requirejs/require
//= require require_config

window.CMS.wysiwyg = function() {
  'use strict';
  require([
    'mas-editor',
    'editor-plugin-auto-resize-textarea',
    'word-upload'
  ], function (
    masEditor,
    editorPluginAutoResizeTextarea,
    wordUpload
  ) {
    var markdownEditorContentNode = document.querySelector('.js-markdown-editor-content');

    if(!markdownEditorContentNode) return;

    markdownEditorContentNode.value = markdownEditorContentNode.value.split("\n").map(function(e) { return e.trim() }).join("\n");

    masEditor.init({
      editorContainer: document.querySelector('.l-editor'),
      cmsFormNode: document.querySelector('#edit_page') || document.querySelector('#new_page'),
      toolbarNode: document.querySelector('.js-toolbar'),
      htmlEditorNode: document.querySelector('.js-html-editor'),
      htmlEditorContentNode: document.querySelector('.js-html-editor-content'),
      markdownEditorNode: document.querySelector('.js-markdown-editor'),
      markdownEditorContentNode: markdownEditorContentNode,
      switchModeTriggerNodes: document.querySelectorAll('.js-switch-mode'),
      editorOptions: {
        editorLibOptions : {
          sanitizer : {
            tags: {
              p: {},
              br: {},
              b: {},
              strong: {},
              i: {},
              strike: {},
              blockquote: {},
              ol: {},
              ul: {},
              li: {},
              a: { href: true },
              h2: {},
              h3: {},
              h4: {},
              h5: {}
            }
          }
        }
      }
    });

    masEditor.editor.use(editorPluginAutoResizeTextarea(markdownEditorContentNode));

    var focusOnTitle = function() {
      var el = document.querySelector('input#page_label');
      el.value = el.value;
    };

    setTimeout(focusOnTitle, 500);

    // Setup Word upload form elements
    wordUpload.init({
      showConfirm: true,
      fileInputNode: document.querySelector('.js-word-upload-file-input'),
      activateFileInputNode: document.querySelector('.js-activate-word-upload-form'),
      wordFormNode: document.querySelector('.js-word-upload-form')
    });
  });
};

window.CMS.mirrors = function() {
  'use strict';
  $('#site__mirrors').change(function() {
    window.location = $(this).find('input:checked').data()['value'];
  });
};
<commit_msg>More JS linting<commit_after>// Overwrite this file in your application /app/assets/javascripts/comfortable_mexican_sofa/admin/application.js
//= require requirejs/require
//= require require_config

window.CMS.wysiwyg = function() {
  'use strict';
  require([
    'mas-editor',
    'editor-plugin-auto-resize-textarea',
    'word-upload'
  ], function (
    masEditor,
    editorPluginAutoResizeTextarea,
    wordUpload
  ) {
    var markdownEditorContentNode = document.querySelector('.js-markdown-editor-content');

    if(!markdownEditorContentNode) return;

    markdownEditorContentNode.value = markdownEditorContentNode.value.split('\n').map(function(e) {
      return e.trim();
    }).join('\n');

    masEditor.init({
      editorContainer: document.querySelector('.l-editor'),
      cmsFormNode: document.querySelector('#edit_page') || document.querySelector('#new_page'),
      toolbarNode: document.querySelector('.js-toolbar'),
      htmlEditorNode: document.querySelector('.js-html-editor'),
      htmlEditorContentNode: document.querySelector('.js-html-editor-content'),
      markdownEditorNode: document.querySelector('.js-markdown-editor'),
      markdownEditorContentNode: markdownEditorContentNode,
      switchModeTriggerNodes: document.querySelectorAll('.js-switch-mode'),
      editorOptions: {
        editorLibOptions : {
          sanitizer : {
            tags: {
              p: {},
              br: {},
              b: {},
              strong: {},
              i: {},
              strike: {},
              blockquote: {},
              ol: {},
              ul: {},
              li: {},
              a: { href: true },
              h2: {},
              h3: {},
              h4: {},
              h5: {}
            }
          }
        }
      }
    });

    masEditor.editor.use(editorPluginAutoResizeTextarea(markdownEditorContentNode));

    var focusOnTitle = function() {
      var el = document.querySelector('input#page_label');
      el.value = el.value;
    };

    setTimeout(focusOnTitle, 500);

    // Setup Word upload form elements
    wordUpload.init({
      showConfirm: true,
      fileInputNode: document.querySelector('.js-word-upload-file-input'),
      activateFileInputNode: document.querySelector('.js-activate-word-upload-form'),
      wordFormNode: document.querySelector('.js-word-upload-form')
    });
  });
};

window.CMS.mirrors = function() {
  'use strict';
  $('#site__mirrors').change(function() {
    window.location = $(this).find('input:checked').data()['value'];
  });
};

{'fraction_non_alphanumeric': 0.1451581221763897, 'fraction_numerical': 0.0027499508937340405, 'mean_word_length': 2.5141476880607314, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3316448', 'n_tokens_mistral': 1409, 'n_tokens_neox': 1404, 'n_words': 212}