0001-insert-variable-code-in-textarea-when-clicking-on-th.patch
wcs/qommon/static/js/qommon.admin.js | ||
---|---|---|
14 | 14 |
$(this).toggleClass('folded').next().toggle(); |
15 | 15 |
}); |
16 | 16 |
$('.foldable.folded').next().hide(); |
17 | ||
18 |
/* insert variable code in textarea when clicking on them */ |
|
19 |
$('#substvars td:nth-child(2)').css('cursor', 'pointer').click(function() { |
|
20 |
var current_val = $('textarea').val(); |
|
21 |
position = $('textarea').get(0).selectionStart; |
|
22 |
if (position >= 0) { |
|
23 |
var code = $(this).text(); |
|
24 |
var new_val = current_val.substr(0, position) + code + current_val.substr(position); |
|
25 |
$('textarea').val(new_val); |
|
26 |
} |
|
27 |
return true; |
|
28 |
}); |
|
17 | 29 |
}); |
18 |
- |