Created
November 22, 2010 18:44
-
-
Save rgrove/710413 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
YUI.add('autocomplete-jeremy', function(Y) { | |
var Plugin = Y.Plugin; | |
function ACListPlugin(config) { | |
config.inputNode = config.host; | |
// Render by default. | |
if (!config.render && config.render !== false) { | |
config.render = true; | |
} | |
Y.before(this._bindPrompt, this, 'bindUI'); | |
ACListPlugin.superclass.constructor.apply(this, arguments); | |
} | |
Y.extend(ACListPlugin, Y.AutoCompleteList, { | |
_bindPrompt: function () { | |
this.get('inputNode').on('focus', this._showLocationPrompt); | |
}, | |
_showLocationPrompt: function (e) { | |
var inputNode = e.target; | |
if (inputNode.get('value') === '') { | |
this.get('listNode').setContent('<li>Please type the name of your city.</li>'); | |
this.show(); | |
} | |
} | |
}, { | |
NAME : 'autocompleteListPlugin', | |
NS : 'ac', | |
CSS_PREFIX: Y.ClassNameManager.getClassName('aclist') | |
}); | |
Plugin.AutoComplete = ACListPlugin; | |
Plugin.AutoCompleteList = ACListPlugin; | |
}, '@VERSION@', {requires:['autocomplete-list', 'node-pluginhost']}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment