<commit_before>/*!
 *
 * Prozorro v1.0.0
 *
 * Author: <NAME> (<EMAIL>)
 *
 * © 2015
 *
 */

var APP,
    INPUT,
    SEARCH_BUTTON,
    BLOCKS,
    INITED=false,
    LANG,
    SEARCH_TYPE,
    SEARCH_QUERY=[],
    SEARCH_QUERY_TIMEOUT,

    IS_MAC = /Mac/.test(navigator.userAgent),
    IS_HISTORY = (window.History ? window.History.enabled : false),

    KEY_BACKSPACE = 8,
    KEY_UP = 38,
    KEY_DOWN = 40,
    KEY_ESC = 27,
    KEY_RETURN = 13,
    KEY_CMD = IS_MAC ? 91 : 17,
    
    spin_options={
        color:'#e55166',
        lines: 15,
        width: 2
    },
    
    spin_options_light={
        color:'#fff',
        lines: 15,
        width: 2
    };

(function(window, undefined){

    'use strict';

    var suggest_opened,
        suggest_current;

    APP = (function(){

        var viewport = function () {
            var e = window, a = 'inner';
            if (!('innerWidth' in window )) {
                a = 'client';
                e = document.documentElement || document.body;
            }
            return {width: e[a + 'Width'], height: e[a + 'Height']};
        };

        var methods =  {
            common: function(){
                $('html').removeClass('no-js');

                $('a.registration').bind('click', function(event){
                    event.preventDefault();
                    $('.startpopup').css('display', 'block');
                });

                $('.close-startpopup').bind('click', function(event){
                    event.preventDefault();
                    $('.startpopup').css('display', 'none');
                });

                $('a.document-link').click(function(e){
                    e.preventDefault();

                    $(this).closest('.container').find('.tender--offers.documents').hide();
                    $(this).closest('.container').find('.tender--offers.documents[data-id='+$(this).data('id')+']').show();

                    $(this).closest('.container').find('.overlay-documents').addClass('open');
                });

                $('.overlay-close').click(function(e){
                    e.preventDefault();

                    $('.overlay').removeClass('open');
                });
                
                $(document).keydown(function(e){
                    if($('.overlay').is('.open')){
                        switch (e.keyCode){
                            case KEY_ESC:
                                $('.overlay-close').click();
                                return;
                            break;
                        }
                    }
                });
            },
            js: {
                customer_search: function () {
                    $('#tender-customer').selectize({
                        valueField: 'key',
                        labelField: 'value',
                        searchField: 'value',
                        create: false,
                        render: {
                            option: function(item, escape) {
                                return '<div>' + escape(item.value) + '</div>';
                            }
                        },
                        load: function(query, callback) {
                            $.ajax({
                                url: '/sources/ua/edrpou.json',
                                type: 'GET',
                                error: function() {
                                    callback();
                                },
                                success: function(res) {
                                    var arrayOfEdrpou = [];

                                    for (var item in res) {
                                        arrayOfEdrpou.push({
                                            key: item,
                                            value: res[item]
                                        });
                                    }
                                    // Debug
                                    // console.log(arrayOfEdrpou);
                                    callback(arrayOfEdrpou.slice(0, 250));
                                }
                            });
                        }
                    });
                },
                disableSearchButton: function (_self) {
                    $('#c-find-form').validate({
                        messages: {
                            tid: 'Формат: UA-2016-01-01-000001'
                        },
                        errorPlacement: function(error, element) {
                            error.appendTo('#errordiv');
                        },
                        rules: {
                            tid: {
                                required: false,
                                pattern: /^UA\-20\d{2}\-\d{2}\-\d{2}\-\d{6}$/
                            }
                        }
                    });

                    jQuery.extend(jQuery.validator.messages, {
                        // Add custom text message for pattern
                        pattern: "Invalid pattern format for tender number.",
                    });

                    $('input[id="btn-find"]').prop('disabled', true);
                    $('input[id="tender-number"], input[id="tender-customer"]').keyup(function () {
                        if ($(this).val() != '') {
                            $('input[id="btn-find"]').prop('disabled', false);
                        } else {
                            $('input[id="btn-find"]').prop('disabled', true);
                        }
                    });
                },
                imageSlider: function(_self){
                    _self.slick({
                        dots: true,
                        autoplay: _self.data('autoplay')
                    });
                },
                feedback_thanks: function(_self){<commit_msg>Обновил pattern регулярных выражений для номеров тендеров<commit_after>/*!
 *
 * Prozorro v1.0.0
 *
 * Author: <NAME> (<EMAIL>)
 *
 * © 2015
 *
 */

var APP,
    INPUT,
    SEARCH_BUTTON,
    BLOCKS,
    INITED=false,
    LANG,
    SEARCH_TYPE,
    SEARCH_QUERY=[],
    SEARCH_QUERY_TIMEOUT,

    IS_MAC = /Mac/.test(navigator.userAgent),
    IS_HISTORY = (window.History ? window.History.enabled : false),

    KEY_BACKSPACE = 8,
    KEY_UP = 38,
    KEY_DOWN = 40,
    KEY_ESC = 27,
    KEY_RETURN = 13,
    KEY_CMD = IS_MAC ? 91 : 17,
    
    spin_options={
        color:'#e55166',
        lines: 15,
        width: 2
    },
    
    spin_options_light={
        color:'#fff',
        lines: 15,
        width: 2
    };

(function(window, undefined){

    'use strict';

    var suggest_opened,
        suggest_current;

    APP = (function(){

        var viewport = function () {
            var e = window, a = 'inner';
            if (!('innerWidth' in window )) {
                a = 'client';
                e = document.documentElement || document.body;
            }
            return {width: e[a + 'Width'], height: e[a + 'Height']};
        };

        var methods =  {
            common: function(){
                $('html').removeClass('no-js');

                $('a.registration').bind('click', function(event){
                    event.preventDefault();
                    $('.startpopup').css('display', 'block');
                });

                $('.close-startpopup').bind('click', function(event){
                    event.preventDefault();
                    $('.startpopup').css('display', 'none');
                });

                $('a.document-link').click(function(e){
                    e.preventDefault();

                    $(this).closest('.container').find('.tender--offers.documents').hide();
                    $(this).closest('.container').find('.tender--offers.documents[data-id='+$(this).data('id')+']').show();

                    $(this).closest('.container').find('.overlay-documents').addClass('open');
                });

                $('.overlay-close').click(function(e){
                    e.preventDefault();

                    $('.overlay').removeClass('open');
                });
                
                $(document).keydown(function(e){
                    if($('.overlay').is('.open')){
                        switch (e.keyCode){
                            case KEY_ESC:
                                $('.overlay-close').click();
                                return;
                            break;
                        }
                    }
                });
            },
            js: {
                customer_search: function () {
                    $('#tender-customer').selectize({
                        valueField: 'key',
                        labelField: 'value',
                        searchField: 'value',
                        create: false,
                        render: {
                            option: function(item, escape) {
                                return '<div>' + escape(item.value) + '</div>';
                            }
                        },
                        load: function(query, callback) {
                            $.ajax({
                                url: '/sources/ua/edrpou.json',
                                type: 'GET',
                                error: function() {
                                    callback();
                                },
                                success: function(res) {
                                    var arrayOfEdrpou = [];

                                    for (var item in res) {
                                        arrayOfEdrpou.push({
                                            key: item,
                                            value: res[item]
                                        });
                                    }
                                    // Debug
                                    // console.log(arrayOfEdrpou);
                                    callback(arrayOfEdrpou.slice(0, 250));
                                }
                            });
                        }
                    });
                },
                disableSearchButton: function (_self) {
                    $('#c-find-form').validate({
                        messages: {
                            tid: 'Формат: UA-2016-01-01-000001'
                        },
                        errorPlacement: function(error, element) {
                            error.appendTo('#errordiv');
                        },
                        rules: {
                            tid: {
                                required: false,
                                pattern: /^UA\-20\d{2}\-\d{2}\-\d{2}\-\d{6}$|^UA\-20\d{2}\-\d{2}\-\d{2}\-\d{6}\-([a-z])$/
                            }
                        }
                    });

                    jQuery.extend(jQuery.validator.messages, {
                        // Add custom text message for pattern
                        pattern: "Invalid pattern format for tender number.",
                    });

                    $('input[id="btn-find"]').prop('disabled', true);
                    $('input[id="tender-number"], input[id="tender-customer"]').keyup(function () {
                        if ($(this).val() != '') {
                            $('input[id="btn-find"]').prop('disabled', false);
                        } else {
                            $('input[id="btn-find"]').prop('disabled', true);
                        }
                    });
                },
                imageSlider: function(_self){
                    _self.slick({
                        dots: true,
                        autoplay: _self.data('autoplay')
                    });
                },
                feedback_thanks: function(_self){
{'fraction_non_alphanumeric': 0.1329177897574124, 'fraction_numerical': 0.00977088948787062, 'mean_word_length': 0.8563164477798624, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 28, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5186512', 'n_tokens_mistral': 2981, 'n_tokens_neox': 2690, 'n_words': 437}