@newlogic-digital/ui 3.0.1 → 3.1.0
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/README.md +8 -12
- package/gulpfile.js +16 -168
- package/package.json +13 -8
- package/src/emails/email.css +15 -9
- package/src/emails/email.twig +7 -7
- package/src/icons.svg +32 -0
- package/src/main.json +14 -27
- package/src/scripts/Components/+.js +2 -2
- package/src/scripts/Components/CookieConsent.js +66 -64
- package/src/scripts/Components/Form.js +28 -21
- package/src/scripts/Layout/+.js +2 -1
- package/src/scripts/Layout/Header.js +18 -0
- package/src/scripts/Layout/Main.js +49 -45
- package/src/scripts/Libraries/+.js +12 -10
- package/src/scripts/Libraries/Anchor.js +18 -43
- package/src/scripts/Libraries/CookieConsent.js +37 -58
- package/src/scripts/Libraries/Dialog.js +56 -55
- package/src/scripts/Libraries/Drawer.js +23 -23
- package/src/scripts/Libraries/NativeSlider.js +86 -86
- package/src/scripts/Libraries/ReCaptcha.js +20 -18
- package/src/scripts/Libraries/Ripple.js +16 -32
- package/src/scripts/Libraries/Stimulus.js +30 -34
- package/src/scripts/Libraries/Swup.js +47 -50
- package/src/scripts/Libraries/Tabs.js +12 -18
- package/src/scripts/Libraries/Tippy.js +118 -0
- package/src/scripts/Ui/+.js +5 -3
- package/src/scripts/Ui/Checkbox.js +19 -0
- package/src/scripts/Ui/Input.js +188 -161
- package/src/scripts/Ui/Radio.js +23 -0
- package/src/scripts/Ui/Select.js +64 -37
- package/src/scripts/Ui/Text.js +25 -0
- package/src/scripts/Utils/Functions/+.js +6 -6
- package/src/scripts/Utils/Functions/dataValue.js +28 -25
- package/src/scripts/Utils/Functions/importScript.js +9 -11
- package/src/scripts/Utils/Functions/importStyle.js +18 -5
- package/src/scripts/Utils/Functions/inView.js +19 -21
- package/src/scripts/Utils/Functions/loadStimulus.js +22 -20
- package/src/scripts/Utils/cdn.js +6 -4
- package/src/scripts/Utils/global.js +10 -33
- package/src/scripts/main.js +6 -6
- package/src/styles/Components/CookieConsent.css +40 -179
- package/src/styles/Components/Dialog/Default.css +12 -15
- package/src/styles/Components/Form/CookieConsent.css +7 -12
- package/src/styles/Components/Item/+.css +1 -0
- package/src/styles/Layout/+.css +2 -0
- package/src/{templates/Components/Dialogs/.gitkeep → styles/Layout/Header.css} +0 -0
- package/src/styles/Layout/Main.css +28 -63
- package/src/styles/Layout/Nav.css +43 -0
- package/src/styles/Libraries/+.css +1 -1
- package/src/styles/Libraries/Datepicker.css +85 -39
- package/src/styles/Libraries/Dialog.css +6 -5
- package/src/styles/Libraries/Drawer.css +15 -15
- package/src/styles/Libraries/Hint.css +29 -23
- package/src/styles/Libraries/Lazysizes.css +2 -1
- package/src/styles/Libraries/NativeSlider.css +19 -18
- package/src/styles/Libraries/Ripple.css +8 -5
- package/src/styles/Libraries/Tabs.css +4 -4
- package/src/styles/Libraries/Tippy.css +87 -0
- package/src/styles/Sections/+.css +1 -0
- package/src/styles/Ui/+.css +5 -1
- package/src/styles/Ui/Badge.css +33 -19
- package/src/styles/Ui/Btn.css +80 -53
- package/src/styles/Ui/Checkbox.css +80 -41
- package/src/styles/Ui/Dropdown.css +5 -0
- package/src/styles/Ui/Heading.css +12 -12
- package/src/styles/Ui/Icon.css +27 -8
- package/src/styles/Ui/Image.css +23 -0
- package/src/styles/Ui/Input.css +295 -220
- package/src/styles/Ui/Label.css +14 -0
- package/src/styles/Ui/Link.css +3 -3
- package/src/styles/Ui/Notice.css +14 -16
- package/src/styles/Ui/Progress.css +10 -21
- package/src/styles/Ui/Radio.css +3 -8
- package/src/styles/Ui/Select.css +63 -112
- package/src/styles/Ui/Switch.css +70 -0
- package/src/styles/Ui/{Wsw.css → Text.css} +61 -80
- package/src/styles/Ui/Title.css +8 -4
- package/src/styles/Utils/default.css +75 -67
- package/src/styles/Utils/icons.css +9 -0
- package/src/styles/Utils/keyframes.css +182 -0
- package/src/styles/Utils/normalize.css +223 -0
- package/src/styles/Utils/print.css +1 -0
- package/src/styles/Utils/tailwind/base.css +15 -0
- package/src/styles/Utils/tailwind/gutters.css +264 -263
- package/src/styles/Utils/theme/main.css +24 -21
- package/src/styles/Utils/vars.css +58 -35
- package/src/styles/Utils/vendor.css +1 -2
- package/src/styles/main.css +6 -3
- package/src/styles/tailwind.css +1 -4
- package/src/templates/Components/CookieConsent.twig +30 -0
- package/src/templates/Components/Dialogs/Basic.twig +7 -3
- package/src/templates/Layout/Header.twig +42 -0
- package/src/templates/Layout/Main.twig +47 -64
- package/src/templates/Sections/Gdpr.twig +64 -0
- package/src/templates/Sections/Ui.twig +2104 -0
- package/src/templates/dialog-basic.twig +2 -2
- package/src/templates/gdpr.json +11 -0
- package/src/templates/index.json +8 -2
- package/src/templates/json-tippy.twig +16 -0
- package/src/templates/ui.json +11 -0
- package/CHANGELOG +0 -231
- package/src/icons/selection.json +0 -1
- package/src/icons/style.css +0 -171
- package/src/icons/variables.css +0 -31
- package/src/scripts/Ui/Wsw.js +0 -25
- package/src/scripts/Utils/Functions/bodyLoaded.js +0 -12
- package/src/styles/Libraries/Animate.css +0 -184
- package/src/styles/Utils/reference.css +0 -2
- package/src/styles/Utils/tailwind/content.css +0 -24
- package/src/styles/Utils/theme/vars.css +0 -19
- package/src/styles/preload.css +0 -29
- package/src/templates/Layout/Preload.twig +0 -21
- package/src/templates/Sections/.gitkeep +0 -0
|
@@ -1,80 +1,82 @@
|
|
|
1
|
-
import {LibStimulus, Controller} from
|
|
2
|
-
import LibCookieConsent from
|
|
1
|
+
import { LibStimulus, Controller } from '../Libraries/Stimulus.js'
|
|
2
|
+
import LibCookieConsent from '../Libraries/CookieConsent.js'
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
LibStimulus.register("c-cookieconsent", class extends Controller {
|
|
4
|
+
LibStimulus.register('c-cookieconsent', class extends Controller {
|
|
7
5
|
connect() {
|
|
8
|
-
const selector = this.element
|
|
6
|
+
const selector = this.element
|
|
7
|
+
|
|
8
|
+
if (document.querySelector('.c-form-cookieconsent') !== null) {
|
|
9
|
+
return
|
|
10
|
+
}
|
|
9
11
|
|
|
10
|
-
if (localStorage.getItem('cookieconsent') === null) {
|
|
12
|
+
if (localStorage.getItem('lib-cookieconsent') === null || parseInt(localStorage.getItem('lib-cookieconsent-expire')) < Date.now()) {
|
|
11
13
|
setTimeout(() => {
|
|
12
|
-
selector._addDataValue(
|
|
13
|
-
selector.classList.add(
|
|
14
|
-
},1500)
|
|
14
|
+
selector._addDataValue('state', 'active')
|
|
15
|
+
selector.classList.add('is-animate')
|
|
16
|
+
}, 1500)
|
|
15
17
|
}
|
|
16
18
|
|
|
17
|
-
selector.
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
selector.remove();
|
|
38
|
-
},500);
|
|
39
|
-
});
|
|
19
|
+
selector._hasDataValue('type', 'closable') &&
|
|
20
|
+
selector.addEventListener('click', e => {
|
|
21
|
+
if (e.target.closest('.c-cookieconsent > .wrp') === null) {
|
|
22
|
+
this.hide([])
|
|
23
|
+
}
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
selector.querySelector('[data-lib-cookieconsent-approve]').addEventListener('click', () => {
|
|
27
|
+
this.hide(['performance', 'marketing'])
|
|
28
|
+
})
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
hide(type) {
|
|
32
|
+
LibCookieConsent.set(type)
|
|
33
|
+
this.element.classList.remove('is-animate')
|
|
34
|
+
|
|
35
|
+
setTimeout(() => {
|
|
36
|
+
this.element._removeDataValue('state', 'active')
|
|
37
|
+
this.element.remove()
|
|
38
|
+
}, 500)
|
|
40
39
|
}
|
|
41
|
-
})
|
|
40
|
+
})
|
|
42
41
|
|
|
43
|
-
LibStimulus.register(
|
|
42
|
+
LibStimulus.register('c-form-cookieconsent', class extends Controller {
|
|
44
43
|
connect() {
|
|
45
|
-
const selector = this.element
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
44
|
+
const selector = this.element
|
|
45
|
+
const type = localStorage.getItem('lib-cookieconsent')
|
|
46
|
+
|
|
47
|
+
document.querySelector('.c-cookieconsent').classList.remove('is-animate')
|
|
48
|
+
document.querySelector('.c-cookieconsent')._removeDataValue('state', 'active')
|
|
49
|
+
|
|
50
|
+
if (type !== null) {
|
|
51
|
+
this.element.querySelectorAll('input:not([disabled])').forEach(input => {
|
|
52
|
+
input.checked = false
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
JSON.parse(type).forEach(type => {
|
|
56
|
+
if (selector.querySelector(`input[value="${type}"]`) !== null) {
|
|
57
|
+
selector.querySelector(`input[value="${type}"]`).checked = true
|
|
58
58
|
}
|
|
59
|
-
}
|
|
60
|
-
selector.querySelector(`input[value="decline"]`).checked = true;
|
|
61
|
-
}
|
|
59
|
+
})
|
|
62
60
|
}
|
|
63
61
|
|
|
64
|
-
selector.addEventListener(
|
|
65
|
-
e.preventDefault()
|
|
62
|
+
selector.addEventListener('submit', e => {
|
|
63
|
+
e.preventDefault()
|
|
66
64
|
|
|
67
|
-
|
|
65
|
+
const type = []
|
|
68
66
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
} else if (value === "decline") {
|
|
76
|
-
LibCookieConsent.set("decline", () => location.reload());
|
|
77
|
-
}
|
|
67
|
+
this.element.querySelectorAll('input:not([disabled])').forEach(input => {
|
|
68
|
+
input.checked && type.push(input.value)
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
LibCookieConsent.set(type)
|
|
72
|
+
location.reload()
|
|
78
73
|
})
|
|
79
74
|
}
|
|
80
|
-
|
|
75
|
+
|
|
76
|
+
disconnect() {
|
|
77
|
+
if (localStorage.getItem('lib-cookieconsent') === null || parseInt(localStorage.getItem('lib-cookieconsent-expire')) < Date.now()) {
|
|
78
|
+
document.querySelector('.c-cookieconsent')._addDataValue('state', 'active')
|
|
79
|
+
document.querySelector('.c-cookieconsent').classList.add('is-animate')
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
})
|
|
@@ -1,26 +1,33 @@
|
|
|
1
|
-
import {LibStimulus, Controller} from
|
|
1
|
+
import { LibStimulus, Controller, getController } from '../Libraries/Stimulus.js'
|
|
2
2
|
|
|
3
|
-
LibStimulus.register(
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
LibStimulus.register('c-form', class extends Controller {
|
|
4
|
+
validate(element, e) {
|
|
5
|
+
if (element.reportValidity() === false) {
|
|
6
|
+
e.preventDefault()
|
|
7
|
+
e.stopPropagation()
|
|
8
|
+
}
|
|
6
9
|
|
|
7
|
-
|
|
8
|
-
element.
|
|
9
|
-
|
|
10
|
-
if (element.reportValidity() === false) {
|
|
11
|
-
event.preventDefault();
|
|
12
|
-
event.stopPropagation();
|
|
13
|
-
}
|
|
10
|
+
element.querySelectorAll('.ui-input').forEach(element => {
|
|
11
|
+
getController(element, 'ui-input').validate(element, true)
|
|
12
|
+
})
|
|
14
13
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
});
|
|
14
|
+
element.querySelectorAll('.ui-select:not([data-state*="active"]) select[required]').forEach(select => {
|
|
15
|
+
getController(select.parentNode, 'ui-select').validate(select.parentNode, select)
|
|
16
|
+
})
|
|
19
17
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
18
|
+
element.querySelectorAll('[data-controller="ui-checkbox"] input:not([type="hidden"])').forEach(input => {
|
|
19
|
+
input.parentNode._removeDataValue('state', 'valid invalid')
|
|
20
|
+
|
|
21
|
+
if (input.checkValidity()) {
|
|
22
|
+
input.parentNode._addDataValue('state', 'valid')
|
|
23
|
+
} else {
|
|
24
|
+
input.parentNode._addDataValue('state', 'invalid')
|
|
25
|
+
}
|
|
26
|
+
})
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
connect() {
|
|
30
|
+
this.element.setAttribute('novalidate', '')
|
|
31
|
+
this.element.addEventListener('submit', e => this.validate(this.element, e))
|
|
25
32
|
}
|
|
26
|
-
})
|
|
33
|
+
})
|
package/src/scripts/Layout/+.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
import './
|
|
1
|
+
import './Header.js'
|
|
2
|
+
import './Main.js'
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { LibStimulus, Controller, getController } from '../Libraries/Stimulus.js'
|
|
2
|
+
|
|
3
|
+
LibStimulus.register('l-header', class extends Controller {
|
|
4
|
+
connect() {
|
|
5
|
+
if (document.querySelector('#l-nav') === null) {
|
|
6
|
+
this.element.insertAdjacentHTML('afterend', '<div id="l-nav" class="lib-drawer" data-lib-drawer-target="nav" data-action="scroll->lib-drawer#scroll"><div class="wrp_nav"><div class="wrp_nav_head"></div><div class="wrp_nav_body"></div></div></div>')
|
|
7
|
+
|
|
8
|
+
getController(document.body, 'lib-drawer').init()
|
|
9
|
+
|
|
10
|
+
const layoutNav = document.querySelector('#l-nav')
|
|
11
|
+
const logo = this.element.querySelector('.elm_header_logo').outerHTML
|
|
12
|
+
const nav = this.element.querySelector('.elm_header_nav').outerHTML
|
|
13
|
+
|
|
14
|
+
layoutNav.querySelector('.wrp_nav_head').insertAdjacentHTML('beforeend', logo)
|
|
15
|
+
layoutNav.querySelector('.wrp_nav_body').insertAdjacentHTML('beforeend', nav)
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
})
|
|
@@ -1,76 +1,80 @@
|
|
|
1
|
-
import {LibStimulus, Controller, loadStimulus} from
|
|
2
|
-
import {
|
|
3
|
-
import LibRipple from
|
|
4
|
-
import LibAnchor from
|
|
5
|
-
import LibDialog from
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
1
|
+
import { LibStimulus, Controller, loadStimulus } from '../Libraries/Stimulus.js'
|
|
2
|
+
import { importScript } from '../Utils/Functions/+.js'
|
|
3
|
+
import LibRipple from '../Libraries/Ripple.js'
|
|
4
|
+
import LibAnchor from '../Libraries/Anchor.js'
|
|
5
|
+
import LibDialog from '../Libraries/Dialog.js'
|
|
6
|
+
import LibTippy from '../Libraries/Tippy.js'
|
|
7
|
+
import LibTabs from '../Libraries/Tabs.js'
|
|
8
|
+
import LibNativeSlider from '../Libraries/NativeSlider.js'
|
|
9
|
+
import cdn from '../Utils/cdn.js'
|
|
10
|
+
|
|
11
|
+
LibStimulus.register('lib', class extends Controller {
|
|
12
|
+
connect() {
|
|
13
|
+
if (!('scrollBehavior' in document.documentElement.style)) {
|
|
14
|
+
importScript(cdn.seamless).then(() => window.seamless.polyfill())
|
|
15
|
+
}
|
|
16
|
+
}
|
|
9
17
|
|
|
10
|
-
LibStimulus.register("lib", class extends Controller {
|
|
11
18
|
ripple(e) {
|
|
12
|
-
LibRipple(e
|
|
19
|
+
LibRipple(e)
|
|
13
20
|
}
|
|
14
21
|
|
|
15
22
|
anchor(e) {
|
|
16
|
-
e.preventDefault()
|
|
23
|
+
e.preventDefault()
|
|
17
24
|
LibAnchor.action(e.currentTarget)
|
|
18
25
|
}
|
|
19
26
|
|
|
20
|
-
darkMode(
|
|
21
|
-
let currentTarget = e.currentTarget;
|
|
22
|
-
|
|
27
|
+
darkMode() {
|
|
23
28
|
if (document.documentElement.classList.contains('dark')) {
|
|
24
|
-
localStorage.theme = 'light'
|
|
25
|
-
document.documentElement.classList.remove('dark')
|
|
26
|
-
currentTarget.classList.remove("icon-light");
|
|
29
|
+
localStorage.theme = 'light'
|
|
30
|
+
document.documentElement.classList.remove('dark')
|
|
27
31
|
} else {
|
|
28
|
-
localStorage.theme = 'dark'
|
|
29
|
-
document.documentElement.classList.add('dark')
|
|
30
|
-
currentTarget.classList.add("icon-light");
|
|
32
|
+
localStorage.theme = 'dark'
|
|
33
|
+
document.documentElement.classList.add('dark')
|
|
31
34
|
}
|
|
32
35
|
}
|
|
33
|
-
})
|
|
36
|
+
})
|
|
34
37
|
|
|
35
|
-
LibStimulus.register(
|
|
36
|
-
connect() {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
if (typeof element.dataset.libDialogOpen !== "undefined") {
|
|
40
|
-
let url = element.getAttribute("data-action-url");
|
|
38
|
+
LibStimulus.register('lib-dialog', class extends Controller {
|
|
39
|
+
async connect() {
|
|
40
|
+
if (this.element.getAttribute('data-lib-dialog-open')) {
|
|
41
|
+
const url = this.element.getAttribute('data-action-url')
|
|
41
42
|
|
|
42
43
|
if (url) {
|
|
43
|
-
LibDialog.action(element, url, () => loadStimulus(document.querySelector(
|
|
44
|
+
await LibDialog.action(this.element, url, () => loadStimulus(document.querySelector('.lib-dialog')))
|
|
44
45
|
} else {
|
|
45
|
-
LibDialog.show(document.querySelector(element.
|
|
46
|
+
await LibDialog.show(document.querySelector(this.element.getAttribute('data-lib-dialog-open')).innerHTML, () => loadStimulus(document.querySelector('.lib-dialog')))
|
|
46
47
|
}
|
|
47
48
|
}
|
|
48
49
|
}
|
|
49
50
|
|
|
50
|
-
show(
|
|
51
|
-
|
|
52
|
-
let url = element.getAttribute("data-action-url");
|
|
51
|
+
async show({ currentTarget }) {
|
|
52
|
+
const url = currentTarget.getAttribute('data-action-url')
|
|
53
53
|
|
|
54
|
-
LibDialog.action(
|
|
54
|
+
await LibDialog.action(currentTarget, url)
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
hide() {
|
|
58
|
-
LibDialog.hide()
|
|
57
|
+
async hide() {
|
|
58
|
+
await LibDialog.hide()
|
|
59
59
|
}
|
|
60
|
-
})
|
|
60
|
+
})
|
|
61
61
|
|
|
62
|
-
LibStimulus.register(
|
|
62
|
+
LibStimulus.register('lib-tabs', class extends Controller {
|
|
63
63
|
connect() {
|
|
64
|
-
LibTabs(this.element)
|
|
64
|
+
LibTabs(this.element)
|
|
65
65
|
}
|
|
66
|
-
})
|
|
66
|
+
})
|
|
67
67
|
|
|
68
|
-
LibStimulus.register(
|
|
68
|
+
LibStimulus.register('lib-ns', class extends Controller {
|
|
69
69
|
connect() {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
70
|
+
LibNativeSlider(this.element.querySelector('[data-lib-ns]'), this.element)
|
|
71
|
+
}
|
|
72
|
+
})
|
|
73
|
+
|
|
74
|
+
LibStimulus.register('lib-tippy', class extends Controller {
|
|
75
|
+
connect() {
|
|
76
|
+
const attributes = this.element.getAttribute('data-lib-tippy')
|
|
73
77
|
|
|
74
|
-
|
|
78
|
+
new LibTippy(this.element, attributes !== null ? attributes.replace(/\s/g, '').split(',') : undefined)
|
|
75
79
|
}
|
|
76
|
-
})
|
|
80
|
+
})
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
export { default as Anchor } from './Anchor.js'
|
|
2
|
-
export { default as CookieConsent } from './CookieConsent.js'
|
|
3
|
-
export { default as Dialog } from './Dialog.js'
|
|
4
|
-
import './Drawer.js'
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export { default as
|
|
1
|
+
export { default as Anchor } from './Anchor.js'
|
|
2
|
+
export { default as CookieConsent } from './CookieConsent.js'
|
|
3
|
+
export { default as Dialog } from './Dialog.js'
|
|
4
|
+
import './Drawer.js'
|
|
5
|
+
import './Fetch.js'
|
|
6
|
+
export { default as NativeSlider } from './NativeSlider.js'
|
|
7
|
+
import './ReCaptcha.js'
|
|
8
|
+
export { default as Ripple } from './Ripple.js'
|
|
9
|
+
import './Stimulus.js'
|
|
10
|
+
export { default as Swup } from './Swup.js'
|
|
11
|
+
export { default as Tabs } from './Tabs.js'
|
|
12
|
+
export { default as Tippy } from './Tippy.js'
|
|
@@ -1,60 +1,35 @@
|
|
|
1
1
|
const LibAnchor = {
|
|
2
2
|
animation: (element) => {
|
|
3
|
-
|
|
4
|
-
let attr = "data-offset";
|
|
3
|
+
const offset = parseInt(window.getComputedStyle(document.documentElement).getPropertyValue('scroll-padding-top'))
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
offset = 0;
|
|
8
|
-
if (element.getAttribute(attr) !== null) {
|
|
9
|
-
if (isNaN(parseInt(element.getAttribute(attr)))) {
|
|
10
|
-
offset = document.querySelector(element.getAttribute(attr)).offsetHeight;
|
|
11
|
-
} else {
|
|
12
|
-
offset = parseInt(element.getAttribute(attr));
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
document.documentElement.scroll({top: element.offsetTop - offset, behavior: "smooth"});
|
|
5
|
+
document.documentElement.scroll({ top: element.offsetTop - offset, behavior: 'smooth' })
|
|
18
6
|
},
|
|
19
7
|
action: (element) => {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
href = element.getAttribute("data-action-href");
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
let id = document.querySelector("[id=" + href.replace('#', '') + "]");
|
|
27
|
-
let options = element.getAttribute("data-action-options");
|
|
8
|
+
const href = element.href ? element.getAttribute('href') : element.getAttribute('data-action-href')
|
|
9
|
+
const data = element.dataset.libAnhor ? element.dataset.libAnhor : ''
|
|
10
|
+
const target = document.querySelector(`[id="${href.replace('#', '')}"]`)
|
|
28
11
|
|
|
29
|
-
if (
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
if (id !== null) {
|
|
34
|
-
if (!(options.indexOf("mobile") > -1 && window.innerWidth > 960)) {
|
|
35
|
-
|
|
36
|
-
LibAnchor.animation(id);
|
|
12
|
+
if (target !== null) {
|
|
13
|
+
if (!(data.includes('mobile') && window.innerWidth > 960)) {
|
|
14
|
+
LibAnchor.animation(target)
|
|
15
|
+
}
|
|
37
16
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
17
|
+
if (!data.includes('silent')) {
|
|
18
|
+
window.location.hash = target.id
|
|
41
19
|
}
|
|
42
20
|
}
|
|
43
21
|
},
|
|
44
22
|
init: () => {
|
|
45
|
-
|
|
23
|
+
const selector = document.querySelectorAll('[id]')
|
|
46
24
|
|
|
47
25
|
if (selector[0] !== null) {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
LibAnchor.animation(element);
|
|
26
|
+
selector.forEach(element => {
|
|
27
|
+
if (window.location.hash && element.getAttribute('id') === window.location.hash.replace('#', '')) {
|
|
28
|
+
LibAnchor.animation(element)
|
|
52
29
|
}
|
|
53
|
-
})
|
|
30
|
+
})
|
|
54
31
|
}
|
|
55
32
|
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
LibAnchor.init();
|
|
33
|
+
}
|
|
59
34
|
|
|
60
|
-
export default LibAnchor
|
|
35
|
+
export default LibAnchor
|
|
@@ -1,82 +1,61 @@
|
|
|
1
1
|
const LibCookieConsent = {
|
|
2
2
|
init: () => {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
LibCookieConsent.append("performance");
|
|
8
|
-
} else if (type === "marketing") {
|
|
9
|
-
LibCookieConsent.append("all");
|
|
10
|
-
}
|
|
11
|
-
} else {
|
|
12
|
-
LibCookieConsent.append("all");
|
|
13
|
-
}
|
|
14
|
-
} else if (localStorage.getItem('cookieconsent') === null) {
|
|
15
|
-
LibCookieConsent.append("all");
|
|
3
|
+
const type = localStorage.getItem('lib-cookieconsent')
|
|
4
|
+
|
|
5
|
+
if (type !== null) {
|
|
6
|
+
JSON.parse(type).forEach(type => LibCookieConsent.append(type))
|
|
16
7
|
}
|
|
17
8
|
},
|
|
18
|
-
set: (type
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
localStorage.setItem(
|
|
26
|
-
LibCookieConsent.
|
|
27
|
-
|
|
28
|
-
} else if (type === "marketing") {
|
|
29
|
-
localStorage.setItem("cookieconsent", "approve");
|
|
30
|
-
localStorage.setItem("cookieconsent_type", "marketing");
|
|
31
|
-
LibCookieConsent.append("all");
|
|
32
|
-
|
|
33
|
-
} else if (type === "decline") {
|
|
34
|
-
localStorage.setItem("cookieconsent", "decline");
|
|
35
|
-
localStorage.removeItem("cookieconsent_type");
|
|
36
|
-
LibCookieConsent.remove();
|
|
37
|
-
|
|
38
|
-
if (callback) {
|
|
39
|
-
callback();
|
|
40
|
-
}
|
|
9
|
+
set: (type) => {
|
|
10
|
+
localStorage.setItem('lib-cookieconsent', JSON.stringify(type))
|
|
11
|
+
localStorage.setItem('lib-cookieconsent-expire', (Date.now() + 31556926 * 1000).toString())
|
|
12
|
+
|
|
13
|
+
if (type.length > 0) {
|
|
14
|
+
type.forEach(type => LibCookieConsent.append(type))
|
|
15
|
+
} else {
|
|
16
|
+
localStorage.setItem('lib-cookieconsent', JSON.stringify([]))
|
|
17
|
+
LibCookieConsent.remove()
|
|
41
18
|
}
|
|
42
19
|
},
|
|
43
20
|
remove: () => {
|
|
44
|
-
document.cookie.split(
|
|
45
|
-
document.cookie = c.replace(/^ +/,
|
|
46
|
-
})
|
|
21
|
+
document.cookie.split(';').forEach(c => {
|
|
22
|
+
document.cookie = c.replace(/^ +/, '').replace(/=.*/, '=;expires=' + new Date().toUTCString() + ';path=/')
|
|
23
|
+
})
|
|
47
24
|
},
|
|
48
25
|
append: (type) => {
|
|
49
|
-
|
|
50
|
-
if (type ===
|
|
51
|
-
|
|
52
|
-
let delay = 0
|
|
26
|
+
document.querySelectorAll('[data-lib-cookieconsent]').forEach(elm => {
|
|
27
|
+
if (type === 'all' || elm.getAttribute('data-lib-cookieconsent') === type) {
|
|
28
|
+
const script = document.createElement('script')
|
|
29
|
+
let delay = 0
|
|
53
30
|
|
|
54
|
-
[...elm.attributes].forEach((attribute) => {
|
|
31
|
+
;[...elm.attributes].forEach((attribute) => {
|
|
55
32
|
if (attribute.specified) {
|
|
56
|
-
if (attribute.name.indexOf(
|
|
57
|
-
script.setAttribute(attribute.name, attribute.value)
|
|
33
|
+
if (attribute.name.indexOf('data-lib-cookieconsent') === -1 && attribute.name.indexOf('type') === -1) {
|
|
34
|
+
script.setAttribute(attribute.name, attribute.value)
|
|
58
35
|
}
|
|
59
36
|
}
|
|
60
|
-
})
|
|
37
|
+
})
|
|
61
38
|
|
|
62
|
-
script.innerHTML = elm.innerHTML
|
|
39
|
+
script.innerHTML = elm.innerHTML
|
|
63
40
|
|
|
64
|
-
if (elm.getAttribute(
|
|
65
|
-
delay = parseInt(elm.getAttribute(
|
|
41
|
+
if (elm.getAttribute('data-lib-cookieconsent-delay')) {
|
|
42
|
+
delay = parseInt(elm.getAttribute('data-lib-cookieconsent-delay'))
|
|
66
43
|
}
|
|
67
44
|
|
|
68
45
|
setTimeout(() => {
|
|
69
|
-
if (elm.closest(
|
|
70
|
-
document.body.appendChild(script)
|
|
71
|
-
} else if (elm.closest(
|
|
72
|
-
document.head.appendChild(script)
|
|
46
|
+
if (elm.closest('body') !== null) {
|
|
47
|
+
document.body.appendChild(script)
|
|
48
|
+
} else if (elm.closest('head') !== null) {
|
|
49
|
+
document.head.appendChild(script)
|
|
73
50
|
}
|
|
74
51
|
|
|
75
|
-
elm.remove()
|
|
76
|
-
}, delay)
|
|
52
|
+
elm.remove()
|
|
53
|
+
}, delay)
|
|
77
54
|
}
|
|
78
55
|
})
|
|
79
56
|
}
|
|
80
|
-
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
LibCookieConsent.init()
|
|
81
60
|
|
|
82
|
-
export default LibCookieConsent
|
|
61
|
+
export default LibCookieConsent
|