<commit_before>'use strict';

viewModel.ByProjectCustom = new Object();
var bpc = viewModel.ByProjectCustom;

// vm.currentMenu('All Farms');
// vm.currentTitle('All Farms');
// vm.breadcrumb([
//     { title: "Monitoring", href: '#' }, 
//     { title: 'All Farms', href: viewModel.appName + 'page/monitoringbyprojectcustom' },
// ]);

bpc.projectList = ko.observableArray(projectList);
bpc.feederList = ko.observableArray([]);
bpc.turbineList = ko.observableArray([]);

var requests = [];


var audioElement = document.createElement('audio');
    audioElement.setAttribute('src', "../res/alarm/alarm.mp3");


ko.bindingHandlers.singleOrDoubleClick = {
    init: function(element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) {
    	var accessor = valueAccessor();
        var clicks = 0;
        var timeout = 200;

        var singleHandler   = valueAccessor().click,
            doubleHandler   = valueAccessor().dblclick;
            // delay           = valueAccessor().delay || 1000,
            // clicks          = 0;

        $(element).click(function(event) {
            if(typeof(accessor) === 'object') {
                clicks++;
                if (clicks === 1) {
                    setTimeout(function() {
                        if(clicks === 1) {
                            singleHandler.call(viewModel, bindingContext.$data, event);
                        } else {
                            doubleHandler.call(viewModel, bindingContext.$data, event);
                        }
                        clicks = 0;
                    }, timeout);
                }
            } else {
                accessor.call(viewModel, bindingContext.$data, event);
            }
            return false;
        });
    }
};

bpc.getShorterName = function(str){<commit_msg>fix the double click<commit_after>'use strict';

viewModel.ByProjectCustom = new Object();
var bpc = viewModel.ByProjectCustom;

// vm.currentMenu('All Farms');
// vm.currentTitle('All Farms');
// vm.breadcrumb([
//     { title: "Monitoring", href: '#' }, 
//     { title: 'All Farms', href: viewModel.appName + 'page/monitoringbyprojectcustom' },
// ]);

bpc.projectList = ko.observableArray(projectList);
bpc.feederList = ko.observableArray([]);
bpc.turbineList = ko.observableArray([]);

var requests = [];


var audioElement = document.createElement('audio');
    audioElement.setAttribute('src', "../res/alarm/alarm.mp3");


ko.bindingHandlers.singleOrDoubleClick = {
    init: function(element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) {
        var singleHandler   = valueAccessor().click,
            doubleHandler   = valueAccessor().dblclick,
            delay           = valueAccessor().delay || 1000,
            clicks          = 0;

        $(element).bind('click',function(event) {
            clicks++;
            if (clicks === 1) {
                setTimeout(function() {
                    if( clicks === 1 ) {
                        // Call the single click handler - passing viewModel as this 'this' object
                        // you may want to pass 'this' explicitly
                        if (singleHandler !== undefined) { 
                            singleHandler.call(viewModel, bindingContext.$data, event); 
                        }
                    } else {
                        // Call the double click handler - passing viewModel as this 'this' object
                        // you may want to pass 'this' explicitly
                        if (doubleHandler !== undefined) { 
                            doubleHandler.call(viewModel, bindingContext.$data, event); 
                        }
                    }
                    clicks = 0;
                }, delay);
            }
            return false;
        });
    }
};

bpc.getShorterName = function(str){
{'fraction_non_alphanumeric': 0.12775902363022593, 'fraction_numerical': 0.005712801869644248, 'mean_word_length': 1.7692307692307692, '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': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7650171', 'n_tokens_mistral': 1043, 'n_tokens_neox': 988, 'n_words': 208}