bootstrap.js 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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('./components/localstorage');
  16. //require('./components/likebutton');
  17. //require('./components/commentform');
  18. require('./components/searchform');
  19. require('./components/bookmarkform');
  20. } catch (e) {}
  21. /**
  22. * We'll load the axios HTTP library which allows us to easily issue requests
  23. * to our Laravel back-end. This library automatically handles sending the
  24. * CSRF token as a header based on the value of the "XSRF" token cookie.
  25. */
  26. window.axios = require('axios');
  27. window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
  28. /**
  29. * Next we will register the CSRF Token as a common header with Axios so that
  30. * all outgoing HTTP requests automatically have it attached. This is just
  31. * a simple convenience so we don't have to attach every token manually.
  32. */
  33. let token = document.head.querySelector('meta[name="csrf-token"]');
  34. if (token) {
  35. window.axios.defaults.headers.common['X-CSRF-TOKEN'] = token.content;
  36. } else {
  37. console.error('CSRF token not found: https://laravel.com/docs/csrf#csrf-x-csrf-token');
  38. }
  39. /**
  40. * Echo exposes an expressive API for subscribing to channels and listening
  41. * for events that are broadcast by Laravel. Echo and event broadcasting
  42. * allows your team to easily build robust real-time web applications.
  43. */
  44. // import Echo from 'laravel-echo'
  45. // window.Pusher = require('pusher-js');
  46. // window.Echo = new Echo({
  47. // broadcaster: 'pusher',
  48. // key: process.env.MIX_PUSHER_APP_KEY,
  49. // cluster: process.env.MIX_PUSHER_APP_CLUSTER,
  50. // encrypted: true
  51. // });