Advertisement
Guest User

Untitled

a guest
Apr 26th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.    var searchInput = $(this).typeahead({
  2.                     hint: true,
  3.                     highlight: true,
  4.                     minLength: minLength
  5.                 },
  6.                 {
  7.                     name: 'tooltips',
  8.                     limit: 100,
  9.                     source: searchResults.ttAdapter(),
  10.                     display: function(data) {
  11.                         var value = searchInput.typeahead('val');
  12.                         if (data.type === 'performer' || data.type === 'event' || data.type === 'venue') {
  13.                             value = data.title;
  14.                         }
  15.                         return value;
  16.                     },
  17.                     templates: {
  18.                         empty:
  19.                         '<div class="tasearch-no-results">' +
  20.                         'Unable to find any performer, venue or event that match the current query' +
  21.                         '</div>',
  22.  
  23.                         suggestion: function (data) {
  24.                             var text = "";
  25.                             if (data.type === 'all') {
  26.                                 text = "<div class='tasearch-all-results'><a href='#'>"+data.title+"</a></div>";
  27.                             }
  28.                             if (data.type === 'heading') {
  29.                                 text = "<div class='tasearch-heading "+data.dataType+"'>"+data.title+"</div>";
  30.                             }
  31.                             if (data.type === 'performer') {
  32.                                 text = "<div class=''><a href='"+data.url+"'>"+data.title+"</a></div>"
  33.                             }
  34.                             if (data.type === 'event') {
  35.                                 text = "<div class=''><a href='"+data.url+"'>"+data.title+"<div class='info'>"+data.eventDate+" | "+ data.vName+"</div></a></div>";
  36.                             }
  37.                             if (data.type === 'venue') {
  38.                                 text = "<div class=''><a href='"+data.url+"'>"+data.title+"<div class='info'>"+data.city+" | "+ data.state+"</div></a></div>"
  39.                             }
  40.                             return text;
  41.                         }
  42.                     }
  43.                 }
  44.             );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement