<commit_before>/* Core */
var resizeText = function(size) {
    if ($('body').css('fontSize') === "") {
        $('body').css('fontSize', '1.0em');
    }

    $('body').css('fontSize', String(size) + "pt");
};

var FPS = 30;

var MARGIN = 10;

/* Bubbles */
var move_val = 1;
function Bubble(css_selector){
    this.selector = css_selector;
    this.top = parseInt($(""+this.selector).css('top'));
    this.left = parseInt($(""+this.selector).css('left'));
    this.width = parseInt($(""+this.selector).width());
    this.deltaX = move_val;
    this.deltaY = move_val;
    this.currentBorder = "none";
    this.update = function(){
        this.top = parseInt($(""+this.selector).css('top'));
        this.left = parseInt($(""+this.selector).css('left'));
    };
    this.move = function(){
        $(""+this.selector).css('top', "+="+this.deltaY+"px");
        $(""+this.selector).css('left', "+="+this.deltaX+"px");
    };

    this.updateMovementState = function(){
        var path = Math.floor(Math.random() * 8);

        if(this.currentBorder === "top"){
            var choiceArray = [4, 5, 6];
            path = choiceArray[ Math.floor(Math.random() * 3) ];
        }

        if(this.currentBorder === "bottom"){
            var choiceArray = [8, 1, 2];
            path = choiceArray[ Math.floor(Math.random() * 3) ];
        }

        if(this.currentBorder === "left"){
            var choiceArray = [2, 3, 4];
            path = choiceArray[ Math.floor(Math.random() * 3) ];
        }

        if(this.currentBorder === "right"){
            var choiceArray = [6, 7, 8];
            path = choiceArray[ Math.floor(Math.random() * 3) ];
        }

        switch (path) {
            case 0:
                this.deltaX = 0;
                this.deltaY = -move_val;
                break;
            case 1:
                this.deltaX = move_val;
                this.deltaY = -move_val;
                break;
            case 2:
                this.deltaX = move_val;
                this.deltaY = 0;
                break;
            case 3:
                this.deltaX = move_val;
                this.deltaY = move_val;
                break;
            case 4:
                this.deltaX = 0;
                this.deltaY = move_val;
                break;
            case 5:
                this.deltaX = -move_val;
                this.deltaY = move_val;
                break;
            case 6:
                this.deltaX = -move_val;
                this.deltaY = 0;
                break;
            case 7:
                this.deltaX = -move_val;
                this.deltaY = -move_val;
                break;
        }
    };

    this.isTouchingPageElement = function(){
        this.update();

        if(this.left >= 
            (parseInt($(window).innerWidth()) - (this.width + MARGIN)) 
            ) {
            console.log("choosing right border");
            console.log("window width: " + parseInt($(window).innerWidth()));
            console.log("bubble width: " + this.width);
            console.log("left: " + this.left);
            console.log("top: " + this.top);
            this.currentBorder = "right";
            return true;
        }

        if(this.top >= parseInt($(window).innerHeight())/2 ) {
            this.currentBorder = "bottom";
            return true;
        }
        
        if(this.top <= 0) {
            this.currentBorder = "top";
            return true;
        }
        
        if(this.left <= 0) {
            this.currentBorder = "left";
            return true;
        }
        
        this.currentBorder = "none";
        return false;
    };

    this.counter = 0;
    this.action = function(){
        if(this.isTouchingPageElement()) {
            this.updateMovementState();
        }
        if(this.counter === FPS * 4) {
            this.counter = 0;
            this.updateMovementState();
        }
        this.move();
        this.counter += 1;
    };

    /*$(''+this.selector).click(function(){
        $(''+this.selector).fadeOut(2000);
    });*/

    this.startX = parseInt( $(''+this.selector).css('left') );
    this.startY = parseInt( $(''+this.selector).css('top') );
    this.reset = function(){<commit_msg>more animate<commit_after>/* Core */
var resizeText = function(size) {
    if ($('body').css('fontSize') === "") {
        $('body').css('fontSize', '1.0em');
    }

    $('body').css('fontSize', String(size) + "pt");
};

var FPS = 35;

var MARGIN = 10;

/* Bubbles */
var move_val = 1;
function Bubble(css_selector){
    this.selector = css_selector;
    this.top = parseInt($(""+this.selector).css('top'));
    this.left = parseInt($(""+this.selector).css('left'));
    this.width = parseInt($(""+this.selector).width());
    this.deltaX = move_val;
    this.deltaY = move_val;
    this.currentBorder = "none";
    this.update = function(){
        this.top = parseInt($(""+this.selector).css('top'));
        this.left = parseInt($(""+this.selector).css('left'));
    };
    this.move = function(){
        $(""+this.selector).css('top', "+="+this.deltaY+"px");
        $(""+this.selector).css('left', "+="+this.deltaX+"px");
    };

    this.updateMovementState = function(){
        var path = Math.floor(Math.random() * 8);

        if(this.currentBorder === "top"){
            var choiceArray = [4, 5, 6];
            path = choiceArray[ Math.floor(Math.random() * 3) ];
        }

        if(this.currentBorder === "bottom"){
            var choiceArray = [8, 1, 2];
            path = choiceArray[ Math.floor(Math.random() * 3) ];
        }

        if(this.currentBorder === "left"){
            var choiceArray = [2, 3, 4];
            path = choiceArray[ Math.floor(Math.random() * 3) ];
        }

        if(this.currentBorder === "right"){
            var choiceArray = [6, 7, 8];
            path = choiceArray[ Math.floor(Math.random() * 3) ];
        }

        switch (path) {
            case 0:
                this.deltaX = 0;
                this.deltaY = -move_val;
                break;
            case 1:
                this.deltaX = move_val;
                this.deltaY = -move_val;
                break;
            case 2:
                this.deltaX = move_val;
                this.deltaY = 0;
                break;
            case 3:
                this.deltaX = move_val;
                this.deltaY = move_val;
                break;
            case 4:
                this.deltaX = 0;
                this.deltaY = move_val;
                break;
            case 5:
                this.deltaX = -move_val;
                this.deltaY = move_val;
                break;
            case 6:
                this.deltaX = -move_val;
                this.deltaY = 0;
                break;
            case 7:
                this.deltaX = -move_val;
                this.deltaY = -move_val;
                break;
        }
    };

    this.isTouchingPageElement = function(){
        this.update();

        if(this.left >= 
            (parseInt($(window).innerWidth()) - (this.width + MARGIN)) 
            ) {
            console.log("choosing right border");
            console.log("window width: " + parseInt($(window).innerWidth()));
            console.log("bubble width: " + this.width);
            console.log("left: " + this.left);
            console.log("top: " + this.top);
            this.currentBorder = "right";
            return true;
        }

        if(this.top >= parseInt($(window).innerHeight())/2 ) {
            this.currentBorder = "bottom";
            return true;
        }
        
        if(this.top <= 0) {
            this.currentBorder = "top";
            return true;
        }
        
        if(this.left <= 0) {
            this.currentBorder = "left";
            return true;
        }
        
        this.currentBorder = "none";
        return false;
    };

    this.counter = 0;
    this.action = function(){
        if(this.isTouchingPageElement()) {
            this.updateMovementState();
        }
        if(this.counter === FPS * 3) {
            this.counter = 0;
            this.updateMovementState();
        }
        this.move();
        this.counter += 1;
    };

    /*$(''+this.selector).click(function(){
        $(''+this.selector).fadeOut(2000);
    });*/

    this.startX = parseInt( $(''+this.selector).css('left') );
    this.startY = parseInt( $(''+this.selector).css('top') );
    this.reset = function(){
{'fraction_non_alphanumeric': 0.16274393849793023, 'fraction_numerical': 0.011117681845062094, 'mean_word_length': 1.5136741973840666, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '299981', 'n_tokens_mistral': 2621, 'n_tokens_neox': 2471, 'n_words': 458}