Pathauto and dependencies
This commit is contained in:
parent
4b1a293d57
commit
24ffcb956b
257 changed files with 29510 additions and 0 deletions
58
web/modules/contrib/token/js/token.js
Normal file
58
web/modules/contrib/token/js/token.js
Normal file
|
@ -0,0 +1,58 @@
|
|||
|
||||
(function ($) {
|
||||
|
||||
'use strict';
|
||||
|
||||
Drupal.behaviors.tokenTree = {
|
||||
attach: function (context, settings) {
|
||||
$('table.token-tree', context).once('token-tree').each(function () {
|
||||
$(this).treetable({ expandable: true });
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
Drupal.behaviors.tokenInsert = {
|
||||
attach: function (context, settings) {
|
||||
// Keep track of which textfield was last selected/focused.
|
||||
$('textarea, input[type="text"]', context).focus(function () {
|
||||
drupalSettings.tokenFocusedField = this;
|
||||
});
|
||||
|
||||
$('.token-click-insert .token-key', context).once('token-click-insert').each(function () {
|
||||
var newThis = $('<a href="javascript:void(0);" title="' + Drupal.t('Insert this token into your form') + '">' + $(this).html() + '</a>').click(function () {
|
||||
if (typeof drupalSettings.tokenFocusedField == 'undefined') {
|
||||
alert(Drupal.t('First click a text field to insert your tokens into.'));
|
||||
}
|
||||
else {
|
||||
var myField = drupalSettings.tokenFocusedField;
|
||||
var myValue = $(this).text();
|
||||
|
||||
// IE support.
|
||||
if (document.selection) {
|
||||
myField.focus();
|
||||
var sel = document.selection.createRange();
|
||||
sel.text = myValue;
|
||||
}
|
||||
|
||||
// MOZILLA/NETSCAPE support.
|
||||
else if (myField.selectionStart || myField.selectionStart === '0') {
|
||||
var startPos = myField.selectionStart;
|
||||
var endPos = myField.selectionEnd;
|
||||
myField.value = myField.value.substring(0, startPos)
|
||||
+ myValue
|
||||
+ myField.value.substring(endPos, myField.value.length);
|
||||
}
|
||||
else {
|
||||
myField.value += myValue;
|
||||
}
|
||||
|
||||
$('html,body').animate({scrollTop: $(myField).offset().top}, 500);
|
||||
}
|
||||
return false;
|
||||
});
|
||||
$(this).html(newThis);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
})(jQuery, drupalSettings);
|
Reference in a new issue