<commit_before>///<reference path='refs.ts'/>


module TDev.HTML {
    export function tr(parent: HTMLElement, cl: string) {
        var d = document.createElement('tr');
        d.className = cl;
        parent.appendChild(d);
        return d;
    }

    export function td(parent: HTMLElement, cl: string) {
        var d = document.createElement('td');
        d.className = cl;
        parent.appendChild(d);
        return d;
    }

    export function col(parent: HTMLElement) {
        var d = document.createElement('col');
        parent.appendChild(d);
        return d;
    }

    export function jsrequireAsync(url: string): Promise {
        return new Promise((onSuccess, onProgress, onError) => {
            // look for previous script tag
            if (Util.children(document.head).some(el => /script/i.test(el.tagName) && el.getAttribute("src") == url)) {
                onSuccess(undefined);
                return;
            }

            Util.log('require ' + url);
            // add a new script entry and wait till loaded
            var script = <HTMLScriptElement> document.createElement("script");
            script.type = "text/javascript";
            script.charset = "utf-8";
            script.onload = () => {
                if (!script.readyState || script.readyState === 'complete') {
                    Util.log('require success ' + url);
                    onSuccess(undefined);
                }
            };
            script.onreadystatechange = script.onload;
            script.onerror = (err) => {
                Util.log('require error: {0}', err);
                onSuccess(err)
            };
            script.src = url;
            document.head.appendChild(script);
        });
    }

    export interface OEmbed {
        title: string;
        author_name: string;
        author_url: string;
        html: string;
        thumbnail_url: string;
        provider_name: string;
        provider_url: string;
    }

    export function mkOEmbed(url: string, oe: OEmbed): HTMLElement {
        var d = div('md-video-link',
            div('', HTML.mkImg(oe.thumbnail_url)).withClick(() => window.open(url, 'oembed') ),
            oe.title,
            HTML.mkA('', oe.author_url, 'oembed', oe.author_name),
            HTML.mkA('', oe.provider_url, 'oembed', oe.provider_url)
            );
        return d;
    }

    export function mkVideoIframe(iframeSrc:string) {
        return Util.fmt("<div class='md-video-wrapper'><iframe src='{0:url}' frameborder='0' allowfullscreen=''></iframe></div>",iframeSrc);
    }<commit_msg>support for legacy full screen support<commit_after>///<reference path='refs.ts'/>


module TDev.HTML {
    export function tr(parent: HTMLElement, cl: string) {
        var d = document.createElement('tr');
        d.className = cl;
        parent.appendChild(d);
        return d;
    }

    export function td(parent: HTMLElement, cl: string) {
        var d = document.createElement('td');
        d.className = cl;
        parent.appendChild(d);
        return d;
    }

    export function col(parent: HTMLElement) {
        var d = document.createElement('col');
        parent.appendChild(d);
        return d;
    }

    export function jsrequireAsync(url: string): Promise {
        return new Promise((onSuccess, onProgress, onError) => {
            // look for previous script tag
            if (Util.children(document.head).some(el => /script/i.test(el.tagName) && el.getAttribute("src") == url)) {
                onSuccess(undefined);
                return;
            }

            Util.log('require ' + url);
            // add a new script entry and wait till loaded
            var script = <HTMLScriptElement> document.createElement("script");
            script.type = "text/javascript";
            script.charset = "utf-8";
            script.onload = () => {
                if (!script.readyState || script.readyState === 'complete') {
                    Util.log('require success ' + url);
                    onSuccess(undefined);
                }
            };
            script.onreadystatechange = script.onload;
            script.onerror = (err) => {
                Util.log('require error: {0}', err);
                onSuccess(err)
            };
            script.src = url;
            document.head.appendChild(script);
        });
    }

    export interface OEmbed {
        title: string;
        author_name: string;
        author_url: string;
        html: string;
        thumbnail_url: string;
        provider_name: string;
        provider_url: string;
    }

    export function mkOEmbed(url: string, oe: OEmbed): HTMLElement {
        var d = div('md-video-link',
            div('', HTML.mkImg(oe.thumbnail_url)).withClick(() => window.open(url, 'oembed') ),
            oe.title,
            HTML.mkA('', oe.author_url, 'oembed', oe.author_name),
            HTML.mkA('', oe.provider_url, 'oembed', oe.provider_url)
            );
        return d;
    }

    export function mkVideoIframe(iframeSrc:string) {
        return Util.fmt("<div class='md-video-wrapper'><iframe src='{0:url}' frameborder='0' webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe></div>",iframeSrc);
    }
{'fraction_non_alphanumeric': 0.1312630977329015, 'fraction_numerical': 0.0015240998285387694, 'mean_word_length': 1.9166666666666667, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 25, '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': '3452958', 'n_tokens_mistral': 1488, 'n_tokens_neox': 1438, 'n_words': 317}