<commit_before>(function () {
    'use strict';

    var days = {
        montags: 1,
        dienstags: 2,
        mittwochs: 3,
        donnerstags: 4,
        freitags: 5,
        samstags: 6,
        sonntags: 7
    }

    var openingHours;

    function getCurrentMonth() {
        return (new Date()).getMonth() + 1;
    }

    //Returns the current distance of the red Timeline pointer of the div element
    function currentWidth(){
        var widthPerMin = 41/(24*60);
        var currentDay = moment().day();
        if(currentDay < 7)
            return widthPerMin * minutesSinceMid() + (widthPerMin * 1440 * (moment().day() - 1));
        else
            //TODO: Bessere Lösung überlegen, außerhalb des sichtbaren Bereichs zu schicken ist nicht das beste
            return 1000;
    }

    //Returns the time since midnight in minutes
    function minutesSinceMid(){
        return moment().diff(moment().startOf('day'), 'minutes');
    }

    function calcuateWidth(minutes){
         var widthPerMin = 41/(24*60);
         return widthPerMin * minutes;
    }

    //Iterate through all days of the opening hours
    function iterateOpeningHours(){
        var result = [];
        for (var property in openingHours) {
             if (openingHours.hasOwnProperty(property)) {
                   openingHours[property].forEach(function (Array) {
                       result += '<div class="timeline-durationBox" style="left:' + Math.round(calcuateWidth(Array.from) + (days[property] - 1) *  41) + 'px;width:' + Math.round(calcuateWidth(Array.to - Array.from)) + 'px;"></div>';
                       console.log(property);
                       console.log(days[property]);
                       console.log((calcuateWidth(Array.from) + (days[property] - 1) *  41));
                   });
             }
        }

        console.log(result);
        return result;
    }

    angular.module('rc').directive('timeline', function () {
        return {
            restrict: 'E',
            scope: {
                  openingHours: "=",
            },
            template: '<div class="timeline-container">' +
                       		'<div class="timeline-mo">Mo</div>' +
                       		'<div class="timeline-tu">Di</div>' +
                       		'<div class="timeline-tu-bar"></div>' +
                       		'<div class="timeline-we">Mi</div>' +
                       		'<div class="timeline-th">Do</div>' +
                       		'<div class="timeline-th-bar"></div>' +
                       		'<div class="timeline-fr">Fr</div>' +
                       		'<div class="timeline-sa">Sa</div>' +
                       		'<div class="timeline-sa-bar"></div>' +
                       		iterateOpeningHours() +
                       		'<div class="timeline-current" style="left:' + currentWidth() + 'px;"></div>' +
                       	'</div>',

            link: function (scope) {
                openingHours = scope.openingHours;
                iterateOpeningHours();
            }
        }
    });
})();<commit_msg>Readded the green bars on the timeline Fixed a timelineCursor bug which appeared at sunday<commit_after>//Written by GityUpNow
(function () {
    'use strict';

    var days = {
        montags: 1,
        dienstags: 2,
        mittwochs: 3,
        donnerstags: 4,
        freitags: 5,
        samstags: 6,
        sonntags: 7
    }

    var openingHours;

    //Checks if it is Sunday
    function cursorVisible(){
        var currentDay = moment().day();
        if(currentDay > 0)
            return 'visible';
        else
            return 'hidden';
    }

    function getCurrentMonth() {
        return (new Date()).getMonth() + 1;
    }

    //Returns the current distance of the red Timeline pointer of the div element
    function currentWidth(){
        var widthPerMin = 41/(24*60);
        var currentDay = moment().day();
        if(currentDay < 7)
            return widthPerMin * minutesSinceMid() + (widthPerMin * 1440 * (moment().day() - 1));
    }

    //Returns the time since midnight in minutes
    function minutesSinceMid(){
        return moment().diff(moment().startOf('day'), 'minutes');
    }

    function calcuateWidth(minutes){
         var widthPerMin = 41/(24*60);
         return widthPerMin * minutes;
    }

    function timelineBox(left, width){
        this.left = left;
        this.width = width;
    }

    //Iterate through all days of the opening hours
    function iterateOpeningHours(){
        var temp = [];
        for (var property in openingHours) {
             if (openingHours.hasOwnProperty(property)) {
                   openingHours[property].forEach(function (Array) {
                        var tempBox = new timelineBox(Math.round(calcuateWidth(Array.from) + (days[property] - 1) *  41) ,Math.round(calcuateWidth(Array.to - Array.from)));
                        temp.push(tempBox);
                   });
             }
        }

        return temp;
    }

    angular.module('rc').directive('timeline', function ($compile) {
        return {
            restrict: 'E',
            scope: {
                  openingHours: "=",
            },
            template: '<div class="timeline-container">' +
                       		'<div class="timeline-mo">Mo</div>' +
                       		'<div class="timeline-tu">Di</div>' +
                       		'<div class="timeline-tu-bar"></div>' +
                       		'<div class="timeline-we">Mi</div>' +
                       		'<div class="timeline-th">Do</div>' +
                       		'<div class="timeline-th-bar"></div>' +
                       		'<div class="timeline-fr">Fr</div>' +
                       		'<div class="timeline-sa">Sa</div>' +
                       		'<div class="timeline-sa-bar"></div>' +
                       		'<div ng-repeat="x in result" class ="timeline-durationBox" style="left:{{x.left}}px;width:{{x.width}}px;"></div>' +
                       		'<div class="timeline-current" style="left:' + currentWidth() + 'px;visibility:' + cursorVisible() + '"></div>' +
                       	'</div>',

            link: function (scope) {
                openingHours = scope.openingHours;
                var temp = [];
                temp = iterateOpeningHours();
                scope.result = temp;
            }
        }
    });
})();
{'fraction_non_alphanumeric': 0.13915501806188157, 'fraction_numerical': 0.010365949426731585, 'mean_word_length': 1.6109061090610906, 'pattern_counts': {'":': 0, '<': 53, '<?xml version=': 0, '>': 52, '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': '3285881', 'n_tokens_mistral': 1902, 'n_tokens_neox': 1759, 'n_words': 383}