bootstrap.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. window._ = require('lodash');
  2. window.Popper = require('popper.js').default;
  3. /**
  4. * We'll load jQuery and the Bootstrap jQuery plugin which provides support
  5. * for JavaScript based Bootstrap features such as modals and tabs. This
  6. * code may be modified to fit the specific needs of your application.
  7. */
  8. try {
  9. window.$ = window.jQuery = require('jquery');
  10. require('bootstrap');
  11. window.InfiniteScroll = require('infinite-scroll');
  12. window.filesize = require('filesize');
  13. window.typeahead = require('./lib/typeahead');
  14. window.Bloodhound = require('./lib/bloodhound');
  15. require('./lib/fontawesome-all');
  16. require('./components/localstorage');
  17. require('./components/likebutton');
  18. require('./components/commentform');
  19. require('./components/searchform');
  20. require('./components/bookmarkform');
  21. } catch (e) {}
  22. /**
  23. * We'll load the axios HTTP library which allows us to easily issue requests
  24. * to our Laravel back-end. This library automatically handles sending the
  25. * CSRF token as a header based on the value of the "XSRF" token cookie.
  26. */
  27. window.axios = require('axios');
  28. window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
  29. /**
  30. * Next we will register the CSRF Token as a common header with Axios so that
  31. * all outgoing HTTP requests automatically have it attached. This is just
  32. * a simple convenience so we don't have to attach every token manually.
  33. */
  34. let token = document.head.querySelector('meta[name="csrf-token"]');
  35. if (token) {
  36. window.axios.defaults.headers.common['X-CSRF-TOKEN'] = token.content;
  37. } else {
  38. console.error('CSRF token not found: https://laravel.com/docs/csrf#csrf-x-csrf-token');
  39. }
  40. /**
  41. * Echo exposes an expressive API for subscribing to channels and listening
  42. * for events that are broadcast by Laravel. Echo and event broadcasting
  43. * allows your team to easily build robust real-time web applications.
  44. */
  45. // import Echo from 'laravel-echo'
  46. // window.Pusher = require('pusher-js');
  47. // window.Echo = new Echo({
  48. // broadcaster: 'pusher',
  49. // key: process.env.MIX_PUSHER_APP_KEY,
  50. // cluster: process.env.MIX_PUSHER_APP_CLUSTER,
  51. // encrypted: true
  52. // });