ultimix

- Main Page
- Data Structures
- Files
- Examples

- File List
- Globals

inplace.js
Go to the documentation of this file.
1
6 if( !ultimix )
7 {
8 ultimix = {};
9 }
10
16 if( !ultimix.inplace )
17 {
18 ultimix.inplace = {};
19 }
20
28 ultimix.inplace.ReplaceWithTextarea = function( Event )
29 {
30 var Width = jQuery( Event.target ).outerWidth();
31 var Height = jQuery( Event.target ).outerHeight();
32 var Name = jQuery( Event.target ).attr( 'field_name' );
33 var Class = jQuery( Event.target ).attr( 'field_class' );
34 var Value = jQuery( Event.target ).html();
35
36 jQuery( Event.target ).hide();
37 jQuery( Event.target ).after(
38 '<textarea style="margin: 0px; width: ' + ( Width - 5 ) + 'px; height: ' + ( Height - 3 ) +
39 'px" class="' + Class + '" name="' + Name + '">' + Value + '</textarea>'
40 );
41 jQuery( Event.target ).next().focus();
42 }
43
51 ultimix.inplace.ReplaceWithInput = function( Event )
52 {
53 var Width = jQuery( Event.target ).outerWidth();
54 var Name = jQuery( Event.target ).attr( 'field_name' );
55 var Class = jQuery( Event.target ).attr( 'field_class' );
56 var Value = jQuery( Event.target ).html();
57
58 jQuery( Event.target ).hide();
59 jQuery( Event.target ).after(
60 '<input style="margin: 0px; width: ' + ( Width - 5 ) + 'px;' +
61 '" class="' + Class + '" name="' + Name + '" value="' + Value + '">'
62 );
63 jQuery( Event.target ).next().focus();
64 }
65
71 jQuery(
72 function()
73 {
74 jQuery( '.inplace_textarea' ).each(
75 function( i , Element )
76 {
77 jQuery( Element ).dblclick( ultimix.inplace.ReplaceWithTextarea );
78 }
79 );
80 jQuery( '.inplace_input' ).each(
81 function( i , Element )
82 {
83 jQuery( Element ).dblclick( ultimix.inplace.ReplaceWithInput );
84 }
85 );
86 }
87 );