Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- 883: category status wasn't saved.
- 870, 877, 878: growfield plugins send wrong value when empty textarea. Now use another plugin for autogrow. git-svn-id: http://piwigo.org/svn/trunk@2653 68402e56-0260-453c-a942-63ccdbb3a9ee
- Loading branch information
patdenice
committed
Oct 4, 2008
1 parent
9559f1a
commit eb07150
Showing
5 changed files
with
51 additions
and
337 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,14 @@ | ||
{* $Id$ *} | ||
{known_script id="jquery" src=$ROOT_URL|@cat:"template-common/lib/jquery.packed.js"} | ||
{known_script id="jquery.ui" src=$ROOT_URL|@cat:"template-common/lib/ui/ui.core.packed.js"} | ||
{known_script id="jquery.growfield" src=$ROOT_URL|@cat:"template-common/lib/plugins/jquery.growfield.packed.js"} | ||
{known_script id="jquery.autogrow" src=$ROOT_URL|@cat:"template-common/lib/plugins/jquery.autogrow-textarea.js"} | ||
|
||
{* Auto size and auto grow textarea *} | ||
{literal} | ||
<script type="text/javascript"> | ||
jQuery().ready(function(){ | ||
jQuery('textarea').css('overflow-y', 'hidden'); | ||
// Auto size and auto grow for all text area | ||
jQuery("TEXTAREA").growfield({ | ||
animate: false | ||
}); | ||
jQuery('textarea').autogrow(); | ||
}); | ||
</script> | ||
{/literal} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
(function($) { | ||
|
||
/* | ||
* Auto-growing textareas; technique ripped from Facebook | ||
*/ | ||
$.fn.autogrow = function(options) { | ||
|
||
this.filter('textarea').each(function() { | ||
|
||
var $this = $(this), | ||
minHeight = $this.height(), | ||
lineHeight = $this.css('lineHeight'); | ||
|
||
var shadow = $('<div></div>').css({ | ||
position: 'absolute', | ||
top: -10000, | ||
left: -10000, | ||
width: $(this).width(), | ||
fontSize: $this.css('fontSize'), | ||
fontFamily: $this.css('fontFamily'), | ||
lineHeight: $this.css('lineHeight'), | ||
resize: 'none' | ||
}).appendTo(document.body); | ||
|
||
var update = function() { | ||
|
||
var val = this.value.replace(/</g, '<') | ||
.replace(/>/g, '>') | ||
.replace(/&/g, '&') | ||
.replace(/\n/g, '<br/>'); | ||
|
||
shadow.html(val); | ||
$(this).css('height', Math.max(shadow.height() + 20, minHeight)); | ||
|
||
} | ||
|
||
$(this).change(update).keyup(update).keydown(update); | ||
|
||
update.apply(this); | ||
|
||
}); | ||
|
||
return this; | ||
|
||
} | ||
|
||
})(jQuery); |
Oops, something went wrong.