<commit_before>﻿markers = [];

ko.bindingHandlers.map = {
    init: function (element, valueAccessor, allBindingsAccessor, viewModel) {

        try {
            var position = new google.maps.LatLng(allBindingsAccessor().latitude(), allBindingsAccessor().longitude());

            var marker = new google.maps.Marker({
                map: allBindingsAccessor().map,
                position: position,
                title: name
            });

            google.maps.event.addListener(marker, 'click', function () {
                viewModel.select();
            });

            markers.push(marker);
            viewModel._mapMarker = marker;

            allBindingsAccessor().map.setCenter(position);
        }
        catch (err) { }
    },
    update: function (element, valueAccessor, allBindingsAccessor, viewModel) {
        try{
            var latlng = new google.maps.LatLng(allBindingsAccessor().latitude(), allBindingsAccessor().longitude());
            viewModel._mapMarker.setPosition(latlng);
        } catch (err) { }
    }
};

ko.bindingHandlers.datepicker = {
    init: function(element, valueAccessor, allBindingsAccessor) {
      //initialize datepicker with some optional options
      var options = allBindingsAccessor().datepickerOptions || {};
      $(element).datepicker(options);
      
      //when a user changes the date, update the view model
      ko.utils.registerEventHandler(element, "changeDate", function(event) {
             var value = valueAccessor();
             if (ko.isObservable(value)) {
                 value(event.date);
             }                
      });
    },
    update: function(element, valueAccessor)   {
        var widget = $(element).data("datepicker");
         //when the view model is updated, update the widget
        if (widget) {
            var vmValue = ko.utils.unwrapObservable(valueAccessor());

            //if we have a string value - convert it first
            if (isString(vmValue)) {
                vmValue = new Date(vmValue);
            }

            //if the date is not valid - don't visualize it, or we would have a "NaN/NaN/NaN"
            if (!isValidDate(vmValue))
                return;

            widget.setValue(vmValue);
        }
    }
};


var defaultPieChartOptions = { legend: true, width: 200, height: 200 };
var defaultBarChartOptions = { legend: true, width: 600, height: 200, xUnitName : 'x', itemName: 'Item' };
var defaultHistogramOptions = { legend: true, width: 600, height: 200 };<commit_msg>fixing the date picker binding<commit_after>﻿markers = [];

ko.bindingHandlers.map = {
    init: function (element, valueAccessor, allBindingsAccessor, viewModel) {

        try {
            var position = new google.maps.LatLng(allBindingsAccessor().latitude(), allBindingsAccessor().longitude());

            var marker = new google.maps.Marker({
                map: allBindingsAccessor().map,
                position: position,
                title: name
            });

            google.maps.event.addListener(marker, 'click', function () {
                viewModel.select();
            });

            markers.push(marker);
            viewModel._mapMarker = marker;

            allBindingsAccessor().map.setCenter(position);
        }
        catch (err) { }
    },
    update: function (element, valueAccessor, allBindingsAccessor, viewModel) {
        try{
            var latlng = new google.maps.LatLng(allBindingsAccessor().latitude(), allBindingsAccessor().longitude());
            viewModel._mapMarker.setPosition(latlng);
        } catch (err) { }
    }
};

ko.bindingHandlers.datepicker = {
    init: function(element, valueAccessor, allBindingsAccessor) {
      //initialize datepicker with some optional options
      var options = allBindingsAccessor().datepickerOptions || {};
      $(element).datepicker(options);
      
      //when a user changes the date, update the view model
      ko.utils.registerEventHandler(element, "changeDate", function(event) {
             var value = valueAccessor();
             if (ko.isObservable(value)) {
                 value(event.date);
             }                
      });
    },
    update: function(element, valueAccessor)   {
        var widget = $(element).data("datepicker");
        if (widget != null) {
            var vmValue = ko.utils.unwrapObservable(valueAccessor());
            //if we have a string value - convert it first
            if (isString(vmValue)) {
                vmValue = new Date(vmValue);
            }

            //if the date is not valid - don't visualize it, or we would have a "NaN/NaN/NaN"
            if (!isValidDate(vmValue))
                return;

            widget.setDates(vmValue);
        }
    }
};


var defaultPieChartOptions = { legend: true, width: 200, height: 200 };
var defaultBarChartOptions = { legend: true, width: 600, height: 200, xUnitName : 'x', itemName: 'Item' };
var defaultHistogramOptions = { legend: true, width: 600, height: 200 };
{'fraction_non_alphanumeric': 0.11603754743359297, 'fraction_numerical': 0.007189934092270821, 'mean_word_length': 2.1417816813048933, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6360035', 'n_tokens_mistral': 1367, 'n_tokens_neox': 1296, 'n_words': 324}