added colors, removed all day

This commit is contained in:
Jens Timmerman 2021-08-02 19:13:23 +02:00
parent 063d31a7b6
commit 08932839be
1 changed files with 20 additions and 0 deletions

View File

@ -8,10 +8,29 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.18.1/moment.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.4.0/fullcalendar.min.js"></script>
<script>
function mycolor(str){
var hash = 0;
for (var i = 0; i < str.length; i++) {
hash = str.charCodeAt(i) + ((hash << 5) - hash);
}
return "#" + intToRGB(hash);
}
function intToRGB(i){
var c = (i & 0x00FFFFFF)
.toString(16)
.toUpperCase();
return "00000".substring(0, 6 - c.length) + c;
}
$(document).ready(function () {
var calendar = $('#calendar').fullCalendar({
defaultView: 'agendaWeek',
allDaySlot: false,
nowIndicator: true,
selectMirror: true,
longPressDelay: 500,
header: {
left: 'prev,next today',
center: 'title',
@ -24,6 +43,7 @@
start: '{{ event.start|date:"Y-m-d H:i" }}',
end: '{{ event.end|date:"Y-m-d H:i" }}',
id: '{{ event.id }}',
backgroundColor: mycolor('{{ event.name }}'),
},
{% endfor %}
],