Update schoolCalendar.js
parent
89f82a5043
commit
e799550544
|
|
@ -1,19 +1,23 @@
|
||||||
require("Font8x12").add(Graphics);
|
require("Font8x12").add(Graphics);
|
||||||
require("Font8x16").add(Graphics);
|
require("Font8x16").add(Graphics);
|
||||||
|
require("Font6x8").add(Graphics);
|
||||||
Graphics.prototype.setFontAudiowide = function () {
|
require("Font7x11Numeric7Seg").add(Graphics);
|
||||||
var widths = atob("BxYfDBkYGhkZFRkZCA==");
|
require("FontHaxorNarrow7x17").add(Graphics);
|
||||||
var font = atob("AAAAAAAAA8AAAAHgAAAB8AAAAHgAAAA4AAAAAAAAAAEAAAABgAAAA8AAAAPgAAAH8AAAB/gAAA/4AAAf+AAAH/AAAD/wAAA/4AAAf8AAAP/AAAD/gAAB/4AAAf8AAAD+AAAAfgAAADwAAAAcAAAAAAAAAAAAAAAAAAAAAAP/AAAH//AAB//8AAf//wAH///AA///4APwD/gB8A/8APgP/gB8D98AfAfvgD4H58AfB/PgD4Px8AfD8PgD4/h8AfH4PgD5+B8AP/wPgB/8B8AP/APgB/4D8AH8B/AA///4AD//+AAP//gAA//4AAB/8AAAAAAAAAAAAAAAAAAD4AAAAfAAAAD4AAAAfAAAAD///8Af///gD///8Af///gD///8AAAAAAAAAAAAAAAAAAAA/8AAAf/gD4H/8AfA//gD4P/8AfB+PgD4Ph8AfB8PgD4Ph8AfB8PgD4Ph8AfB8PgD4Ph8AfB8PgD4Ph8AfB8PgB8Ph8AP/8PgB//B8AP/4PgA/+B8AD/gPgABgA8AAAAAAAAAAAAPA4HgD4Ph8AfB8PgD4Ph8AfB8PgD4Ph8AfB8PgD4Ph8AfB8PgD4Ph8AfB8PgD4Ph8AfB8PgD4Ph8AfB8PgB8Ph8AP///gB///8AH///AA///wAB//8AAAAAAAAAAAAB/8AAAf/4AAD//gAAf/8AAD//gAAf/8AAAAPgAAAB8AAAAPgAAAB8AAAAPgAAAB8AAAAPgAAAB8AAAAPgAAAB8AAAAPgAAP///gD///8Af///gD///8Af///gD///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAD/8B8Af/wPgD//B8Af/4PgD//h8AfB8PgD4Ph8AfB8PgD4Ph8AfB8PgD4Ph8AfB8PgD4Ph8AfB8PgD4Ph8AfB8PgD4Ph8AfB//gD4H/8AfA//AAAD/4AAAP8AAAAAAAAAAAAAH//AAB//8AAf//wAH///AB///8AP58/gB8Ph8APh8PgD4Ph8AfB8PgD4Ph8AfB8PgD4Ph8AfB8PgD4Ph8AfB8PgD4Ph8AfB//gD4H/8AAA//AAAD/4AAAP8AAAAAAAAAAAAD4AAAAfAAAAD4AAAAfAABgD4AA8AfAAPgD4AH8AfAD/gD4A/8AfAf/AD4P/gAfH/wAD5/8AAf/+AAD//AAAf/gAAD/4AAAf8AAAB+AAAAPAAAAAAAAAAAAAAAAAB/gAAAf+AAP//4AH///gA///8AP/+PgB//h8APh8PgD4Ph8AfB8PgD4Ph8AfB8PgD4Ph8AfB8PgB8Ph8AP/8PgB//h8AP///gA///8AD///AADz/4AAAP8AAAAMAAAAAAAAAAAAAB/gAAA/+AAAH/4AAB//B8AP/8PgB8Ph8AfB8PgD4Ph8AfB8PgD4Ph8AfB8PgD4Ph8AfB8PgD4Ph8APh8PgB8Ph8APx8fgB///8AH///AAf//wAD//8AAH//AAAAAAAAAAAAAAAAAAAAAAAAAOAHgAD4A8AAfAPgAD4A8AAOAHAAAAAAA==");
|
|
||||||
var scale = 1; // size multiplier for this font
|
|
||||||
g.setFontCustom(font, 46, widths, 33+(scale<<8)+(1<<16));
|
|
||||||
};
|
|
||||||
|
|
||||||
function getBackgroundImage() {return require("heatshrink").decompress(atob("gMwyEgBAsAgQBCgcAggBCgsAgwBCg8AhABChMAhQBChcAhgBChsAhwBCh8AiEAiIBCiUAiYBCikAioBCi0Ai4BCjEAjIBCjUAjYBCjkAjoBCj0Aj4BBA"));}
|
function getBackgroundImage() {return require("heatshrink").decompress(atob("gMwyEgBAsAgQBCgcAggBCgsAgwBCg8AhABChMAhQBChcAhgBChsAhwBCh8AiEAiIBCiUAiYBCikAioBCi0Ai4BCjEAjIBCjUAjYBCjkAjoBCj0Aj4BBA"));}
|
||||||
|
|
||||||
|
function getUpArrow() {return require("heatshrink").decompress(atob("hkOyANKmv9AIIjRCoYZRlvdAI8U3YVK3oBJC4Mc7YVRC4sc7gVCzoBNC4oZDGowXGR58lvoBFC9FcAIoXongBFC58dngBFC6EcAIoPHA"));}
|
||||||
|
|
||||||
|
function getDownArrow() {return require("heatshrink").decompress(atob("hkOyALImv9AIojPmvdAIoXPlvdAIoXQ3oBFC9GdAIoXnkt9AIoPPAI8U3cc7cc7gBBDIVcAJYXFGYwXOLpU8AI4XBO5sdjgBFR54ZFBpIA=="));}
|
||||||
|
|
||||||
|
function getMenuIcon() {return require("heatshrink").decompress(atob("iEQyBC/AEU+rwBEn02js17st3stvklrkljkc/cc3cUzYBBD5AdUD4oA/P/4A/P/4A/ADoA=="));}
|
||||||
|
|
||||||
|
function getDotIcon() {return require("heatshrink").decompress(atob("iEQyBC/AA0t3oBBA4ndAIIPGA4gAFkt9lt9AYIHEzoBBBIwRED41cks8AYIJGA44RGP8xtGP44RJBYh1CAIIHHBJJ/KroBBPoqBFB4YRDAA8dngHHBJKdq3oBDBI4RNP4l9AIYHHBJJBJks8AIIHTAH4ABA="));}
|
||||||
|
|
||||||
Bangle.setLCDMode("doublebuffered");
|
Bangle.setLCDMode("doublebuffered");
|
||||||
g.clear();
|
g.clear();
|
||||||
g.setFont("Audiowide");
|
g.setFont("HaxorNarrow7x17");
|
||||||
g.drawString("...",115,60);
|
g.drawString("Loading...",115,60);
|
||||||
g.flip();
|
g.flip();
|
||||||
|
|
||||||
LIST = 1;
|
LIST = 1;
|
||||||
|
|
@ -91,9 +95,9 @@ function getScheduleTable() {
|
||||||
function processDay() {
|
function processDay() {
|
||||||
var schedule = getScheduleTable();
|
var schedule = getScheduleTable();
|
||||||
var currentDate = new Date();
|
var currentDate = new Date();
|
||||||
var currentDayOfWeek = 2;//currentDate.getDay();
|
var currentDayOfWeek = currentDate.getDay();
|
||||||
var currentHour = 9;//currentDate.getHours();
|
var currentHour = currentDate.getHours();
|
||||||
var currentMinute = 30;//currentDate.getMinutes();
|
var currentMinute = currentDate.getMinutes();
|
||||||
var minofDay = (currentHour*60)+currentMinute;
|
var minofDay = (currentHour*60)+currentMinute;
|
||||||
var i;
|
var i;
|
||||||
var currentPositon;
|
var currentPositon;
|
||||||
|
|
@ -154,8 +158,8 @@ function updateDay(ffunction,day){
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
day = "Saturday";
|
day = "Saturday";
|
||||||
|
}
|
||||||
return day;
|
return day;
|
||||||
}
|
|
||||||
}else if(ffunction == 2){
|
}else if(ffunction == 2){
|
||||||
switch (day) {
|
switch (day) {
|
||||||
case 0:
|
case 0:
|
||||||
|
|
@ -177,8 +181,8 @@ function updateDay(ffunction,day){
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
day = "Sat";
|
day = "Sat";
|
||||||
return day;
|
|
||||||
}
|
}
|
||||||
|
return day;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -215,7 +219,7 @@ function displayClock() {
|
||||||
currentMinuteUpdated = updateMinutesToCurrentTime(currentMinute);
|
currentMinuteUpdated = updateMinutesToCurrentTime(currentMinute);
|
||||||
currentHourUpdated = updateHoursToCurrentTime(currentHour);
|
currentHourUpdated = updateHoursToCurrentTime(currentHour);
|
||||||
g.setColor(255,255,255);
|
g.setColor(255,255,255);
|
||||||
g.setFont("Audiowide");
|
g.setFont("7x11Numeric7Seg",2);
|
||||||
g.clear();
|
g.clear();
|
||||||
var foundNumber = processDay();
|
var foundNumber = processDay();
|
||||||
var foundSchedule = getScheduleTable();
|
var foundSchedule = getScheduleTable();
|
||||||
|
|
@ -224,31 +228,38 @@ function displayClock() {
|
||||||
for(var i = 0;i<=240;i++){
|
for(var i = 0;i<=240;i++){
|
||||||
g.drawImage(getBackgroundImage(),i,120,{scale:5,rotate:0});
|
g.drawImage(getBackgroundImage(),i,120,{scale:5,rotate:0});
|
||||||
}
|
}
|
||||||
g.drawString(currentHourUpdated+":"+currentMinuteUpdated, 150, 0);
|
g.drawString(currentHourUpdated+":"+currentMinuteUpdated, 160, 0);
|
||||||
|
|
||||||
|
g.drawImage(getUpArrow(),225,5);
|
||||||
|
g.drawImage(getDownArrow(),225,140);
|
||||||
if(currentStage == LIST){
|
if(currentStage == LIST){
|
||||||
for(var x = 0;x<=numberOfItemsShown;x++){
|
for(var x = 0;x<=numberOfItemsShown;x++){
|
||||||
|
g.drawImage(getDotIcon(),223.5,66);
|
||||||
scheduleMinuteUpdatedStart = updateMinutesToCurrentTime(foundSchedule[((foundNumber-2)+x)].sm);
|
scheduleMinuteUpdatedStart = updateMinutesToCurrentTime(foundSchedule[((foundNumber-2)+x)].sm);
|
||||||
scheduleHourUpdatedStart = updateHoursToCurrentTime(foundSchedule[((foundNumber-2)+x)].sh);
|
scheduleHourUpdatedStart = updateHoursToCurrentTime(foundSchedule[((foundNumber-2)+x)].sh);
|
||||||
scheduleMinuteUpdatedEnd = updateMinutesToCurrentTime(foundSchedule[((foundNumber-2)+x)].em);
|
scheduleMinuteUpdatedEnd = updateMinutesToCurrentTime(foundSchedule[((foundNumber-2)+x)].em);
|
||||||
scheduleHourUpdatedEnd = updateHoursToCurrentTime(foundSchedule[((foundNumber-2)+x)].eh);
|
scheduleHourUpdatedEnd = updateHoursToCurrentTime(foundSchedule[((foundNumber-2)+x)].eh);
|
||||||
|
schduleDay = updateDay(2,foundSchedule[((foundNumber-2)+x)].dow);
|
||||||
g.setColor(255,255,255);
|
g.setColor(255,255,255);
|
||||||
g.drawRect(10,30+(x*20),230,50+(20*x));
|
g.drawRect(10,30+(x*20),220,50+(20*x));
|
||||||
g.reset();
|
g.reset();
|
||||||
g.setFont("8x12");
|
g.setFont("8x12");
|
||||||
g.drawString(scheduleHourUpdatedStart+":"+scheduleMinuteUpdatedStart+"-"+scheduleHourUpdatedEnd+":"+scheduleMinuteUpdatedEnd+" "+foundSchedule[((foundNumber-2)+x)].cn,13,35+(x*20));
|
g.drawString(scheduleHourUpdatedStart+":"+scheduleMinuteUpdatedStart+"-"+scheduleHourUpdatedEnd+":"+scheduleMinuteUpdatedEnd+" "+schduleDay+" "+foundSchedule[((foundNumber-2)+x)].cn,13,35+(x*20));
|
||||||
g.setColor(255,0,0);
|
g.setColor(255,0,0);
|
||||||
g.drawRect(10,30+(currentPositionTable*20),230,50+(20*currentPositionTable));
|
g.drawRect(10,30+(currentPositionTable*20),220,50+(20*currentPositionTable));
|
||||||
}
|
}
|
||||||
}else if(currentStage == INFORMATION){
|
}else if(currentStage == INFORMATION){
|
||||||
|
g.drawImage(getMenuIcon(),223.5,66);
|
||||||
scheduleMinuteUpdatedStart = updateMinutesToCurrentTime(foundSchedule[((foundNumber-2)+currentPositionTable)].sm);
|
scheduleMinuteUpdatedStart = updateMinutesToCurrentTime(foundSchedule[((foundNumber-2)+currentPositionTable)].sm);
|
||||||
scheduleHourUpdatedStart = updateHoursToCurrentTime(foundSchedule[((foundNumber-2)+currentPositionTable)].sh);
|
scheduleHourUpdatedStart = updateHoursToCurrentTime(foundSchedule[((foundNumber-2)+currentPositionTable)].sh);
|
||||||
scheduleMinuteUpdatedEnd = updateMinutesToCurrentTime(foundSchedule[((foundNumber-2)+currentPositionTable)].em);
|
scheduleMinuteUpdatedEnd = updateMinutesToCurrentTime(foundSchedule[((foundNumber-2)+currentPositionTable)].em);
|
||||||
scheduleHourUpdatedEnd = updateHoursToCurrentTime(foundSchedule[((foundNumber-2)+currentPositionTable)].eh);
|
scheduleHourUpdatedEnd = updateHoursToCurrentTime(foundSchedule[((foundNumber-2)+currentPositionTable)].eh);
|
||||||
|
schduleDay = updateDay(1,foundSchedule[((foundNumber-2)+currentPositionTable)].dow);
|
||||||
g.setColor(255,255,255);
|
g.setColor(255,255,255);
|
||||||
g.reset();
|
g.reset();
|
||||||
g.setFont("8x16");
|
g.setFont("HaxorNarrow7x17");
|
||||||
g.drawString(foundSchedule[((foundNumber-2)+currentPositionTable)].cn,13,30);
|
g.drawString(foundSchedule[((foundNumber-2)+currentPositionTable)].cn,13,30);
|
||||||
g.drawString(scheduleHourUpdatedStart+":"+scheduleMinuteUpdatedStart+"-"+scheduleHourUpdatedEnd+":"+scheduleMinuteUpdatedEnd,13,50);
|
g.drawString(scheduleHourUpdatedStart+":"+scheduleMinuteUpdatedStart+"-"+scheduleHourUpdatedEnd+":"+scheduleMinuteUpdatedEnd+" "+schduleDay+" ",13,45);
|
||||||
}
|
}
|
||||||
g.flip();
|
g.flip();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue