Skip to content

Commit

Permalink
Changing name from autoexpander to auto-height. (makes more sense).
Browse files Browse the repository at this point in the history
  • Loading branch information
prajwalit committed Jul 9, 2011
1 parent e80ca78 commit 5507101
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 27 deletions.
4 changes: 2 additions & 2 deletions README
@@ -1,3 +1,3 @@
A YUI 3 Widget which adds auto-expanding functionality to textareas.
A YUI 3 Widget which adds 'auto-height' functionality to textareas.

Demo: http://prajwalit.com/Simple-textarea-auto-expander/
Demo: http://prajwalit.com/textarea-autoheight/
18 changes: 9 additions & 9 deletions index.html
@@ -1,7 +1,7 @@
<!doctype html>
<html lang="en">
<head>
<title>YUI 3: Simple Textarea Auto-Expander</title>
<title>YUI 3: Simple Textarea Autoheight</title>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="chrome=1" />
<style type="text/css">
Expand Down Expand Up @@ -36,7 +36,7 @@
</head>
<body>
<header>
<h2>YUI 3: Textarea Auto-Expander</h2>
<h2>YUI 3: Textarea Autoheight</h2>
</header>

<div class="doc">
Expand All @@ -47,25 +47,25 @@ <h4>Demo: Start typing in this textarea: </h4>
<h4>Code:</h4>
<pre>
&lt;script type="text/javascript" src="http://yui.yahooapis.com/3.2.0/build/yui/yui-min.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="textareaAutoexpander-min.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="textareaAutoheight-min.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript"&gt;
YUI ().use ("textareaAutoexpander", function (Y) {
new Y.TextareaAutoexpander ({
YUI ().use ("textareaAutoheight", function (Y) {
new Y.TextareaAutoheight ({
node: Y.one("textarea")
}).render ();
});
&lt;/script&gt;</pre>
</div>
<footer>
<a href="http://github.com/prajwalit/Simple-textarea-auto-expander">Download Code</a>
<a href="https://github.com/prajwalit/textarea-autoheight">Download Code</a>
| <a href="http://prajwalit.com">Prajwalit.com</a>
| @<a href="http://twitter.com/prajwalit">prajwalit</a>
</footer>
<script type="text/javascript" src="http://yui.yahooapis.com/3.2.0/build/yui/yui-min.js"></script>
<script type="text/javascript" src="textareaAutoexpander-min.js"></script>
<script type="text/javascript" src="textareaAutoheight-min.js"></script>
<script type="text/javascript">
YUI ().use ("textareaAutoexpander", function (Y) {
new Y.TextareaAutoexpander ({
YUI ().use ("textareaAutoheight", function (Y) {
new Y.TextareaAutoheight ({
node: Y.one("textarea")
}).render ();
});
Expand Down
1 change: 0 additions & 1 deletion textareaAutoexpander-min.js

This file was deleted.

1 change: 1 addition & 0 deletions textareaAutoheight-min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 14 additions & 15 deletions textareaAutoexpander.js → textareaAutoheight.js
@@ -1,8 +1,8 @@
/**
* A YUI 3 Widget which adds auto-expanding functionality to textareas.
* A YUI 3 Widget which adds auto-height functionality to textareas.
* @author Prajwalit Bhopale <prajwalit@infinitelybeta.com>
* @created Jul 9, 2011
* @module textareaAutoexpander
* @module textareaAutoheight
* @requires node
*
* Copyright (c) 2011, Prajwalit Bhopale
Expand Down Expand Up @@ -37,27 +37,27 @@
* This method (just) registers the module so that it can attached to a YUI instance
* via the use method. It's executed at YUI().use(...) phase.
*/
YUI.add("textareaAutoexpander", function(Y) {
YUI.add("textareaAutoheight", function(Y) {

/**
* @class Y.TextareaAutoexpander
* @class Y.TextareaAutoheight
* @example -
* new Y.TextareaAutoexpander ({
* new Y.TextareaAutoheight ({
* node: Y.one("textarea")
* }).render ();
*/
Y.TextareaAutoexpander = Y.Base.create ("textareaAutoexpander", Y.Widget, [], {
Y.TextareaAutoheight = Y.Base.create ("textareaAutoheight", Y.Widget, [], {

_originalRows: 1,
_rowHeight: 0,
_eventHandler: null,
_currentRows: 1,

/**
* Constructor for TextareaAutoexpander.
* Constructor for TextareaAutoheight.
*/
initializer: function (config) {
Y.log ("Initializing textareaAutoexpander");
Y.log ("Initializing textareaAutoheight");
var node = this.get ("node");
this._originalRows = node.get ("rows");
var content = node.get ("value");
Expand All @@ -83,7 +83,7 @@ YUI.add("textareaAutoexpander", function(Y) {
},

/**
* Destructor for TextareaAutoexpander.
* Destructor for TextareaAutoheight.
*/
destructor: function () {
this.get ("node").setStyle ("overflow", "auto").set ("rows", this._originalRows);
Expand All @@ -92,7 +92,7 @@ YUI.add("textareaAutoexpander", function(Y) {
},

/**
* Renderer function for TextareaAutoexpander.
* Renderer function for TextareaAutoheight.
* This function gets called when render() function gets executed.
*/
renderer: function () {
Expand All @@ -111,7 +111,7 @@ YUI.add("textareaAutoexpander", function(Y) {
},

/**
* BindUI function for TextareaAutoexpander.
* BindUI function for TextareaAutoheight.
* This method is responsible for attaching event listeners which bind the UI
* to the widget state.
*/
Expand Down Expand Up @@ -139,7 +139,7 @@ YUI.add("textareaAutoexpander", function(Y) {
},

/**
* SyncUI function for TextareaAutoexpander.
* SyncUI function for TextareaAutoheight.
* This method is responsible for setting the initial state of the UI based on
* the current state of the widget at the time of rendering.
*
Expand All @@ -157,16 +157,15 @@ YUI.add("textareaAutoexpander", function(Y) {
}, {

/**
* Config attributes for TextareaAutoexpander go here.
* Config attributes for TextareaAutoheight go here.
*/
ATTRS: {

/**
* Textarea to be converted to auto-expander
* Textarea to which autoheight functionality is to be attached.
*/
node: null
}
});

}, "0.0.1", {requires:["widget", "base-build", "node"]});

0 comments on commit 5507101

Please sign in to comment.