How to use corejs-typeahead - 9 common examples

To help you get started, we’ve selected a few corejs-typeahead examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dotkom / onlineweb4 / assets / common / typeahead / index.js View on Github external
export const typeahead = (element, options) => {
  const source = new Bloodhound({
    // Boilerplate
    datumTokenizer(d) {
      return Bloodhound.tokenizers.whitespace(d.num);
    },
    queryTokenizer: Bloodhound.tokenizers.whitespace,
    remote: {
      url: options.url,
      wildcard: '%QUERY',
    },
  });
  element.typeahead({
    valueKey: 'id',
  }, {
    name: options.name || 'typeahead',
    source,
    templates: {
      suggestion: options.template,
    },
    display: options.display || 'name',
  }).on('typeahead:selected typeahead:autocompleted', options.select);
};
github dotkom / onlineweb4 / assets / common / typeahead / index.js View on Github external
export const typeahead = (element, options) => {
  const source = new Bloodhound({
    // Boilerplate
    datumTokenizer(d) {
      return Bloodhound.tokenizers.whitespace(d.num);
    },
    queryTokenizer: Bloodhound.tokenizers.whitespace,
    remote: {
      url: options.url,
      wildcard: '%QUERY',
    },
  });
  element.typeahead({
    valueKey: 'id',
  }, {
    name: options.name || 'typeahead',
    source,
    templates: {
github prymitive / karma / assets / static / autocomplete.js View on Github external
function init() {
    autocomplete = new Bloodhound({
        datumTokenizer: Bloodhound.tokenizers.whitespace,
        queryTokenizer: Bloodhound.tokenizers.whitespace,
        remote: {
            url: "autocomplete.json?term=%QUERY",
            wildcard: "%QUERY",
            rateLimitBy: "throttle",
            rateLimitWait: 300
        },
        sufficient: 12
    });
}
github prymitive / karma / assets / static / autocomplete.js View on Github external
function init() {
    autocomplete = new Bloodhound({
        datumTokenizer: Bloodhound.tokenizers.whitespace,
        queryTokenizer: Bloodhound.tokenizers.whitespace,
        remote: {
            url: "autocomplete.json?term=%QUERY",
            wildcard: "%QUERY",
            rateLimitBy: "throttle",
            rateLimitWait: 300
        },
        sufficient: 12
    });
}
github Strimoid / Strimoid / resources / assets / js / lara.js View on Github external
      datumTokenizer: function (d) { return Bloodhound.tokenizers.whitespace(d.value) },
      queryTokenizer: Bloodhound.tokenizers.whitespace,
github dotkom / onlineweb4 / assets / common / typeahead / index.js View on Github external
datumTokenizer(d) {
      return Bloodhound.tokenizers.whitespace(d.num);
    },
    queryTokenizer: Bloodhound.tokenizers.whitespace,
github Strimoid / Strimoid / resources / assets / js / lara.js View on Github external
})

    groups.initialize()

    $('input.group_typeahead, .entry_add_form input[name="groupname"], .content_add_form input[name="groupname"]').typeahead(null, {
      name: 'groups',
      source: groups.ttAdapter(),
      display: 'value',
      templates: {
        suggestion: _.template('<div><img class="avatar" src="<%= avatar %>"><p>&lt;%= value %&gt;<span class="count">[&lt;%= contents %&gt;]</span></p></div>')
      }
    })

    var users = new Bloodhound({
      datumTokenizer: function (d) { return Bloodhound.tokenizers.whitespace(d.value) },
      queryTokenizer: Bloodhound.tokenizers.whitespace,
      prefetch: {
        url: '/users.json',
        filter: function (d) {
          if (window.blocked_users)
            return _.filter(d, function (u) { return !_.includes(window.blocked_users, u.value) })
          else
            return d
        }
      }
    })

    users.initialize()

    $('input.user_typeahead').typeahead([
      {
        name: 'users',
github Strimoid / Strimoid / resources / assets / js / lara.js View on Github external
if (!('permission' in Notification))
          Notification.permission = permission

        if (permission === 'granted')
          $('input[name="browser_notifications"]').prop('checked', true)
      })
    }

    return false
  })

  if (window.Notification && Notification.permission === 'granted')
    $('input[name="browser_notifications"]').prop('checked', true)

  if (window.username) {
    var groups = new Bloodhound({
      datumTokenizer: function (d) { return Bloodhound.tokenizers.whitespace(d.value) },
      queryTokenizer: Bloodhound.tokenizers.whitespace,
      prefetch: {
        url: '/groups.json',
        filter: function (d) {
          if (window.settings && window.settings.homepage_subscribed)
            return _.filter(d, function (g) { return _.includes(window.subscribed_groups, g.value) })
          else
            return _.filter(d, function (g) { return !_.includes(window.blocked_groups, g.value) })
        }
      },
      sorter: function (a, b) {
        return b.contents - a.contents
      }
    })
github Strimoid / Strimoid / resources / assets / js / lara.js View on Github external
return b.contents - a.contents
      }
    })

    groups.initialize()

    $('input.group_typeahead, .entry_add_form input[name="groupname"], .content_add_form input[name="groupname"]').typeahead(null, {
      name: 'groups',
      source: groups.ttAdapter(),
      display: 'value',
      templates: {
        suggestion: _.template('<div><img class="avatar" src="<%= avatar %>"><p>&lt;%= value %&gt;<span class="count">[&lt;%= contents %&gt;]</span></p></div>')
      }
    })

    var users = new Bloodhound({
      datumTokenizer: function (d) { return Bloodhound.tokenizers.whitespace(d.value) },
      queryTokenizer: Bloodhound.tokenizers.whitespace,
      prefetch: {
        url: '/users.json',
        filter: function (d) {
          if (window.blocked_users)
            return _.filter(d, function (u) { return !_.includes(window.blocked_users, u.value) })
          else
            return d
        }
      }
    })

    users.initialize()

    $('input.user_typeahead').typeahead([

corejs-typeahead

fast and fully-featured autocomplete library

MIT
Latest version published 11 months ago

Package Health Score

69 / 100
Full package analysis