Skip to content

Commit

Permalink
duration
Browse files Browse the repository at this point in the history
  • Loading branch information
strukturart committed Jan 27, 2024
1 parent 8a13fab commit dfe45cb
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 8 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ build
.cache
application/assets/js/google_cred.js
application/google_cred.js
.env

68 changes: 61 additions & 7 deletions application/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,6 @@ async function load_caldav(callback = false) {
if (callback) side_toaster('all event reloaded', 2000);
}
closing_prohibited = false;
// style_calendar_cell(currentYear, currentMonth);
side_toaster('Data loaded', 3000);
} catch (e) {
if (m.route.get() === '/page_calendar') {
Expand Down Expand Up @@ -1682,6 +1681,11 @@ var page_events = {
se = formatDT(item.DTSTART._time).format('HH:mm');
}

let weekDay =
settings.firstday == 'sunday'
? weekday[dayjs(formatDT(item.DTSTART._time)).day()]
: weekday[dayjs(formatDT(item.DTSTART._time)).day() - 1];

//date
if (
item.DTSTART != null &&
Expand All @@ -1698,7 +1702,7 @@ var page_events = {
de =
formatDT(item.DTSTART._time).format(settings.dateformat) +
' | ' +
weekday[dayjs(formatDT(item.DTSTART._time)).day()];
weekDay;
}

let u = item.isSubscription ? 'subscription' : '';
Expand Down Expand Up @@ -2054,6 +2058,48 @@ export let page_options = {
),
]
),
m(
'div',
{
class: 'item input-parent',
id: 'event-duration-wrapper',
tabindex: '5',
},
[
m('label', { for: 'default-duration-time' }, 'default Duration'),
m(
'select',
{
id: 'default-duration-time',
class: 'select-box',
onchange: function () {
store_settings();
},
oncreate: function () {
load_settings();
setTimeout(function () {
focus_after_selection();
if (settings.default_duration == '') {
document.querySelector('#default-duration-time').value =
'none';
} else {
document.querySelector(
'#default-notification-time'
).value = settings.default_duration;
}
}, 1000);
},
},
[
m('option', { value: 'none' }, 'none'),
m('option', { value: '30' }, '30 minutes'),
m('option', { value: '60' }, '60 minutes'),
m('option', { value: '120' }, '120 minutes'),
m('option', { value: '240' }, '240 minutes'),
]
),
]
),

m(
'div',
Expand Down Expand Up @@ -2899,7 +2945,14 @@ var page_add_event = {
},

oncreate: function ({ dom }) {
dom.value = dayjs().add(1, 'hour').format('HH:mm');
console.log(settings.default_duration);
if (settings.default_duration != '') {
dom.value = dayjs()
.add(settings.default_duration, 'minutes')
.format('HH:mm');
} else {
dom.value = dayjs().add(1, 'hour').format('HH:mm');
}
},
}),
]),
Expand Down Expand Up @@ -3514,6 +3567,10 @@ let store_settings = function () {
'default-notification-time'
).value;

settings.default_duration = document.getElementById(
'default-duration-time'
).value;

settings.dateformat = document.getElementById('event-date-format').value;
settings.firstday = document.getElementById('first-day-of-the-week').value;
settings.eventsfilter = document.getElementById(
Expand Down Expand Up @@ -5050,9 +5107,6 @@ function handleKeyDown(evt) {
function handleKeyUp(evt) {
if (status.visible === false) return false;

if (evt.key == 'Backspace' && document.activeElement.tagName == 'INPUT') {
}

clearTimeout(timeout);
if (!longpress) {
shortpress_action(evt);
Expand All @@ -5072,7 +5126,7 @@ if (debug) {
}

// Set up a timer to check if no messages have arrived for a certain period
const waitTimeout = 500; // Time in milliseconds
const waitTimeout = 400; // Time in milliseconds
const checkMessagesInterval = 100; // Interval to check for new messages
let waitForNoMessages;
let interval_is_running = false;
Expand Down
2 changes: 1 addition & 1 deletion application/manifest.webapp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "2.2.609",
"version": "2.2.611",
"name": "greg",
"id": "greg",
"categories": ["utilities"],
Expand Down

0 comments on commit dfe45cb

Please sign in to comment.