Skip to content
Snippets Groups Projects
Select Git revision
  • 8c6d1aff59d821f8d3421c4568fdaeeb6c8234c7
  • noblogs default
  • noblogs-5.7.1
  • upstream
  • noblogs-5.7
  • noblogs-5.6new
  • upstream5.5.1
  • noblogs28dic
  • upstream28dic
  • noblogs-5.5.1
  • noblogs-5.4.2
  • noblogs-5.4_seconda
  • noblogs-5.4
  • noblogs-7c
  • wp5.2.3p3
  • mergedbconf
  • noblogs-5.7.1
  • noblogs.5.7.0p1
  • noblogs-5.7.0
  • noblogs-5.6p3
  • noblogs5.6p2
  • noblogs-5.6p1
  • noblogs-5.6
  • noblogs-5.4.2p1
  • noblogs-5.4.2
  • noblogs-5.4.1
  • noblogs-5.4
  • noblogs-p5.4
  • noblogs-5.3.2p2
  • noblogs-5.3.2p1
  • noblogs-5.3.2
  • noblogs-5.3
  • noblogs-5.2.3p4
  • noblogs-5.2.3p3
  • noblogs-5.2.3p2
  • noblogs-5.2.3p1
36 results

controls.js

Blame
  • controls.js 33.97 KiB
    // script.aculo.us controls.js v1.9.0, Thu Dec 23 16:54:48 -0500 2010
    
    // Copyright (c) 2005-2010 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
    //           (c) 2005-2010 Ivan Krstic (http://blogs.law.harvard.edu/ivan)
    //           (c) 2005-2010 Jon Tirsen (http://www.tirsen.com)
    // Contributors:
    //  Richard Livsey
    //  Rahul Bhargava
    //  Rob Wills
    //
    // script.aculo.us is freely distributable under the terms of an MIT-style license.
    // For details, see the script.aculo.us web site: http://script.aculo.us/
    
    // Autocompleter.Base handles all the autocompletion functionality
    // that's independent of the data source for autocompletion. This
    // includes drawing the autocompletion menu, observing keyboard
    // and mouse events, and similar.
    //
    // Specific autocompleters need to provide, at the very least,
    // a getUpdatedChoices function that will be invoked every time
    // the text inside the monitored textbox changes. This method
    // should get the text for which to provide autocompletion by
    // invoking this.getToken(), NOT by directly accessing
    // this.element.value. This is to allow incremental tokenized
    // autocompletion. Specific auto-completion logic (AJAX, etc)
    // belongs in getUpdatedChoices.
    //
    // Tokenized incremental autocompletion is enabled automatically
    // when an autocompleter is instantiated with the 'tokens' option
    // in the options parameter, e.g.:
    // new Ajax.Autocompleter('id','upd', '/url/', { tokens: ',' });
    // will incrementally autocomplete with a comma as the token.
    // Additionally, ',' in the above example can be replaced with
    // a token array, e.g. { tokens: [',', '\n'] } which
    // enables autocompletion on multiple tokens. This is most
    // useful when one of the tokens is \n (a newline), as it
    // allows smart autocompletion after linebreaks.
    
    if(typeof Effect == 'undefined')
      throw("controls.js requires including script.aculo.us' effects.js library");
    
    var Autocompleter = { };
    Autocompleter.Base = Class.create({
      baseInitialize: function(element, update, options) {
        element          = $(element);
        this.element     = element;
        this.update      = $(update);
        this.hasFocus    = false;
        this.changed     = false;
        this.active      = false;
        this.index       = 0;
        this.entryCount  = 0;
        this.oldElementValue = this.element.value;
    
        if(this.setOptions)
          this.setOptions(options);
        else
          this.options = options || { };
    
        this.options.paramName    = this.options.paramName || this.element.name;
        this.options.tokens       = this.options.tokens || [];
        this.options.frequency    = this.options.frequency || 0.4;
        this.options.minChars     = this.options.minChars || 1;
        this.options.onShow       = this.options.onShow ||
          function(element, update){
            if(!update.style.position || update.style.position=='absolute') {
              update.style.position = 'absolute';
              Position.clone(element, update, {
                setHeight: false,
                offsetTop: element.offsetHeight