<commit_before>require('codemirror/mode/yaml/yaml');
require('codemirror/mode/javascript/javascript');
require('codemirror/mode/css/css');
require('codemirror/mode/htmlmixed/htmlmixed');

var fs = require('fs');
var _ = require("underscore");
var CodeMirror = require('codemirror/lib/codemirror');
var hasher = require("hasher");
var MonsterParser = require('./MonsterParser');
var base64 = require("./Base64");
var BookmarkletGenerator = require('../services/BookmarkletGenerator');

var INITIAL_MONSTER_DATA = fs.readFileSync(__dirname + '/../../test.yaml', 'utf8');

var initialize = function (updateMonstersCallback) {
    var codeMirrorEditor,
        permalink = document.getElementById('permalink'),
        fallback = INITIAL_MONSTER_DATA || '',
        sourceTextArea = document.getElementById('source'),
        bookmarkletLink = document.getElementById('bookmarklet-link');

    sourceTextArea.innerHTML = INITIAL_MONSTER_DATA;
    bookmarkletLink.href = BookmarkletGenerator.generated;

    var _parse = function() {
        var str, monsters;
        str = codeMirrorEditor.getValue();
        permalink.href = '#yaml=' + base64.encode(str);
        monsters = MonsterParser.parseMonstersFromYaml(str);
        updateMonstersCallback(monsters);
    };
    var parse = _.debounce(_parse, 500);
    var updateSource = function() {
        var yaml;
        if (location.hash && '#yaml=' === location.hash.toString().slice(0, 6)) {
            yaml = base64.decode(location.hash.slice(6));
        }
        codeMirrorEditor.setValue(yaml || fallback);
    };<commit_msg>Disabled onclick behavior for the bookmarklet button, since it is not meant to be executed on the landing page.<commit_after>require('codemirror/mode/yaml/yaml');
require('codemirror/mode/javascript/javascript');
require('codemirror/mode/css/css');
require('codemirror/mode/htmlmixed/htmlmixed');

var fs = require('fs');
var _ = require("underscore");
var CodeMirror = require('codemirror/lib/codemirror');
var hasher = require("hasher");
var MonsterParser = require('./MonsterParser');
var base64 = require("./Base64");
var BookmarkletGenerator = require('../services/BookmarkletGenerator');
var INITIAL_MONSTER_DATA = fs.readFileSync(__dirname + '/../../test.yaml', 'utf8');

var initialize = function (updateMonstersCallback) {
    var codeMirrorEditor,
        permalink = document.getElementById('permalink'),
        fallback = INITIAL_MONSTER_DATA || '',
        sourceTextArea = document.getElementById('source'),
        bookmarkletLink = document.getElementById('bookmarklet-link'),
        instructions = document.querySelector('.instructions');

    bookmarkletLink.addEventListener("click", function(e){
        e.stopPropagation();
        e.preventDefault();
        instructions.innerHTML = "You must *drag* the button to your toolbar to install; clicking it here will do nothing!";
    }, false);
    bookmarkletLink.href = BookmarkletGenerator.generated;

    sourceTextArea.innerHTML = INITIAL_MONSTER_DATA;

    var _parse = function() {
        var str, monsters;
        str = codeMirrorEditor.getValue();
        permalink.href = '#yaml=' + base64.encode(str);
        monsters = MonsterParser.parseMonstersFromYaml(str);
        updateMonstersCallback(monsters);
    };
    var parse = _.debounce(_parse, 500);
    var updateSource = function() {
        var yaml;
        if (location.hash && '#yaml=' === location.hash.toString().slice(0, 6)) {
            yaml = base64.decode(location.hash.slice(6));
        }
        codeMirrorEditor.setValue(yaml || fallback);
    };
{'fraction_non_alphanumeric': 0.138268156424581, 'fraction_numerical': 0.008379888268156424, 'mean_word_length': 3.8987688098495212, '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': '7363457', 'n_tokens_mistral': 1052, 'n_tokens_neox': 1010, 'n_words': 200}