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 var query = self.$field.val(); 34 query = query.replace(/<\/?[^>]+>/gi, ''); 35 self.$field.val(query); 36 37 return true; 38 }, 39 40 focus: function() { 41 var self = this; 42 43 if(self.$field.val() == self.emptyText){ 44 self.$field.val(''); 45 } 46 }, 47 48 blur: function() { 49 var self = this; 50 51 if(self.$field.val() == ''){ 52 self.$field.val(self.emptyText); 53 } 54 } 55 56}); 57 58$(function() { 59 _.each($('.UI-SEARCHAUTOCOMPLETE'), function (el) { 60 var form = new SearchAutocompleteForm(); 61 form.init(el); 62 }); 63}); 64 65});
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.