bootstrap.js 2.2 KB

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