webpack-bootstrap-ui-kit/src/js/app.js

124 lines
3.2 KiB
JavaScript
Raw Normal View History

2020-01-29 10:09:39 +01:00
'use strict';
2019-11-27 06:29:20 +01:00
2021-02-20 07:00:59 +01:00
if (process.env.NODE_ENV === 'development') {
// mocking service worker
const regeneratorRuntime = require('regenerator-runtime');
const { worker } = require('../mocks/browser');
worker.start({
serviceWorker: {
url: 'src/_graphql/mockServiceWorker.js',
options: {
scope: '/',
},
},
});
2021-02-20 07:00:59 +01:00
// caching service worker (set injectClient: false at webpack.config.serve.js)
/*if ('serviceWorker' in navigator) {
const baseHref = (document.getElementsByTagName('base')[0] || {}).href;
const version = (document.querySelector('meta[name="swversion"]') || {})
.content;
if (baseHref) {
navigator.serviceWorker
.register(`${baseHref}app_sw.js?v=${version}`)
.then(() => {
console.log('SW: Registered');
});
}
}*/
}
2021-01-31 12:57:22 +01:00
//import $ from 'jquery';
2019-06-08 17:20:51 +02:00
import '../scss/app.scss';
2021-02-08 01:30:14 +01:00
import { Dropdown } from 'bootstrap';
2021-01-31 21:44:01 +01:00
2021-02-08 01:30:14 +01:00
import Events from './_events';
import MainUI from './_components/_main';
2019-10-20 01:40:40 +02:00
2021-01-31 12:57:22 +01:00
//import 'hammerjs/hammer';
//import 'jquery-hammerjs/jquery.hammer';
2019-10-20 01:40:40 +02:00
// Routie
//import 'pouchdb/dist/pouchdb';
//import './_components/routes/index';
// conflicts with _components/_ui.hover.js (shows dropdown on hover)
//import 'bootstrap/js/dist/dropdown';
2021-01-31 12:57:22 +01:00
/*import './_components/_ui.hover';
2019-10-20 01:40:40 +02:00
import './_components/_ui.carousel';
import './_components/_ui.menu';
2019-06-08 17:20:51 +02:00
import 'bootstrap/js/dist/modal';
import 'bootstrap/js/dist/tooltip';
import 'bootstrap/js/dist/popover';
import 'bootstrap/js/dist/scrollspy';
2021-01-31 12:57:22 +01:00
import 'bootstrap/js/dist/tab';*/
2019-06-08 17:20:51 +02:00
//
// Offcanvas menu
2019-09-07 03:49:08 +02:00
//import 'offcanvas-bootstrap/dist/js/bootstrap.offcanvas';
// Uncomment it to enable meta-lightbox zooming on hover
//import 'jquery-zoom/jquery.zoom';
2019-09-07 03:49:08 +02:00
2019-11-30 09:28:57 +01:00
// FlyoutUI
2021-01-31 12:57:22 +01:00
//import FlyoutUI from './_components/_ui.flyout';
2019-10-20 01:40:40 +02:00
2020-01-29 10:09:39 +01:00
// Sticky sidebar
2021-01-31 12:57:22 +01:00
//import SidebarUI from './_components/_ui.sidebar';
2020-01-29 10:09:39 +01:00
2019-10-20 01:40:40 +02:00
// Toggle bootstrap form fields
//import FormToggleUI from './_components/_ui.form.fields.toggle';
// Bootstrap Date & Time fields
//import FormDatetime from './_components/_ui.form.datetime';
// Stepped forms functionality
//import FormStepped from './_components/_ui.form.stepped';
// Forms validation functionality
//import FormValidate from './_components/_ui.form.validate';
// Store forms data into localStorage
//import FormStorage from './_components/_ui.form.storage';
// client-side images cropping
//import FormCroppie from './_components/_ui.form.croppie';
// Google NoCaptcha fields
//import NoCaptcha from './_components/_ui.nocaptcha';
2019-09-07 03:49:08 +02:00
// youtube video preview image
2021-01-31 12:57:22 +01:00
//import './_components/_ui.video.preview';
2019-09-07 03:49:08 +02:00
2019-10-20 01:40:40 +02:00
// Meta Lightbox
2021-01-31 11:31:35 +01:00
import '@a2nt/meta-lightbox-react/src/js/app';
2019-06-08 17:20:51 +02:00
2019-10-20 01:40:40 +02:00
//import Confirmation from 'bootstrap-confirmation2/dist/bootstrap-confirmation';
//import Table from 'bootstrap-table/dist/bootstrap-table';
// Map UI
//import MapApi from './_components/_ui.map.api';
2021-01-14 19:13:57 +01:00
//import FormSelect2 from './_components/_ui.form.select2';
2021-01-31 12:57:22 +01:00
//import './_main';
//import './_layout';
2019-06-08 17:20:51 +02:00
// Google Analytics
2021-01-31 12:57:22 +01:00
//import './_components/drivers/_google.track.external.links';
2019-06-08 17:20:51 +02:00
function importAll(r) {
2021-02-08 01:30:14 +01:00
return r.keys().map(r);
2019-06-08 17:20:51 +02:00
}
2020-01-29 10:09:39 +01:00
const images = importAll(
2021-02-08 01:30:14 +01:00
require.context('../img/', false, /\.(png|jpe?g|svg)$/),
2020-01-29 10:09:39 +01:00
);
const fontAwesome = importAll(
2021-02-08 01:30:14 +01:00
require.context('font-awesome', false, /\.(otf|eot|svg|ttf|woff|woff2)$/),
2020-01-29 10:09:39 +01:00
);