--- /dev/null
+$(document).ready( function(){
+
+ $('form#eval textarea').each( function() {
+ console.debug('grow',this);
+
+ var rows = this.rows;
+ console.debug( 'textarea_grow', rows, this );
+ var grow = function(ta) {
+ var lines = ta.value.split('\n').length;
+ if ( lines != rows ) {
+ ta.rows = lines;
+ rows = lines;
+ console.debug('keyup', lines, rows, ta );
+ }
+ };
+ grow(this);
+ this.onkeyup = function() { grow(this) };
+ });
+
+ $('input#close').click( function(){
+ console.debug( 'close console' );
+ $.post( document.location, { code: '' } );
+ $(this).parent().hide();
+ });
+
+ var $out = $('pre#out');
+ if ( $out.height() > ( $(window).height() / 3 * 2 ) ) {
+ $out.height( $(window).height() / 3 * 2 ).css({ overflow: 'auto' });
+ }
+
+ $('a#console').click( function() {
+ console.debug('open console');
+ var $f = $('form#eval');
+ if ( $f.is(':visible') ) {
+ $f.hide();
+ } else {
+ $f.show();
+ }
+ return false;
+ }).show();
+
+});
+
</form>
-<form method=post>
+<form id=eval method=post>
<input type=hidden name=name value="<%= $name %>">
<div style="float: right">
Eval code on each facet <tt>$value</tt> and <tt>$count</tt>
<textarea name=code style="width: 100%">
<%= param('code') %>
</textarea>
-<input type=submit>
+<input type=submit value="Eval on facet values">
+<input id=close name=close type=button value="Close" style="float: right">
</form>
% if ( $#$facet_names < 5000 ) {
<script type="text/javascript">
$(document).ready( function(){
console.debug('check alert');
- var a = $('.alert');
- if ( a.length ) {
- $('.middle').html( a.html() );
+ var $a = $('.alert');
+ if ( $a.length ) {
+ $('.middle').html( $a.html() );
}
+
+ $('a#console').show();
+
});
</script>
<pre class=debug><%#= dumper $facet %></pre>
% }
+<script type="text/javascript" src="/js/eval_console.js"></script>
+
<input id=close name=close type=button value="Close" style="float: right">
</form>
-<script type="text/javascript" src="/js/jquery.textarea_grow.js"></script>
-<script type="text/javascript">
-
-$(document).ready( function(){
-
- $('form#eval textarea').textarea_grow();
- $('input#close').click( function(){
- console.debug( 'close console' );
- $.post( document.location, { code: '' } );
- $(this).parent().hide();
- });
-
- var $out = $('pre#out');
- if ( $out.height() > ( $(window).height() / 3 * 2 ) ) {
- $out.height( $(window).height() / 3 * 2 ).css({ overflow: 'auto' });
- }
-
- $('a#console').click( function() {
- console.debug('open console');
- var $f = $('form#eval');
- if ( $f.is(':visible') ) {
- $f.hide();
- } else {
- $f.show();
- }
- return false;
- }).show();
-
-});
-
-</script>
-
+<script type="text/javascript" src="/js/eval_console.js"></script>
<script type="text/javascript" src="/edit_table.js"></script>