<commit_before>showdown.extension('header-anchors', function () {
    var ancTpl = '$1<a id="user-content-$3" class="anchor" href="#$3" aria-hidden="true">' +
        '<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewBox="0 0 16 16" width="16">' +
        '<path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path>' +
        '</svg></a> $4';

    return [{
        type: 'html',
        regex: /(<h([1-3]) id="([^"]+?)">)(.*<\/h\2>)/g,
        replace: ancTpl
    }];
});
var converter = new showdown.Converter({tables: true, extensions: ['header-anchors']});

app.controller('mainController', ['$scope', '$http', '$interval', function ($scope, $http, $interval) {

    $scope.tabSelect = function (el) {
        // var w =$(".underline").parent().parent().parent().width();
        // $(".underline").width(w);
        var navOffset = $(".nav-tabs").find(".uib-tab").eq(el).offset();
        var lineOffset = $(".underline").offset();
        var currentMargin = $(".underline").margin();
        if (navOffset && lineOffset) {
            var diff = currentMargin.left + navOffset.left - lineOffset.left;
            $(".underline").animate({
                marginLeft: diff + 'px'
            }, 300);
        }
    }

    $scope.sendMessageIntercom = function () {
        Intercom('showNewMessage');
    }

    $scope.activeSlide = 0;
    $interval(function () {
        $scope.activeSlide = ($scope.activeSlide + 1) % 2;
    }, 10000);
}])

    .controller('docsController', function ($http, $state, $scope, $sce, sidebar, markdown, $q, parent) {
        $scope.promise = null;

        $scope.sidebar = converter.makeHtml(sidebar);
        $scope.content = converter.makeHtml(markdown);
        $scope.parent = parent;
        $scope.search = function (q) {

            $state.go('app.doc-search', {'query': q});
        }

    })

    .controller('formController', function ($scope, $http, $sce, $stateParams, $state) {
        $scope.form = {
            email: "",
            name: "",
            phone: "",
            message: ""
        }
        $scope.submitForm = function () {
            $scope.isLoading = true;
            $scope.complete = false;
            $http.post("https://mp3ssd6ej8.execute-api.us-east-1.amazonaws.com/prod/rakam-landing-send-email", {
                email: $scope.form.email,
                subject: '[Rakam.io] Contact form message',
                message: {
                    name: $scope.form.name,
                    message: $scope.form.message,
                    email: $scope.form.email
                }
            }).then(function () {
                $scope.isLoading = false;
                $('.form-success').fadeIn(400);
                $('.form-error').hide();
                $('.email-icon').animate({marginTop: '200px'}, 400);
                $('.inputs').animate({height: '0px'}, 400, function () {$(this).hide()});
                $scope.complete = true;
            }, function (e) {
                $('.form-error').fadeIn(400);
                $('.form-success').hide();
                $scope.isLoading = false;
            });


        }

        $scope.isLoading = false;


    })

    .controller('docsSearchController', function ($http, $scope, $sce, $state, $stateParams, sidebar, result) {

        $scope.sidebar = (converter.makeHtml(sidebar));
        $scope.result = result;
        $scope.query = $stateParams.query;
        $scope.search = function (q) {

            $state.go('app.doc-search', {'query': q});
        }
    })

    .controller('configController', function ($http, $scope, modules, $document) {
        $scope.modules = modules;

    })

    .controller('pricingController', function ($http, $scope) {

        $scope.pricingTabSelect = function (el) {

            var navOffset = $(".nav-tabs").find(".uib-tab").eq(el).offset();
            var lineOffset = $(".underline2").offset();
            var currentMargin = $(".underline2").margin();

            if (navOffset && lineOffset) {
                var diff = currentMargin.left + navOffset.left - lineOffset.left;

                $(".underline2").animate({
                    marginLeft: diff + 'px'
                }, 300);
            }

        }

    })

    .controller('demoController', ['$http', '$rootScope', '$scope', function ($http, $rootScope, $scope) {
        document.body.style.overflow = 'hidden';
        $rootScope.hiddenFooter = true;

        $scope.submitEmail = function (email) {
            if (window.Intercom) {
                window.Intercom('update', {email: email, visited_demo: true});
            }
            window.location = 'https://app.rakam.io/login?demo=187&email=' + email
        }

        $scope.verify = function (email) {
            if($scope.error) {
                $scope.submitEmail(email);
            }

            $http.get("https://api.hunter.io/trial/v2/email-verifier?api_key=0925084c997e6815149ee621344d1cef66194f68&format=json&email=" + email).then(function (response) {
                $scope.error = response.data.data.score <= 40;
                if(!$scope.error) {
                    $scope.submitEmail(email);<commit_msg>Update controllers.js<commit_after>showdown.extension('header-anchors', function () {
    var ancTpl = '$1<a id="user-content-$3" class="anchor" href="#$3" aria-hidden="true">' +
        '<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewBox="0 0 16 16" width="16">' +
        '<path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path>' +
        '</svg></a> $4';

    return [{
        type: 'html',
        regex: /(<h([1-3]) id="([^"]+?)">)(.*<\/h\2>)/g,
        replace: ancTpl
    }];
});
var converter = new showdown.Converter({tables: true, extensions: ['header-anchors']});

app.controller('mainController', ['$scope', '$http', '$interval', function ($scope, $http, $interval) {

    $scope.tabSelect = function (el) {
        // var w =$(".underline").parent().parent().parent().width();
        // $(".underline").width(w);
        var navOffset = $(".nav-tabs").find(".uib-tab").eq(el).offset();
        var lineOffset = $(".underline").offset();
        var currentMargin = $(".underline").margin();
        if (navOffset && lineOffset) {
            var diff = currentMargin.left + navOffset.left - lineOffset.left;
            $(".underline").animate({
                marginLeft: diff + 'px'
            }, 300);
        }
    }

    $scope.sendMessageIntercom = function () {
        Intercom('showNewMessage');
    }

    $scope.activeSlide = 0;
    $interval(function () {
        $scope.activeSlide = ($scope.activeSlide + 1) % 2;
    }, 10000);
}])

    .controller('docsController', function ($http, $state, $scope, $sce, sidebar, markdown, $q, parent) {
        $scope.promise = null;

        $scope.sidebar = converter.makeHtml(sidebar);
        $scope.content = converter.makeHtml(markdown);
        $scope.parent = parent;
        $scope.search = function (q) {

            $state.go('app.doc-search', {'query': q});
        }

    })

    .controller('formController', function ($scope, $http, $sce, $stateParams, $state) {
        $scope.form = {
            email: "",
            name: "",
            phone: "",
            message: ""
        }
        $scope.submitForm = function () {
            $scope.isLoading = true;
            $scope.complete = false;
            $http.post("https://mp3ssd6ej8.execute-api.us-east-1.amazonaws.com/prod/rakam-landing-send-email", {
                email: $scope.form.email,
                subject: '[Rakam.io] Contact form message',
                message: {
                    name: $scope.form.name,
                    message: $scope.form.message,
                    email: $scope.form.email
                }
            }).then(function () {
                $scope.isLoading = false;
                $('.form-success').fadeIn(400);
                $('.form-error').hide();
                $('.email-icon').animate({marginTop: '200px'}, 400);
                $('.inputs').animate({height: '0px'}, 400, function () {$(this).hide()});
                $scope.complete = true;
            }, function (e) {
                $('.form-error').fadeIn(400);
                $('.form-success').hide();
                $scope.isLoading = false;
            });


        }

        $scope.isLoading = false;


    })

    .controller('docsSearchController', function ($http, $scope, $sce, $state, $stateParams, sidebar, result) {

        $scope.sidebar = (converter.makeHtml(sidebar));
        $scope.result = result;
        $scope.query = $stateParams.query;
        $scope.search = function (q) {

            $state.go('app.doc-search', {'query': q});
        }
    })

    .controller('configController', function ($http, $scope, modules, $document) {
        $scope.modules = modules;

    })

    .controller('pricingController', function ($http, $scope) {

        $scope.pricingTabSelect = function (el) {

            var navOffset = $(".nav-tabs").find(".uib-tab").eq(el).offset();
            var lineOffset = $(".underline2").offset();
            var currentMargin = $(".underline2").margin();

            if (navOffset && lineOffset) {
                var diff = currentMargin.left + navOffset.left - lineOffset.left;

                $(".underline2").animate({
                    marginLeft: diff + 'px'
                }, 300);
            }

        }

    })

    .controller('demoController', ['$http', '$rootScope', '$scope', function ($http, $rootScope, $scope) {
        document.body.style.overflow = 'hidden';
        $rootScope.hiddenFooter = true;

        $scope.submitEmail = function (email) {
            if (window.Intercom) {
                window.Intercom('update', {email: email, visited_demo: true});
            }
            window.location = 'https://app.rakam.io/login?demo=907&email=' + email
        }

        $scope.verify = function (email) {
            if($scope.error) {
                $scope.submitEmail(email);
            }

            $http.get("https://api.hunter.io/trial/v2/email-verifier?api_key=0925084c997e6815149ee621344d1cef66194f68&format=json&email=" + email).then(function (response) {
                $scope.error = response.data.data.score <= 40;
                if(!$scope.error) {
                    $scope.submitEmail(email);
{'fraction_non_alphanumeric': 0.18210659898477158, 'fraction_numerical': 0.049854967367657724, 'mean_word_length': 1.9587020648967552, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 19, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4693326', 'n_tokens_mistral': 3877, 'n_tokens_neox': 3449, 'n_words': 630}