mirror of
				https://github.com/pierre42100/ComunicWeb
				synced 2025-11-04 04:04:20 +00:00 
			
		
		
		
	created textarea 2.0 object
This commit is contained in:
		
							
								
								
									
										54
									
								
								assets/3rdparty/jquery.textarea_autosize/jquery.textarea_autosize.js
									
									
									
									
										vendored
									
									
										Executable file
									
								
							
							
						
						
									
										54
									
								
								assets/3rdparty/jquery.textarea_autosize/jquery.textarea_autosize.js
									
									
									
									
										vendored
									
									
										Executable file
									
								
							@@ -0,0 +1,54 @@
 | 
			
		||||
/*!
 | 
			
		||||
 * jQuery Textarea AutoSize plugin
 | 
			
		||||
 * Author: Javier Julio
 | 
			
		||||
 * Licensed under the MIT license
 | 
			
		||||
 */
 | 
			
		||||
;(function ($, window, document, undefined) {
 | 
			
		||||
 | 
			
		||||
  var pluginName = "textareaAutoSize";
 | 
			
		||||
  var pluginDataName = "plugin_" + pluginName;
 | 
			
		||||
 | 
			
		||||
  var containsText = function (value) {
 | 
			
		||||
    return (value.replace(/\s/g, '').length > 0);
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  function Plugin(element, options) {
 | 
			
		||||
    this.element = element;
 | 
			
		||||
    this.$element = $(element);
 | 
			
		||||
    this.init();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  Plugin.prototype = {
 | 
			
		||||
    init: function() {
 | 
			
		||||
      var height = this.$element.outerHeight();
 | 
			
		||||
      var diff = parseInt(this.$element.css('paddingBottom')) +
 | 
			
		||||
                 parseInt(this.$element.css('paddingTop')) || 0;
 | 
			
		||||
 | 
			
		||||
      if (containsText(this.element.value)) {
 | 
			
		||||
        this.$element.height(this.element.scrollHeight - diff);
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      // keyup is required for IE to properly reset height when deleting text
 | 
			
		||||
      this.$element.on('input keyup', function(event) {
 | 
			
		||||
        var $window = $(window);
 | 
			
		||||
        var currentScrollPosition = $window.scrollTop();
 | 
			
		||||
 | 
			
		||||
        $(this)
 | 
			
		||||
          .height(0)
 | 
			
		||||
          .height(this.scrollHeight - diff);
 | 
			
		||||
 | 
			
		||||
        $window.scrollTop(currentScrollPosition);
 | 
			
		||||
      });
 | 
			
		||||
    }
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  $.fn[pluginName] = function (options) {
 | 
			
		||||
    this.each(function() {
 | 
			
		||||
      if (!$.data(this, pluginDataName)) {
 | 
			
		||||
        $.data(this, pluginDataName, new Plugin(this, options));
 | 
			
		||||
      }
 | 
			
		||||
    });
 | 
			
		||||
    return this;
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
})(jQuery, window, document);
 | 
			
		||||
							
								
								
									
										1
									
								
								assets/3rdparty/jquery.textarea_autosize/jquery.textarea_autosize.min.js
									
									
									
									
										vendored
									
									
										Executable file
									
								
							
							
						
						
									
										1
									
								
								assets/3rdparty/jquery.textarea_autosize/jquery.textarea_autosize.min.js
									
									
									
									
										vendored
									
									
										Executable file
									
								
							@@ -0,0 +1 @@
 | 
			
		||||
!function(t,e,i,n){function s(e,i){this.element=e,this.$element=t(e),this.init()}var h="textareaAutoSize",o="plugin_"+h,r=function(t){return t.replace(/\s/g,"").length>0};s.prototype={init:function(){var i=parseInt(this.$element.css("paddingBottom"))+parseInt(this.$element.css("paddingTop"))+parseInt(this.$element.css("borderTopWidth"))+parseInt(this.$element.css("borderBottomWidth"))||0;r(this.element.value)&&this.$element.height(this.element.scrollHeight-i),this.$element.on("input keyup",function(n){var s=t(e),h=s.scrollTop();t(this).height(0).height(this.scrollHeight-i),s.scrollTop(h)})}},t.fn[h]=function(e){return this.each(function(){t.data(this,o)||t.data(this,o,new s(this,e))}),this}}(jQuery,window,document);
 | 
			
		||||
		Reference in New Issue
	
	Block a user