1
|
|
2
|
|
3
|
|
4
|
|
5
|
(function ($) {
|
6
|
Drupal.behaviors.TokenInsertText = {
|
7
|
attach: function(context) {
|
8
|
|
9
|
if(!(typeof(Drupal.settings.token_insert) == 'undefined')){
|
10
|
for(var key in Drupal.settings.token_insert.buttons){
|
11
|
$("#" + key, context).click(insert);
|
12
|
}
|
13
|
}
|
14
|
|
15
|
function insert() {
|
16
|
var field = $(this).attr('id');
|
17
|
var selectbox = field.replace('button', 'select');
|
18
|
var content = '[' + $('#' + selectbox ).val() + ']';
|
19
|
$('#' + Drupal.settings.token_insert.buttons[field]).insertAtCursor(content);
|
20
|
return false;
|
21
|
}
|
22
|
}
|
23
|
};
|
24
|
})(jQuery);
|
25
|
|