<commit_before>/*
 * animations.js - jordansne.com
 *
 * Author: <NAME>
 * License: MIT
 */

const PAGE_SCROLL_EVENTS = 'scrollend mousedown mousewheel wheel keyup touchmove DOMMouseScroll resize';

class SectionAnimation {

    constructor(contentID) {
        this.contentID = '#' + contentID;
        this.contentLinkID = this.contentID + '_link';

        $(this.contentID).css("opacity", 0);
        this.addScrollEvent();
        this.registerFadeEvent();
    }

    /* Registers navbar buttons to their respective scroll events. */
    addScrollEvent() {
        const page = $('html, body');
        const stopFunction = function() { page.stop(); };

        $(this.contentLinkID).click(() => {
            page.animate({
                scrollTop: $(this.contentID).offset().top - 75
            }, 750, () => {
                page.off(PAGE_SCROLL_EVENTS, stopFunction);
                page.trigger('clicklink');
            });

            page.one(PAGE_SCROLL_EVENTS, stopFunction);
        });
    }

    /* Show content immediately if in view or register to an event handler if not. */
    registerFadeEvent() {
        const page = $('html, body');

        $(this.contentID).one('show', () => {
            $(this.contentID).animate({
                opacity: 1
            }, 400);
        });

        page.on(PAGE_SCROLL_EVENTS + ' clicklink', () => {
            if (this.isInView(this.contentID)) {
                $(this.contentID).trigger('show');
            }
        });
    }

    /* Returns true if div content in view of browser. */
    isInView() {
        const contentTop = $(this.contentID).offset().top;
        const contentBottom = contentTop + $(this.contentID).height();

        const viewTop = $(window).scrollTop();
        const viewBottom = viewTop + $(window).height();

        return (viewTop + 150 < contentBottom && viewBottom - 150 > contentTop);
    }
}

$(document).ready(function() {

    const sectionAnimations = [];<commit_msg>Add email obfuscation<commit_after>/*
 * animations.js - jordansne.com
 *
 * Author: <NAME>
 * License: MIT
 */

const PAGE_SCROLL_EVENTS = 'scrollend mousedown mousewheel wheel keyup touchmove DOMMouseScroll resize';

class SectionAnimation {

    constructor(contentID) {
        this.contentID = '#' + contentID;
        this.contentLinkID = this.contentID + '_link';

        $(this.contentID).css("opacity", 0);
        this.addScrollEvent();
        this.registerFadeEvent();
    }

    /* Registers navbar buttons to their respective scroll events. */
    addScrollEvent() {
        const page = $('html, body');
        const stopFunction = function() { page.stop(); };

        $(this.contentLinkID).click(() => {
            page.animate({
                scrollTop: $(this.contentID).offset().top - 75
            }, 750, () => {
                page.off(PAGE_SCROLL_EVENTS, stopFunction);
                page.trigger('clicklink');
            });

            page.one(PAGE_SCROLL_EVENTS, stopFunction);
        });
    }

    /* Show content immediately if in view or register to an event handler if not. */
    registerFadeEvent() {
        const page = $('html, body');

        $(this.contentID).one('show', () => {
            $(this.contentID).animate({
                opacity: 1
            }, 400);
        });

        page.on(PAGE_SCROLL_EVENTS + ' clicklink', () => {
            if (this.isInView(this.contentID)) {
                $(this.contentID).trigger('show');
            }
        });
    }

    /* Returns true if div content in view of browser. */
    isInView() {
        const contentTop = $(this.contentID).offset().top;
        const contentBottom = contentTop + $(this.contentID).height();

        const viewTop = $(window).scrollTop();
        const viewBottom = viewTop + $(window).height();

        return (viewTop + 150 < contentBottom && viewBottom - 150 > contentTop);
    }
}

/* Displays email redudantly to avoid spam. */
function setEmail() {
    const domain = "g" + "mail";
    const name = "jordan" + "sne";
    const suffix = ".c" + "om";

    const emailDiv = document.getElementById("email");

    for (let i = 0; i < emailDiv.childNodes.length; i++) {
        const child = emailDiv.childNodes[i];
        if (child.nodeName === 'A') {
            child.setAttribute("href", "mailto:" + name + "@" + domain + suffix);

            for (let j = 0; j < child.childNodes.length; j++) {
                const innerChild = child.childNodes[j];
                if (innerChild.nodeName === 'H3') {
                    innerChild.innerHTML = name + "@" + domain + suffix;
                }
            }
        }
    }
}

$(document).ready(function() {
    setEmail();

    const sectionAnimations = [];
{'fraction_non_alphanumeric': 0.14662447257383968, 'fraction_numerical': 0.007383966244725738, 'mean_word_length': 2.074578469520104, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 15, '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': '1497742', 'n_tokens_mistral': 1410, 'n_tokens_neox': 1318, 'n_words': 301}