<commit_before>// requires Helpers.

// class that collects settings data and does the auto saving.
var SettingsAutoSaver = new function(){
    
    this.interval = 5000;
    this.hosted_settings = '';
    this.def_data = {};
    this.panel_data = {};
    this.final_data = {};
    
    
    // initialize all the class needs.
    this.init = function(){
        
        // load the default data.
        this.hosted_settings = this.get_hosted_settings();
        this.def_data = $.parseJSON(this.hosted_settings);
        this.panel_data = $.parseJSON(this.hosted_settings);
        
        
        // start the autosave.
        setInterval('SettingsAutoSaver.save()', this.interval);
        
        // display section events.
        $('.tickerbox').click(function(){
            // i'm on the right track, baby i was born this way!
            var value = (  $(this).is('.off') ? '0' : '1' );
            SettingsAutoSaver.set_data($(this).attr('field'), value);
        });
        
        // description and colors section events.
        $('#panel_desc_textbox').blur(function(){
            SettingsAutoSaver.set_data('description', $(this).val());
        });
        
        $('.btnBgColor').on('change', function(){
            SettingsAutoSaver.set_data('button_bg_color', $(this).val());
        });
        
        $('.mbtnBgColor').on('change', function(){
            SettingsAutoSaver.set_data('button_hover_bg_color', $(this).val());
        });
        
        $('.btnFontColor').on('change', function(){
            SettingsAutoSaver.set_data('button_font_color', $(this).val());
        });

        // layout section events
        $('.layout-list li').click(function(){
            $('.layout-list li').each(function(){
                $(this).removeClass('selected');
            });
            $(this).addClass('selected');
            $('#selectedLayout').val(this.id);
        });
        $('#chooseLayout').click(function(){
            $('#maskDisabler').fadeIn();
            SettingsAutoSaver.set_data('theme_name', $('#selectedLayout').val());
        });
        
        // social media section events.
        $('.social_url').blur(function(){
            
            var url = $(this).val();
            var fb_regex = /^(https?:\/\/)?(www\.)?facebook\.com\/[\w\.-]+\/?$/;
            var tw_regex = /^(https?:\/\/)?(www\.)?twitter\.com\/(#!\/)?@?[\w\.-]+\/?$/;
            
            $(this).parent().find('.social_url_msg').hide();
            
            if( $(this).is('#fb_url') && url != SettingsAutoSaver.def_data.facebook_url ){
                if( url == '' ){
                    SettingsAutoSaver.set_data('facebook_url', url);
                    $('.social-icon.fb a').attr('href', '');<commit_msg>Removed redundant functions with settings.js<commit_after>// requires Helpers.

// class that collects settings data and does the auto saving.
var SettingsAutoSaver = new function(){
    
    this.interval = 5000;
    this.hosted_settings = '';
    this.def_data = {};
    this.panel_data = {};
    this.final_data = {};
    
    
    // initialize all the class needs.
    this.init = function(){
        
        // load the default data.
        this.hosted_settings = this.get_hosted_settings();
        this.def_data = $.parseJSON(this.hosted_settings);
        this.panel_data = $.parseJSON(this.hosted_settings);
        
        
        // start the autosave.
        setInterval('SettingsAutoSaver.save()', this.interval);
        
        // display section events.
        $('.tickerbox').click(function(){
            // i'm on the right track, baby i was born this way!
            var value = (  $(this).is('.off') ? '0' : '1' );
            SettingsAutoSaver.set_data($(this).attr('field'), value);
        });
        
        // description and colors section events.
        $('#panel_desc_textbox').blur(function(){
            SettingsAutoSaver.set_data('description', $(this).val());
        });
        
        $('.btnBgColor').on('change', function(){
            SettingsAutoSaver.set_data('button_bg_color', $(this).val());
        });
        
        $('.mbtnBgColor').on('change', function(){
            SettingsAutoSaver.set_data('button_hover_bg_color', $(this).val());
        });
        
        $('.btnFontColor').on('change', function(){
            SettingsAutoSaver.set_data('button_font_color', $(this).val());
        });
        
        // social media section events.
        $('.social_url').blur(function(){
            
            var url = $(this).val();
            var fb_regex = /^(https?:\/\/)?(www\.)?facebook\.com\/[\w\.-]+\/?$/;
            var tw_regex = /^(https?:\/\/)?(www\.)?twitter\.com\/(#!\/)?@?[\w\.-]+\/?$/;
            
            $(this).parent().find('.social_url_msg').hide();
            
            if( $(this).is('#fb_url') && url != SettingsAutoSaver.def_data.facebook_url ){
                if( url == '' ){
                    SettingsAutoSaver.set_data('facebook_url', url);
                    $('.social-icon.fb a').attr('href', '');
{'fraction_non_alphanumeric': 0.18557919621749408, 'fraction_numerical': 0.002364066193853428, 'mean_word_length': 1.8895845190665908, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, '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': '3861458', 'n_tokens_mistral': 1483, 'n_tokens_neox': 1438, 'n_words': 242}