Lively Kernel canvas
// this script is evaluated on world load{
borderWidth: 2,
borderColor: Color.red,
strokeOpacity: 0,
fillOpacity: 1,
fill: Color.lightGray
}pt(140, 100)function($super, date, optPos) {
if (!optPos) optPos = pt(100,100);
$super(optPos.extent(this.initialExtent));
this.dateMs = date.valueOf();
//this.applyStyle(this.initialStyle);
this.buildDateText(date);
}function(date) {
var bnds = this.innerBounds().translatedBy(pt(0, this.getExtent().y-25));
var text = new TextMorph(bnds, date.toUTCString().slice(0,11));
text.beLabel();
text.setFontSize(18);
this.text = text;
//text.setFill(Color.rgb(169,193,208).lighter());
this.addMorphFront(text);
}function($super, morph) {
$super(morph);
if (morph instanceof HandleMorph || morph instanceof SchedulableAction) return morph;
var margin = 10;
this.droppedMorph = morph;
this.oldScale = morph.getScale();
var morphWidth = morph.bounds().extent().x;
var myWidth = this.getExtent().x - margin;
var morphHeight = morph.bounds().extent().y;
var myHeight = this.getExtent().y - 50;
var scaleFactor = Math.min(myWidth / morphWidth, myHeight/morphHeight);
console.log(scaleFactor);
if (scaleFactor < 1)
morph.setScale(scaleFactor*morph.getScale()); // using bounds of morph, its scale already in it, consider it when rescale
morph.centerAt(this.innerBounds().center());
return morph;
}Functions.Truefunction(evt) {
if (!this.droppedMorph) return;
this.droppedMorph.setScale(this.oldScale || 1);
evt.hand.addMorph(this.droppedMorph);
this.droppedMorph = null;
}function() {
var oneDay = 1000*60*60*24;
var daysAhead = 5;
var myDate = new Date(this.dateMs);
var currentDate = new Date();
this.applyStyle(this.style);
if (myDate.getDate() == currentDate.getDate() && myDate.getMonth() == currentDate.getMonth())
this.applyStyle({fill: Color.white, fillOpacity: 1});
if (myDate < currentDate && myDate.getDate() != currentDate.getDate())
return;
if (!this.droppedMorph) return;
var timeDiff = myDate - currentDate;
if (timeDiff > daysAhead*oneDay) return;
var redIntensity = 1 - Math.abs(timeDiff/(daysAhead*oneDay));
this.setStrokeOpacity(redIntensity);
}function() {
this.startStepping(1000, "highlight");
}5new Date(24*60*60*1000) - new Date(0)function(date) {
return new Date(date.valueOf() + this.day);
}function(monthNo, startPos) {
var pos = startPos;
var extent = DayMorph.prototype.initialExtent;
var margin = this.defaultMargin;
monthNo -= 1;
if (!this.morphs) this.morphs = [];
var date = new Date(2009, monthNo/*month-1*/, 1/*day*/, 8/*hour*/, 1/*minute*/);
do {
this.createDayMorph(date, pos);
pos = date.getDay() % 7 == 0 ? startPos.withY(pos.y + extent.y + margin) : pos.addXY(extent.x + margin, 0);
date = this.nextDay(date);
} while (date.getMonth() === monthNo);
return this.morphs;
}function(date, pos) {
var x = new DayMorph(date, pos);
this.morphs.push(x);
x.openInWorld();
x.start();
}/*
m= new DayMorph(new Date(), pt(100,100));
m.openInWorld();
m.highlight();
allM = new CalendarBuilder().buildMonth(3, pt(10,10));
allM.invoke('remove');
TextMorph.prototype.this.fontFamily = 'Marker Felt';
TextMorph.prototype.style: { borderWidth: 0, borderColor: Color.black};
*/
Thu,01Oct18falsenull
100072.419524030703641254376860000
Fri,02Oct18falsenull
10001.11560367004265811254463260000
1.2719085216522217null
Sat,03Oct18falsenull
10001.94068568838541161254549660000
Sun,04Oct18falsenull
10000.88537872694240431254636060000
null3.1622776985168457
Mon,05Oct18falsenull
10000.32691640380376361254722460000
Tue,06Oct18falsenull
10001.9594518693973153
Exam:Data-orientedXML11254808860000
1.8124911785125732
Wed,07Oct18falsenull
10000.53914446860720631254895260000
Thu,08Oct18falsenull
10001.7138918456365153
DeadlineFASE201011254981660000
2.0204434394836426
Fri,09Oct18falsenull
10002.38007323221527621255068060000
Sat,10Oct18falsenull
10000.26036316918786411255154460000
Sun,11Oct18falsenull
10000.69437836780213571255240860000
Mon,12Oct18falsenull
10001.88528061790013531255327260000
Tue,13Oct18falsenull
10004.918248188671176
Welcomenewstudents
PrepareWikidemos1255413660000
1
Wed,14Oct18falsenull
10001.940068739757611
LivelyWikiPresentation11255500060000
1.9317231178283691
Thu,15Oct18falsenull
10001.36613589807606181255586460000
Fri,16Oct18falsenull
10001.03421198570246681255672860000
null2.627974510192871
Sat,17Oct18falsenull
10000.9552858997634731255759260000
null2.627974510192871
Sun,18Oct18falsenull
10000.037251177994364441255845660000
null2.627974510192871
Mon,19Oct18falsenull
10000.99783982297631731255932060000
null1.9317231178283691
Tue,20Oct18falsenull
10003.52580116346209
0.16059.39396589107608-1.2583772044793595
1256018460000
1
Wed,21Oct18falsenull
100046.4289589120086751256104860000
Thu,22Oct18falsenull
10001.54162590665301671256191260000
Fri,23Oct18falsenull
10001.36885848727512131256277660000
null3.1622776985168457
Sat,24Oct18falsenull
10001.7573351910130186
FlighttoOrlando1256364060000
3.1622776985168457
Sun,25Oct18falsenull
10001.4635301500765878
VMIL:TalkDougSimon11256450460000
3.1622776985168457
Mon,26Oct18falsenull
10002.830236679877668
10.45am:LivelyWikiPresentationWikiSym31256536860000
1.9317231178283691
Tue,27Oct18falsenull
10000.80931513199493441256623260000
Wed,28Oct18falsenull
10000.38232516631197031256709660000
Thu,29Oct18falsenull
10000.9769371656269337
Flightback1256796060000
3.1622776985168457
Fri,30Oct18falsenull
10000.67870026320875471256882460000
Sat,31Oct18falsenull
10003.8924054340817181256968860000
null20