Skip to content

Commit

Permalink
reduce keys
Browse files Browse the repository at this point in the history
  • Loading branch information
strukturart committed Aug 23, 2023
1 parent ad48e32 commit b5bd8f6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 97 deletions.
26 changes: 5 additions & 21 deletions application/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -1551,11 +1551,11 @@ var page_events = {
//date
if (item.dateStart != item.dateEnd && !item.allDay) {
de =
dayjs(item.dateStart).format(settings.dateformat) +
dayjs.unix(item.dateStartUnix).format(settings.dateformat) +
" - " +
dayjs(item.dateEnd).format(settings.dateformat);
dayjs.unix(item.dateEndUnix).format(settings.dateformat);
} else {
de = dayjs(item.dateStart).format(settings.dateformat);
de = dayjs.unix(item.dateStartUnix).format(settings.dateformat);
}

let u = item.isSubscription ? "subscription" : "";
Expand Down Expand Up @@ -3219,8 +3219,6 @@ let store_settings = function () {
"events-category-filter"
).value;

console.log(settings);

localforage
.setItem("settings", settings)
.then(function () {
Expand Down Expand Up @@ -4253,22 +4251,6 @@ let delete_event = function (etag, url, account_id, uid) {
//let d = `0${t.getDate()}`.slice(-2);
//let y = t.getFullYear();

// callback import event
let import_event_callback = function (id, date) {
let without_subscription = events.filter(
(events) => events.isSubscription === false
);

localforage
.setItem("events", without_subscription)
.then(function () {
export_ical("others/greg.ics", without_subscription);
})
.catch(function (err) {
side_toaster("no data to export", 2000);
});
};

export let set_tabindex = () => {
document
.querySelectorAll('.item:not([style*="display: none"]')
Expand Down Expand Up @@ -4661,6 +4643,8 @@ function shortpress_action(param) {
break;

case "0":
if (document.activeElement.tagName == "INPUT") return false;

m.route.set("/page_events_filtered", { query: settings.eventsfilter });
break;
}
Expand Down
76 changes: 0 additions & 76 deletions application/assets/js/eximport.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,13 +258,6 @@ export const parse_ics = async function (
let dtstart = ite.getFirstPropertyValue("dtstart");
let dtend = ite.getFirstPropertyValue("dtend");

if (account_id === "local-id") {
dtstart = formatTimeWithTimeZone(ite.getFirstPropertyValue("dtstart"));
dtend = formatTimeWithTimeZone(ite.getFirstPropertyValue("dtend"));
lastmod = formatTimeWithTimeZone(
ite.getFirstPropertyValue("last-modified")
);
}
//todo remove more key:values
let imp = {
BEGIN: "VEVENT",
Expand Down Expand Up @@ -300,75 +293,6 @@ export const parse_ics = async function (
});
};

/*
export const parse_ics = async function (
data,
isSubscription,
etag,
url,
account_id,
isCaldav,
alarm
) {
let jcalData;
try {
jcalData = ICAL.parse(data);
} catch (e) {
console.log("parser error" + e);
}
var comp = new ICAL.Component(jcalData);
var vevent = comp.getAllProperties("vevent");
let calendar_name = comp.getFirstPropertyValue("x-wr-calname") || "";
const events = vevent.map((ite) => {
const rrule = ite.getFirstPropertyValue("rrule") || {};
const n = rrule.freq ? rrule : null;
const dtstart = ite.getFirstPropertyValue("dtstart");
const dtend = ite.getFirstPropertyValue("dtend");
const allday = dtstart.isDate && dtend.isDate;
const lastmod = ite.getFirstPropertyValue("last-modified");
return {
BEGIN: "VEVENT",
UID: ite.getFirstPropertyValue("uid"),
SUMMARY: ite.getFirstPropertyValue("summary"),
LOCATION: ite.getFirstPropertyValue("location"),
DESCRIPTION: ite.getFirstPropertyValue("description"),
CATEGORIES: ite.getFirstPropertyValue("categories") || "",
ATTACH: ite.getFirstPropertyValue("attach"),
RRULE: n,
"LAST-MODIFIED": lastmod,
CLASS: ite.getFirstPropertyValue("class") || "",
DTSTAMP: dtstart,
DTSTART: dtstart,
DTEND: dtend,
END: "VEVENT",
isSubscription,
isCaldav,
allDay: allday,
dateStart: dtstart.toJSDate().toISOString().substring(0, 10),
dateStartUnix: dtstart.toJSDate().getTime() / 1000,
dateEnd: dtend.toJSDate().toISOString().substring(0, 10),
time_start: dtstart.toJSDate().toISOString().substring(11, 19),
time_end: dtend.toJSDate().toISOString().substring(11, 19),
alarm: alarm || "none",
rrule_json: n,
etag,
url,
calendar_name,
id: account_id,
};
});
// Now `events` contains the optimized event objects.
// You can further process or use them as needed.
};
*/

/////////////
///FETCH ICS
///////////
Expand Down

0 comments on commit b5bd8f6

Please sign in to comment.