1jQuery.noConflict(); 2jQuery(function($) { 3 4SearchAutocompleteForm = Backbone.View.extend({ 5 events : { 6 'focus .UI-SEARCH' : 'focus', 7 'blur .UI-SEARCH' : 'blur', 8 'submit' : 'submit' 9 }, 10 11 initialize: function() { 12 var self = this; 13 _.bindAll(self); 14 }, 15 16 init: function(el) { 17 var self = this; 18 self.setElement(el); 19 20 self.$field = $('.UI-SEARCH', self.$el); 21 self.emptyText = self.$el.attr('data-tip'); 22 23 self.blur(); 24 }, 25 26 submit: function(e) { 27 var self = this; 28 29 if (self.$field.val() == self.emptyText || self.$field.val() == '') { 30 e.stopPropagation(); 31 return false; 32 } 33 34 return true; 35 }, 36 37 focus: function() { 38 var self = this; 39 40 if(self.$field.val() == self.emptyText){ 41 self.$field.val(''); 42 } 43 }, 44 45 blur: function() { 46 var self = this; 47 48 if(self.$field.val() == ''){ 49 self.$field.val(self.emptyText); 50 } 51 } 52 53}); 54 55$(function() { 56 _.each($('.UI-SEARCHAUTOCOMPLETE'), function (el) { 57 var form = new SearchAutocompleteForm(); 58 form.init(el); 59 }); 60}); 61 62});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.