Permalink
Browse files

First commit

  • Loading branch information...
berkerpeksag committed Dec 8, 2009
0 parents commit 087590475a944cc664398650317fc6544003714b
Showing with 339 additions and 0 deletions.
  1. +1 −0 .gitignore
  2. +12 −0 .project
  3. +40 −0 .tmp_test.html.9489~
  4. +94 −0 js/jquery.jgrow-0.3.2.js
  5. +97 −0 js/jquery.jgrow-0.3.2.js~
  6. +1 −0 js/jquery.jgrow-0.3.2.min.js
  7. +14 −0 js/jquery.jgrow-0.3.2.min.js~
  8. +40 −0 test.html
  9. +40 −0 test.html~
@@ -0,0 +1 @@
+js-old
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>jGrow</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ </buildSpec>
+ <natures>
+ <nature>com.aptana.ide.project.nature.web</nature>
+ </natures>
+</projectDescription>
@@ -0,0 +1,40 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" lang="tr" xml:lang="tr">
+<head>
+<title>Örnek - jGrow 0.3</title>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<meta http-equiv="Content-Language" content="TR" />
+<meta name="Description" content="" />
+<meta name="Keywords" content="" />
+<meta name="Author" content="Berker Peksag" />
+<meta name="Reply-To" content="berkerpeksag@hurriyet.com.tr" />
+<meta name="Robots" content="all,index,follow" />
+<meta name="Document-State" content="dynamic" />
+
+<script src="js/jquery-1.2.6.min.js" type="text/javascript"></script>
+<script src="js/jquery.jgrow-0.3.min.js" type="text/javascript"></script>
+
+<script type="text/javascript">
+ $(document).ready(function() {
+
+ // jGrow
+ $("textarea").jGrow({ height: "50px" });
+
+ });
+</script>
+
+</head>
+<body>
+
+ <h1>jGrow 0.3-dev</h1>
+
+ <textarea name="frmTextArea" cols="30" rows="5" style="width: 300px; height: 50px;"></textarea>
+
+ <textarea name="frmTextArea2" cols="30" rows="5" style="width: 300px; height: 50px;"></textarea>
+
+ <div id="sonuc"></div>
+
+<hr />
+
+</body>
+</html>
@@ -0,0 +1,94 @@
+/**
+* jGrow
+* jGrow is a jQuery plug-in that makes the textarea adjust its size according to the length of the text.
+* @requires jQuery v1.2.3 or later
+* @version 0.3.2
+* @author Berker Peksag http://lab.berkerpeksag.com/jGrow
+*
+* Dual licensed under the MIT and GPL licenses:
+* http://www.opensource.org/licenses/mit-license.php
+* http://www.gnu.org/licenses/gpl.html
+*/
+
+/*
+ * 0.3.2 Changelog (2009-12-09)
+ * - IE CSS height fixed
+ *
+ */
+
+(function($) {
+
+ //jGrow:
+ $.fn.jGrow = function(settings) {
+ var settings = $.extend({}, $.fn.jGrow.defaults, settings);
+
+ this.each(function() {
+ var $t = $(this);
+ $t.css(settings);
+
+ var height = $.browser.msie ? $t.innerHeight() : $t.css('height');
+ var c_h = parseInt(height);
+
+ settings.cache_height = c_h;
+ init($(this), settings);
+ }).keyup(function() {
+
+ init($(this), settings);
+ });
+
+ function init(k, o) {
+ var $t = k;
+ var id = "jgrow-" + $t.attr("name");
+ var h = $t.css("height");
+ h = parseInt(h == "auto" ? "50px" : h);
+ var l = $t.css("line-height");
+ l = parseInt(l == "normal" ? "16px" : l);
+
+ var v = $t.val().replace(/\n/g, "<br />");
+
+ if (!$("#" + id).length) {
+
+ $("<div/>").attr("id", id).css({
+ "border": $t.css("border"),
+ "font-family": $t.css("font-family"),
+ "font-size": $t.css("font-size"),
+ "font-weight": $t.css("font-weight"),
+ "left": "-999px",
+ "overflow": "auto",
+ "padding": $t.css("padding"),
+ "position": "absolute",
+ "top": 0,
+ "width": $t.css("width")
+ }).html(v).appendTo("body");
+
+ } else {
+ $("#" + id).html(v);
+ }
+
+ var n_h = $.browser.msie ? parseInt($("#" + id).innerHeight()) : parseInt($("#" + id).css("height")) + l;
+
+ if (n_h > parseInt(settings.max_height)) {
+ $t.css({
+ overflow: "auto", "height": (parseInt(settings.max_height) + l) + "px"
+ });
+ }else if (n_h > settings.cache_height) {
+ $t.css("height", n_h + "px");
+ }else {
+ var cache_height = isNaN(settings.cache_height) ? 0 : settings.cache_height + 'px';
+ $t.css("height", cache_height);
+ }
+ }
+ };
+
+ //Default configuration:
+ $.fn.jGrow.defaults = {
+ max_height : "700px",
+ resize : "none",
+ overflow : "hidden",
+ cache_height: 0
+ };
+
+ //Current version:
+ $.fn.jGrow.version = '0.3.2';
+
+})(jQuery);
@@ -0,0 +1,97 @@
+/**
+* jGrow
+* jGrow is a jQuery plug-in that makes the textarea adjust its size according to the length of the text.
+* @requires jQuery v1.2.3 or later
+* @version 0.3.1.1
+* @author Berker Peksag http://lab.berkerpeksag.com/jGrow
+*
+* Dual licensed under the MIT and GPL licenses:
+* http://www.opensource.org/licenses/mit-license.php
+* http://www.gnu.org/licenses/gpl.html
+*/
+
+/*
+ * 0.3.1 Changelog (2009-11-25)
+ * - IE CSS height fixed
+ *
+ * 0.3.1.1 Changelog (2009-11-25)
+ * - IE CSS height fixed
+ *
+ */
+
+(function($) {
+
+ //jGrow:
+ $.fn.jGrow = function(settings) {
+ var settings = $.extend({}, $.fn.jGrow.defaults, settings);
+
+ this.each(function() {
+ var $t = $(this);
+ $t.css(settings);
+
+ var height = $.browser.msie ? $t.innerHeight() : $t.css('height');
+ var c_h = parseInt(height);
+
+ settings.cache_height = c_h;
+ init($(this), settings);
+ }).keyup(function() {
+
+ init($(this), settings);
+ });
+
+ function init(k, o) {
+ var $t = k;
+ var id = "jgrow-" + $t.attr("name");
+ var h = $t.css("height");
+ h = parseInt(h == "auto" ? "50px" : h);
+ var l = $t.css("line-height");
+ l = parseInt(l == "normal" ? "16px" : l);
+
+ var v = $t.val().replace(/\n/g, "<br />");
+
+ if (!$("#" + id).length) {
+
+ $("<div/>").attr("id", id).css({
+ "border": $t.css("border"),
+ "font-family": $t.css("font-family"),
+ "font-size": $t.css("font-size"),
+ "font-weight": $t.css("font-weight"),
+ "left": "-999px",
+ "overflow": "auto",
+ "padding": $t.css("padding"),
+ "position": "absolute",
+ "top": 0,
+ "width": $t.css("width")
+ }).html(v).appendTo("body");
+
+ } else {
+ $("#" + id).html(v);
+ }
+
+ var n_h = $.browser.msie ? parseInt($("#" + id).innerHeight()) : parseInt($("#" + id).css("height")) + l;
+
+ if (n_h > parseInt(settings.max_height)) {
+ $t.css({
+ overflow: "auto", "height": (parseInt(settings.max_height) + l) + "px"
+ });
+ }else if (n_h > settings.cache_height) {
+ $t.css("height", n_h + "px");
+ }else {
+ var cache_height = isNaN(settings.cache_height) ? 0 : settings.cache_height + 'px';
+ $t.css("height", cache_height);
+ }
+ }
+ };
+
+ //Default configuration:
+ $.fn.jGrow.defaults = {
+ max_height : "700px",
+ resize : "none",
+ overflow : "hidden",
+ cache_height: 0
+ };
+
+ //Current version:
+ $.fn.jGrow.version = '0.3.1.1';
+
+})(jQuery);

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -0,0 +1,14 @@
+(function($) {
+
+ //jGrow:
+ $.fn.jGrow = function(settings) {
+ var settings = $.extend({}, $.fn.jGrow.defaults, settings);
+
+ this.each(function() {
+ var $t = $(this);
+ $t.css(settings);
+
+ var height = $.browser.msie ? $t.innerHeight() : $t.css('height');
+ var c_h = parseInt(height);
+
+ settings.cache_height = c_h;init($(this),settings);}).keyup(function(){init($(this),settings);});function init(k,o){var $t=k;var id="jgrow-"+$t.attr("name");var h=$t.css("height");h=parseInt(h=="auto"?"50px":h);var l=$t.css("line-height");l=parseInt(l=="normal"?"16px" :l);var v=$t.val().replace(/\n/g,"<br />");if(!$("#"+id).length){$("<div/>").attr("id",id).css({"border":$t.css("border"),"font-family":$t.css("font-family"),"font-size":$t.css("font-size"),"font-weight":$t.css("font-weight"),"left":"-999px","overflow":"auto","padding":$t.css("padding"),"position":"absolute","top":0,"width":$t.css("width")}).html(v).appendTo("body");}else{$("#"+id).html(v);};var n_h=$.browser.msie?parseInt($("#"+id).innerHeight()):parseInt($("#"+id).css("height"))+l;if(n_h>parseInt(settings.max_height)){$t.css({overflow:"auto","height":(parseInt(settings.max_height)+l)+"px"});}else if(n_h>settings.cache_height){$t.css("height",n_h+"px");}else{var cache_height=isNaN(settings.cache_height)?0:settings.cache_height+'px';$t.css("height",cache_height);}}};$.fn.jGrow.defaults={max_height:"700px",resize:"none",overflow:"hidden",cache_height:0};$.fn.jGrow.version='0.3.2';})(jQuery);
@@ -0,0 +1,40 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" lang="tr" xml:lang="tr">
+<head>
+<title>Örnek - jGrow 0.3</title>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<meta http-equiv="Content-Language" content="TR" />
+<meta name="Description" content="" />
+<meta name="Keywords" content="" />
+<meta name="Author" content="Berker Peksag" />
+<meta name="Reply-To" content="berkerpeksag@hurriyet.com.tr" />
+<meta name="Robots" content="all,index,follow" />
+<meta name="Document-State" content="dynamic" />
+
+<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script>
+<script src="js/jquery.jgrow-0.3.2.min.js" type="text/javascript"></script>
+
+<script type="text/javascript">
+ $(function() {
+
+ // jGrow
+ $("#frmTextArea").jGrow();
+
+ $("#frmTextArea2").jGrow();
+
+ });
+</script>
+
+</head>
+<body>
+
+<h1>jGrow 0.3.x-dev</h1>
+
+<textarea name="frmTextArea" id="frmTextArea" rows="20"></textarea>
+
+<hr />
+
+<textarea name="frmTextArea2" id="frmTextArea2"></textarea>
+
+</body>
+</html>
@@ -0,0 +1,40 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" lang="tr" xml:lang="tr">
+<head>
+<title>Örnek - jGrow 0.3</title>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<meta http-equiv="Content-Language" content="TR" />
+<meta name="Description" content="" />
+<meta name="Keywords" content="" />
+<meta name="Author" content="Berker Peksag" />
+<meta name="Reply-To" content="berkerpeksag@hurriyet.com.tr" />
+<meta name="Robots" content="all,index,follow" />
+<meta name="Document-State" content="dynamic" />
+
+<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script>
+<script src="js/jquery.jgrow-0.3.2.js" type="text/javascript"></script>
+
+<script type="text/javascript">
+ $(function() {
+
+ // jGrow
+ $("#frmTextArea").jGrow();
+
+ $("#frmTextArea2").jGrow();
+
+ });
+</script>
+
+</head>
+<body>
+
+<h1>jGrow 0.3.x-dev</h1>
+
+<textarea name="frmTextArea" id="frmTextArea" rows="20"></textarea>
+
+<hr />
+
+<textarea name="frmTextArea2" id="frmTextArea2"></textarea>
+
+</body>
+</html>

0 comments on commit 0875904

Please sign in to comment.