wonder-image 1.2.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/DOCS.md +12 -0
- package/LICENSE +21 -0
- package/README.md +1 -0
- package/babel.config.json +3 -0
- package/demo/backend/body-end.php +10 -0
- package/demo/backend/head.php +93 -0
- package/demo/frontend/body-end.php +19 -0
- package/demo/frontend/head.php +244 -0
- package/demo/wonder-image.php +41 -0
- package/dist/0d01fa889dc2b0202b98.png +0 -0
- package/dist/203d1199e7aef04c0a34.gif +0 -0
- package/dist/26d6ed3fa1c815e4c78f.png +0 -0
- package/dist/39795c0b4513de014cf8.woff +0 -0
- package/dist/40b30ca122107c2852be.png +0 -0
- package/dist/4a7b4107b62ef059ba65.png +0 -0
- package/dist/4dce7f71b08755f19759.png +0 -0
- package/dist/60af14fddca897f348bb.png +0 -0
- package/dist/67172a36bcdeaca8592a.png +0 -0
- package/dist/a85c6dc53638f894de38.png +0 -0
- package/dist/b7bcc075b395c14ce8c2.woff2 +0 -0
- package/dist/backend/body-end.js +3 -0
- package/dist/backend/body-end.js.LICENSE.txt +44 -0
- package/dist/backend/body-end.js.map +1 -0
- package/dist/backend/head.css +2 -0
- package/dist/backend/head.css.map +1 -0
- package/dist/backend/head.js +3 -0
- package/dist/backend/head.js.LICENSE.txt +46 -0
- package/dist/backend/head.js.map +1 -0
- package/dist/backend/lib.js +2 -0
- package/dist/backend/lib.js.LICENSE.txt +1 -0
- package/dist/frontend/body-end.js +3 -0
- package/dist/frontend/body-end.js.LICENSE.txt +46 -0
- package/dist/frontend/body-end.js.map +1 -0
- package/dist/frontend/head.css +2 -0
- package/dist/frontend/head.css.map +1 -0
- package/dist/frontend/head.js +3 -0
- package/dist/frontend/head.js.LICENSE.txt +46 -0
- package/dist/frontend/head.js.map +1 -0
- package/dist/frontend/lib.css +2 -0
- package/dist/frontend/lib.css.map +1 -0
- package/dist/frontend/lib.js +3 -0
- package/dist/frontend/lib.js.LICENSE.txt +151 -0
- package/dist/frontend/lib.js.map +1 -0
- package/dist/lib/autonumeric/autonumeric.js +3 -0
- package/dist/lib/autonumeric/autonumeric.js.LICENSE.txt +47 -0
- package/dist/lib/autonumeric/autonumeric.js.map +1 -0
- package/dist/lib/bootstrap/bootstrap-datepicker.css +2 -0
- package/dist/lib/bootstrap/bootstrap-datepicker.css.map +1 -0
- package/dist/lib/bootstrap/bootstrap-datepicker.js +3 -0
- package/dist/lib/bootstrap/bootstrap-datepicker.js.LICENSE.txt +42 -0
- package/dist/lib/bootstrap/bootstrap-datepicker.js.map +1 -0
- package/dist/lib/bootstrap/bootstrap-icons.css +2 -0
- package/dist/lib/bootstrap/bootstrap-icons.css.map +1 -0
- package/dist/lib/bootstrap/bootstrap-icons.js +3 -0
- package/dist/lib/bootstrap/bootstrap-icons.js.LICENSE.txt +13 -0
- package/dist/lib/bootstrap/bootstrap-icons.js.map +1 -0
- package/dist/lib/bootstrap/bootstrap.css +2 -0
- package/dist/lib/bootstrap/bootstrap.css.map +1 -0
- package/dist/lib/bootstrap/bootstrap.js +3 -0
- package/dist/lib/bootstrap/bootstrap.js.LICENSE.txt +44 -0
- package/dist/lib/bootstrap/bootstrap.js.map +1 -0
- package/dist/lib/chartjs/chart.js +3 -0
- package/dist/lib/chartjs/chart.js.LICENSE.txt +1467 -0
- package/dist/lib/chartjs/chart.js.map +1 -0
- package/dist/lib/datatables/datatables.css +2 -0
- package/dist/lib/datatables/datatables.css.map +1 -0
- package/dist/lib/datatables/datatables.js +3 -0
- package/dist/lib/datatables/datatables.js.LICENSE.txt +8988 -0
- package/dist/lib/datatables/datatables.js.map +1 -0
- package/dist/lib/editorjs/editor.js +3 -0
- package/dist/lib/editorjs/editor.js.LICENSE.txt +5812 -0
- package/dist/lib/editorjs/editor.js.map +1 -0
- package/dist/lib/fancyapps/fancyapps.css +2 -0
- package/dist/lib/fancyapps/fancyapps.css.map +1 -0
- package/dist/lib/fancyapps/fancyapps.js +3 -0
- package/dist/lib/fancyapps/fancyapps.js.LICENSE.txt +19 -0
- package/dist/lib/fancyapps/fancyapps.js.map +1 -0
- package/dist/lib/filepond/filepond.css +2 -0
- package/dist/lib/filepond/filepond.css.map +1 -0
- package/dist/lib/filepond/filepond.js +3 -0
- package/dist/lib/filepond/filepond.js.LICENSE.txt +2797 -0
- package/dist/lib/filepond/filepond.js.map +1 -0
- package/dist/lib/fullcalendar/fullcalendar.js +3 -0
- package/dist/lib/fullcalendar/fullcalendar.js.LICENSE.txt +3787 -0
- package/dist/lib/fullcalendar/fullcalendar.js.map +1 -0
- package/dist/lib/jquery/jquery-plugin.css +2 -0
- package/dist/lib/jquery/jquery-plugin.css.map +1 -0
- package/dist/lib/jquery/jquery-plugin.js +3 -0
- package/dist/lib/jquery/jquery-plugin.js.LICENSE.txt +60 -0
- package/dist/lib/jquery/jquery-plugin.js.map +1 -0
- package/dist/lib/jquery/jquery.js +3 -0
- package/dist/lib/jquery/jquery.js.LICENSE.txt +3240 -0
- package/dist/lib/jquery/jquery.js.map +1 -0
- package/dist/lib/jstree/jstree.css +2 -0
- package/dist/lib/jstree/jstree.css.map +1 -0
- package/dist/lib/jstree/jstree.js +3 -0
- package/dist/lib/jstree/jstree.js.LICENSE.txt +42 -0
- package/dist/lib/jstree/jstree.js.map +1 -0
- package/dist/lib/moment/moment.js +3 -0
- package/dist/lib/moment/moment.js.LICENSE.txt +772 -0
- package/dist/lib/moment/moment.js.map +1 -0
- package/dist/lib/quilljs/quill.css +2 -0
- package/dist/lib/quilljs/quill.css.map +1 -0
- package/dist/lib/quilljs/quill.js +3 -0
- package/dist/lib/quilljs/quill.js.LICENSE.txt +3038 -0
- package/dist/lib/quilljs/quill.js.map +1 -0
- package/dist/lib/swiperjs/swiper-plugin.css +2 -0
- package/dist/lib/swiperjs/swiper-plugin.css.map +1 -0
- package/dist/lib/swiperjs/swiper-plugin.js +3 -0
- package/dist/lib/swiperjs/swiper-plugin.js.LICENSE.txt +1113 -0
- package/dist/lib/swiperjs/swiper-plugin.js.map +1 -0
- package/dist/lib/swiperjs/swiper.css +2 -0
- package/dist/lib/swiperjs/swiper.css.map +1 -0
- package/dist/lib/swiperjs/swiper.js +3 -0
- package/dist/lib/swiperjs/swiper.js.LICENSE.txt +651 -0
- package/dist/lib/swiperjs/swiper.js.map +1 -0
- package/dist/lib/videojs/video.css +2 -0
- package/dist/lib/videojs/video.css.map +1 -0
- package/dist/lib/videojs/video.js +3 -0
- package/dist/lib/videojs/video.js.LICENSE.txt +23391 -0
- package/dist/lib/videojs/video.js.map +1 -0
- package/package.json +95 -0
- package/src/build/backend/css/header.css +252 -0
- package/src/build/backend/css/input.css +295 -0
- package/src/build/backend/css/list.css +57 -0
- package/src/build/backend/css/order.css +99 -0
- package/src/build/backend/js/ajax.js +96 -0
- package/src/build/backend/js/alert.js +78 -0
- package/src/build/backend/js/bootstrap.js +52 -0
- package/src/build/backend/js/form/editor.js +293 -0
- package/src/build/backend/js/form/file.js +142 -0
- package/src/build/backend/js/form/filepond.js +11 -0
- package/src/build/backend/js/form/input.js +313 -0
- package/src/build/backend/js/form/inputRow.js +164 -0
- package/src/build/backend/js/form/send.js +14 -0
- package/src/build/backend/js/form/set.js +314 -0
- package/src/build/backend/js/jquery.js +15 -0
- package/src/build/backend/js/list.js +19 -0
- package/src/build/backend/js/modal.js +31 -0
- package/src/build/backend/js/pageSetUp.js +125 -0
- package/src/build/backend/js/utility.js +38 -0
- package/src/build/frontend/css/class/dimension.css +3376 -0
- package/src/build/frontend/css/class/function.css +316 -0
- package/src/build/frontend/css/class/grid.css +240 -0
- package/src/build/frontend/css/class/margin.css +823 -0
- package/src/build/frontend/css/class/padding.css +760 -0
- package/src/build/frontend/css/class/position.css +351 -0
- package/src/build/frontend/css/class/resize.css +24 -0
- package/src/build/frontend/css/class/section.css +41 -0
- package/src/build/frontend/css/class/text.css +244 -0
- package/src/build/frontend/css/components/alert.css +42 -0
- package/src/build/frontend/css/components/button.css +107 -0
- package/src/build/frontend/css/components/dropdown.css +118 -0
- package/src/build/frontend/css/components/form/address.css +26 -0
- package/src/build/frontend/css/components/form/checkbox.css +65 -0
- package/src/build/frontend/css/components/form/date.css +133 -0
- package/src/build/frontend/css/components/form/input.css +176 -0
- package/src/build/frontend/css/components/form/select.css +69 -0
- package/src/build/frontend/css/components/header/hamburger/hamburger-1.css +56 -0
- package/src/build/frontend/css/components/header/hamburger/hamburger.css +58 -0
- package/src/build/frontend/css/components/header/header.css +57 -0
- package/src/build/frontend/css/components/header/mobile-nav.css +79 -0
- package/src/build/frontend/css/components/modal.css +76 -0
- package/src/build/frontend/css/components/spinner.css +37 -0
- package/src/build/frontend/css/generator/dimension.php +93 -0
- package/src/build/frontend/css/generator/margin.php +48 -0
- package/src/build/frontend/css/generator/padding.php +48 -0
- package/src/build/frontend/css/lib.css +3 -0
- package/src/build/frontend/css/main.css +37 -0
- package/src/build/frontend/js/alert.js +64 -0
- package/src/build/frontend/js/aos.js +9 -0
- package/src/build/frontend/js/dropdown.js +73 -0
- package/src/build/frontend/js/form/input.js +211 -0
- package/src/build/frontend/js/form/list.js +155 -0
- package/src/build/frontend/js/form/select.js +108 -0
- package/src/build/frontend/js/form/send.js +137 -0
- package/src/build/frontend/js/header.js +12 -0
- package/src/build/frontend/js/modal.js +26 -0
- package/src/build/frontend/js/pageSetUp.js +35 -0
- package/src/build/frontend/js/scroll.js +70 -0
- package/src/build/frontend/js/utility.js +21 -0
- package/src/build/global/js/canvas.js +82 -0
- package/src/build/global/js/fetch.js +47 -0
- package/src/build/global/js/form/autonumeric.js +136 -0
- package/src/build/global/js/form/phone.js +19 -0
- package/src/build/global/js/utility.js +88 -0
- package/src/build/global/js/video.js +7 -0
- package/src/build/lib/editorjs/gallery.js +39 -0
- package/src/build/lib/editorjs/hyperlink.js +170 -0
- package/src/build/lib/editorjs/video.js +61 -0
- package/src/build/lib/swiperjs/effect-carousel.css +24 -0
- package/src/build/lib/swiperjs/effect-carousel.esm.js +102 -0
- package/src/build/lib/swiperjs/effect-shutters.css +33 -0
- package/src/build/lib/swiperjs/effect-shutters.esm.js +114 -0
- package/src/build/lib/swiperjs/effect-slicer.css +39 -0
- package/src/build/lib/swiperjs/effect-slicer.esm.js +198 -0
- package/src/build/lib/swiperjs/swiper-gl.css +44 -0
- package/src/build/lib/swiperjs/swiper-gl.esm.js +6063 -0
- package/src/export/backend/body-end.js +4 -0
- package/src/export/backend/head.js +25 -0
- package/src/export/backend/lib.js +0 -0
- package/src/export/frontend/body-end.js +9 -0
- package/src/export/frontend/head.js +42 -0
- package/src/export/frontend/lib.js +17 -0
- package/src/export/lib/autonumeric/autonumeric.js +3 -0
- package/src/export/lib/bootstrap/bootstrap-datepicker.js +4 -0
- package/src/export/lib/bootstrap/bootstrap-icons.js +2 -0
- package/src/export/lib/bootstrap/bootstrap.js +3 -0
- package/src/export/lib/chartjs/chart.js +4 -0
- package/src/export/lib/datatables/datatables.js +6 -0
- package/src/export/lib/editorjs/editor.js +48 -0
- package/src/export/lib/fancyapps/fancyapps.js +7 -0
- package/src/export/lib/filepond/filepond.js +51 -0
- package/src/export/lib/fullcalendar/fullcalendar.js +29 -0
- package/src/export/lib/jquery/jquery-plugin.js +14 -0
- package/src/export/lib/jquery/jquery.js +4 -0
- package/src/export/lib/jstree/jstree.js +2 -0
- package/src/export/lib/moment/moment.js +12 -0
- package/src/export/lib/quilljs/quill.js +4 -0
- package/src/export/lib/swiperjs/swiper-plugin.js +20 -0
- package/src/export/lib/swiperjs/swiper.js +4 -0
- package/src/export/lib/videojs/video.js +3 -0
- package/webpack.config.js +79 -0
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
function toggleDropdown(container) {
|
|
2
|
+
|
|
3
|
+
if (container.classList.contains('wi-show')) {
|
|
4
|
+
closeDropdown(container);
|
|
5
|
+
} else {
|
|
6
|
+
openDropdown(container);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function openDropdown(container) {
|
|
12
|
+
|
|
13
|
+
container.classList.add('wi-show');
|
|
14
|
+
|
|
15
|
+
if (container.querySelector('i.bi-chevron-down')) {
|
|
16
|
+
container.querySelector('i.bi-chevron-down').classList.add('bi-chevron-up');
|
|
17
|
+
container.querySelector('i.bi-chevron-down').classList.remove('bi-chevron-down');
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
if (container.querySelector('i.bi-plus')) {
|
|
21
|
+
container.querySelector('i.bi-plus').classList.add('bi-dash');
|
|
22
|
+
container.querySelector('i.bi-plus').classList.remove('bi-plus');
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (container.querySelector('i.bi-plus-lg')) {
|
|
26
|
+
container.querySelector('i.bi-plus-lg').classList.add('bi-dash-lg');
|
|
27
|
+
container.querySelector('i.bi-plus-lg').classList.remove('bi-plus-lg');
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function closeDropdown(container) {
|
|
33
|
+
|
|
34
|
+
container.classList.remove('wi-show');
|
|
35
|
+
|
|
36
|
+
if (container.querySelector('i.bi-chevron-up')) {
|
|
37
|
+
container.querySelector('i.bi-chevron-up').classList.add('bi-chevron-down');
|
|
38
|
+
container.querySelector('i.bi-chevron-up').classList.remove('bi-chevron-up');
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (container.querySelector('i.bi-dash')) {
|
|
42
|
+
container.querySelector('i.bi-dash').classList.add('bi-plus');
|
|
43
|
+
container.querySelector('i.bi-dash').classList.remove('bi-dash');
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (container.querySelector('i.bi-dash-lg')) {
|
|
47
|
+
container.querySelector('i.bi-dash-lg').classList.add('bi-plus-lg');
|
|
48
|
+
container.querySelector('i.bi-dash-lg').classList.remove('bi-dash-lg');
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function setDropdown() {
|
|
54
|
+
|
|
55
|
+
document.querySelectorAll(".wi-dropdown-btn .wi-switcher").forEach(element => {
|
|
56
|
+
|
|
57
|
+
element.onclick = function() { toggleDropdown(element.parentElement); };
|
|
58
|
+
|
|
59
|
+
element.parentElement.onmouseleave = function() { closeDropdown(element.parentElement); };
|
|
60
|
+
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
document.querySelectorAll(".wi-dropdown-box .wi-switcher").forEach(element => {
|
|
64
|
+
|
|
65
|
+
if (element.parentElement.classList.contains('wi-show')) {
|
|
66
|
+
openDropdown(element.parentElement);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
element.onclick = function() { toggleDropdown(element.parentElement); };
|
|
70
|
+
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
}
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
function check() {
|
|
2
|
+
|
|
3
|
+
document.querySelectorAll("form .wi-submit").forEach(button => {
|
|
4
|
+
|
|
5
|
+
button.removeAttribute("disabled");
|
|
6
|
+
|
|
7
|
+
var inputList = button.form.elements;
|
|
8
|
+
|
|
9
|
+
for (let i = 0; i < inputList.length; i++) {
|
|
10
|
+
|
|
11
|
+
var input = inputList[i];
|
|
12
|
+
|
|
13
|
+
if (input.required) {
|
|
14
|
+
if (input.type == 'checkbox' || input.type == 'radio') {
|
|
15
|
+
if (input.checked == false) { button.setAttribute("disabled", null); }
|
|
16
|
+
} else {
|
|
17
|
+
if (input.value == "") { button.setAttribute("disabled", null); }
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function togglePassword(el, id) {
|
|
28
|
+
|
|
29
|
+
var input = document.getElementById(id);
|
|
30
|
+
|
|
31
|
+
if (input.type == 'password') {
|
|
32
|
+
input.type = 'text'
|
|
33
|
+
el.classList.remove('bi-eye');
|
|
34
|
+
el.classList.add('bi-eye-slash');
|
|
35
|
+
}else{
|
|
36
|
+
input.type = 'password'
|
|
37
|
+
el.classList.remove('bi-eye-slash');
|
|
38
|
+
el.classList.add('bi-eye');
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function checkNumber(event) {
|
|
44
|
+
|
|
45
|
+
event.target.value = event.target.value.replace(/[^0-9.]/g, '').replace(/(\..*?)\..*/g, '$1');
|
|
46
|
+
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function labelPositionTop(event) {
|
|
50
|
+
|
|
51
|
+
event.target.parentElement.classList.add('compiled');
|
|
52
|
+
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function labelPosition(event) {
|
|
56
|
+
|
|
57
|
+
var container = event.target.parentElement;
|
|
58
|
+
|
|
59
|
+
if (event.target.value == '' && event.target !== document.activeElement) {
|
|
60
|
+
container.classList.remove('compiled');
|
|
61
|
+
} else {
|
|
62
|
+
container.classList.add('compiled');
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function customDateRange(element) {
|
|
68
|
+
|
|
69
|
+
var inputFrom = element.querySelector('input.wi-daterange-from');
|
|
70
|
+
var inputTo = element.querySelector('input.wi-daterange-to');
|
|
71
|
+
|
|
72
|
+
if (inputFrom.value != '') {
|
|
73
|
+
$('#'+inputTo.id).datepicker('option', 'minDate', inputFrom.value);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function customDateTimeRange(element) {
|
|
79
|
+
|
|
80
|
+
var inputFrom = element.querySelector('input.wi-datetimerange-from');
|
|
81
|
+
var inputTo = element.querySelector('input.wi-datetimerange-to');
|
|
82
|
+
|
|
83
|
+
if (inputFrom.value != '') {
|
|
84
|
+
$('#'+inputTo.id).datetimepicker('option', 'minDate', inputFrom.value);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function checkLabel() {
|
|
90
|
+
|
|
91
|
+
document.querySelectorAll("[data-wi-label='true']").forEach(element => {
|
|
92
|
+
|
|
93
|
+
var container = element.parentElement;
|
|
94
|
+
|
|
95
|
+
if (element.value == '') {
|
|
96
|
+
container.classList.remove('compiled');
|
|
97
|
+
} else {
|
|
98
|
+
container.classList.add('compiled');
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function checkInputFile(event) {
|
|
106
|
+
|
|
107
|
+
var input = event.target;
|
|
108
|
+
|
|
109
|
+
var inputContainer = input.parentElement;
|
|
110
|
+
var errorContainer = inputContainer.querySelector('.alert-error');
|
|
111
|
+
|
|
112
|
+
var maxFile = input.dataset.wiMaxFile;
|
|
113
|
+
var maxSize = input.dataset.wiMaxSize;
|
|
114
|
+
var prettyMaxSize = ((maxSize/1024)/1024).toFixed(2); // MB
|
|
115
|
+
|
|
116
|
+
var prettyErrorFile = "<i class='bi bi-exclamation-triangle'></i> Hai caricato troppi file! Puoi caricare massimo "+maxFile+" file";
|
|
117
|
+
var prettyErrorSize = "<i class='bi bi-exclamation-triangle'></i> Hai caricato file troppo grandi! Le dimensioni massime sono di "+prettyMaxSize+"Mb";
|
|
118
|
+
|
|
119
|
+
var files = input.files;
|
|
120
|
+
|
|
121
|
+
inputContainer.classList.remove('input-error');
|
|
122
|
+
errorContainer.innerHTML = '';
|
|
123
|
+
|
|
124
|
+
for (var x in files) {
|
|
125
|
+
|
|
126
|
+
if(files[x].size > maxSize){
|
|
127
|
+
|
|
128
|
+
inputContainer.classList.add('input-error');
|
|
129
|
+
errorContainer.innerHTML = prettyErrorSize;
|
|
130
|
+
input.value = "";
|
|
131
|
+
break;
|
|
132
|
+
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
if (files.length > maxFile) {
|
|
138
|
+
|
|
139
|
+
inputContainer.classList.add('input-error');
|
|
140
|
+
errorContainer.innerHTML = prettyErrorFile;
|
|
141
|
+
input.value = "";
|
|
142
|
+
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
function setInput() {
|
|
148
|
+
|
|
149
|
+
document.querySelectorAll("[data-wi-max-file]").forEach(element => {
|
|
150
|
+
element.addEventListener("change", checkInputFile);
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
document.querySelectorAll("[data-wi-max-size]").forEach(element => {
|
|
154
|
+
element.addEventListener("change", checkInputFile);
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
document.querySelectorAll("[data-wi-label='true']").forEach(element => {
|
|
158
|
+
element.addEventListener("input", labelPosition);
|
|
159
|
+
element.addEventListener("change", labelPosition);
|
|
160
|
+
element.addEventListener("focusin", labelPositionTop);
|
|
161
|
+
element.addEventListener("focusout", labelPosition);
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
document.querySelectorAll("[data-wi-check='true']").forEach(element => {
|
|
165
|
+
element.addEventListener("keyup", check);
|
|
166
|
+
element.addEventListener("change", check);
|
|
167
|
+
element.addEventListener("focusin", check);
|
|
168
|
+
element.addEventListener("focusout", check);
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
document.querySelectorAll("[data-wi-list-input='true']").forEach(element => {
|
|
172
|
+
element.addEventListener("keyup", searchInput);
|
|
173
|
+
element.addEventListener("focusin", searchInput);
|
|
174
|
+
element.addEventListener("keyup", showList);
|
|
175
|
+
element.addEventListener("focusout", hideList);
|
|
176
|
+
element.addEventListener("change", controlList);
|
|
177
|
+
element.addEventListener("focusout", controlList);
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
document.querySelectorAll("[data-wi-search-input='true']").forEach(element => {
|
|
181
|
+
element.addEventListener("keyup", showList);
|
|
182
|
+
element.addEventListener("keyup", searchResults);
|
|
183
|
+
element.addEventListener("change", controlList);
|
|
184
|
+
element.addEventListener("focusout", hideList);
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
document.querySelectorAll("[data-wi-search-text='true']").forEach(element => {
|
|
188
|
+
element.addEventListener("keyup", showList);
|
|
189
|
+
element.addEventListener("keyup", searchText);
|
|
190
|
+
element.addEventListener("focusout", hideList);
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
document.querySelectorAll("[data-wi-search-radio='true']").forEach(element => {
|
|
194
|
+
element.addEventListener("keyup", showList);
|
|
195
|
+
element.addEventListener("keyup", searchRadio);
|
|
196
|
+
element.addEventListener("focusout", hideList);
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
document.querySelectorAll("[data-wi-list-value='true']").forEach(element => {
|
|
200
|
+
element.addEventListener("click", checkInput);
|
|
201
|
+
element.addEventListener("mousedown", checkInput);
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
document.querySelectorAll("[data-wi-phone='true']").forEach(element => {
|
|
205
|
+
checkPhone(element);
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
check();
|
|
209
|
+
setAutonumeric();
|
|
210
|
+
|
|
211
|
+
}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
function searchInput(event) {
|
|
2
|
+
|
|
3
|
+
var inputId = event.target.id;
|
|
4
|
+
var inputValue = event.target.value.toLowerCase();
|
|
5
|
+
|
|
6
|
+
document.querySelectorAll('#list_'+inputId+' input').forEach(x => {
|
|
7
|
+
|
|
8
|
+
var keyword = x.dataset.wiKeyword.toLowerCase();
|
|
9
|
+
|
|
10
|
+
if (keyword.includes(inputValue)) {
|
|
11
|
+
x.parentElement.style.display = 'block';
|
|
12
|
+
}else{
|
|
13
|
+
x.parentElement.style.display = 'none';
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function checkInput(event) {
|
|
21
|
+
|
|
22
|
+
var container = event.target;
|
|
23
|
+
|
|
24
|
+
if (container.localName == 'div') {
|
|
25
|
+
var checkbox = container.querySelector('input');
|
|
26
|
+
} else {
|
|
27
|
+
var checkbox = container;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
var inputId = checkbox.dataset.wiInput;
|
|
31
|
+
|
|
32
|
+
checkbox.checked = true;
|
|
33
|
+
|
|
34
|
+
var input = document.querySelector('#'+inputId);
|
|
35
|
+
input.value = checkbox.dataset.wiName;
|
|
36
|
+
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function controlList(event) {
|
|
40
|
+
|
|
41
|
+
var element = event.target;
|
|
42
|
+
var container = event.target.parentElement;
|
|
43
|
+
var spanAlert = container.querySelector('.alert-error');
|
|
44
|
+
|
|
45
|
+
var l = element.dataset.wiListArray.split('|');
|
|
46
|
+
var v = element.value.toLowerCase();
|
|
47
|
+
|
|
48
|
+
if (v != '') {
|
|
49
|
+
if (l.includes(v)) {
|
|
50
|
+
|
|
51
|
+
spanAlert.innerHTML = "";
|
|
52
|
+
container.classList.remove('input-error');
|
|
53
|
+
element.setCustomValidity('');
|
|
54
|
+
|
|
55
|
+
container.querySelectorAll('input[type=radio]').forEach(e => {
|
|
56
|
+
var name = e.dataset.wiName;
|
|
57
|
+
if (name.toLowerCase() == v) {
|
|
58
|
+
e.checked = true;
|
|
59
|
+
}else{
|
|
60
|
+
e.checked = false;
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
} else {
|
|
65
|
+
|
|
66
|
+
spanAlert.innerHTML = "<i class='bi bi-exclamation-triangle'></i> Campo non corretto!";
|
|
67
|
+
element.setCustomValidity('Non valido');
|
|
68
|
+
container.classList.add('input-error');
|
|
69
|
+
|
|
70
|
+
container.querySelectorAll('input[type=radio]:checked').forEach(e => {
|
|
71
|
+
e.checked = false;
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function showList(event) { event.target.parentElement.classList.add('wi-list-active'); }
|
|
80
|
+
|
|
81
|
+
function hideList(event) { event.target.parentElement.classList.remove('wi-list-active'); }
|
|
82
|
+
|
|
83
|
+
function searchText(event) { searchResults(event, "text"); }
|
|
84
|
+
|
|
85
|
+
function searchRadio(event) { searchResults(event, "radio"); }
|
|
86
|
+
|
|
87
|
+
function searchResults(event, result) {
|
|
88
|
+
|
|
89
|
+
var input = event.target;
|
|
90
|
+
|
|
91
|
+
var container = input.parentElement;
|
|
92
|
+
|
|
93
|
+
var list = container.querySelector('.wi-input-list');
|
|
94
|
+
var listValue = list.querySelector('.wi-input-list-body');
|
|
95
|
+
var listFooter = list.querySelector('.wi-input-list-footer');
|
|
96
|
+
|
|
97
|
+
var inputId = input.id;
|
|
98
|
+
var inputName = input.dataset.wiName;
|
|
99
|
+
var inputValue = input.value.toLowerCase();
|
|
100
|
+
|
|
101
|
+
var inputUrl = input.dataset.wiSearchUrl;
|
|
102
|
+
|
|
103
|
+
if (result == 'radio') {
|
|
104
|
+
var radioName = "name='"+inputName+"'";
|
|
105
|
+
} else {
|
|
106
|
+
var radioName = "";
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
$.ajax({
|
|
110
|
+
type: "POST",
|
|
111
|
+
url: inputUrl,
|
|
112
|
+
data: {
|
|
113
|
+
post: 'true',
|
|
114
|
+
search: inputValue
|
|
115
|
+
},
|
|
116
|
+
success: function (data) {
|
|
117
|
+
|
|
118
|
+
const response = JSON.parse(data);
|
|
119
|
+
const nResponse = response.length;
|
|
120
|
+
|
|
121
|
+
var listHTML = "";
|
|
122
|
+
|
|
123
|
+
for (let index = 0; index < nResponse; index++) {
|
|
124
|
+
|
|
125
|
+
const value = response[index]['value'];
|
|
126
|
+
const label = response[index]['label'];
|
|
127
|
+
const inputValue = response[index]['input-value'];
|
|
128
|
+
|
|
129
|
+
listHTML += "<div class='wi-input-list-value' data-wi-list-value='true'><input data-wi-input='"+inputId+"' type='radio' "+radioName+" data-wi-name='"+inputValue+"' value='"+value+"'>"+label+"</div>";
|
|
130
|
+
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
if (inputValue == '') {
|
|
134
|
+
listFooter.innerHTML = "Cosa stai cercando?";
|
|
135
|
+
} else if (nResponse == 1) {
|
|
136
|
+
listFooter.innerHTML = nResponse+" risultato";
|
|
137
|
+
} else if (nResponse != 1) {
|
|
138
|
+
listFooter.innerHTML = nResponse+" risultati";
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
listValue.innerHTML = listHTML;
|
|
142
|
+
|
|
143
|
+
document.querySelectorAll("[data-wi-list-value='true']").forEach(element => {
|
|
144
|
+
element.addEventListener("click", checkInput);
|
|
145
|
+
element.addEventListener("mousedown", checkInput);
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
},
|
|
149
|
+
error: function (XMLHttpRequest) {
|
|
150
|
+
ajaxRequestError(XMLHttpRequest);
|
|
151
|
+
loadingSpinner();
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
var x, i, j, l, ll, selElmnt, a, b, c;
|
|
2
|
+
|
|
3
|
+
// Look for any elements with the class "custom-select":
|
|
4
|
+
x = document.querySelectorAll("[data-wi-select='true']");
|
|
5
|
+
l = x.length;
|
|
6
|
+
|
|
7
|
+
for (i = 0; i < l; i++) {
|
|
8
|
+
|
|
9
|
+
selElmnt = x[i].getElementsByTagName("select")[0];
|
|
10
|
+
ll = selElmnt.length;
|
|
11
|
+
|
|
12
|
+
// For each element, create a new DIV that will act as the selected item:
|
|
13
|
+
a = document.createElement("DIV");
|
|
14
|
+
a.setAttribute("class", "select-selected wi-input");
|
|
15
|
+
a.innerHTML = selElmnt.options[selElmnt.selectedIndex].innerHTML;
|
|
16
|
+
x[i].appendChild(a);
|
|
17
|
+
|
|
18
|
+
// For each element, create a new DIV that will contain the option list:
|
|
19
|
+
b = document.createElement("DIV");
|
|
20
|
+
b.setAttribute("class", "select-items wi-input-list no-scrollbar");
|
|
21
|
+
|
|
22
|
+
for (j = 0; j < ll; j++) {
|
|
23
|
+
|
|
24
|
+
// For each option in the original select element, create a new DIV that will act as an option item:
|
|
25
|
+
c = document.createElement("DIV");
|
|
26
|
+
c.id = selElmnt.options[j].value;
|
|
27
|
+
c.setAttribute("class", "wi-input-list-value");
|
|
28
|
+
c.innerHTML = selElmnt.options[j].innerHTML;
|
|
29
|
+
|
|
30
|
+
// Se è impostato un valore di default selezionalo
|
|
31
|
+
if (selElmnt.value != undefined) { if (c.id == selElmnt.value) { c.classList.add("same-as-selected"); } }
|
|
32
|
+
|
|
33
|
+
c.addEventListener("click", function(e) {
|
|
34
|
+
|
|
35
|
+
// When an item is clicked, update the original select box, and the selected item:
|
|
36
|
+
var y, i, k, s, h, sl, yl;
|
|
37
|
+
s = this.parentNode.parentNode.getElementsByTagName("select")[0];
|
|
38
|
+
sl = s.length;
|
|
39
|
+
selElmnt.value = this.id;
|
|
40
|
+
h = this.parentNode.previousSibling;
|
|
41
|
+
|
|
42
|
+
for (i = 0; i < sl; i++) {
|
|
43
|
+
if (s.options[i].innerHTML == this.innerHTML) {
|
|
44
|
+
s.selectedIndex = i;
|
|
45
|
+
h.innerHTML = this.innerHTML;
|
|
46
|
+
y = this.parentNode.getElementsByClassName("same-as-selected");
|
|
47
|
+
yl = y.length;
|
|
48
|
+
for (k = 0; k < yl; k++) {
|
|
49
|
+
y[k].classList.remove("same-as-selected");
|
|
50
|
+
}
|
|
51
|
+
this.setAttribute("class", "wi-input-list-value same-as-selected");
|
|
52
|
+
break;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
h.click();
|
|
57
|
+
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
// Passa le funzioni onchange dal select alle nuove opzioni
|
|
61
|
+
c.onclick = selElmnt.onchange;
|
|
62
|
+
c.mousedown = selElmnt.onchange;
|
|
63
|
+
|
|
64
|
+
b.appendChild(c);
|
|
65
|
+
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
x[i].appendChild(b);
|
|
69
|
+
|
|
70
|
+
a.addEventListener("click", function(e) {
|
|
71
|
+
|
|
72
|
+
// When the select box is clicked, close any other select boxes, and open/close the current select box
|
|
73
|
+
e.stopPropagation();
|
|
74
|
+
closeAllSelect(this);
|
|
75
|
+
this.classList.toggle("select-arrow-active");
|
|
76
|
+
this.parentNode.classList.toggle("wi-list-active");
|
|
77
|
+
check();
|
|
78
|
+
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function closeAllSelect(elmnt) {
|
|
84
|
+
|
|
85
|
+
// A function that will close all select boxes in the document, except the current select box:
|
|
86
|
+
var x, y, i, xl, yl, arrNo = [];
|
|
87
|
+
x = document.getElementsByClassName("select-items");
|
|
88
|
+
y = document.getElementsByClassName("select-selected");
|
|
89
|
+
var container = document.querySelector(".wi-input-container.wi-list-active");
|
|
90
|
+
xl = x.length;
|
|
91
|
+
yl = y.length;
|
|
92
|
+
|
|
93
|
+
for (i = 0; i < yl; i++) {
|
|
94
|
+
if (elmnt == y[i]) {
|
|
95
|
+
arrNo.push(i)
|
|
96
|
+
}else{
|
|
97
|
+
y[i].classList.remove("select-arrow-active");
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
if (container != null) {
|
|
102
|
+
container.classList.remove("wi-list-active");
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// If the user clicks anywhere outside the select box, then close all select boxes:
|
|
108
|
+
document.addEventListener("click", closeAllSelect);
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
function formToArray(formElements) {
|
|
2
|
+
|
|
3
|
+
const ARRAY = {};
|
|
4
|
+
|
|
5
|
+
for (let i = 0; i < formElements.length; i++) {
|
|
6
|
+
|
|
7
|
+
var add = false;
|
|
8
|
+
|
|
9
|
+
var input = formElements[i];
|
|
10
|
+
|
|
11
|
+
if (input.type == 'checkbox' || input.type == 'radio') {
|
|
12
|
+
if (input.checked == true) { var add = true; }
|
|
13
|
+
} else {
|
|
14
|
+
if (input.value != "") { var add = true;}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
if (add) {
|
|
18
|
+
|
|
19
|
+
var inputName = input.name;
|
|
20
|
+
var inputValue = input.value;
|
|
21
|
+
|
|
22
|
+
if (inputName.includes("[]")) {
|
|
23
|
+
|
|
24
|
+
inputName = inputName.replace("[]", "");
|
|
25
|
+
|
|
26
|
+
if (inputName in ARRAY) {
|
|
27
|
+
inputName = inputName.replace("[]", "");
|
|
28
|
+
ARRAY[inputName].push(inputValue);
|
|
29
|
+
} else {
|
|
30
|
+
inputName = inputName.replace("[]", "");
|
|
31
|
+
ARRAY[inputName] = [];
|
|
32
|
+
ARRAY[inputName].push(inputValue);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
} else {
|
|
36
|
+
|
|
37
|
+
if (inputName in ARRAY) {
|
|
38
|
+
|
|
39
|
+
} else {
|
|
40
|
+
ARRAY[inputName] = inputValue;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return ARRAY;
|
|
50
|
+
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function prettyFormResponse(data) {
|
|
54
|
+
|
|
55
|
+
if (data != '') {
|
|
56
|
+
|
|
57
|
+
console.log('ERRORE FORM: '+data);
|
|
58
|
+
|
|
59
|
+
var container = document.querySelector("#loading-spinner .center");
|
|
60
|
+
container.classList.add("w-80");
|
|
61
|
+
container.innerHTML = '<div class="title-big a-c"><i class="bi bi-x-circle tx-danger"></i></div><div class="subtitle mt-8 a-c">C\'è stato un problema con l\'invio della tua richiesta</div><div class="c-w mt-10"><a onclick="location.reload();" class="btn btn-primary c-w">Riprova</a></div>';
|
|
62
|
+
|
|
63
|
+
} else {
|
|
64
|
+
|
|
65
|
+
var container = document.querySelector("#loading-spinner .center");
|
|
66
|
+
container.classList.add("w-80");
|
|
67
|
+
container.innerHTML = '<div class="title-big a-c"><i class="bi bi-check2-circle tx-success"></i></div><div class="subtitle mt-8 a-c">La tua richiesta è stata inviata con successo!</div><div class="c-w mt-10"><a onclick="location.reload(); " class="btn btn-primary c-w">Torna al sito</a></div>';
|
|
68
|
+
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function sendForm(button, url, responseFunction = prettyFormResponse) {
|
|
74
|
+
|
|
75
|
+
loadingSpinner();
|
|
76
|
+
|
|
77
|
+
const VALUES = formToArray(button.form.elements);
|
|
78
|
+
var form = JSON.stringify(VALUES);
|
|
79
|
+
|
|
80
|
+
$.ajax({
|
|
81
|
+
type: "POST",
|
|
82
|
+
url: url,
|
|
83
|
+
data: {
|
|
84
|
+
post: 'true',
|
|
85
|
+
form: form
|
|
86
|
+
},
|
|
87
|
+
success: function (data) {
|
|
88
|
+
|
|
89
|
+
if (responseFunction != null) {
|
|
90
|
+
if (typeof responseFunction === 'function') {
|
|
91
|
+
responseFunction(data);
|
|
92
|
+
} else {
|
|
93
|
+
loadingSpinner();
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
},
|
|
98
|
+
error: function (XMLHttpRequest) {
|
|
99
|
+
ajaxRequestError(XMLHttpRequest);
|
|
100
|
+
loadingSpinner();
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function formUpload(form, url, responseFunction = prettyFormResponse) {
|
|
107
|
+
|
|
108
|
+
loadingSpinner();
|
|
109
|
+
|
|
110
|
+
var formData = new FormData(form);
|
|
111
|
+
formData.append('post', 'true');
|
|
112
|
+
|
|
113
|
+
$.ajax({
|
|
114
|
+
type: "POST",
|
|
115
|
+
url: url,
|
|
116
|
+
data: formData,
|
|
117
|
+
contentType: false,
|
|
118
|
+
cache: false,
|
|
119
|
+
processData:false,
|
|
120
|
+
success: function (data) {
|
|
121
|
+
|
|
122
|
+
if (responseFunction != null) {
|
|
123
|
+
if (typeof responseFunction === 'function') {
|
|
124
|
+
responseFunction(data);
|
|
125
|
+
} else {
|
|
126
|
+
loadingSpinner();
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
},
|
|
131
|
+
error: function (XMLHttpRequest) {
|
|
132
|
+
ajaxRequestError(XMLHttpRequest);
|
|
133
|
+
loadingSpinner();
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
function menuMobile(hamburger = "#hamburger", navMobile = "#nav-mobile") {
|
|
2
|
+
|
|
3
|
+
if (hamburger != null) { document.querySelector(hamburger).classList.toggle("click"); }
|
|
4
|
+
if (navMobile != null) { document.querySelector(navMobile).classList.toggle("show"); }
|
|
5
|
+
|
|
6
|
+
if (document.querySelector(hamburger).classList.contains("click")) {
|
|
7
|
+
disableScroll();
|
|
8
|
+
} else {
|
|
9
|
+
enableScroll();
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
}
|