nodebb-plugin-calendar-onekite 11.2.11 → 11.2.13
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/package.json +1 -1
- package/public/client.js +31 -11
package/package.json
CHANGED
package/public/client.js
CHANGED
|
@@ -101,17 +101,25 @@ define('forum/calendar-onekite', ['alerts', 'bootbox', 'hooks'], function (alert
|
|
|
101
101
|
let seStart = new Date(start);
|
|
102
102
|
let seEnd = new Date(end);
|
|
103
103
|
|
|
104
|
-
const
|
|
104
|
+
const msSpan = seEnd.getTime() - seStart.getTime();
|
|
105
|
+
const isAllDaySelection = selectionInfo && (selectionInfo.allDay || (
|
|
105
106
|
seStart.getHours() === 0 && seStart.getMinutes() === 0 &&
|
|
106
|
-
seEnd.getHours() === 0 && seEnd.getMinutes() === 0
|
|
107
|
-
Math.abs(seEnd.getTime() - seStart.getTime() - 24 * 60 * 60 * 1000) < 1000
|
|
107
|
+
seEnd.getHours() === 0 && seEnd.getMinutes() === 0
|
|
108
108
|
));
|
|
109
109
|
|
|
110
|
-
|
|
110
|
+
const isSingleDayAllDay = isAllDaySelection && msSpan <= (24 * 60 * 60 * 1000 + 1500);
|
|
111
|
+
|
|
112
|
+
if (isSingleDayAllDay) {
|
|
111
113
|
// Keep same day; default start at 07:00 and end at 23:59
|
|
112
114
|
seStart.setHours(7, 0, 0, 0);
|
|
113
115
|
seEnd = new Date(seStart);
|
|
114
116
|
seEnd.setHours(23, 59, 0, 0);
|
|
117
|
+
} else if (isAllDaySelection) {
|
|
118
|
+
// Multi-day all-day selection: start at 07:00 on first day, end at 23:59 on last day
|
|
119
|
+
seStart.setHours(7, 0, 0, 0);
|
|
120
|
+
const lastDay = new Date(seEnd.getTime() - 24 * 60 * 60 * 1000);
|
|
121
|
+
seEnd = new Date(lastDay);
|
|
122
|
+
seEnd.setHours(23, 59, 0, 0);
|
|
115
123
|
} else {
|
|
116
124
|
seStart = roundTo5Minutes(seStart);
|
|
117
125
|
seEnd = roundTo5Minutes(seEnd);
|
|
@@ -783,6 +791,8 @@ function toDatetimeLocalValue(date) {
|
|
|
783
791
|
|
|
784
792
|
// Current creation mode: reservation (location) or special (event)
|
|
785
793
|
let mode = 'reservation';
|
|
794
|
+
// Avoid showing the "mode évènement" hint multiple times (desktop + mobile handlers)
|
|
795
|
+
let lastModeHintAt = 0;
|
|
786
796
|
function refreshDesktopModeButton() {
|
|
787
797
|
try {
|
|
788
798
|
const btn = document.querySelector('#onekite-calendar .fc-newSpecial-button');
|
|
@@ -807,7 +817,11 @@ function toDatetimeLocalValue(date) {
|
|
|
807
817
|
// Reset any pending selection/dialog state when switching modes
|
|
808
818
|
try { if (mode === 'reservation') { calendar.unselect(); isDialogOpen = false; } } catch (e) {}
|
|
809
819
|
if (mode === 'special') {
|
|
810
|
-
|
|
820
|
+
const now = Date.now();
|
|
821
|
+
if (now - lastModeHintAt > 1200) {
|
|
822
|
+
lastModeHintAt = now;
|
|
823
|
+
showAlert('success', 'Mode évènement : sélectionnez une date ou une plage');
|
|
824
|
+
}
|
|
811
825
|
}
|
|
812
826
|
refreshDesktopModeButton();
|
|
813
827
|
try {
|
|
@@ -904,9 +918,6 @@ function toDatetimeLocalValue(date) {
|
|
|
904
918
|
text: 'Évènement',
|
|
905
919
|
click: () => {
|
|
906
920
|
setMode((mode === 'special') ? 'reservation' : 'special');
|
|
907
|
-
if (mode === 'special') {
|
|
908
|
-
showAlert('success', 'Mode évènement : sélectionne une plage (date/heure) sur le calendrier.');
|
|
909
|
-
}
|
|
910
921
|
},
|
|
911
922
|
},
|
|
912
923
|
} : {},
|
|
@@ -935,6 +946,18 @@ function toDatetimeLocalValue(date) {
|
|
|
935
946
|
el2.style.borderColor = '#8e44ad';
|
|
936
947
|
el2.style.color = '#ffffff';
|
|
937
948
|
}
|
|
949
|
+
|
|
950
|
+
// Improve readability: show a clock icon before the time and a dash after it.
|
|
951
|
+
// Example: "🕒 07:00 - Titre"
|
|
952
|
+
try {
|
|
953
|
+
const timeEl = arg.el && arg.el.querySelector && arg.el.querySelector('.fc-event-time');
|
|
954
|
+
if (timeEl && typeof timeEl.textContent === 'string') {
|
|
955
|
+
const t = timeEl.textContent.trim();
|
|
956
|
+
if (t && !t.startsWith('🕒')) {
|
|
957
|
+
timeEl.textContent = `🕒 ${t} -`;
|
|
958
|
+
}
|
|
959
|
+
}
|
|
960
|
+
} catch (e2) {}
|
|
938
961
|
}
|
|
939
962
|
} catch (e) {}
|
|
940
963
|
},
|
|
@@ -1487,9 +1510,6 @@ function toDatetimeLocalValue(date) {
|
|
|
1487
1510
|
modeBtn.addEventListener('click', () => {
|
|
1488
1511
|
setMode((mode === 'special') ? 'reservation' : 'special');
|
|
1489
1512
|
refreshModeBtn();
|
|
1490
|
-
if (mode === 'special') {
|
|
1491
|
-
showAlert('success', 'Mode évènement : sélectionne une plage (date/heure) sur le calendrier.');
|
|
1492
|
-
}
|
|
1493
1513
|
});
|
|
1494
1514
|
refreshModeBtn();
|
|
1495
1515
|
controls.appendChild(modeBtn);
|