Projet

Général

Profil

Révision 5721e759

Ajouté par Assos Assos il y a presque 10 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/token_insert/token_insert.js
1

  
1
/*jshint strict:true, browser:true, curly:true, eqeqeq:true, expr:true, forin:true, latedef:true, newcap:true, noarg:true, trailing: true, undef:true, unused:true */
2
/*global jQuery: true*/
2 3
// General Insert API functions.
3 4
(function ($) {
5
  "use strict";
4 6
  $.fn.insertAtCursor = function (tagName) {
5 7
    return this.each(function(){
6 8
      if (document.selection) {
7 9
        //IE support
8 10
        this.focus();
9
        sel = document.selection.createRange();
11
        var sel = document.selection.createRange();
10 12
        sel.text = tagName;
11 13
        this.focus();
12
      }else if (this.selectionStart || this.selectionStart == '0') {
14
      }
15
      else if (this.selectionStart || this.selectionStart === 0) {
13 16
        //MOZILLA/NETSCAPE support
14
        startPos = this.selectionStart;
15
        endPos = this.selectionEnd;
16
        scrollTop = this.scrollTop;
17
        var startPos = this.selectionStart;
18
        var endPos = this.selectionEnd;
19
        var scrollTop = this.scrollTop;
17 20
        this.value = this.value.substring(0, startPos) + tagName + this.value.substring(endPos,this.value.length);
18 21
        this.focus();
19 22
        this.selectionStart = startPos + tagName.length;
......
26 29
    });
27 30
  };
28 31
})(jQuery);
32

  

Formats disponibles : Unified diff