1
0
Fork 0
BangleApps/apps/schoolCalendar/custom.html

116 lines
3.6 KiB
HTML
Raw Normal View History

2021-11-20 20:58:24 +00:00
@@ -1,99 +1,35 @@
2021-10-04 22:57:53 +00:00
<html>
<head>
2021-11-20 20:58:24 +00:00
<style>
body {
padding: 0;
margin: 0;
}
html, body, #map {
height: 100%;
width: 100%;
}
#controls {
padding: 10px;
margin: 10px;
border: 1px solid black;
position:absolute;
right:0px;bottom:0px;
background-color: rgb(255, 255, 255);
z-index: 100;
}
</style>
<div id="controls">
<p>Create your events on the current week. Keep in note that your events repeat weekly.</p>
<p>One you have created your events, Click <button id="upload" class="btn btn-primary">Upload</button></p>
<p>All day events are not supported. A feature that lets you get the calendar from your watch will be added in a future update.</p>
</div>
<meta charset='utf-8' />
2021-11-03 03:10:58 +00:00
<link rel="stylesheet" href="../../css/spectre.min.css">
2021-11-20 20:58:24 +00:00
<link href='fullcalendar/main.css' rel='stylesheet' />
<script src='fullcalendar/main.js'></script>
<script src="../../core/lib/customize.js"></script>
2021-11-20 21:07:38 +00:00
</head>
<body>
2021-11-20 20:58:24 +00:00
<script>
document.addEventListener('DOMContentLoaded', function() {
var calendarEl = document.getElementById('calendar');
var calendar = new FullCalendar.Calendar(calendarEl, {
initialView: 'timeGridWeek',
headerToolbar: {
left: '',
center: 'title',
right: 'timeGridWeek,listWeek'
},
navLinks: true, // can click day/week names to navigate views
editable: true,
selectable: true,
selectMirror: true,
nowIndicator: true,
editable: true,
height: 600,
select: function(arg) {
var title = prompt('Event Title:');
if (title) {
calendar.addEvent({
title: title,
start: arg.start,
end: arg.end,
allDay: arg.allDay
})
}
calendar.unselect()
},
eventClick: function(arg) {
if (confirm('Are you sure you want to delete this event?')) {
arg.event.remove()
}
},
});
calendar.render();
});
var calendarEvents = calendar.getEvents();
let schedule = []
2021-11-04 23:00:41 +00:00
2021-11-20 20:58:24 +00:00
for(i=0;i>calendarEvents.length;i++){
var calendarEntry = {}
calendarEntry['cn'] = calendarEvents[i].title;
calendarEntry['dow'] = calendarEvents[i].start.getDate();
calendarEntry['sh'] = calendarEvents[i].start.getHours();
calendarEntry['sm'] = calendarEvents[i].start.getMinutes();
calendarEntry['eh'] = calendarEvents[i].end.getHours();
calendarEntry['em'] = calendarEvents[i].end.getMinutes();
schedule.push(calendarEntry)
}
2021-11-04 23:00:41 +00:00
2021-10-04 22:57:53 +00:00
<script>
2021-11-04 23:00:41 +00:00
// When the 'upload' button is clicked...
2021-11-03 15:06:50 +00:00
document.getElementById("upload").addEventListener("click", function() {
2021-11-20 20:58:24 +00:00
content = schedule
2021-11-04 23:00:41 +00:00
// get the text to add
var text = document.getElementById("mytext").value;
// build the app's text using a templated String
var app = `
var txt = ${JSON.stringify(text)};
g.clear(1);
g.setFontAlign(0,0);
g.setFont("6x8");
g.drawString(txt,120,120);
`;
// send finished app (in addition to contents of app.json)
2021-11-03 15:06:50 +00:00
sendCustomizedApp({
storage:[
2021-11-20 20:58:24 +00:00
{"name":"customFile.app.json",url:"app.js",content:content}
2021-11-04 23:00:41 +00:00
{name:"myapp.app.js", url:"app.js", content:app},
2021-11-03 15:06:50 +00:00
]
});
});
2021-11-04 23:00:41 +00:00
2021-10-04 22:57:53 +00:00
</script>
2021-11-20 20:58:24 +00:00
</head>
<body>
<div id='calendar'></div>
2021-10-04 22:57:53 +00:00
</body>
</html>