fullCalendar
by brasofilo
HTML
<script src="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.0/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.0/css/bootstrap-combined.min.css">
<script src="//cdnjs.cloudflare.com/ajax/libs/moment.js/2.8.3/moment.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/fullcalendar/2.1.1/fullcalendar.min.js"></script>
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/fullcalendar/2.1.1/fullcalendar.min.css">
<body>
<div id="mycalendar"></div>
<div id="sopt"><a class="btn" href="http://fullcalendar.io/docs/" target="_blank">docs</a>
</body>
CSS
#mycalendar {
margin:30px;
height:500px;
max-width:500px;
}
.x-fechar {
position: absolute;
right: 0;
padding: 0px 20px 0 0px;
margin: -15px 0 0 0;
cursor: pointer;
}
#sopt {
position:fixed;
bottom: 0;
right: 0;
}
JavaScript
//$.fn.popover.defaults.container = 'body';
var dayToday = function( date ) {
var d = new Date(date);
var weekday = new Array(7);
weekday[0]= "Sunday";
weekday[1] = "Monday";
weekday[2] = "Tuesday";
weekday[3] = "Wednesday";
weekday[4] = "Thursday";
weekday[5] = "Friday";
weekday[6] = "Saturday";
return weekday[d.getDay()];
};
var isTwoOclock = function( date ) {
var d = new Date(date);
var n = d.getHours();
console.log(d);
if( n === 14 )
return true;
return false;
}
// http://stackoverflow.com/a/19375264/1287812
function firstDayOfWeek (year, week) {
// Jan 1 of 'year'
var d = new Date(year, 0, 1),
offset = d.getTimezoneOffset();
// ISO: week 1 is the one with the year's first Thursday
// so nearest Thursday: current date + 4 - current day number
// Sunday is converted from 0 to 7
d.setDate(d.getDate() + 4 - (d.getDay() || 7));
// 7 days * (week - overlapping first week)
d.setTime(d.getTime() + 7 * 24 * 60 * 60 * 1000
* (week + (year == d.getFullYear() ? -1 : 0 )));
// daylight savings fix
d.setTime(d.getTime()
+ (d.getTimezoneOffset() - offset) * 60 * 1000);
// back to Monday (from Thursday)
d.setDate(d.getDate() - 3);
return d;
}
$( "td.fc-widget-content td" )
.mouseup(function() {
$( this ).append( "<span style='color:#f00;'>Mouse up.</span>" );
})
.mousedown(function() {
alert();
$( this ).append( "<span style='color:#00f;'>Mouse down.</span>" );
});
$(document).on('onmousedown', function(e){
alert()
var e = window.event;
var x=e.clientX;
var y=e.clientY;
if (e.which === 3 || e.button === 2) {
alert();
}
});
$('#mycalendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month agendaWeek agendaDay'
},
editable: true,
weekNumbers: true,
eventRender: function...