<commit_before>/**
 * availiable option : {floatVal:true}
 * $('.js_numeric_input').checkNumeric( {floatVal:true} );
 * or add attribute to html: data-float="true"

 * markup example:
 * <input class="js_numeric_input" type="number" value="12" max="15" min="10" required="" step="2" data-float="true">
 */

/*
 (function($){
 var isModalLoad = false;
 // load the html file using ajax
 $.get("/scripts/components/templates/lazy-selector-modal.html", function(resp){
 var data = $('body').append(resp);
 console.log('data' , data);
 //data.modal();
 }).done(function() {
 isModalLoad = true;
 console.log( "second success" );
 });

 //$("body").load("/scripts/components/templates/lazy-selector-modal.html");

 if(isModalLoad) {}
 console.log('data 2', isModalLoad);

 })(jQuery);
 */

(function ($) {

  $.fn.lazySelector = function (options) {
    var defaults = {},
      settings = $.extend({}, $.fn.lazySelector.defaults, options),
      $iconButton = $('<a class="icon" id="get-event-by-Id-' + options + '" data-toggle="modal" data-target="#js_ls-modal" />');

    var stateConf = {
      pageIncrement: 0,
      loadingFlag: false
    };

    var $modal = $('#js_ls-modal'),
      $form = $('#js_lazy-sel_form', $modal),
      $ul = $('#js_lazy-sel_list'),
      $liFooter = $('#load-more-box'),
      $hr = $('#js_ls-top-hr'),
      $btnGET = $modal.find('#js_ls-modal_btn'),
      btnCloseMap = $('.button-close-map', $modal),
      cssValidationClass = 'get-eventId_form-validation';
    var modalContent = $('.modal-content', $modal);

    var keyword = $form.find('#keyword'),
      apikey = $('#w-tm-api-key').val() || '<KEY>0Xm8KWdANDgecHMV0',
      selector = options || 'events',
      eventUrl = 'https://app.ticketmaster.com/discovery/v2/' + selector + '.json';

    var $input = $(this);

    function formatDate(date) {
      var result = '';
      if (!date.day) return result; // Day is required

      var MONTH_NAMES = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
        DAY_NAMES = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
        dayArray = date.day.split('-'),
        d = parseInt(dayArray[2]),
        M = parseInt(dayArray[1]);

      var E = new Date(date.day).getDay();

      //var E1 = new Date(+date.day.split('-')[0],(+date.day.split('-')[1])-1,+date.day.split('-')[2]).getDay();
      //if(E !== E1) console.log('\t alarm equal - ' , E === E1);

      result = DAY_NAMES[E] + ', ' + MONTH_NAMES[M - 1] + ' ' + d + ', ' + dayArray[0];

      if (!date.time) return result;

      var timeArray = date.time.split(':'),
        H = parseInt(timeArray[0]),
        m = timeArray[1],
        a = "AM";

      if (H > 11) a = "PM";
      if (H == 0) {
        H = 12;
      } else if (H > 12) {
        H = H - 12;
      }

      return result + ' ' + getNormalizedDateValue(H) + ':' + m + ' ' + a;
    }

    function getNormalizedDateValue(val) {
      return (val < 0 || val > 9 ? "" : "0") + val
    }


    /**
     * show or init map listener
     * @param e
     */
    var mapPopUpListener = function (e) {
      e.preventDefault();
      var lat = $(e.target).attr('data-latitude') != "undefined" ? parseFloat($(e.target).attr('data-latitude')) : null,
        lng = $(e.target).attr('data-longitude') != "undefined" ? parseFloat($(e.target).attr('data-longitude')) : null,
        address = lat && lng ? null : $(e.target).attr('data-address');

      // console.log("lat");
      if (lat && lng || address) {
        initMap(lat, lng, address);
      } else {
        initMap(0, 0, address);
        console.log("Coordinates are not defined :(");
      }
    };


    /**
     * Init map google maps
     * @param lat - float
     * @param lng - float
     * @param address - not used @deprecated
     */
    var initMap = function (lat, lng, address) {
      var map,
        marker,
        mapEl = $('#js_ls-modal'),
        geocoder = new google.maps.Geocoder(),
        mapCenter = new google.maps.LatLng(lat || 55, lng || 43),
        latLng = (lat && lng ? {lat: lat, lng: lng} : new google.maps.LatLng(0, 0));


      // initialize map object
      map = new google.maps.Map(document.getElementById('map-canvas'), {
        center: mapCenter,
        zoom: 6,
        mapTypeControl: false,
        scaleControl: false,
        streetViewControl: false,
        rotateControl: false
      });
      /*if (address){ // if there was address provided
       geocodeAddress(geocoder, map, address, function(result){ // geocode address and center the map
       latLng = result;<commit_msg>mod: map zoom to 10<commit_after>/**
 * availiable option : {floatVal:true}
 * $('.js_numeric_input').checkNumeric( {floatVal:true} );
 * or add attribute to html: data-float="true"

 * markup example:
 * <input class="js_numeric_input" type="number" value="12" max="15" min="10" required="" step="2" data-float="true">
 */

/*
 (function($){
 var isModalLoad = false;
 // load the html file using ajax
 $.get("/scripts/components/templates/lazy-selector-modal.html", function(resp){
 var data = $('body').append(resp);
 console.log('data' , data);
 //data.modal();
 }).done(function() {
 isModalLoad = true;
 console.log( "second success" );
 });

 //$("body").load("/scripts/components/templates/lazy-selector-modal.html");

 if(isModalLoad) {}
 console.log('data 2', isModalLoad);

 })(jQuery);
 */

(function ($) {

  $.fn.lazySelector = function (options) {
    var defaults = {},
      settings = $.extend({}, $.fn.lazySelector.defaults, options),
      $iconButton = $('<a class="icon" id="get-event-by-Id-' + options + '" data-toggle="modal" data-target="#js_ls-modal" />');

    var stateConf = {
      pageIncrement: 0,
      loadingFlag: false
    };

    var $modal = $('#js_ls-modal'),
      $form = $('#js_lazy-sel_form', $modal),
      $ul = $('#js_lazy-sel_list'),
      $liFooter = $('#load-more-box'),
      $hr = $('#js_ls-top-hr'),
      $btnGET = $modal.find('#js_ls-modal_btn'),
      btnCloseMap = $('.button-close-map', $modal),
      cssValidationClass = 'get-eventId_form-validation';
    var modalContent = $('.modal-content', $modal);

    var keyword = $form.find('#keyword'),
      apikey = $('#w-tm-api-key').val() || '<KEY>',
      selector = options || 'events',
      eventUrl = 'https://app.ticketmaster.com/discovery/v2/' + selector + '.json';

    var $input = $(this);

    function formatDate(date) {
      var result = '';
      if (!date.day) return result; // Day is required

      var MONTH_NAMES = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
        DAY_NAMES = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
        dayArray = date.day.split('-'),
        d = parseInt(dayArray[2]),
        M = parseInt(dayArray[1]);

      var E = new Date(date.day).getDay();

      //var E1 = new Date(+date.day.split('-')[0],(+date.day.split('-')[1])-1,+date.day.split('-')[2]).getDay();
      //if(E !== E1) console.log('\t alarm equal - ' , E === E1);

      result = DAY_NAMES[E] + ', ' + MONTH_NAMES[M - 1] + ' ' + d + ', ' + dayArray[0];

      if (!date.time) return result;

      var timeArray = date.time.split(':'),
        H = parseInt(timeArray[0]),
        m = timeArray[1],
        a = "AM";

      if (H > 11) a = "PM";
      if (H == 0) {
        H = 12;
      } else if (H > 12) {
        H = H - 12;
      }

      return result + ' ' + getNormalizedDateValue(H) + ':' + m + ' ' + a;
    }

    function getNormalizedDateValue(val) {
      return (val < 0 || val > 9 ? "" : "0") + val
    }


    /**
     * show or init map listener
     * @param e
     */
    var mapPopUpListener = function (e) {
      e.preventDefault();
      var lat = $(e.target).attr('data-latitude') != "undefined" ? parseFloat($(e.target).attr('data-latitude')) : null,
        lng = $(e.target).attr('data-longitude') != "undefined" ? parseFloat($(e.target).attr('data-longitude')) : null,
        address = lat && lng ? null : $(e.target).attr('data-address');

      // console.log("lat");
      if (lat && lng || address) {
        initMap(lat, lng, address);
      } else {
        initMap(0, 0, address);
        console.log("Coordinates are not defined :(");
      }
    };


    /**
     * Init map google maps
     * @param lat - float
     * @param lng - float
     * @param address - not used @deprecated
     */
    var initMap = function (lat, lng, address) {
      var map,
        marker,
        mapEl = $('#js_ls-modal'),
        geocoder = new google.maps.Geocoder(),
        mapCenter = new google.maps.LatLng(lat || 55, lng || 43),
        latLng = (lat && lng ? {lat: lat, lng: lng} : new google.maps.LatLng(0, 0));


      // initialize map object
      map = new google.maps.Map(document.getElementById('map-canvas'), {
        center: mapCenter,
        zoom: 10,
        mapTypeControl: false,
        scaleControl: false,
        streetViewControl: false,
        rotateControl: false
      });
      /*if (address){ // if there was address provided
       geocodeAddress(geocoder, map, address, function(result){ // geocode address and center the map
       latLng = result;
{'fraction_non_alphanumeric': 0.19962890198646585, 'fraction_numerical': 0.010259768609473915, 'mean_word_length': 2.5695364238410594, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 15, 'https://': 2, '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': '6701340', 'n_tokens_mistral': 3170, 'n_tokens_neox': 3027, 'n_words': 693}