var ButtonsUI = {

  bindUIActions: function() {

    $('.effeckt-button').on( 'click', function(){
      Buttons.showLoader(this);
    });

  },

  toggleLoader: function(el) {

      var button = $((el.target) ? el.target : el),
        resetTimeout;

    if(button.attr( 'data-loading' )){

      button.removeAttr( 'data-loading' );

    } else {

      button.attr( 'data-loading', true );

    }

    //clearTimeout( resetTimeout );
    //resetTimeout = setTimeout( function() {
    //  button.removeAttr( 'data-loading' );
    //}, 2000 );

  }

  , showLoader: function (el, disable) {
        disable = (disable == true) ? true : false; 
        var button = $((el.target) ? el.target : el),
        resetTimeout;
      
        if (!button.hasClass("btn")) button = button.closest(".btn"); 

        button.attr('data-loading', true);
        if (disable) button.attr('disabled', 'disabled'); 

  }

  , hideLoader: function (el, keepDisabled) {
      keepDisabled = (keepDisabled == true) ? true : false; 
      var button = $((el.target) ? el.target : el),
        resetTimeout;

      if (!button.hasClass("btn")) button = button.closest(".btn");

      if (button.attr('data-loading')) {
        button.removeAttr('data-loading');
      }
      if (!keepDisabled) button.removeAttr('disabled'); 
  }

};
