SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict
    Join Date
    Jun 2005
    Posts
    196
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    upgrading MooTools version

    i need to upgrade a script for MoolTools that was built on version Build 86. I need it upgraded to work with v1.2. I have looked on the web for info on build 86, but im not finding much help. Im sure someone firmiliar with MooTools will be able to spot the upgraded functions that are needed. Thanks much in advance.

    This is the script that is need upgrading. Found here, http://www.zed23.com/2007/01/23/moot...rea-component/

    Code:
    <script type="text/javascript">
    ResizingTextArea = new Class(
    	{
    		iRows: 1,
    		initialize: function(element, options)
    		{
    			this.element = $(element.id);
    			this.element.setStyle('overflow','hidden');
    			this.element.setStyle('overflow-x','auto');
    			this.element.setProperty('wrap','vitual');
    			this.iRows = this.getRows();
    			this.opt = Object.extend(
    				{
    					resizeStep: 1
    				},
    				options || {}
    			);
    			this.resize(this); // Boot up just in case we used an onload
    			this.element.onclick = this.resize.bindAsEventListener(this);
    			this.element.onkeyup = this.resize.bindAsEventListener(this);
    		},
    		getRows: function()
    		{
    			return Math.max(this.element.getProperty('rows'), 10)
    		},
    		resize: function()
    		{
    			var lines = this.element.getValue().split('\n');
    			var newRows = lines.length + this.opt.resizeStep;
    			var oldRows = this.iRows;
    			var cols = this.element.getProperty('cols');
    			for (var i = 0; i < lines.length; i++)
    			{
    				var line = lines[i];
    				if (line.length >= cols) newRows += Math.floor(line.length / cols);	
    			}
    			if (newRows > this.element.rows) this.element.setProperty('rows', newRows);
    			if (newRows < this.element.rows) this.element.setProperty('rows', Math.max(this.iRows, newRows));
    		}
    	}
    );
    
    window.onload = function()
    {
    	$A(document.getElementsByTagName('textarea')).each(
    		function(el)
    		{
    			el.onfocus = new ResizingTextArea(el);
    		}
    	);
    }
    </script>

  2. #2
    SitePoint Addict
    Join Date
    Jun 2005
    Posts
    196
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks to CroNIX for this link to an even better version of the textarea plugin using MooTools v1.2, http://tools.uvumi.com/textarea.html.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •