<commit_before>/// <reference path="metron.extenders.ts" />
/// <reference path="metron.ts" />
/// <reference path="metron.lists.ts" />
/// <reference path="metron.forms.ts" />
/// <reference path="metron.tools.ts" />
/// <reference path="metron.templates.ts" />

namespace metron {
    export var globals: any = { };
    export function onready(callback: Function) {
        document.addEventListener("DOMContentLoaded", function(e) {
            if(metron.templates.master.hasMaster(document.documentElement.outerHTML)) {
                metron.templates.master.loadMaster(document.documentElement.outerHTML);
            }
            document.querySelectorAll("[data-m-type='markdown']").each(function (idx: number, elem: Element) {
                (<HTMLElement>elem).innerHTML = metron.templates.markdown.toHTML((<HTMLElement>elem).innerHTML);
            });
            let root: string = metron.fw.getApplicationRoot(document.documentElement.outerHTML);
            metron.tools.loadJSON(`${root}/metron.json`, function(configData: JSON) {
                for(let obj in configData) {
                    globals[obj] = configData[obj];
                }
                if(callback != null) {
                    callback(e);
                }
            });
        });
    }
    export namespace fw {
        export function getApplicationRoot(page: string): string {<commit_msg>document check for non-DOM usage<commit_after>/// <reference path="metron.extenders.ts" />
/// <reference path="metron.ts" />
/// <reference path="metron.lists.ts" />
/// <reference path="metron.forms.ts" />
/// <reference path="metron.tools.ts" />
/// <reference path="metron.templates.ts" />

namespace metron {
    export var globals: any = { };
    export function onready(callback: Function) {
        if(document !== undefined) {
            document.addEventListener("DOMContentLoaded", function(e) {
                if(metron.templates.master.hasMaster(document.documentElement.outerHTML)) {
                    metron.templates.master.loadMaster(document.documentElement.outerHTML);
                }
                document.querySelectorAll("[data-m-type='markdown']").each(function (idx: number, elem: Element) {
                    (<HTMLElement>elem).innerHTML = metron.templates.markdown.toHTML((<HTMLElement>elem).innerHTML);
                });
                let root: string = metron.fw.getApplicationRoot(document.documentElement.outerHTML);
                metron.tools.loadJSON(`${root}/metron.json`, function(configData: JSON) {
                    for(let obj in configData) {
                        globals[obj] = configData[obj];
                    }
                    if(callback != null) {
                        callback(e);
                    }
                });
            });
        }
    }
    export namespace fw {
        export function getApplicationRoot(page: string): string {
{'fraction_non_alphanumeric': 0.1405071967100754, 'fraction_numerical': 0.0, 'mean_word_length': 2.1488673139158574, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, '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': '7624481', 'n_tokens_mistral': 782, 'n_tokens_neox': 760, 'n_words': 122}