<commit_before>var radians = 0.0174532925,
        clockRadius = 200,
        margin = 50,
        width = (clockRadius+margin)*2,
        height = (clockRadius+margin)*2,
        hourHandLength = 2*clockRadius/3,
        minuteHandLength = clockRadius,
        secondHandLength = clockRadius-12,
        secondHandBalance = 30,
        secondTickStart = clockRadius,
        secondTickLength = -10,
        hourTickStart = clockRadius,
        hourTickLength = -18,
        secondLabelRadius = clockRadius + 16,
        secondLabelYOffset = 5,
        hourLabelRadius = clockRadius - 40,
        hourLabelYOffset = 7;
        temp = 0; //used in countdown
        alarm_time = [];    //storage for the specific clock alarm time
        alarm = [];         //just a storage for text
        alarmCount = [];    //used as a counter
        ampm = [];          //am or pm for the local time according to the inputted timezone

var activeTab = "#home";

var hourScale = d3.scale.linear()
        .range([0,330])
        .domain([0,11]);

var minuteScale = secondScale = d3.scale.linear()
        .range([0,354])
        .domain([0,59]);

//world clocks data
var handData = [
    {
        type:'hour',
        value:0,
        length:-hourHandLength,
        scale:hourScale
    },
    {
        type:'minute',
        value:0,
        length:-minuteHandLength,
        scale:minuteScale
    },
    {
        type:'second',
        value:0,
        length:-secondHandLength,
        scale:secondScale,
        balance:secondHandBalance
    }
];

