Guest User

Untitled

a guest
Jan 22nd, 2018
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. // Select multiple Twitter users by searching their profile info.
  2.  
  3. // Marco Polo takes the URL from the form's 'action' attribute. This can also
  4. // be set explicitly using the 'url' option, but since this form is solely for
  5. // the search field, it makes sense to use the 'action' attribute.
  6.  
  7. $('#twitterUserSearch').manifest({
  8. // Use each person's Twitter username as the display text.
  9. formatDisplay: function (data, $item, $mpItem) {
  10. return data.screen_name;
  11. },
  12. // Use each person's Twitter user ID as the value to be submitted.
  13. formatValue: function (data, $value, $item, $mpItem) {
  14. return data.user_id;
  15. },
  16. // Options passed on to Marco Polo.
  17. marcoPolo: {
  18. // The API key is sent as extra data with the request. The search value is
  19. // automatically included as 'q', but can be changed through 'param' option.
  20. data: {
  21. apikey: 'api_test-W1cipwpcdu9Cbd9pmm8D4Cjc469',
  22. },
  23. // Since the Infochimps API embeds the array of result objects in the
  24. // 'results' attribute — and doesn't provide a way to limit the number of
  25. // results — we return the first 20 results programmatically.
  26. formatData: function (data) {
  27. return data.results.slice(0, 20);
  28. },
  29. // Use each person's Twitter username as the display text.
  30. formatItem: function (data, $item) {
  31. return data.screen_name;
  32. }
  33. },
  34. // Only allow autocomplete results to be added. No arbitrary values.
  35. required: true
  36. });
Add Comment
Please, Sign In to add comment