Projet

Général

Profil

0001-insert-variable-code-in-textarea-when-clicking-on-th.patch

Frédéric Péters, 13 juin 2014 16:33

Télécharger (1,19 ko)

Voir les différences:

Subject: [PATCH] insert variable code in textarea when clicking on them
 (#4964)

 wcs/qommon/static/js/qommon.admin.js | 12 ++++++++++++
 1 file changed, 12 insertions(+)
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
-