Init architecture
This commit is contained in:
parent
9849374b96
commit
124344518e
33 changed files with 17552 additions and 27 deletions
22
composer.lock
generated
22
composer.lock
generated
|
|
@ -1038,27 +1038,27 @@
|
|||
},
|
||||
{
|
||||
"name": "kwaadpepper/enum",
|
||||
"version": "2.1.4",
|
||||
"version": "2.1.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Kwaadpepper/enum.git",
|
||||
"reference": "767d8c8d150c29c4f2cb462864ab07df71e92f6d"
|
||||
"reference": "cc695e6a07ee57a1220942581c303842e186b22f"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/Kwaadpepper/enum/zipball/767d8c8d150c29c4f2cb462864ab07df71e92f6d",
|
||||
"reference": "767d8c8d150c29c4f2cb462864ab07df71e92f6d",
|
||||
"url": "https://api.github.com/repos/Kwaadpepper/enum/zipball/cc695e6a07ee57a1220942581c303842e186b22f",
|
||||
"reference": "cc695e6a07ee57a1220942581c303842e186b22f",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.3"
|
||||
},
|
||||
"require-dev": {
|
||||
"orchestra/testbench": "^5",
|
||||
"phpunit/php-code-coverage": "^9.2",
|
||||
"phpunit/phpunit": "~9.0",
|
||||
"slevomat/coding-standard": "^7.0",
|
||||
"squizlabs/php_codesniffer": "^3.5"
|
||||
"orchestra/testbench": "^6",
|
||||
"phpunit/php-code-coverage": "^9",
|
||||
"phpunit/phpunit": "~9",
|
||||
"slevomat/coding-standard": "^7",
|
||||
"squizlabs/php_codesniffer": "^3"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
|
|
@ -1092,9 +1092,9 @@
|
|||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/Kwaadpepper/enum/issues",
|
||||
"source": "https://github.com/Kwaadpepper/enum/tree/2.1.4"
|
||||
"source": "https://github.com/Kwaadpepper/enum/tree/2.1.3"
|
||||
},
|
||||
"time": "2022-07-28T14:19:44+00:00"
|
||||
"time": "2022-07-28T15:18:54+00:00"
|
||||
},
|
||||
{
|
||||
"name": "kwaadpepper/exception-handler",
|
||||
|
|
|
|||
16642
package-lock.json
generated
Normal file
16642
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
10
package.json
10
package.json
|
|
@ -11,8 +11,16 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"axios": "^0.21",
|
||||
"bootstrap": "^5.2.0",
|
||||
"clean-webpack-plugin": "^4.0.0",
|
||||
"laravel-mix": "^6.0.6",
|
||||
"laravel-mix-polyfill": "^3.0.1",
|
||||
"lodash": "^4.17.19",
|
||||
"postcss": "^8.1.14"
|
||||
"postcss": "^8.1.14",
|
||||
"resolve-url-loader": "^5.0.0",
|
||||
"sass": "^1.54.8",
|
||||
"sass-loader": "^12.6.0",
|
||||
"vue": "^3.2.38",
|
||||
"vue-loader": "^16.8.3"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
10
public/mix-manifest.json
Normal file
10
public/mix-manifest.json
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"/js/preload-back.js": "/js/preload-back.js?id=c608df5583e0193785c2f8fabdc4c33f",
|
||||
"/js/preload-front.js": "/js/preload-front.js?id=513f40d3fa77933f80bd551b2a5c57ab",
|
||||
"/css/preload-main.css": "/css/preload-main.css?id=ea5fccf893b13807401d5c307c2456b4",
|
||||
"/assets/fonts/Poppins/Poppins-Medium.ttf": "/assets/fonts/Poppins/Poppins-Medium.ttf?id=e791de8a3953f3c23d3198d2d7bd923d",
|
||||
"/assets/fonts/Poppins/Poppins-Regular.ttf": "/assets/fonts/Poppins/Poppins-Regular.ttf?id=bfa0e348943e04fd8c6202702b1b3e25",
|
||||
"/assets/fonts/Poppins/Poppins-SemiBold.ttf": "/assets/fonts/Poppins/Poppins-SemiBold.ttf?id=fd8fca9940f16adfc586b42e1c9b6f6f",
|
||||
"/assets/fonts/Poppins/Poppins-SemiBoldItalic.ttf": "/assets/fonts/Poppins/Poppins-SemiBoldItalic.ttf?id=9466426100d98b856f242f056ff7aab3",
|
||||
"/assets/fonts/Poppins-Regular.ttf": "/assets/fonts/Poppins-Regular.ttf?id=bfa0e348943e04fd8c6202702b1b3e25"
|
||||
}
|
||||
BIN
resources/assets/fonts/Poppins/Poppins-Medium.ttf
Normal file
BIN
resources/assets/fonts/Poppins/Poppins-Medium.ttf
Normal file
Binary file not shown.
BIN
resources/assets/fonts/Poppins/Poppins-Regular.ttf
Normal file
BIN
resources/assets/fonts/Poppins/Poppins-Regular.ttf
Normal file
Binary file not shown.
BIN
resources/assets/fonts/Poppins/Poppins-SemiBold.ttf
Normal file
BIN
resources/assets/fonts/Poppins/Poppins-SemiBold.ttf
Normal file
Binary file not shown.
BIN
resources/assets/fonts/Poppins/Poppins-SemiBoldItalic.ttf
Normal file
BIN
resources/assets/fonts/Poppins/Poppins-SemiBoldItalic.ttf
Normal file
Binary file not shown.
|
|
@ -1 +0,0 @@
|
|||
require('./bootstrap');
|
||||
1
resources/js/back.js
Normal file
1
resources/js/back.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
require('./libs/bootstrap');
|
||||
227
resources/js/components/carousel.js
Normal file
227
resources/js/components/carousel.js
Normal file
|
|
@ -0,0 +1,227 @@
|
|||
/*js doc*/
|
||||
|
||||
export class Carrousel {
|
||||
/**
|
||||
*
|
||||
* This callback type is called 'requestCallback' and is displayed as a global symbol
|
||||
*
|
||||
* @callback moveCallback
|
||||
* @param {number} index
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {HTMLElement} element
|
||||
* @param {Object} options
|
||||
* @param {Object} [options.slidesToScroll=1] Nombre d'éléments à faire défiler
|
||||
* @param {Object} [options.slidesVisible=1] Nombre d'éléments visible dans un slide
|
||||
* @param {boolean} [options.loop=false] Doit-on boucler en fin de carrousel
|
||||
* @param {boolean} [options.pagination=false]
|
||||
* @param {boolean} [options.navigation=true]
|
||||
*/
|
||||
|
||||
constructor(element, options = {}) {
|
||||
this.element = element
|
||||
this.options = Object.assign({}, {
|
||||
slidesToScroll: 1,
|
||||
slidesVisible: 1,
|
||||
loop: true,
|
||||
play: true,
|
||||
interval: 3000,
|
||||
pagination: false,
|
||||
navigation: true
|
||||
}, options)
|
||||
let children = [].slice.call(element.children)
|
||||
this.isMobile = false
|
||||
this.currentItem = 0
|
||||
this.moveCallbacks = []
|
||||
|
||||
//Modification du DOM
|
||||
this.root = this.createDivWithClass('carrousel')
|
||||
this.container = this.createDivWithClass('carrousel__container')
|
||||
this.root.setAttribute('tabindex', '0')
|
||||
this.root.appendChild(this.container)
|
||||
this.element.appendChild(this.root)
|
||||
this.items = children.map((child) => {
|
||||
let item = this.createDivWithClass('carrousel__item')
|
||||
|
||||
item.appendChild(child)
|
||||
this.container.appendChild(item)
|
||||
return item
|
||||
})
|
||||
this.setStyle()
|
||||
if (this.options.navigation) {
|
||||
this.createNavigation()
|
||||
}
|
||||
if (this.options.pagination) {
|
||||
this.createPagination()
|
||||
}
|
||||
|
||||
//Evenements
|
||||
this.moveCallbacks.forEach(cb => cb(0))
|
||||
this.onWindowResize()
|
||||
window.addEventListener('resize', this.onWindowResize.bind(this))
|
||||
this.root.addEventListener('keyup', e => {
|
||||
if (e.key === 'ArrowRight' || e.key === 'Right') {
|
||||
this.next()
|
||||
} else if (e.key === 'ArrowLeft' || e.key === 'Left') {
|
||||
this.prev()
|
||||
}
|
||||
})
|
||||
|
||||
// Interval
|
||||
if (this.options.play) {
|
||||
let playpause = setInterval(() => this.next(), this.options.interval);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Applique les bonnes dimensions aux éléments du carrousel
|
||||
*/
|
||||
setStyle() {
|
||||
let ratio = this.items.length / this.slidesVisible
|
||||
this.container.style.width = (ratio * 100) + "%"
|
||||
this.items.forEach(item => item.style.width = ((100 / this.slidesVisible) / ratio) + "%")
|
||||
}
|
||||
|
||||
/**
|
||||
* Créer les flêches de navigation dans le DOM
|
||||
*/
|
||||
createNavigation() {
|
||||
let nextButton = this.createDivWithClass('carrousel__next')
|
||||
let prevButton = this.createDivWithClass('carrousel__prev')
|
||||
this.root.appendChild(nextButton)
|
||||
this.root.appendChild(prevButton)
|
||||
nextButton.addEventListener('click', this.next.bind(this))
|
||||
prevButton.addEventListener('click', this.prev.bind(this))
|
||||
|
||||
if (this.options.loop === true) {
|
||||
return
|
||||
}
|
||||
this.onMove(index => {
|
||||
if (index === 0) {
|
||||
prevButton.classList.add('carrousel__prev--hidden')
|
||||
} else {
|
||||
prevButton.classList.remove('carrousel__prev--hidden')
|
||||
}
|
||||
if (this.items[this.currentItem + this.slidesVisible] === undefined) {
|
||||
nextButton.classList.add('carrousel__next--hidden')
|
||||
} else {
|
||||
nextButton.classList.remove('carrousel__next--hidden')
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Créer la pagination dans le DOM
|
||||
*/
|
||||
createPagination() {
|
||||
let pagination = this.createDivWithClass('carrousel__pagination')
|
||||
let buttons = []
|
||||
this.root.appendChild(pagination)
|
||||
for (let i = 0; i < this.items.length; i = i + this.options.slidesToScroll) {
|
||||
let button = this.createDivWithClass('carrousel__pagination__button')
|
||||
button.addEventListener('click', () => this.gotoItem(i))
|
||||
pagination.appendChild(button)
|
||||
buttons.push(button)
|
||||
}
|
||||
this.onMove(index => {
|
||||
let activeButton = buttons[Math.floor(index / this.options.slidesToScroll)]
|
||||
if (activeButton) {
|
||||
buttons.forEach(button => button.classList.remove('carrousel__pagination__button--active'))
|
||||
activeButton.classList.add('carrousel__pagination__button--active')
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
next() {
|
||||
this.gotoItem(this.currentItem + this.slidesToScroll)
|
||||
}
|
||||
|
||||
prev() {
|
||||
this.gotoItem(this.currentItem - this.slidesToScroll)
|
||||
}
|
||||
|
||||
/**
|
||||
* Déplace le carrousel vers l'élément ciblé
|
||||
* @param {number} index
|
||||
*/
|
||||
gotoItem(index) {
|
||||
if (index < 0) {
|
||||
if (this.options.loop) {
|
||||
index = this.items.length - this.slidesVisible
|
||||
} else {
|
||||
return
|
||||
}
|
||||
} else if (index >= this.items.length || (this.items[this.currentItem + this.slidesVisible] === undefined && index > this.currentItem)) {
|
||||
if (this.options.loop) {
|
||||
index = 0
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
let translateX = index * -100 / this.items.length
|
||||
this.container.style.transform = 'translate3d(' + translateX + '%, 0, 0)'
|
||||
this.currentItem = index
|
||||
this.moveCallbacks.forEach(cb => cb(index))
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {moveCallback} cb
|
||||
*/
|
||||
onMove(cb) {
|
||||
this.moveCallbacks.push(cb)
|
||||
}
|
||||
|
||||
onWindowResize() {
|
||||
let mobile = window.innerWidth < 800
|
||||
if (mobile !== this.isMobile) {
|
||||
this.isMobile = mobile
|
||||
this.setStyle()
|
||||
this.moveCallbacks.forEach(cb => cb(this.currentItem))
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {string} className
|
||||
* @returns {HTMLElement}
|
||||
*/
|
||||
createDivWithClass(className) {
|
||||
let div = document.createElement('div')
|
||||
div.setAttribute('class', className)
|
||||
return div
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {number}
|
||||
*/
|
||||
get slidesToScroll() {
|
||||
return this.isMobile ? 1 : this.options.slidesToScroll
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {number}
|
||||
*/
|
||||
get slidesVisible() {
|
||||
return this.isMobile ? 1 : this.options.slidesVisible
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
|
||||
if (document.querySelector('#carrousel1')) {
|
||||
new Carrousel(document.querySelector('#carrousel1'), {
|
||||
pagination: true,
|
||||
navigation: false,
|
||||
})
|
||||
}
|
||||
|
||||
if (document.querySelector('#carrousel2')) {
|
||||
new Carrousel(document.querySelector('#carrousel2'), {})
|
||||
}
|
||||
|
||||
})
|
||||
5
resources/js/front.js
Normal file
5
resources/js/front.js
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
import { LdcwebCn } from "./libs/ldcweb-cookies";
|
||||
window.LdcwebCn = LdcwebCn;
|
||||
|
||||
import { Carrousel } from "./components/carousel"
|
||||
window.Carrousel = Carrousel;
|
||||
401
resources/js/libs/ldcweb-cookies.js
Normal file
401
resources/js/libs/ldcweb-cookies.js
Normal file
|
|
@ -0,0 +1,401 @@
|
|||
/*
|
||||
LDC Service Web Cookies
|
||||
Version 2.0.1
|
||||
*/
|
||||
|
||||
export class LdcwebCn {
|
||||
constructor(config) {
|
||||
this.config = config;
|
||||
this.cookieContainer = document.getElementById("ldcweb-cn");
|
||||
this.bannerContainer = document.querySelector(".ldcweb-cn-banner");
|
||||
this.bannerBtn = document.querySelector(".ldcweb-banner-btnDetails-p");
|
||||
this.ldcwebBtn = document.querySelector(".ldcweb-btn");
|
||||
this.ldcwebBannerParaP = document.querySelector(".ldcweb-banner-para-p");
|
||||
this.ldcwebBannerContent = document.querySelector(".ldcweb-banner-content");
|
||||
this.ldcwebBannerDetails = document.querySelector(".ldcweb-banner-details");
|
||||
this.ldcwebBannerBtnDetails = document.querySelector(
|
||||
".ldcweb-banner-btnDetails"
|
||||
);
|
||||
this.modalContainer = document.getElementById("ldcweb-cn-modal");
|
||||
this.acceptAllBtnBanner = document.getElementById(
|
||||
"ldcweb-cn-accept-banner"
|
||||
);
|
||||
this.denyAllBtnBanner = document.getElementById("ldcweb-cn-deny-banner");
|
||||
this.personalizeBtn = document.getElementsByClassName(
|
||||
"ldcweb-cn-personalize"
|
||||
);
|
||||
this.personalizeBtnBanner = document.querySelector(
|
||||
".ldcweb-cn-personalize"
|
||||
);
|
||||
this.changeBtn = document.getElementsByClassName("ldcweb-cn-change");
|
||||
this.cookiesList = document.getElementById("ldcweb-cn-list");
|
||||
this.cookieLink = document.querySelector(".ldcweb-cn-cookie-link");
|
||||
this.modalDetails = document.querySelector(".modal-details");
|
||||
this.template = document.getElementById("template").cloneNode(true);
|
||||
this.modalBtnBoolean = 0;
|
||||
this.bannerBtnTextBoolean = 0;
|
||||
document.getElementById("template").remove();
|
||||
|
||||
let cookies = this.getLDCWebCookie("ldcwebcn-init");
|
||||
if (cookies === undefined) {
|
||||
let newCookie = [];
|
||||
|
||||
for (const [key] of Object.entries(this.config)) {
|
||||
newCookie.push(key + "=wait");
|
||||
}
|
||||
|
||||
this.bannerContainer.classList.add("ldcweb-cn-banner-open");
|
||||
|
||||
this.saveLDCWebCookie(newCookie);
|
||||
} else {
|
||||
let test = cookies.split(",");
|
||||
test.forEach((elm) => {
|
||||
let test = elm.split("=");
|
||||
if (test[1] === "wait") {
|
||||
this.bannerContainer.classList.add("ldcweb-cn-banner-open");
|
||||
}
|
||||
});
|
||||
}
|
||||
let accept = function (e) {
|
||||
e.preventDefault();
|
||||
for (const [key, value] of Object.entries(this.config)) {
|
||||
this.addCookie(key, value);
|
||||
}
|
||||
for (let acceptLabel of this.cookieContainer.querySelectorAll(
|
||||
".accept > label"
|
||||
)) {
|
||||
acceptLabel.classList.add("active");
|
||||
}
|
||||
for (let denyLabel of this.cookieContainer.querySelectorAll(
|
||||
".deny > label"
|
||||
)) {
|
||||
denyLabel.classList.remove("active");
|
||||
}
|
||||
this.updateAllCookiesButtonsActiveStatus();
|
||||
this.bannerContainer.classList.remove("ldcweb-cn-banner-open");
|
||||
}.bind(this);
|
||||
this.acceptAllBtnBanner.addEventListener("click", accept);
|
||||
|
||||
let deny = function (e) {
|
||||
e.preventDefault();
|
||||
for (const [key, value] of Object.entries(this.config)) {
|
||||
this.removeCookie(key, value);
|
||||
}
|
||||
for (let acceptLabel of this.cookieContainer.querySelectorAll(
|
||||
".accept > label"
|
||||
)) {
|
||||
acceptLabel.classList.remove("active");
|
||||
}
|
||||
for (let denyLabel of this.cookieContainer.querySelectorAll(
|
||||
".deny > label"
|
||||
)) {
|
||||
denyLabel.classList.add("active");
|
||||
}
|
||||
this.updateAllCookiesButtonsActiveStatus();
|
||||
this.bannerContainer.classList.remove("ldcweb-cn-banner-open");
|
||||
}.bind(this);
|
||||
this.denyAllBtnBanner.addEventListener("click", deny);
|
||||
|
||||
let openLdcwebCookies = function (e) {
|
||||
e.preventDefault();
|
||||
this.openModal();
|
||||
}.bind(this);
|
||||
this.cookieLink.addEventListener("click", openLdcwebCookies);
|
||||
|
||||
let hideModal = function (e) {
|
||||
e.preventDefault();
|
||||
this.ldcwebBannerContent.classList.toggle("visibility");
|
||||
this.ldcwebBannerDetails.classList.toggle("visibility");
|
||||
this.ldcwebBannerBtnDetails.classList.toggle("visibility");
|
||||
this.modalContainer.classList.toggle("visibility");
|
||||
this.setCookieList();
|
||||
}.bind(this);
|
||||
this.personalizeBtnBanner.addEventListener("click", hideModal);
|
||||
|
||||
let changeBtnPersonalize = function (e) {
|
||||
e.preventDefault();
|
||||
this.modalDetails.scrollTop = 0;
|
||||
if (this.modalBtnBoolean === 0) {
|
||||
this.personalizeBtnBanner.innerHTML =
|
||||
this.personalizeBtnBanner.getAttribute("data-open-modal");
|
||||
this.modalBtnBoolean = 1;
|
||||
} else {
|
||||
this.personalizeBtnBanner.innerHTML =
|
||||
this.personalizeBtnBanner.getAttribute("data-close-modal");
|
||||
this.modalBtnBoolean = 0;
|
||||
}
|
||||
}.bind(this);
|
||||
this.personalizeBtnBanner.addEventListener("click", changeBtnPersonalize);
|
||||
|
||||
this.setListenerOnChange();
|
||||
|
||||
let cookie = this.getLDCWebCookie("ldcwebcn-init");
|
||||
let test = cookie.split(",");
|
||||
test.forEach((elm) => {
|
||||
let test = elm.split("=");
|
||||
if (test[1] === "true") {
|
||||
this.config[test[0]].script();
|
||||
} else {
|
||||
if (this.config[test[0]].fallback) {
|
||||
this.config[test[0]].fallback();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
this.updateAllCookiesButtonsActiveStatus();
|
||||
|
||||
let changePara = function (e) {
|
||||
e.preventDefault();
|
||||
this.ldcwebBannerDetails.classList.toggle("ldcweb-banner-details-open");
|
||||
this.bannerBtn.classList.toggle("ldcweb-banner-btnDetails-p-open");
|
||||
if (this.bannerBtnTextBoolean === 0) {
|
||||
e.target.innerHTML = e.target.getAttribute("data-open");
|
||||
this.ldcwebBannerParaP.innerHTML =
|
||||
this.ldcwebBannerParaP.getAttribute("data-open");
|
||||
this.ldcwebBannerDetails.style.height =
|
||||
this.ldcwebBannerDetails.children[0].clientHeight + "px";
|
||||
this.bannerBtnTextBoolean = 1;
|
||||
} else {
|
||||
e.target.innerHTML = e.target.getAttribute("data-close");
|
||||
this.ldcwebBannerParaP.innerHTML =
|
||||
this.ldcwebBannerParaP.getAttribute("data-close");
|
||||
this.ldcwebBannerDetails.style.height = "0px";
|
||||
this.bannerBtnTextBoolean = 0;
|
||||
}
|
||||
}.bind(this);
|
||||
this.bannerBtn.addEventListener("click", changePara);
|
||||
|
||||
let resetVue = function (e) {
|
||||
e.preventDefault();
|
||||
this.bannerContainer.classList.toggle("ldcweb-cn-banner-open");
|
||||
if (this.bannerContainer.classList.contains("ldcweb-cn-banner-open")) {
|
||||
this.ldcwebBannerContent.classList.remove("visibility"),
|
||||
this.ldcwebBannerDetails.classList.remove("visibility"),
|
||||
this.ldcwebBannerBtnDetails.classList.remove("visibility"),
|
||||
this.modalContainer.classList.add("visibility");
|
||||
this.personalizeBtnBanner.innerHTML =
|
||||
this.personalizeBtnBanner.getAttribute("data-close-modal");
|
||||
this.modalBtnBoolean = 0;
|
||||
}
|
||||
}.bind(this);
|
||||
this.ldcwebBtn.addEventListener("click", resetVue);
|
||||
}
|
||||
|
||||
setCookieList() {
|
||||
this.cookiesList.innerHTML = "";
|
||||
let cookiesSite = this.getLDCWebCookie("ldcwebcn-init");
|
||||
let acceptInputEvent = function (acceptLabel, denyLabel, key, value) {
|
||||
return function () {
|
||||
acceptLabel.classList.add("active");
|
||||
denyLabel.classList.remove("active");
|
||||
this.updateAllCookiesButtonsActiveStatus();
|
||||
this.addCookie(key, value);
|
||||
}.bind(this, [acceptLabel, denyLabel, key, value]);
|
||||
};
|
||||
let denyInputEvent = function (acceptLabel, denyLabel, key, value) {
|
||||
return function () {
|
||||
acceptLabel.classList.remove("active");
|
||||
denyLabel.classList.add("active");
|
||||
this.updateAllCookiesButtonsActiveStatus();
|
||||
this.removeCookie(key, value);
|
||||
}.bind(this, [acceptLabel, denyLabel, key, value]);
|
||||
};
|
||||
|
||||
for (const [key, value] of Object.entries(this.config)) {
|
||||
let cookie = document.createElement("li");
|
||||
cookie.append(this.template.children.item(0).cloneNode(true));
|
||||
let name = cookie.querySelector("span.ldcweb-cn-name");
|
||||
let description = cookie.querySelector("span.ldcweb-cn-description");
|
||||
let link = cookie.querySelector("a.ldcweb-cn-link");
|
||||
let acceptInput = cookie.querySelector(".accept > input");
|
||||
let denyInput = cookie.querySelector(".deny > input");
|
||||
let acceptLabel = cookie.querySelector(".accept > label");
|
||||
let denyLabel = cookie.querySelector(".deny > label");
|
||||
|
||||
name.textContent = value.name;
|
||||
description.textContent = value.description;
|
||||
link.textContent = value.labelLink;
|
||||
link.setAttribute("href", value.link);
|
||||
acceptInput.id = key + "1";
|
||||
acceptInput.name = key;
|
||||
acceptInput.dataset.name = key;
|
||||
acceptLabel.htmlFor = key + "1";
|
||||
denyInput.id = key + "2";
|
||||
denyInput.name = key;
|
||||
denyInput.dataset.name = key;
|
||||
denyLabel.htmlFor = key + "2";
|
||||
|
||||
acceptInput.addEventListener(
|
||||
"click",
|
||||
acceptInputEvent.apply(this, [acceptLabel, denyLabel, key, value])
|
||||
);
|
||||
denyInput.addEventListener(
|
||||
"click",
|
||||
denyInputEvent.apply(this, [acceptLabel, denyLabel, key, value])
|
||||
);
|
||||
|
||||
this.cookiesList.append(cookie);
|
||||
|
||||
let cookiesArray = cookiesSite.split(",");
|
||||
for (const cookieEl of cookiesArray) {
|
||||
let name = cookieEl.slice(0, cookieEl.indexOf("="));
|
||||
let status = cookieEl.slice(cookieEl.indexOf("=") + 1);
|
||||
if (name === key) {
|
||||
acceptLabel.classList.remove("active");
|
||||
denyLabel.classList.remove("active");
|
||||
switch (status) {
|
||||
case "true":
|
||||
acceptLabel.classList.add("active");
|
||||
break;
|
||||
case "false":
|
||||
denyLabel.classList.add("active");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
this.setListenerOnChange();
|
||||
}
|
||||
|
||||
updateAllCookiesButtonsActiveStatus() {
|
||||
let acceptsButtons =
|
||||
this.cookieContainer.querySelectorAll("div.accept > label");
|
||||
let deniesButtons =
|
||||
this.cookieContainer.querySelectorAll("div.deny > label");
|
||||
let activeAcceptsButtons = this.cookieContainer.querySelectorAll(
|
||||
"div.accept > label.active"
|
||||
);
|
||||
let activeDeniesButtons = this.cookieContainer.querySelectorAll(
|
||||
"div.deny > label.active"
|
||||
);
|
||||
|
||||
if (
|
||||
acceptsButtons.length &&
|
||||
acceptsButtons.length === activeAcceptsButtons.length
|
||||
) {
|
||||
}
|
||||
if (
|
||||
deniesButtons.length &&
|
||||
deniesButtons.length === activeDeniesButtons.length
|
||||
) {
|
||||
}
|
||||
}
|
||||
|
||||
addCookie(key, value) {
|
||||
if (value.script) {
|
||||
value.script();
|
||||
}
|
||||
this.changeStatus(key, "true");
|
||||
}
|
||||
|
||||
removeCookie(key, value) {
|
||||
for (let cookieName of value.cookies) {
|
||||
this.deleteBrowserCookie(cookieName, "/", "." + location.host);
|
||||
}
|
||||
if (document.getElementById(key)) {
|
||||
document.getElementById(key).remove();
|
||||
}
|
||||
if (value.fallback) {
|
||||
value.fallback();
|
||||
}
|
||||
this.changeStatus(key, "false");
|
||||
}
|
||||
setListenerOnChange() {
|
||||
this.changeBtn = document.getElementsByClassName("ldcweb-cn-change");
|
||||
let itemClick = function (item) {
|
||||
return function () {
|
||||
this.changeStatus(
|
||||
item.getAttribute("data-name"),
|
||||
item.getAttribute("data-status")
|
||||
);
|
||||
}.bind(this);
|
||||
};
|
||||
for (let item of this.changeBtn) {
|
||||
this.addEvent(item, "click", itemClick.bind(this, [item]));
|
||||
}
|
||||
}
|
||||
|
||||
changeStatus(name, status) {
|
||||
let newCookie = [];
|
||||
|
||||
let cookie = this.getLDCWebCookie("ldcwebcn-init");
|
||||
let test = cookie.split(",");
|
||||
test.forEach((elm) => {
|
||||
let test = elm.split("=");
|
||||
if (test[0] === name) {
|
||||
newCookie.push(name + "=" + status);
|
||||
if (status === "false") {
|
||||
this.config[test[0]].cookies.forEach((elm) => {
|
||||
let cookies = this.getLDCWebCookie(elm);
|
||||
if (cookies !== undefined) {
|
||||
document.cookie =
|
||||
elm +
|
||||
"=; expires=Thu, 01 Jan 1970 00:00:00 UTC; domain=" +
|
||||
document.domain +
|
||||
"; path=/";
|
||||
document.cookie =
|
||||
elm +
|
||||
"=; expires=Thu, 01 Jan 1970 00:00:00 UTC; domain=." +
|
||||
document.domain +
|
||||
"; path=/";
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
newCookie.push(elm);
|
||||
}
|
||||
});
|
||||
|
||||
this.saveLDCWebCookie(newCookie);
|
||||
}
|
||||
|
||||
deleteBrowserCookie(name, path, domain) {
|
||||
if (this.getLDCWebCookie(name)) {
|
||||
document.cookie =
|
||||
name +
|
||||
"=" +
|
||||
(path ? ";path=" + path : "") +
|
||||
(domain ? ";domain=" + domain : "") +
|
||||
";expires=Thu, 01 Jan 1970 00:00:01 GMT";
|
||||
}
|
||||
}
|
||||
|
||||
getLDCWebCookie(name) {
|
||||
let matches = document.cookie.match(
|
||||
new RegExp(
|
||||
"(?:^|; )" + name.replace(/([.$?*|{}()[\]\\/+^])/g, "\\$1") + "=([^;]*)"
|
||||
)
|
||||
);
|
||||
return matches ? decodeURIComponent(matches[1]) : undefined;
|
||||
}
|
||||
|
||||
addEvent(element, evnt, funct) {
|
||||
if (element.attachEvent) return element.attachEvent("on" + evnt, funct);
|
||||
else return element.addEventListener(evnt, funct, false);
|
||||
}
|
||||
|
||||
saveLDCWebCookie(content) {
|
||||
let date = new Date();
|
||||
let newDate = new Date(date.setMonth(date.getMonth() + 13));
|
||||
document.cookie =
|
||||
"ldcwebcn-init=" +
|
||||
content +
|
||||
"; expires=" +
|
||||
newDate.toUTCString() +
|
||||
"; path=/;";
|
||||
}
|
||||
|
||||
openModal() {
|
||||
this.bannerContainer.classList.add("ldcweb-cn-banner-open");
|
||||
this.ldcwebBannerContent.classList.add("visibility");
|
||||
this.ldcwebBannerDetails.classList.add("visibility");
|
||||
this.ldcwebBannerBtnDetails.classList.add("visibility");
|
||||
this.modalContainer.classList.remove("visibility");
|
||||
this.personalizeBtnBanner.innerHTML =
|
||||
this.personalizeBtnBanner.getAttribute("data-open-modal");
|
||||
this.modalBtnBoolean = 1;
|
||||
this.modalDetails.scrollTop = 0;
|
||||
this.setCookieList();
|
||||
this.updateAllCookiesButtonsActiveStatus();
|
||||
}
|
||||
}
|
||||
9
resources/sass/base/_fonts.scss
Normal file
9
resources/sass/base/_fonts.scss
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
$font-path: "~@/fonts";
|
||||
//CreamyScript Regular
|
||||
@font-face {
|
||||
font-family: "Poppins";
|
||||
src: url("#{$font-path}/Poppins/Poppins-Regular.ttf") format("truetype");
|
||||
font-style: 400;
|
||||
font-weight: normal;
|
||||
font-display: swap;
|
||||
}
|
||||
129
resources/sass/base/_reset.scss
Normal file
129
resources/sass/base/_reset.scss
Normal file
|
|
@ -0,0 +1,129 @@
|
|||
/* http://meyerweb.com/eric/tools/css/reset/
|
||||
v2.0 | 20110126
|
||||
License: none (public domain)
|
||||
*/
|
||||
|
||||
html,
|
||||
body,
|
||||
div,
|
||||
span,
|
||||
applet,
|
||||
object,
|
||||
iframe,
|
||||
h1,
|
||||
h2,
|
||||
h3,
|
||||
h4,
|
||||
h5,
|
||||
h6,
|
||||
p,
|
||||
blockquote,
|
||||
pre,
|
||||
a,
|
||||
abbr,
|
||||
acronym,
|
||||
address,
|
||||
big,
|
||||
cite,
|
||||
code,
|
||||
del,
|
||||
dfn,
|
||||
em,
|
||||
img,
|
||||
ins,
|
||||
kbd,
|
||||
q,
|
||||
s,
|
||||
samp,
|
||||
small,
|
||||
strike,
|
||||
strong,
|
||||
sub,
|
||||
sup,
|
||||
tt,
|
||||
var,
|
||||
b,
|
||||
u,
|
||||
i,
|
||||
center,
|
||||
dl,
|
||||
dt,
|
||||
dd,
|
||||
ol,
|
||||
ul,
|
||||
li,
|
||||
fieldset,
|
||||
form,
|
||||
label,
|
||||
legend,
|
||||
table,
|
||||
caption,
|
||||
tbody,
|
||||
tfoot,
|
||||
thead,
|
||||
tr,
|
||||
th,
|
||||
td,
|
||||
article,
|
||||
aside,
|
||||
canvas,
|
||||
details,
|
||||
embed,
|
||||
figure,
|
||||
figcaption,
|
||||
footer,
|
||||
header,
|
||||
hgroup,
|
||||
menu,
|
||||
nav,
|
||||
output,
|
||||
ruby,
|
||||
section,
|
||||
summary,
|
||||
time,
|
||||
mark,
|
||||
audio,
|
||||
video {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
font-size: 100%;
|
||||
font: inherit;
|
||||
vertical-align: baseline;
|
||||
}
|
||||
/* HTML5 display-role reset for older browsers */
|
||||
article,
|
||||
aside,
|
||||
details,
|
||||
figcaption,
|
||||
figure,
|
||||
footer,
|
||||
header,
|
||||
hgroup,
|
||||
menu,
|
||||
nav,
|
||||
section {
|
||||
display: block;
|
||||
}
|
||||
body {
|
||||
line-height: 1;
|
||||
}
|
||||
ol,
|
||||
ul {
|
||||
list-style: none;
|
||||
}
|
||||
blockquote,
|
||||
q {
|
||||
quotes: none;
|
||||
}
|
||||
blockquote:before,
|
||||
blockquote:after,
|
||||
q:before,
|
||||
q:after {
|
||||
content: "";
|
||||
content: none;
|
||||
}
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
border-spacing: 0;
|
||||
}
|
||||
0
resources/sass/components/_buttons.scss
Normal file
0
resources/sass/components/_buttons.scss
Normal file
0
resources/sass/components/_carousel.scss
Normal file
0
resources/sass/components/_carousel.scss
Normal file
0
resources/sass/components/_dropdown.scss
Normal file
0
resources/sass/components/_dropdown.scss
Normal file
0
resources/sass/libs-extensions/_bootstrap.scss
Normal file
0
resources/sass/libs-extensions/_bootstrap.scss
Normal file
29
resources/sass/libs/_bootstrap.scss
Normal file
29
resources/sass/libs/_bootstrap.scss
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
// 1. Include functions first (so you can manipulate colors, SVGs, calc, etc).
|
||||
@import "~bootstrap/scss/functions";
|
||||
|
||||
// 2. Include remainder of required Bootstrap stylesheets.
|
||||
@import "~bootstrap/scss/variables";
|
||||
|
||||
// 3. Include remainder of required parts.
|
||||
@import "~bootstrap/scss/maps";
|
||||
@import "~bootstrap/scss/mixins";
|
||||
@import "~bootstrap/scss/root";
|
||||
|
||||
// 4. Optionally include any other parts as needed.
|
||||
@import "~bootstrap/scss/utilities";
|
||||
@import "~bootstrap/scss/reboot";
|
||||
@import "~bootstrap/scss/type";
|
||||
@import "~bootstrap/scss/images";
|
||||
@import "~bootstrap/scss/containers";
|
||||
@import "~bootstrap/scss/grid";
|
||||
@import "~bootstrap/scss/helpers";
|
||||
@import "~bootstrap/scss/alert";
|
||||
@import "~bootstrap/scss/buttons";
|
||||
@import "~bootstrap/scss/forms";
|
||||
@import "~bootstrap/scss/nav";
|
||||
@import "~bootstrap/scss/navbar";
|
||||
@import "~bootstrap/scss/list-group";
|
||||
@import "~bootstrap/scss/transitions";
|
||||
|
||||
// 5. Optionally include utilities API last to generate classes based on the Sass map in `_utilities.scss`.
|
||||
@import "~bootstrap/scss/utilities/api";
|
||||
25
resources/sass/main.scss
Normal file
25
resources/sass/main.scss
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
@import "utilities/variables.scss";
|
||||
@import "utilities/functions.scss";
|
||||
@import "utilities/mixins.scss";
|
||||
|
||||
@import "libs/bootstrap";
|
||||
|
||||
@import "libs-extensions/bootstrap";
|
||||
|
||||
@import "base/reset";
|
||||
@import "base/fonts";
|
||||
@import "base/base";
|
||||
|
||||
@import "partials/bo/header";
|
||||
@import "partials/bo/footer";
|
||||
|
||||
@import "partials/fo/header";
|
||||
@import "partials/fo/footer";
|
||||
|
||||
@import "components/buttons";
|
||||
@import "components/carousel";
|
||||
@import "components/dropdown";
|
||||
|
||||
@import "pages/bo/home";
|
||||
|
||||
@import "pages/fo/home";
|
||||
0
resources/sass/pages/bo/_home.scss
Normal file
0
resources/sass/pages/bo/_home.scss
Normal file
0
resources/sass/pages/fo/_home.scss
Normal file
0
resources/sass/pages/fo/_home.scss
Normal file
0
resources/sass/partials/bo/_footer.scss
Normal file
0
resources/sass/partials/bo/_footer.scss
Normal file
0
resources/sass/partials/bo/_header.scss
Normal file
0
resources/sass/partials/bo/_header.scss
Normal file
0
resources/sass/partials/fo/_footer.scss
Normal file
0
resources/sass/partials/fo/_footer.scss
Normal file
0
resources/sass/partials/fo/_header.scss
Normal file
0
resources/sass/partials/fo/_header.scss
Normal file
0
resources/sass/utilities/_functions.scss
Normal file
0
resources/sass/utilities/_functions.scss
Normal file
7
resources/sass/utilities/_mixins.scss
Normal file
7
resources/sass/utilities/_mixins.scss
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
/// Helper to size an element
|
||||
/// @param {Length} $width
|
||||
/// @param {Length} $height
|
||||
@mixin size($width, $height: $width) {
|
||||
width: $width;
|
||||
height: $height;
|
||||
}
|
||||
0
resources/sass/utilities/_variables.scss
Normal file
0
resources/sass/utilities/_variables.scss
Normal file
|
|
@ -1,17 +1,50 @@
|
|||
const path = require('path');
|
||||
const mix = require('laravel-mix');
|
||||
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
|
||||
require('laravel-mix-polyfill');
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Mix Asset Management
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Mix provides a clean, fluent API for defining some Webpack build steps
|
||||
| for your Laravel applications. By default, we are compiling the CSS
|
||||
| file for the application as well as bundling up all the JS files.
|
||||
|
|
||||
*/
|
||||
mix.webpackConfig({
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': path.resolve('resources/assets')
|
||||
}
|
||||
},
|
||||
plugins: [
|
||||
new CleanWebpackPlugin({
|
||||
cleanOnceBeforeBuildPatterns: [
|
||||
'css/*',
|
||||
'js/*',
|
||||
'images/*',
|
||||
'fonts/*',
|
||||
'~/assets/*'
|
||||
]
|
||||
})
|
||||
],
|
||||
});
|
||||
|
||||
mix.js('resources/js/app.js', 'public/js')
|
||||
.postCss('resources/css/app.css', 'public/css', [
|
||||
//
|
||||
]);
|
||||
let assetDir = 'assets';
|
||||
mix.options({
|
||||
fileLoaderDirs: {
|
||||
images: `${assetDir}/images`,
|
||||
fonts: `${assetDir}/fonts`
|
||||
},
|
||||
postCss: [
|
||||
require('postcss-discard-comments')({
|
||||
removeAll: true
|
||||
})
|
||||
]
|
||||
});
|
||||
|
||||
mix.js("resources/js/back.js", "public/js/preload-back.js")
|
||||
.js("resources/js/front.js", "public/js/preload-front.js")
|
||||
.sass("resources/sass/main.scss", "public/css/preload-main.css")
|
||||
.vue()
|
||||
.polyfill({
|
||||
enabled: true,
|
||||
useBuiltIns: "usage",
|
||||
targets: { "firefox": "50", "ie": 11 }
|
||||
})
|
||||
.version();
|
||||
|
||||
// Copy Blade Images Assets
|
||||
mix.copyDirectory('resources/assets', 'public/assets');
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue