first import
This commit is contained in:
31
sites/all/modules/views_php/views_php.js
Normal file
31
sites/all/modules/views_php/views_php.js
Normal file
@@ -0,0 +1,31 @@
|
||||
(function ($) {
|
||||
|
||||
/**
|
||||
* Attach views php clickable variables behavior.
|
||||
*/
|
||||
Drupal.behaviors.viewsPHPVariables = {
|
||||
attach: function (context) {
|
||||
$('.views-php-variables', context).delegate('a', 'click', function() {
|
||||
var textarea = $(this.href.replace(/^.*#/, '#'))[0];
|
||||
var text = $(this).text();
|
||||
textarea.focus();
|
||||
if (!isNaN(textarea.selectionStart)) {
|
||||
textarea.value = textarea.value.substring(0, textarea.selectionStart) + text + textarea.value.substring(textarea.selectionEnd);
|
||||
textarea.selectionStart = textarea.selectionStart + text.length;
|
||||
textarea.selectionEnd = textarea.selectionEnd + text.length;
|
||||
}
|
||||
// IE support.
|
||||
else if (document.selection) {
|
||||
document.selection.createRange().text = text;
|
||||
}
|
||||
else {
|
||||
textarea.value += text;
|
||||
}
|
||||
textarea.focus();
|
||||
|
||||
return false;
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
Reference in New Issue
Block a user