@iris.interactive/handcook 7.1.2-beta → 8.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.gitlab-ci.yml +2 -2
- package/.nvmrc +1 -1
- package/README.md +1 -1
- package/package.json +12 -18
- package/public/index.html +33 -36
- package/public/scripts/components/collapse/collapse.component.js +1 -95
- package/public/scripts/components/collapse/collapse.component.scss +4 -4
- package/public/scripts/components/dropdown/dropdown.component.js +1 -81
- package/public/scripts/components/lazyload/lazyload.component.js +1 -61
- package/public/scripts/components/lightbox/lightbox.component.js +1 -91
- package/public/scripts/components/modal/modal.component.js +1 -83
- package/public/scripts/components/nats/nats.component.js +1 -62
- package/public/scripts/components/overlay/overlay.component.js +1 -88
- package/public/scripts/components/popin/popin.component.js +1 -150
- package/public/scripts/components/scroll-reveal/scroll-reveal.component.js +1 -168
- package/public/scripts/components/scrollspy/scrollspy.component.js +1 -93
- package/public/scripts/components/share/share.component.js +1 -0
- package/public/scripts/components/slider/slider.component.js +1 -317
- package/public/scripts/components/smooth-scroll/smooth-scroll.component.js +1 -59
- package/public/scripts/components/tab/tab.component.js +1 -82
- package/public/scripts/components/toggle/toggle.component.js +1 -51
- package/public/scripts/components/tooltip/tooltip.component.js +1 -119
- package/public/scripts/enumerators/element.enum.js +1 -40
- package/public/scripts/enumerators/share.enum.js +1 -0
- package/public/scripts/enumerators/smooth-scroll.enum.js +1 -19
- package/public/scripts/enumerators/tooltip.enum.js +1 -25
- package/public/scripts/handcook.js +1 -49
- package/public/scripts/support/cookie.support.js +1 -0
- package/public/scripts/support/hash.support.js +1 -0
- package/public/scripts/support/toggle-html.support.js +1 -0
- package/public/scripts/support/wrap-select.support.js +1 -0
- package/public/static/css/989.b832cc44.css +1 -0
- package/public/static/css/index.0ac21166.css +1 -0
- package/public/static/js/989.a4a97e0e.js +23 -0
- package/public/static/js/989.a4a97e0e.js.LICENSE.txt +5 -0
- package/public/static/js/index.67977b9b.js +1 -0
- package/public/styles/scss/_utils.scss +21 -17
- package/public/styles/scss/_variables.scss +0 -5
- package/public/styles/scss/handcook.scss +5 -5
- package/public/styles/scss/mixins/_mixin-font.scss +8 -6
- package/public/styles/scss/mixins/_mixin-layout.scss +17 -14
- package/public/styles/scss/mixins/_mixin-style.scss +70 -63
- package/public/styles/scss/style.css +1 -172
- package/mix-manifest.json +0 -51
- package/public/scripts/components/collapse/collapse.component.min.js +0 -1
- package/public/scripts/components/dropdown/dropdown.component.min.js +0 -1
- package/public/scripts/components/lazyload/lazyload.component.min.js +0 -1
- package/public/scripts/components/lightbox/lightbox.component.min.js +0 -1
- package/public/scripts/components/modal/modal.component.min.js +0 -1
- package/public/scripts/components/scrollspy/scrollspy.component.min.js +0 -1
- package/public/scripts/components/slider/slider.component.min.js +0 -1
- package/public/scripts/components/smooth-scroll/smooth-scroll.component.min.js +0 -1
- package/public/scripts/components/tab/tab.component.min.js +0 -1
- package/public/scripts/components/toggle/toggle.component.min.js +0 -1
- package/public/scripts/components/tooltip/tooltip.component.min.js +0 -1
- package/public/scripts/index.js.LICENSE.txt +0 -1
- package/public/styles/style.css +0 -28
|
@@ -1,83 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* IRIS Interactive
|
|
3
|
-
*
|
|
4
|
-
* NOTICE OF LICENSE
|
|
5
|
-
*
|
|
6
|
-
* This source file is no subject to a specific license
|
|
7
|
-
* but it belongs to the company IRIS Interactive.
|
|
8
|
-
* You can contact IRIS Interactive at the following
|
|
9
|
-
* address: contact@iris-interactive.fr
|
|
10
|
-
*
|
|
11
|
-
* @author Lucas ROCHE
|
|
12
|
-
* @date 01/02/2022 11:01
|
|
13
|
-
* @copyright Copyright (c) 2002-2022 IRIS Interactive, Inc. (http://www.iris-interactive.fr)
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
import ElementEnum from "../../enumerators/element.enum";
|
|
17
|
-
import {Fancybox} from "@fancyapps/ui";
|
|
18
|
-
import '@fancyapps/ui/dist/fancybox.css';
|
|
19
|
-
import './modal.component.scss';
|
|
20
|
-
|
|
21
|
-
export class HcModal {
|
|
22
|
-
|
|
23
|
-
showEvent;
|
|
24
|
-
hideEvent;
|
|
25
|
-
options = {};
|
|
26
|
-
|
|
27
|
-
constructor(elements = ElementEnum.modal, overrideOptions = {}) {
|
|
28
|
-
this.createEvent();
|
|
29
|
-
document.querySelectorAll(elements).forEach(element => {
|
|
30
|
-
this.initOptions();
|
|
31
|
-
Object.assign(this.options, overrideOptions);
|
|
32
|
-
this.options.src = this.options.src != '' ? this.options.src : (element.hasAttribute('href') ? element.getAttribute('href') : (element.hasAttribute('data-src') ? element.dataset.src : ''));
|
|
33
|
-
this.options.parentEl = this.options.parentEl !== null ? document.querySelector(this.options.parentEl) : (element.hasAttribute('data-hc-modal-parent') ? document.querySelector(element.getAttribute('data-hc-modal-parent')) : '');
|
|
34
|
-
this.options.autoFocus = element.hasAttribute('data-hc-modal-autofocus') ? true : false;
|
|
35
|
-
|
|
36
|
-
const item = `${ElementEnum.modal}[${element.hasAttribute('data-src') ? 'data-src' : 'href'}="${this.options.src}"]`;
|
|
37
|
-
Fancybox.bind(item, Object.assign(this.options, {
|
|
38
|
-
on: {
|
|
39
|
-
done: () => {
|
|
40
|
-
document.dispatchEvent(this.showEvent);
|
|
41
|
-
},
|
|
42
|
-
closing: () => {
|
|
43
|
-
document.dispatchEvent(this.hideEvent);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}));
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
document.querySelectorAll(ElementEnum.modalClose).forEach(element => {
|
|
50
|
-
element.addEventListener('click', (e) => {
|
|
51
|
-
e.preventDefault();
|
|
52
|
-
const all = e.currentTarget.dataset.hcModalClose === "" ? true : e.currentTarget.dataset.hcModalClose;
|
|
53
|
-
HcModal.close(all);
|
|
54
|
-
});
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
static show(options) {
|
|
59
|
-
Fancybox.show([options]);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
static close(all) {
|
|
63
|
-
Fancybox.close(all);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
initOptions() {
|
|
67
|
-
this.options = {
|
|
68
|
-
src: '',
|
|
69
|
-
type: 'inline',
|
|
70
|
-
parentEl: null
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
createEvent() {
|
|
75
|
-
this.showEvent = new Event("show.hc.modal");
|
|
76
|
-
this.hideEvent = new Event("hide.hc.modal");
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
const hc_modal = function (trigger, options) {
|
|
81
|
-
return new HcModal(trigger, options);
|
|
82
|
-
}
|
|
83
|
-
export default hc_modal;
|
|
1
|
+
import t from"../../enumerators/element.enum";import{Fancybox as e}from"@fancyapps/ui";import"@fancyapps/ui/dist/fancybox.css";import"./modal.component.scss";export class HcModal{showEvent;hideEvent;options={};constructor(o=t.modal,s={}){this.createEvent(),document.querySelectorAll(o).forEach(o=>{this.initOptions(),Object.assign(this.options,s),this.options.src=""!=this.options.src?this.options.src:o.hasAttribute("href")?o.getAttribute("href"):o.hasAttribute("data-src")?o.dataset.src:"",this.options.parentEl=null!==this.options.parentEl?document.querySelector(this.options.parentEl):o.hasAttribute("data-hc-modal-parent")?document.querySelector(o.getAttribute("data-hc-modal-parent")):"",this.options.autoFocus=!!o.hasAttribute("data-hc-modal-autofocus");let n=`${t.modal}[${o.hasAttribute("data-src")?"data-src":"href"}="${this.options.src}"]`;e.bind(n,Object.assign(this.options,{on:{done:()=>{document.dispatchEvent(this.showEvent)},closing:()=>{document.dispatchEvent(this.hideEvent)}}}))}),document.querySelectorAll(t.modalClose).forEach(t=>{t.addEventListener("click",t=>{t.preventDefault();let e=""===t.currentTarget.dataset.hcModalClose||t.currentTarget.dataset.hcModalClose;HcModal.close(e)})})}static show(t){e.show([t])}static close(t){e.close(t)}initOptions(){this.options={src:"",type:"inline",parentEl:null}}createEvent(){this.showEvent=new Event("show.hc.modal"),this.hideEvent=new Event("hide.hc.modal")}}let hc_modal=function(t,e){return new HcModal(t,e)};export default hc_modal;
|
|
@@ -1,62 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* IRIS Interactive
|
|
3
|
-
*
|
|
4
|
-
* NOTICE OF LICENSE
|
|
5
|
-
*
|
|
6
|
-
* This source file is no subject to a specific license
|
|
7
|
-
* but it belongs to the company IRIS Interactive.
|
|
8
|
-
* You can contact IRIS Interactive at the following
|
|
9
|
-
* address: contact@iris-interactive.fr
|
|
10
|
-
*
|
|
11
|
-
* @author Nicolas PAYS
|
|
12
|
-
* @date 10/10/2024 14:30
|
|
13
|
-
* @copyright Copyright (c) 2002-2024 IRIS Interactive, Inc. (http://www.iris-interactive.fr)
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
import {wsconnect} from "@nats-io/nats-core";
|
|
17
|
-
|
|
18
|
-
export class HcNats {
|
|
19
|
-
static server = 'wss://nats.iris-interactive.fr:443';
|
|
20
|
-
|
|
21
|
-
constructor() {
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
static async initialize() {
|
|
25
|
-
try {
|
|
26
|
-
window.natsConnection = await wsconnect({
|
|
27
|
-
servers: this.server,
|
|
28
|
-
name: 'IrisNatsSender',
|
|
29
|
-
user: "irisinteractive",
|
|
30
|
-
pass: "2G4cF4**#*72zBe5%HAmPc89"
|
|
31
|
-
});
|
|
32
|
-
} catch (_err) {
|
|
33
|
-
console.log(`error connecting to ${JSON.stringify(_err)}`);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
async publishMessage(subject, content) {
|
|
38
|
-
try {
|
|
39
|
-
if( window.natsConnection === undefined ) {
|
|
40
|
-
await HcNats.initialize();
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const message = {
|
|
44
|
-
lat: window.IRISCollectionTheme.coordinates.latitude,
|
|
45
|
-
long: window.IRISCollectionTheme.coordinates.longitude,
|
|
46
|
-
blogName : window.IRISCollectionTheme.blogInfos.blogName,
|
|
47
|
-
blogUrl : window.IRISCollectionTheme.blogInfos.blogUrl,
|
|
48
|
-
content: content
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
window.natsConnection.publish(subject, JSON.stringify(message));
|
|
52
|
-
} catch (_err) {
|
|
53
|
-
console.log(`error messaging to ${JSON.stringify(_err)}`);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
const hc_nats = function () {
|
|
60
|
-
return new HcNats();
|
|
61
|
-
}
|
|
62
|
-
export default hc_nats;
|
|
1
|
+
import{wsconnect as t}from"@nats-io/nats-core";export class HcNats{static server="wss://nats.iris-interactive.fr:443";constructor(){}static async initialize(){try{window.natsConnection=await t({servers:this.server,name:"IrisNatsSender",user:"irisinteractive",pass:"2G4cF4**#*72zBe5%HAmPc89"})}catch(t){console.log(`error connecting to ${JSON.stringify(t)}`)}}async publishMessage(t,n){try{void 0===window.natsConnection&&await HcNats.initialize();let o={lat:window.IRISCollectionTheme.coordinates.latitude,long:window.IRISCollectionTheme.coordinates.longitude,blogName:window.IRISCollectionTheme.blogInfos.blogName,blogUrl:window.IRISCollectionTheme.blogInfos.blogUrl,content:n};window.natsConnection.publish(t,JSON.stringify(o))}catch(t){console.log(`error messaging to ${JSON.stringify(t)}`)}}}let hc_nats=function(){return new HcNats};export default hc_nats;
|
|
@@ -1,88 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import './overlay.component.scss';
|
|
3
|
-
|
|
4
|
-
export class HcOverlay {
|
|
5
|
-
|
|
6
|
-
showEvent;
|
|
7
|
-
hideEvent;
|
|
8
|
-
|
|
9
|
-
constructor(elements = ElementEnum.overlay) {
|
|
10
|
-
const HcOverlay = this;
|
|
11
|
-
document.querySelectorAll(elements).forEach(element => {
|
|
12
|
-
HcOverlay.createEvent(element);
|
|
13
|
-
|
|
14
|
-
//Init class
|
|
15
|
-
element.classList.add('hc-overlay-init');
|
|
16
|
-
|
|
17
|
-
//Open triggers
|
|
18
|
-
document.querySelectorAll('[data-hc-overlay-trigger]').forEach(open => {
|
|
19
|
-
open.addEventListener('click', (e) => {
|
|
20
|
-
let target = e.currentTarget.getAttribute('data-hc-overlay-trigger') ? e.currentTarget.getAttribute('data-hc-overlay-trigger'):e.currentTarget.getAttribute('href') ? e.currentTarget.getAttribute('href').substring(1):null;
|
|
21
|
-
HcOverlay.show(document.getElementById(target));
|
|
22
|
-
});
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
//Close triggers
|
|
26
|
-
document.querySelectorAll('[data-hc-overlay-close]').forEach(close => {
|
|
27
|
-
close.addEventListener('click', (e) => {
|
|
28
|
-
e.preventDefault();
|
|
29
|
-
let closeTarget = e.currentTarget.getAttribute('data-hc-overlay-close');
|
|
30
|
-
if (closeTarget) {
|
|
31
|
-
HcOverlay.close(document.getElementById(closeTarget));
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
//Close all overlays on background click
|
|
37
|
-
document.querySelectorAll('[data-hc-overlay-background]').forEach(background => {
|
|
38
|
-
background.addEventListener('click', (e) => {
|
|
39
|
-
console.log('click');
|
|
40
|
-
e.preventDefault();
|
|
41
|
-
document.querySelectorAll(ElementEnum.overlay).forEach(overlay => {
|
|
42
|
-
HcOverlay.close(overlay);
|
|
43
|
-
})
|
|
44
|
-
});
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
//Close all overlays on escape key
|
|
48
|
-
document.onkeyup = function(event) {
|
|
49
|
-
if (event.key === 'Escape') {
|
|
50
|
-
document.querySelectorAll(ElementEnum.overlay).forEach(overlay => {
|
|
51
|
-
HcOverlay.close(overlay);
|
|
52
|
-
})
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
show(element) {
|
|
59
|
-
element.classList.add('hc-overlay-show');
|
|
60
|
-
document.body.classList.add('hc-overlay-lock');
|
|
61
|
-
document.dispatchEvent(this.showEvent);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
close(element) {
|
|
65
|
-
element.classList.remove('hc-overlay-show');
|
|
66
|
-
document.body.classList.remove('hc-overlay-lock');
|
|
67
|
-
document.dispatchEvent(this.hideEvent);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
createEvent(element) {
|
|
71
|
-
this.showEvent = new CustomEvent("show.hc.overlay", {
|
|
72
|
-
detail: {
|
|
73
|
-
element
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
this.hideEvent = new CustomEvent("hide.hc.overlay", {
|
|
78
|
-
detail: {
|
|
79
|
-
element
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
const hc_overlay = function (elements) {
|
|
86
|
-
return new HcOverlay(elements);
|
|
87
|
-
}
|
|
88
|
-
export default hc_overlay;
|
|
1
|
+
import e from"../../enumerators/element.enum";import"./overlay.component.scss";export class HcOverlay{showEvent;hideEvent;constructor(t=e.overlay){let r=this;document.querySelectorAll(t).forEach(t=>{r.createEvent(t),t.classList.add("hc-overlay-init"),document.querySelectorAll("[data-hc-overlay-trigger]").forEach(e=>{e.addEventListener("click",e=>{let t=e.currentTarget.getAttribute("data-hc-overlay-trigger")?e.currentTarget.getAttribute("data-hc-overlay-trigger"):e.currentTarget.getAttribute("href")?e.currentTarget.getAttribute("href").substring(1):null;r.show(document.getElementById(t))})}),document.querySelectorAll("[data-hc-overlay-close]").forEach(e=>{e.addEventListener("click",e=>{e.preventDefault();let t=e.currentTarget.getAttribute("data-hc-overlay-close");t&&r.close(document.getElementById(t))})}),document.querySelectorAll("[data-hc-overlay-background]").forEach(t=>{t.addEventListener("click",t=>{console.log("click"),t.preventDefault(),document.querySelectorAll(e.overlay).forEach(e=>{r.close(e)})})}),document.onkeyup=function(t){"Escape"===t.key&&document.querySelectorAll(e.overlay).forEach(e=>{r.close(e)})}})}show(e){e.classList.add("hc-overlay-show"),document.body.classList.add("hc-overlay-lock"),document.dispatchEvent(this.showEvent)}close(e){e.classList.remove("hc-overlay-show"),document.body.classList.remove("hc-overlay-lock"),document.dispatchEvent(this.hideEvent)}createEvent(e){this.showEvent=new CustomEvent("show.hc.overlay",{detail:{element:e}}),this.hideEvent=new CustomEvent("hide.hc.overlay",{detail:{element:e}})}}let hc_overlay=function(e){return new HcOverlay(e)};export default hc_overlay;
|
|
@@ -1,150 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* IRIS Interactive
|
|
3
|
-
*
|
|
4
|
-
* NOTICE OF LICENSE
|
|
5
|
-
*
|
|
6
|
-
* This source file is no subject to a specific license
|
|
7
|
-
* but it belongs to the company IRIS Interactive.
|
|
8
|
-
* You can contact IRIS Interactive at the following
|
|
9
|
-
* address: contact@iris-interactive.fr
|
|
10
|
-
*
|
|
11
|
-
* @author Stephan JAMBOU
|
|
12
|
-
* @date 28/01/2022 14:27
|
|
13
|
-
* @copyright Copyright (c) 2002-2022 IRIS Interactive, Inc. (http://www.iris-interactive.fr)
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
import ElementEnum from "../../enumerators/element.enum";
|
|
17
|
-
import './popin.component.scss';
|
|
18
|
-
|
|
19
|
-
export class HcPopin {
|
|
20
|
-
|
|
21
|
-
showEvent;
|
|
22
|
-
hideEvent;
|
|
23
|
-
|
|
24
|
-
constructor(triggerAttribute = ElementEnum.popin) {
|
|
25
|
-
document.querySelectorAll(triggerAttribute).forEach( element => {
|
|
26
|
-
this.createEvent(element);
|
|
27
|
-
|
|
28
|
-
//Set close cross
|
|
29
|
-
let cross = document.createElement('button');
|
|
30
|
-
cross.setAttribute('data-hc-popin-close', '');
|
|
31
|
-
cross.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" tabindex="-1"><path d="M20 20L4 4m16 0L4 20"></path></svg>'
|
|
32
|
-
element.prepend(cross)
|
|
33
|
-
|
|
34
|
-
//Set overlay
|
|
35
|
-
if (element.hasAttribute('data-hc-popin-overlay')) {
|
|
36
|
-
let overlay = document.createElement('div');
|
|
37
|
-
overlay.setAttribute('data-hc-popin-overlay-background', '');
|
|
38
|
-
element.prepend(overlay);
|
|
39
|
-
element.parentNode.insertBefore(overlay, element);
|
|
40
|
-
overlay.appendChild(element);
|
|
41
|
-
|
|
42
|
-
//Close overlay
|
|
43
|
-
let closeTriggerOverlay = document.querySelectorAll('[data-hc-popin-overlay-background]');
|
|
44
|
-
closeTriggerOverlay[0].addEventListener('click', (e) => {
|
|
45
|
-
const clickDetect = e.composedPath().includes(element)
|
|
46
|
-
if (!clickDetect) {
|
|
47
|
-
this.close(element);
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
//Set position
|
|
53
|
-
if (element.hasAttribute('data-hc-popin-position-top')) {
|
|
54
|
-
element.style.top = element.getAttribute('data-hc-popin-position-top');
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
if (element.hasAttribute('data-hc-popin-position-bottom')) {
|
|
58
|
-
element.style.bottom = element.getAttribute('data-hc-popin-position-bottom');
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
if (element.hasAttribute('data-hc-popin-position-left')) {
|
|
62
|
-
element.style.left = element.getAttribute('data-hc-popin-position-left');
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
if (element.hasAttribute('data-hc-popin-position-right')) {
|
|
66
|
-
element.style.right = element.getAttribute('data-hc-popin-position-right');
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
//Default position
|
|
70
|
-
if (!element.hasAttribute('data-hc-popin-position-top') && !element.hasAttribute('data-hc-popin-position-top')) {
|
|
71
|
-
element.style.bottom = '20px';
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
if (!element.hasAttribute('data-hc-popin-position-left') && !element.hasAttribute('data-hc-popin-position-right')) {
|
|
75
|
-
element.style.right = '20px';
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
//Mode (trigger or auto [default])
|
|
79
|
-
if (element.hasAttribute('data-hc-popin-mode') && element.getAttribute('data-hc-popin-mode') === 'trigger') {
|
|
80
|
-
document.querySelectorAll('[data-hc-popin-trigger]').forEach(trigger => {
|
|
81
|
-
trigger.addEventListener('click', (e) => {
|
|
82
|
-
let target = e.currentTarget.getAttribute('href');
|
|
83
|
-
this.show(document.getElementById(target.substring(1)));
|
|
84
|
-
});
|
|
85
|
-
});
|
|
86
|
-
} else {
|
|
87
|
-
//Set delay on mode auto
|
|
88
|
-
if (element.hasAttribute('data-hc-popin-delay')) {
|
|
89
|
-
setTimeout(() => {
|
|
90
|
-
this.show(element);
|
|
91
|
-
}, element.getAttribute('data-hc-popin-delay'));
|
|
92
|
-
} else {
|
|
93
|
-
this.show(element);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
//Close cross
|
|
98
|
-
let closeTrigger = element.querySelectorAll('[data-hc-popin-close]');
|
|
99
|
-
closeTrigger[0].addEventListener('click', (e) => {
|
|
100
|
-
e.preventDefault();
|
|
101
|
-
this.close(element);
|
|
102
|
-
});
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
show(element) {
|
|
107
|
-
//On affiche la popin
|
|
108
|
-
element.classList.add('hc-popin-show');
|
|
109
|
-
|
|
110
|
-
//On affiche l'overlay si présent
|
|
111
|
-
let parent = element.parentNode;
|
|
112
|
-
if (parent.hasAttribute('data-hc-popin-overlay-background')) {
|
|
113
|
-
parent.classList.add('hc-popin-overlay-show');
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
document.dispatchEvent(this.showEvent);
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
close(element) {
|
|
120
|
-
//On cache la popin
|
|
121
|
-
element.classList.remove('hc-popin-show');
|
|
122
|
-
|
|
123
|
-
//On cache l'overlay si présent
|
|
124
|
-
let parent = element.parentNode;
|
|
125
|
-
if (parent.hasAttribute('data-hc-popin-overlay-background')) {
|
|
126
|
-
parent.classList.remove('hc-popin-overlay-show');
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
document.dispatchEvent(this.hideEvent);
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
createEvent(element) {
|
|
133
|
-
this.showEvent = new CustomEvent("show.hc.popin", {
|
|
134
|
-
detail: {
|
|
135
|
-
element
|
|
136
|
-
}
|
|
137
|
-
} );
|
|
138
|
-
|
|
139
|
-
this.hideEvent = new CustomEvent("hide.hc.popin", {
|
|
140
|
-
detail: {
|
|
141
|
-
element
|
|
142
|
-
}
|
|
143
|
-
} );
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
const hc_popin = function (trigger) {
|
|
148
|
-
new HcPopin(trigger);
|
|
149
|
-
}
|
|
150
|
-
export default hc_popin;
|
|
1
|
+
import t from"../../enumerators/element.enum";import"./popin.component.scss";export class HcPopin{showEvent;hideEvent;constructor(e=t.popin){document.querySelectorAll(e).forEach(t=>{this.createEvent(t);let e=document.createElement("button");if(e.setAttribute("data-hc-popin-close",""),e.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" tabindex="-1"><path d="M20 20L4 4m16 0L4 20"></path></svg>',t.prepend(e),t.hasAttribute("data-hc-popin-overlay")){let e=document.createElement("div");e.setAttribute("data-hc-popin-overlay-background",""),t.prepend(e),t.parentNode.insertBefore(e,t),e.appendChild(t),document.querySelectorAll("[data-hc-popin-overlay-background]")[0].addEventListener("click",e=>{!e.composedPath().includes(t)&&this.close(t)})}t.hasAttribute("data-hc-popin-position-top")&&(t.style.top=t.getAttribute("data-hc-popin-position-top")),t.hasAttribute("data-hc-popin-position-bottom")&&(t.style.bottom=t.getAttribute("data-hc-popin-position-bottom")),t.hasAttribute("data-hc-popin-position-left")&&(t.style.left=t.getAttribute("data-hc-popin-position-left")),t.hasAttribute("data-hc-popin-position-right")&&(t.style.right=t.getAttribute("data-hc-popin-position-right")),!t.hasAttribute("data-hc-popin-position-top")&&!t.hasAttribute("data-hc-popin-position-top")&&(t.style.bottom="20px"),!t.hasAttribute("data-hc-popin-position-left")&&!t.hasAttribute("data-hc-popin-position-right")&&(t.style.right="20px"),t.hasAttribute("data-hc-popin-mode")&&"trigger"===t.getAttribute("data-hc-popin-mode")?document.querySelectorAll("[data-hc-popin-trigger]").forEach(t=>{t.addEventListener("click",t=>{let e=t.currentTarget.getAttribute("href");this.show(document.getElementById(e.substring(1)))})}):t.hasAttribute("data-hc-popin-delay")?setTimeout(()=>{this.show(t)},t.getAttribute("data-hc-popin-delay")):this.show(t),t.querySelectorAll("[data-hc-popin-close]")[0].addEventListener("click",e=>{e.preventDefault(),this.close(t)})})}show(t){t.classList.add("hc-popin-show");let e=t.parentNode;e.hasAttribute("data-hc-popin-overlay-background")&&e.classList.add("hc-popin-overlay-show"),document.dispatchEvent(this.showEvent)}close(t){t.classList.remove("hc-popin-show");let e=t.parentNode;e.hasAttribute("data-hc-popin-overlay-background")&&e.classList.remove("hc-popin-overlay-show"),document.dispatchEvent(this.hideEvent)}createEvent(t){this.showEvent=new CustomEvent("show.hc.popin",{detail:{element:t}}),this.hideEvent=new CustomEvent("hide.hc.popin",{detail:{element:t}})}}let hc_popin=function(t){new HcPopin(t)};export default hc_popin;
|
|
@@ -1,168 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* IRIS Interactive
|
|
3
|
-
*
|
|
4
|
-
* NOTICE OF LICENSE
|
|
5
|
-
*
|
|
6
|
-
* This source file is no subject to a specific license
|
|
7
|
-
* but it belongs to the company IRIS Interactive.
|
|
8
|
-
* You can contact IRIS Interactive at the following
|
|
9
|
-
* address: contact@iris-interactive.fr
|
|
10
|
-
*
|
|
11
|
-
* @author Stephan JAMBOU
|
|
12
|
-
* @date 11/10/2023 18:27
|
|
13
|
-
* @copyright Copyright (c) 2002-2022 IRIS Interactive, Inc. (http://www.iris-interactive.fr)
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
import ElementEnum from "../../enumerators/element.enum";
|
|
17
|
-
import "./scroll-reveal.component.scss";
|
|
18
|
-
|
|
19
|
-
export class HcScrollReveal {
|
|
20
|
-
|
|
21
|
-
//Default
|
|
22
|
-
static distanceDefault = getComputedStyle(document.documentElement).getPropertyValue('--hc-scroll-reveal-distance');
|
|
23
|
-
static delayDefault = getComputedStyle(document.documentElement).getPropertyValue('--hc-scroll-reveal-delay');
|
|
24
|
-
static durationDefault = getComputedStyle(document.documentElement).getPropertyValue('--hc-scroll-reveal-duration');
|
|
25
|
-
static intervalDefault = getComputedStyle(document.documentElement).getPropertyValue('--hc-scroll-reveal-interval');
|
|
26
|
-
static originDefault = getComputedStyle(document.documentElement).getPropertyValue('--hc-scroll-reveal-origin');
|
|
27
|
-
static timingFunctionDefault = getComputedStyle(document.documentElement).getPropertyValue('--hc-scroll-reveal-timing-function');
|
|
28
|
-
|
|
29
|
-
constructor() {
|
|
30
|
-
|
|
31
|
-
//Get all scrollreveal elements
|
|
32
|
-
const items = Array.prototype.slice.call(document.querySelectorAll(ElementEnum.scrollReveal)).concat(Array.prototype.slice.call(document.querySelectorAll(ElementEnum.scrollRevealChildren)));
|
|
33
|
-
|
|
34
|
-
//Init scrollreveal
|
|
35
|
-
HcScrollReveal.init(items);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
static init(items) {
|
|
39
|
-
let childOffset = 0;
|
|
40
|
-
let childRowCount = 1;
|
|
41
|
-
const observerOptions = {
|
|
42
|
-
root: null,
|
|
43
|
-
rootMargin: '-20px 0px -20px 0px',
|
|
44
|
-
threshold: 0
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
const observer = new IntersectionObserver((entries) => {
|
|
48
|
-
entries.forEach(entry => {
|
|
49
|
-
if (entry.isIntersecting) {
|
|
50
|
-
if (entry.target.classList.contains('hc-sr')) {
|
|
51
|
-
entry.target.classList.add('hc-sr--show');
|
|
52
|
-
}
|
|
53
|
-
} else {
|
|
54
|
-
entry.target.classList.add('hc-sr');
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
}, observerOptions)
|
|
58
|
-
|
|
59
|
-
items.forEach(item => {
|
|
60
|
-
let options;
|
|
61
|
-
let isChild = false;
|
|
62
|
-
|
|
63
|
-
//Get options
|
|
64
|
-
if (!item.hasAttribute('data-hc-scroll-reveal-parent') && !item.hasAttribute('data-hc-scroll-reveal') && !item.hasAttribute('data-hc-noscroll-reveal')) {
|
|
65
|
-
let parent = item.parentElement;
|
|
66
|
-
isChild = true;
|
|
67
|
-
options = HcScrollReveal.getOptions(parent);
|
|
68
|
-
} else {
|
|
69
|
-
options = HcScrollReveal.getOptions(item);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
//Apply options if different than default
|
|
73
|
-
if (options.distance !== HcScrollReveal.distanceDefault && options.distance !== '') {
|
|
74
|
-
item.style.setProperty('--hc-scroll-reveal-distance', options.distance);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
if (options.delay !== HcScrollReveal.delayDefault && options.delay !== null) {
|
|
78
|
-
item.style.setProperty('--hc-scroll-reveal-delay', options.delay);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
if (options.duration !== HcScrollReveal.durationDefault && options.duration !== null) {
|
|
82
|
-
item.style.setProperty('--hc-scroll-reveal-duration', options.duration);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
if (options.timing !== HcScrollReveal.timingFunctionDefault && options.timing !== null) {
|
|
86
|
-
item.style.setProperty('--hc-scroll-reveal-timing-function', options.timing);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
//Interval on items in same row
|
|
90
|
-
if (options.interval !== null && options.delay !== null) {
|
|
91
|
-
if (isChild) {
|
|
92
|
-
if (childOffset == item.offsetTop) {
|
|
93
|
-
let delayValue = parseInt(options.delay.replace('ms', ''));
|
|
94
|
-
let intervalValue = parseInt(options.interval.replace('ms', ''));
|
|
95
|
-
let newDelay = delayValue + (intervalValue * childRowCount);
|
|
96
|
-
options.delay = newDelay+'ms';
|
|
97
|
-
childRowCount++;
|
|
98
|
-
} else {
|
|
99
|
-
childOffset = item.offsetTop;
|
|
100
|
-
childRowCount = 1;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
item.style.setProperty('--hc-scroll-reveal-delay', options.delay);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
//Generate translate according to origin
|
|
108
|
-
if (options.origin !== '') {
|
|
109
|
-
item.style.setProperty('--hc-scroll-reveal-origin', options.origin);
|
|
110
|
-
|
|
111
|
-
if (options.origin == 'top') {
|
|
112
|
-
item.style.setProperty('--hc-scroll-reveal-translate', 'translateY(calc(var(--hc-scroll-reveal-distance) * -1))');
|
|
113
|
-
} else if(options.origin == 'left') {
|
|
114
|
-
item.style.setProperty('--hc-scroll-reveal-translate', 'translateX(calc(var(--hc-scroll-reveal-distance) * -1))');
|
|
115
|
-
} else if(options.origin == 'right') {
|
|
116
|
-
item.style.setProperty('--hc-scroll-reveal-translate', 'translateX(var(--hc-scroll-reveal-distance))');
|
|
117
|
-
} else {
|
|
118
|
-
item.style.setProperty('--hc-scroll-reveal-translate', 'translateY(var(--hc-scroll-reveal-distance))');
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
//Observe
|
|
123
|
-
observer.observe(item);
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
static getOptions(item) {
|
|
128
|
-
let options = {
|
|
129
|
-
distance: HcScrollReveal.distanceDefault,
|
|
130
|
-
delay: HcScrollReveal.delayDefault,
|
|
131
|
-
duration: HcScrollReveal.durationDefault,
|
|
132
|
-
interval: HcScrollReveal.intervalDefault,
|
|
133
|
-
origin: HcScrollReveal.originDefault,
|
|
134
|
-
timing: HcScrollReveal.timingFunctionDefault
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
if (item.hasAttribute('data-hc-scroll-reveal-distance')) {
|
|
138
|
-
options.distance = item.getAttribute('data-hc-scroll-reveal-distance');
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
if (item.hasAttribute('data-hc-scroll-reveal-delay')) {
|
|
142
|
-
options.delay = item.getAttribute('data-hc-scroll-reveal-delay')+'ms';
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
if (item.hasAttribute('data-hc-scroll-reveal-duration')) {
|
|
146
|
-
options.duration = item.getAttribute('data-hc-scroll-reveal-duration')+'ms';
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
if (item.hasAttribute('data-hc-scroll-reveal-interval')) {
|
|
150
|
-
options.interval = item.getAttribute('data-hc-scroll-reveal-interval')+'ms';
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
if (item.hasAttribute('data-hc-scroll-reveal-origin')) {
|
|
154
|
-
options.origin = item.getAttribute('data-hc-scroll-reveal-origin');
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
if (item.hasAttribute('data-hc-scroll-reveal-timing-function')) {
|
|
158
|
-
options.timing = item.getAttribute('data-hc-scroll-reveal-timing-function');
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
return options;
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
const hc_scroll_reveal = function () {
|
|
166
|
-
return new HcScrollReveal();
|
|
167
|
-
}
|
|
168
|
-
export default hc_scroll_reveal;
|
|
1
|
+
import e from"../../enumerators/element.enum";import"./scroll-reveal.component.scss";export class HcScrollReveal{static distanceDefault=getComputedStyle(document.documentElement).getPropertyValue("--hc-scroll-reveal-distance");static delayDefault=getComputedStyle(document.documentElement).getPropertyValue("--hc-scroll-reveal-delay");static durationDefault=getComputedStyle(document.documentElement).getPropertyValue("--hc-scroll-reveal-duration");static intervalDefault=getComputedStyle(document.documentElement).getPropertyValue("--hc-scroll-reveal-interval");static originDefault=getComputedStyle(document.documentElement).getPropertyValue("--hc-scroll-reveal-origin");static timingFunctionDefault=getComputedStyle(document.documentElement).getPropertyValue("--hc-scroll-reveal-timing-function");constructor(){let t=Array.prototype.slice.call(document.querySelectorAll(e.scrollReveal)).concat(Array.prototype.slice.call(document.querySelectorAll(e.scrollRevealChildren)));HcScrollReveal.init(t)}static init(e){let t=0,l=1,r=new IntersectionObserver(e=>{e.forEach(e=>{e.isIntersecting?e.target.classList.contains("hc-sr")&&e.target.classList.add("hc-sr--show"):e.target.classList.add("hc-sr")})},{root:null,rootMargin:"-20px 0px -20px 0px",threshold:0});e.forEach(e=>{let a;let c=!1;if(e.hasAttribute("data-hc-scroll-reveal-parent")||e.hasAttribute("data-hc-scroll-reveal")||e.hasAttribute("data-hc-noscroll-reveal"))a=HcScrollReveal.getOptions(e);else{let t=e.parentElement;c=!0,a=HcScrollReveal.getOptions(t)}if(a.distance!==HcScrollReveal.distanceDefault&&""!==a.distance&&e.style.setProperty("--hc-scroll-reveal-distance",a.distance),a.delay!==HcScrollReveal.delayDefault&&null!==a.delay&&e.style.setProperty("--hc-scroll-reveal-delay",a.delay),a.duration!==HcScrollReveal.durationDefault&&null!==a.duration&&e.style.setProperty("--hc-scroll-reveal-duration",a.duration),a.timing!==HcScrollReveal.timingFunctionDefault&&null!==a.timing&&e.style.setProperty("--hc-scroll-reveal-timing-function",a.timing),null!==a.interval&&null!==a.delay&&c){if(t==e.offsetTop){let e=parseInt(a.delay.replace("ms",""))+parseInt(a.interval.replace("ms",""))*l;a.delay=e+"ms",l++}else t=e.offsetTop,l=1;e.style.setProperty("--hc-scroll-reveal-delay",a.delay)}""!==a.origin&&(e.style.setProperty("--hc-scroll-reveal-origin",a.origin),"top"==a.origin?e.style.setProperty("--hc-scroll-reveal-translate","translateY(calc(var(--hc-scroll-reveal-distance) * -1))"):"left"==a.origin?e.style.setProperty("--hc-scroll-reveal-translate","translateX(calc(var(--hc-scroll-reveal-distance) * -1))"):"right"==a.origin?e.style.setProperty("--hc-scroll-reveal-translate","translateX(var(--hc-scroll-reveal-distance))"):e.style.setProperty("--hc-scroll-reveal-translate","translateY(var(--hc-scroll-reveal-distance))")),r.observe(e)})}static getOptions(e){let t={distance:HcScrollReveal.distanceDefault,delay:HcScrollReveal.delayDefault,duration:HcScrollReveal.durationDefault,interval:HcScrollReveal.intervalDefault,origin:HcScrollReveal.originDefault,timing:HcScrollReveal.timingFunctionDefault};return e.hasAttribute("data-hc-scroll-reveal-distance")&&(t.distance=e.getAttribute("data-hc-scroll-reveal-distance")),e.hasAttribute("data-hc-scroll-reveal-delay")&&(t.delay=e.getAttribute("data-hc-scroll-reveal-delay")+"ms"),e.hasAttribute("data-hc-scroll-reveal-duration")&&(t.duration=e.getAttribute("data-hc-scroll-reveal-duration")+"ms"),e.hasAttribute("data-hc-scroll-reveal-interval")&&(t.interval=e.getAttribute("data-hc-scroll-reveal-interval")+"ms"),e.hasAttribute("data-hc-scroll-reveal-origin")&&(t.origin=e.getAttribute("data-hc-scroll-reveal-origin")),e.hasAttribute("data-hc-scroll-reveal-timing-function")&&(t.timing=e.getAttribute("data-hc-scroll-reveal-timing-function")),t}}let hc_scroll_reveal=function(){return new HcScrollReveal};export default hc_scroll_reveal;
|
|
@@ -1,93 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
export class HcScrollspy {
|
|
4
|
-
|
|
5
|
-
activeEvent;
|
|
6
|
-
|
|
7
|
-
constructor(elements = ElementEnum.scrollspy) {
|
|
8
|
-
document.querySelectorAll(elements).forEach(element => {
|
|
9
|
-
const navElement = document.querySelector(element.dataset.hcScrollspy);
|
|
10
|
-
const shift = element.getAttribute('data-hc-scrollspy-shift') !== null ? parseInt(element.getAttribute('data-hc-scrollspy-shift')) : 0;
|
|
11
|
-
if (navElement !== null) {
|
|
12
|
-
this.activeItem(navElement, ElementEnum.scrollspyNavItem, shift);
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
getPartsConfig(navElement, childElement) {
|
|
18
|
-
let offsetTop = [];
|
|
19
|
-
navElement.querySelectorAll(childElement).forEach(item => {
|
|
20
|
-
const part = item.getAttribute('href') !== null ? {
|
|
21
|
-
id: item.getAttribute('href'),
|
|
22
|
-
value: 0,
|
|
23
|
-
attribute: 'href'
|
|
24
|
-
} : {
|
|
25
|
-
id: item.getAttribute(ElementEnum.scrollspyNavItemHref),
|
|
26
|
-
value: 0,
|
|
27
|
-
attribute: ElementEnum.scrollspyNavItemHref
|
|
28
|
-
};
|
|
29
|
-
if (document.querySelector(part.id) !== null) {
|
|
30
|
-
// part.value = document.querySelector(part.id).offsetTop;
|
|
31
|
-
part.value = this.getOffset(document.querySelector(part.id)).top;
|
|
32
|
-
offsetTop = [
|
|
33
|
-
...offsetTop,
|
|
34
|
-
part
|
|
35
|
-
];
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
return offsetTop;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
activeItem(navElement, childElement, shift = 0) {
|
|
42
|
-
let item = navElement.querySelector(`${childElement}:first-child`);
|
|
43
|
-
window.addEventListener('scroll', () => {
|
|
44
|
-
const partsConfig = this.getPartsConfig(navElement, childElement);
|
|
45
|
-
const top = window.scrollY;
|
|
46
|
-
partsConfig.forEach(offsetTop => {
|
|
47
|
-
if (top > (offsetTop.value - (shift + 50))) {
|
|
48
|
-
item = navElement.querySelector('[' + offsetTop.attribute + '="' + offsetTop.id + '"]');
|
|
49
|
-
}
|
|
50
|
-
})
|
|
51
|
-
navElement.querySelectorAll(childElement).forEach(child => {
|
|
52
|
-
if (child !== item) {
|
|
53
|
-
const deactiveEvent = new CustomEvent('deactive.hc.scrollspy', {
|
|
54
|
-
detail: {
|
|
55
|
-
nav: navElement,
|
|
56
|
-
item: item
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
document.dispatchEvent(deactiveEvent);
|
|
60
|
-
if(child.classList.contains('active')) {
|
|
61
|
-
child.classList.remove('active');
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
if (!item.classList.contains('active')) {
|
|
66
|
-
const activeEvent = new CustomEvent('active.hc.scrollspy', {
|
|
67
|
-
detail: {
|
|
68
|
-
nav: navElement,
|
|
69
|
-
item: item
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
document.dispatchEvent(activeEvent);
|
|
73
|
-
item.classList.add('active');
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
getOffset( element ) {
|
|
79
|
-
let x = 0;
|
|
80
|
-
let y = 0;
|
|
81
|
-
while( element && !isNaN( element.offsetLeft ) && !isNaN( element.offsetTop ) ) {
|
|
82
|
-
x += element.offsetLeft - element.scrollLeft;
|
|
83
|
-
y += element.offsetTop - element.scrollTop;
|
|
84
|
-
element = element.offsetParent;
|
|
85
|
-
}
|
|
86
|
-
return { top: y, left: x };
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
const hc_scrollspy = function (trigger) {
|
|
91
|
-
return new HcScrollspy(trigger);
|
|
92
|
-
}
|
|
93
|
-
export default hc_scrollspy;
|
|
1
|
+
import t from"../../enumerators/element.enum";export class HcScrollspy{activeEvent;constructor(e=t.scrollspy){document.querySelectorAll(e).forEach(e=>{let l=document.querySelector(e.dataset.hcScrollspy),r=null!==e.getAttribute("data-hc-scrollspy-shift")?parseInt(e.getAttribute("data-hc-scrollspy-shift")):0;null!==l&&this.activeItem(l,t.scrollspyNavItem,r)})}getPartsConfig(e,l){let r=[];return e.querySelectorAll(l).forEach(e=>{let l=null!==e.getAttribute("href")?{id:e.getAttribute("href"),value:0,attribute:"href"}:{id:e.getAttribute(t.scrollspyNavItemHref),value:0,attribute:t.scrollspyNavItemHref};null!==document.querySelector(l.id)&&(l.value=this.getOffset(document.querySelector(l.id)).top,r=[...r,l])}),r}activeItem(t,e,l=0){let r=t.querySelector(`${e}:first-child`);window.addEventListener("scroll",()=>{let s=this.getPartsConfig(t,e),c=window.scrollY;if(s.forEach(e=>{c>e.value-(l+50)&&(r=t.querySelector("["+e.attribute+'="'+e.id+'"]'))}),t.querySelectorAll(e).forEach(e=>{if(e!==r){let l=new CustomEvent("deactive.hc.scrollspy",{detail:{nav:t,item:r}});document.dispatchEvent(l),e.classList.contains("active")&&e.classList.remove("active")}}),!r.classList.contains("active")){let e=new CustomEvent("active.hc.scrollspy",{detail:{nav:t,item:r}});document.dispatchEvent(e),r.classList.add("active")}})}getOffset(t){let e=0,l=0;for(;t&&!isNaN(t.offsetLeft)&&!isNaN(t.offsetTop);)e+=t.offsetLeft-t.scrollLeft,l+=t.offsetTop-t.scrollTop,t=t.offsetParent;return{top:l,left:e}}}let hc_scrollspy=function(t){return new HcScrollspy(t)};export default hc_scrollspy;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import e from"../../enumerators/share.enum";export default class a{constructor(){}static manageDisplayOfShareButtons(){navigator.share&&window.matchMedia("(max-width: 1024px)").matches?($(e.shareMobile).removeClass("hidden"),$(e.shareDesktop).addClass("hidden")):($(e.shareMobile).addClass("hidden"),$(e.shareDesktop).removeClass("hidden"))}static sharePage(){$('[data-share="mobile"]').on("click",e=>{e.preventDefault(),navigator.share&&navigator.share({title:document.title,url:window.location.href})})}static shareOnWhatsappWeb(){$(e.shareWhatsappService).on("click",function(e){e.preventDefault(),window.open("https://web.whatsapp.com/send?text="+$(location).attr("href"),"_blank")})}static shareOnMessengerWeb(){$(e.shareMessengerService).on("click",function(e){e.preventDefault(),window.open("http://www.facebook.com/dialog/send?app_id=702473707947207&link="+$(location).attr("href")+"&redirect_uri="+$(location).attr("href"),"_blank")})}}
|