All pastes #237151 Raw Edit

kkaefer

public javascript v1 · immutable
·published 2006-11-04 10:56 UTC
rendered paste body
if (Drupal.jsEnabled) {    $('img.smiley-hand').click(function(){      var smiley = ' ' + this.alt + ' ';      $('textarea#edit-body, textarea#edit-comment').each(function() {        if (document.selection) {          this.focus();          document.selection.createRange().text = smiley;          this.focus();        }        else if (text.selectionStart || text.selectionStart == '0') {          var cursorPos = this.selectionEnd + smiley.length;          this.value = this.value.substring(0, this.selectionStart) + smiley + this.value.substring(this.selectionEnd);          this.focus();          this.selectionStart = this.selectionEnd = cursorPos;        }        else {          this.value = this.value + smiley          this.focus();        }      });    });  });}