var clockObject = [];
var clocks = [];
var clock = {
    render : function(view){
        var dd = $(".digital_display");
        var clockRadius = parseInt(view['clockSize']);
        var offset = parseInt(view['timezone']);
        var guid = view['guid'];
        clocks[guid] = view;
        seconds = 0, minutes = 0, hours = 0;

        var template = $('#template_timer_box').html();
        Mustache.parse(template);
        var output = Mustache.render(template, view);
        //append the output to the specific tab
        if(view['type'] !== 'undefined')
        {
            activeTab = $(".nav .active > a").attr("href");

            // after save global | local pressed activeTab somehow equals '#'
            // next line is fix
            if(activeTab === '#') activeTab = '#home';

            switch(view['type'])
            {
                case '1':
                    $(activeTab+' > .timer_holder').append(output);
                    break;
                case '2':
                    $(activeTab+' > .timer_holder').append(output);
                    alarm_time[guid] = view['alarm_time'].split(":");
                    alarm_time[guid][0] = parseInt(alarm_time[guid][0]);
                    alarm_time[guid][1] = parseInt(alarm_time[guid][1]);

                    //afternoon time
                    if(alarm_time[guid][0] > 12)
                    {
                        alarm_time[guid][0] = alarm_time[guid][0]%12;
                        alarm_time[guid][2] = "PM";
                    }
                    else    //morning time
                    {
                        alarm_time[guid][2] = "AM";
                    }

                    alarm[guid] = alarm_time[guid][0]+":"+alarm_time[guid][1]+" "+alarm_time[guid][2];
                    break;
                case '3':
                    $(activeTab+' > .timer_holder').append(output);

                    //initialize first the countdown data
                    if(typeof handData[guid] === 'undefined')
                    {
                        var formattedTime = view['time'].split(":"); //split the inputted time to an array
                        //check if seconds is 0 while the others are not
                        if(parseInt(formattedTime[2]) == 0 &&
                            (parseInt(formattedTime[1]) != 0 ||
                            parseInt(formattedTime[0]) != 0))<commit_msg>add ajax request with alarm_time data<commit_after>var radians = 0.0174532925,
        clockRadius = 200,
        margin = 50,
        width = (clockRadius+margin)*2,
        height = (clockRadius+margin)*2,
        hourHandLength = 2*clockRadius/3,
        minuteHandLength = clockRadius,
        secondHandLength = clockRadius-12,
        secondHandBalance = 30,
        secondTickStart = clockRadius,
        secondTickLength = -10,
        hourTickStart = clockRadius,
        hourTickLength = -18,
        secondLabelRadius = clockRadius + 16,
        secondLabelYOffset = 5,
        hourLabelRadius = clockRadius - 40,
        hourLabelYOffset = 7;
        temp = 0; //used in countdown
        alarm_time = [];    //storage for the specific clock alarm time
        alarm = [];         //just a storage for text
        alarmCount = [];    //used as a counter
        ampm = [];          //am or pm for the local time according to the inputted timezone

var activeTab = "#home";

var hourScale = d3.scale.linear()
        .range([0,330])
        .domain([0,11]);

var minuteScale = secondScale = d3.scale.linear()
        .range([0,354])
        .domain([0,59]);

//world clocks data
var handData = [
    {
        type:'hour',
        value:0,
        length:-hourHandLength,
        scale:hourScale
    },
    {
        type:'minute',
        value:0,
        length:-minuteHandLength,
        scale:minuteScale
    },
    {
        type:'second',
        value:0,
        length:-secondHandLength,
        scale:secondScale,
        balance:secondHandBalance
    }
];

var clockObject = [];
var clocks = [];
var clock = {
    render : function(view){
        var dd = $(".digital_display");
        var clockRadius = parseInt(view['clockSize']);
        var offset = parseInt(view['timezone']);
        var guid = view['guid'];
        clocks[guid] = view;
        seconds = 0, minutes = 0, hours = 0;

        var template = $('#template_timer_box').html();
        Mustache.parse(template);
        var output = Mustache.render(template, view);
        //append the output to the specific tab
        if(view['type'] !== 'undefined')
        {
            activeTab = $(".nav .active > a").attr("href");

            // after save global | local pressed activeTab somehow equals '#'
            // next line is fix
            if(activeTab === '#') activeTab = '#home';

            switch(view['type'])
            {
                case '1':
                    $(activeTab+' > .timer_holder').append(output);
                    break;
                case '2':
                    /**
                     * if isset alarm_time, send post request with given time.
                     * maybe also need send date?
                     *
                     * need send this data to controller which can insert into database
                     */
                    if(typeof view['alarm_time'] !== 'undefined') {
                        $.ajax({
                            type: "POST",
                            url: "#",
                            data: "time=" + view['alarm_time'],
                            cache: false,
                            success: function(msg) {
                                alert('Alarm time: ' + view['alarm_time']);
                            }
                        });
                    }

                    $(activeTab+' > .timer_holder').append(output);
                    alarm_time[guid] = view['alarm_time'].split(":");
                    alarm_time[guid][0] = parseInt(alarm_time[guid][0]);
                    alarm_time[guid][1] = parseInt(alarm_time[guid][1]);

                    //afternoon time
                    if(alarm_time[guid][0] > 12)
                    {
                        alarm_time[guid][0] = alarm_time[guid][0]%12;
                        alarm_time[guid][2] = "PM";
                    }
                    else    //morning time
                    {
                        alarm_time[guid][2] = "AM";
                    }

                    alarm[guid] = alarm_time[guid][0]+":"+alarm_time[guid][1]+" "+alarm_time[guid][2];
                    break;
                case '3':
                    $(activeTab+' > .timer_holder').append(output);

                    //initialize first the countdown data
                    if(typeof handData[guid] === 'undefined')
                    {
                        var formattedTime = view['time'].split(":"); //split the inputted time to an array
                        //check if seconds is 0 while the others are not
                        if(parseInt(formattedTime[2]) == 0 &&
                            (parseInt(formattedTime[1]) != 0 ||
                            parseInt(formattedTime[0]) != 0))
{'fraction_non_alphanumeric': 0.12395559116401511, 'fraction_numerical': 0.018999656632711456, 'mean_word_length': 1.4285714285714286, 'pattern_counts': {'":': 6, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3565764', 'n_tokens_mistral': 2391, 'n_tokens_neox': 2260, 'n_words': 528}