<commit_before>//beautified with jsbeautifier from pip
(function() {

    function assert(v) {
        if (!v) {
            throw Error("assert error");
        }
    }

    function formPage(name, formNames) {
        this.name = name
        this.formNames = formNames
    }
    formPage.prototype = {
        submit: function() {
            var p = document.getElementsByClassName(this.name);
            assert(p.length == 1)
            p = p[0]
            r = {}
            for (var fname of this.formNames) {
                el = p.getElementsByClassName(fname);
                assert(el.length == 1)
                el = el[0]
                var v = el.value.trim()
                if (!v) {
                    this.print("Please fill out " + el.name + " field.");
                    return;
                }
                r[fname] = v;
            }
            alert(r);
        },
        print: function(x) {
            alert(x)
        },
    };

    for (var ev of document.getElementsByClassName("data-login-button")) {
        (function() {
            var x = new formPage("data-login", ["data-username", "data-password", ]);
            ev.addEventListener("click", function() {
                x.submit();
            });
        })();
    }

    for (var ev of document.getElementsByClassName("data-register-button")) {
        (function() {
            var x = new formPage("data-register", ["data-name", "data-email", "data-username", "data-password", "data-confirm-password", ]);
            ev.addEventListener("click", function() {
                x.submit();
            });
        })();
    }

})();<commit_msg>added pages<commit_after>//beautified with jsbeautifier from pip
(function() {

    function assert(v) {
        if (!v) {
            throw Error("assert error");
        }
    }

    pages = {
        search: ["searchbar", ],
        tags: ["tagsbar"],
        articles: ["searchbar", "articles"],
        login: ["login"],
        register: ["register"],

    }

    function selectPage(visibleSlides) {
        for (var slide of document.getElementsByClassName("data-slide")) {
            var arr = []
            for (var cl of slide.getAttribute("class").split(" "))
                if (cl != "hidden")
                    arr.push(cl)
            if (visibleSlides.indexOf(slide.getAttribute("data-slide-name")) < 0)
                arr.push("hidden");
            slide.setAttribute("class", arr.join(" "));
        }
    }

    function formPage(name, formNames) {
        this.name = name
        this.formNames = formNames
    }
    formPage.prototype = {
        submit: function() {
            var p = document.getElementsByClassName(this.name);
            assert(p.length == 1)
            p = p[0]
            r = {}
            for (var fname of this.formNames) {
                el = p.getElementsByClassName(fname);
                assert(el.length == 1)
                el = el[0]
                var v = el.value.trim()
                if (!v) {
                    this.print("Please fill out " + el.name + " field.");
                    return;
                }
                r[fname] = v;
            }
            alert(r);
        },
        print: function(x) {
            alert(x)
        },
    };

    selectPage(pages.search);

    for (var ev of document.getElementsByClassName("data-link")) {
        (function() {
            var p = ev.getAttribute("data-link-name");
            ev.addEventListener("click", function() {
                selectPage(pages[p])
            });
        })();
    }

    for (var ev of document.getElementsByClassName("data-login-button")) {
        (function() {
            var x = new formPage("data-login", ["data-username", "data-password", ]);
            ev.addEventListener("click", function() {
                x.submit();
            });
        })();
    }

    for (var ev of document.getElementsByClassName("data-register-button")) {
        (function() {
            var x = new formPage("data-register", ["data-name", "data-email", "data-username", "data-password", "data-confirm-password", ]);
            ev.addEventListener("click", function() {
                x.submit();
            });
        })();
    }

})();
{'fraction_non_alphanumeric': 0.1487312030075188, 'fraction_numerical': 0.0021146616541353382, 'mean_word_length': 1.4836639439906651, 'pattern_counts': {'":': 0, '<': 4, '<?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': '4787936', 'n_tokens_mistral': 1195, 'n_tokens_neox': 1153, 'n_words': 234}