1 |
5721e759
|
Assos Assos
|
|
2 |
|
|
|
3 |
85ad3d82
|
Assos Assos
|
|
4 |
|
|
|
5 |
|
|
|
6 |
5721e759
|
Assos Assos
|
(function ($, Drupal) {
|
7 |
|
|
"use strict";
|
8 |
|
|
Drupal.behaviors.TokenInsertText = {
|
9 |
|
|
attach: function(context) {
|
10 |
|
|
function insert (e){
|
11 |
|
|
var $self = $(this);
|
12 |
|
|
e.preventDefault();
|
13 |
|
|
var token = $self.text();
|
14 |
|
|
var id = $self.closest('.token-insert-text-table').attr('id');
|
15 |
|
|
$('#' + Drupal.settings.token_insert.tables[id]).insertAtCursor(token);
|
16 |
|
|
}
|
17 |
|
|
function bindInsert(id) {
|
18 |
|
|
$(context).find("#" + key).find('.token-insert-table .token-key').once('token-insert-table', function() {
|
19 |
|
|
var newThis = $('<a href="javascript:void(0);" title="' + Drupal.t('Insert this token into your form') + '">' + $(this).html() + '</a>').click(insert);
|
20 |
|
|
$(this).html(newThis);
|
21 |
|
|
});
|
22 |
85ad3d82
|
Assos Assos
|
}
|
23 |
|
|
|
24 |
5721e759
|
Assos Assos
|
|
25 |
|
|
if (typeof(Drupal.settings.token_insert) !== 'undefined') {
|
26 |
|
|
for (var key in Drupal.settings.token_insert.tables) {
|
27 |
|
|
if (Drupal.settings.token_insert.tables.hasOwnProperty(key)) {
|
28 |
|
|
bindInsert(key, context);
|
29 |
|
|
}
|
30 |
|
|
}
|
31 |
|
|
}
|
32 |
85ad3d82
|
Assos Assos
|
}
|
33 |
5721e759
|
Assos Assos
|
};
|
34 |
|
|
})(jQuery, Drupal); |