139 lines
4.1 KiB
JavaScript
Vendored
139 lines
4.1 KiB
JavaScript
Vendored
window.Vue = require("vue/dist/vue.min.js");
|
|
window.axios = require("axios");
|
|
window.rater = require("rater-js");
|
|
window.ScrollReveal = require("scrollreveal");
|
|
require("smoothscroll-polyfill").polyfill();
|
|
require("fslightbox");
|
|
import { tns } from "tiny-slider/src/tiny-slider.js";
|
|
import { chunk, flatten } from "lodash";
|
|
import Toastify from "toastify-js";
|
|
let detectElementOverflow = require('detect-element-overflow').default;
|
|
window.Toastify = Toastify;
|
|
window.tns = tns;
|
|
window.axios.defaults.headers.common = {
|
|
'Accept': 'application/json, text/plain, */*',
|
|
'X-Requested-With': 'XMLHttpRequest',
|
|
'X-CSRF-TOKEN' : document.querySelector('meta[name="csrf-token"]').getAttribute('content')
|
|
};
|
|
|
|
if (window.vueDebug) {
|
|
Vue.config.devtools = true;
|
|
Vue.config.debug = true;
|
|
}
|
|
|
|
// cookie notice
|
|
import * as CookieNotice from "@ldc-web/cookie-notice";
|
|
window.CookieNotice = CookieNotice.default;
|
|
|
|
// ProgressBar de l'inscription
|
|
require("./front/functions.js");
|
|
__Gaul.detectElementOverflow = detectElementOverflow;
|
|
|
|
const pages = require.context("./pages", true, /\.js$/i);
|
|
const ignorePages = ["history.js", "onepage.js"];
|
|
pages.keys().map(key => {
|
|
key = key.replace("./", "");
|
|
if (ignorePages.includes(key)) {
|
|
return;
|
|
}
|
|
document.addEventListener("DOMContentLoaded", function (event) {
|
|
require(`./pages/${key}`);
|
|
});
|
|
});
|
|
|
|
document.addEventListener('DOMContentLoaded', function () {
|
|
// * Video frames.
|
|
const videoFrameList = document.querySelectorAll(".video-frame");
|
|
for (const videoLink of videoFrameList) {
|
|
if (!videoLink.dataset.type) {
|
|
throw new Error("Missing dataset type");
|
|
}
|
|
if (!videoLink.dataset.frame) {
|
|
throw new Error("Missing dataset frame");
|
|
}
|
|
// @ts-ignore
|
|
window.__CN_VIDEO = window.__CN_VIDEO ?? {};
|
|
|
|
const newIframe = document.createElement("iframe");
|
|
newIframe.frameBorder = "0";
|
|
newIframe.allow = "fullscreen";
|
|
newIframe.width = "1920px";
|
|
newIframe.height = "1080px";
|
|
newIframe.setAttribute("allowfullscreen", "allowfullscreen");
|
|
|
|
// @ts-ignore
|
|
const instance = new FsLightbox();
|
|
instance.props.sources = [newIframe];
|
|
|
|
setTimeout(() => {
|
|
videoLink.addEventListener("click", (e) => {
|
|
e.preventDefault();
|
|
|
|
// * This comes fslightbox lib
|
|
// @ts-ignore
|
|
instance.open();
|
|
setTimeout(function () {
|
|
// @ts-ignore
|
|
newIframe.src = window.__CN_VIDEO[videoLink.dataset.type]
|
|
? String(videoLink.href)
|
|
: String(videoLink.dataset.frame);
|
|
}, 50);
|
|
return false;
|
|
});
|
|
}, 300);
|
|
}
|
|
})
|
|
|
|
let vueOptions = {
|
|
el: "#app"
|
|
};
|
|
|
|
Vue.prototype.$vueEventBus = new Vue()
|
|
|
|
// register modules
|
|
const modules = require.context("./modules", true, /\.js$/i);
|
|
modules.keys().map(key => Vue.mixin(modules(key).default));
|
|
|
|
// Register components
|
|
const vues = require.context("./components/fo", true, /\.vue$/i);
|
|
vues.keys().map(key =>
|
|
Vue.component(
|
|
key
|
|
.split("/")
|
|
.pop()
|
|
.split(".")[0]
|
|
.replace(/\.?([A-Z])/g, function (x, y) {
|
|
return "-" + y.toLowerCase();
|
|
})
|
|
.replace(/^-/, "")
|
|
.replace("-component", ""),
|
|
vues(key).default
|
|
)
|
|
);
|
|
|
|
// Activate router on pages that needs it
|
|
if (document.getElementById("vue-use-router")) {
|
|
//yaah we have app with routes
|
|
window.VueRouter = require("vue-router");
|
|
const routes = require("./routes.js")(Vue);
|
|
const router = new VueRouter({
|
|
routes
|
|
});
|
|
vueOptions["router"] = router;
|
|
}
|
|
|
|
const app = new Vue(vueOptions);
|
|
|
|
Vue.filter('str_limit', function (value, size) {
|
|
if (!value) return '';
|
|
value = value.toString();
|
|
if (value.length <= size) {
|
|
return value;
|
|
}
|
|
return value.substr(0, size) + '...';
|
|
});
|
|
|
|
// Alias for Vuejs
|
|
Vue.prototype.__Gaul = window.__Gaul;
|
|
Vue.prototype.scrollTo = window.scrollTo;
|
|
Vue.prototype.window = window;
|