2022-11-06 11:28:22 +00:00
|
|
|
import _ from 'lodash';
|
2022-11-14 10:37:09 +00:00
|
|
|
import 'bootstrap';
|
|
|
|
|
2023-01-17 17:09:15 +00:00
|
|
|
import './color-mode';
|
|
|
|
|
2022-11-06 11:28:22 +00:00
|
|
|
/**
|
|
|
|
* We'll load the axios HTTP library which allows us to easily issue requests
|
|
|
|
* to our Laravel back-end. This library automatically handles sending the
|
|
|
|
* CSRF token as a header based on the value of the "XSRF" token cookie.
|
|
|
|
*/
|
2022-11-14 10:37:09 +00:00
|
|
|
import axios from 'axios';
|
2022-11-16 05:16:56 +00:00
|
|
|
|
2023-01-17 17:09:15 +00:00
|
|
|
import 'bootstrap/js/dist/popover';
|
|
|
|
import 'bootstrap/js/dist/tooltip';
|
|
|
|
import 'bootstrap-icons/font/bootstrap-icons.css';
|
|
|
|
|
2022-11-16 05:16:56 +00:00
|
|
|
window._ = _;
|
|
|
|
|
2022-11-06 11:28:22 +00:00
|
|
|
window.axios = axios;
|
|
|
|
|
|
|
|
window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Echo exposes an expressive API for subscribing to channels and listening
|
|
|
|
* for events that are broadcast by Laravel. Echo and event broadcasting
|
|
|
|
* allows your team to easily build robust real-time web applications.
|
|
|
|
*/
|
|
|
|
|
|
|
|
// import Echo from 'laravel-echo';
|
|
|
|
|
|
|
|
// import Pusher from 'pusher-js';
|
|
|
|
// window.Pusher = Pusher;
|
|
|
|
|
|
|
|
// window.Echo = new Echo({
|
|
|
|
// broadcaster: 'pusher',
|
|
|
|
// key: import.meta.env.VITE_PUSHER_APP_KEY,
|
2022-11-14 10:37:09 +00:00
|
|
|
// wsHost: import.meta.env.VITE_PUSHER_HOST ?? `ws-${import.meta.env.VITE_PUSHER_APP_CLUSTER}.pusher.com`,
|
2022-11-06 11:28:22 +00:00
|
|
|
// wsPort: import.meta.env.VITE_PUSHER_PORT ?? 80,
|
|
|
|
// wssPort: import.meta.env.VITE_PUSHER_PORT ?? 443,
|
|
|
|
// forceTLS: (import.meta.env.VITE_PUSHER_SCHEME ?? 'https') === 'https',
|
|
|
|
// enabledTransports: ['ws', 'wss'],
|
|
|
|
// });
|
2023-03-06 01:08:46 +00:00
|
|
|
|
|
|
|
// 根据 URL 自动激活导航栏
|
|
|
|
const navLinks = document.querySelectorAll('#nav .nav-link, #nav .dropdown-item');
|
|
|
|
const currentUrl = window.location.href;
|
|
|
|
|
|
|
|
for (let i = 0; i < navLinks.length; i++) {
|
|
|
|
const navLink = navLinks[i];
|
|
|
|
if (currentUrl === navLink.href) {
|
|
|
|
navLink.classList.add('active');
|
|
|
|
}
|
|
|
|
}
|