topical media & game development

talk show tell print

mobile-graphic-easel-build-createjsTheme-assets-js-api-filter.js / js



  YUI.add('api-filter', function (Y) {
  
  Y.APIFilter = Y.Base.create('apiFilter', Y.Base, [Y.AutoCompleteBase], {
      // -- Initializer ----------------------------------------------------------
      initializer: function () {
          this._bindUIACBase();
          this._syncUIACBase();
      },
      getDisplayName: function(name) {
  
          Y.each(Y.YUIDoc.meta.allModules, function(i) {
              if (i.name === name && i.displayName) {
                  name = i.displayName;
              }
          });
  
          return name;
      }
  
  }, {
      // -- Attributes -----------------------------------------------------------
      ATTRS: {
          resultHighlighter: {
              value: 'phraseMatch'
          },
  
          // May be set to "classes" or "modules".
          queryType: {
              value: 'classes'
          },
  
          source: {
              valueFn: function() {
                  var self = this;
                  return function(q) {
                      var data = Y.YUIDoc.meta[self.get('queryType')],
                          out = [];
                      Y.each(data, function(v) {
                          if (v.toLowerCase().indexOf(q.toLowerCase()) > -1) {
                              out.push(v);
                          }
                      });
                      return out;
                  };
              }
          }
      }
  });
  
  }, '3.4.0', {requires: [
      'autocomplete-base', 'autocomplete-highlighters', 'autocomplete-sources'
  ]});
  


(C) Æliens 04/09/2009

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.