commit 8af440d27930b06df81d5aef05ab6d874a4a344e
parent a8f92b931b23caefd53f739be7e96f984260241a
Author: MTRNord <mtrnord1@gmail.com>
Date: Sun, 4 Sep 2016 15:15:05 +0200
Support both days add some new Events
Diffstat:
3 files changed, 78 insertions(+), 62 deletions(-)
diff --git a/app/index.html b/app/index.html
@@ -23,7 +23,7 @@
</ul>
<div class="tab-content">
- <div class="tab-pane fade in active" id="vertretungen"></div>
+ <div class="tab-pane fade in active" id="vertretungen"><div id="days" day="0"></div><div id="days" day="1"></div></div>
<div class="tab-pane fade" id="messages"></div>
</div>
@@ -59,78 +59,86 @@
document.all.school.innerHTML = body.schoolId.replace(/_/g, ' ') + ' Vertretungsplan'; // Print the json response
for (var key in body.days) {
if (body.days.hasOwnProperty(key)) {
- //////////////////////////////////////////////////////////////
- //////////////////////////////////////////////////////////////
- // //
- // 1 == morgen //
- // 0 == heute //
- // //
- //////////////////////////////////////////////////////////////
- //////////////////////////////////////////////////////////////
- if (key == 1) {
- date = body.days[key].dateString
- substitutions = body.days[key].substitutions
- messages = body.days[key].messages
- console.log("Day found")
- for (var key in messages) {
- if (messages.hasOwnProperty(key)) {
- $("#messages").append('<div class="card card-block" style="height: 10%; background-color: #EEEEEE; color: #000"><p>' + messages[key].replace(/\n/g, ' ') + '</p></div>')
- }
+ date = body.days[key].dateString
+ substitutions = body.days[key].substitutions
+ messages = body.days[key].messages
+ day = key
+ console.log("Day found")
+ $("#messages").append('<h2 id="date">' + date + '</h2>')
+ for (var key in messages) {
+ if (messages.hasOwnProperty(key)) {
+ $("#messages").append('<div class="card card-block" style="height: 10%; background-color: #EEEEEE; color: #000"><p>' + messages[key].replace(/\n/g, ' ') + '</p></div>')
}
- for (var key in substitutions) {
- if (substitutions.hasOwnProperty(key)) {
- console.log("Substitutions found")
- substitutions_now = substitutions[key]
- klassen = substitutions_now.classes
- for (var key in klassen) {
- if (klassen.hasOwnProperty(key)) {
- console.log("Class found")
- klasse = klassen[key]
- console.log(klasse)
- console.log($("h3").filter("[klasse='" + klasse + "']", "#klasse").length)
- if ($("h3").filter("[klasse='" + klasse + "']", "#klasse").length == 0) {
- console.log("Found new Class")
- $("#vertretungen").append('<div id="klasse" klasse="' + klasse + '"><h3 id="klasse" klasse="' + klasse + '">' + klasse + '</h3>')
- }else{}
- var reg = new RegExp('[-]');
- lesson = substitutions_now.lesson
- substitutions_type = substitutions_now.type
- text = substitutions_now.text
- console.log("Appending")
- console.log("Multiple Subjects: " + reg.test(lesson))
- if (substitutions_type == "Vertretung") {
+ }
+ console.log(day)
+ $("div").filter("[day='" + day + "']", "#days").append('<h2 id="date" date="' + date + '">' + date + '</h2>')
+ for (var key in substitutions) {
+ if (substitutions.hasOwnProperty(key)) {
+ console.log("Substitutions found")
+ substitutions_now = substitutions[key]
+ klassen = substitutions_now.classes
+ for (var key in klassen) {
+ if (klassen.hasOwnProperty(key)) {
+ console.log("Class found")
+ klasse = klassen[key]
+ if ($("h3").filter("[klasse='" + klasse + "'][day='" + day + "']", "#klasse").length == 0) {
+ console.log("Found new Class")
+ $("h2").filter("[date='" + date + "']", "#days").after('<div id="klasse" klasse="' + klasse + '"><h3 id="klasse" klasse="' + klasse + '" day="' + day + '">' + klasse + '</h3>')
+ }else{}
+ var reg = new RegExp('[-]');
+ lesson = substitutions_now.lesson
+ substitutions_type = substitutions_now.type
+ text = substitutions_now.text
+ console.log("Appending")
+ console.log("Multiple Subjects: " + reg.test(lesson))
+ if (substitutions_type == "Vertretung") {
+ if (reg.test(lesson)) {
+ $("h3").filter("[klasse='" + klasse + "'][day='" + day + "']", "#klasse").after('<div class="card card-block" style="height: 10%; background-color: #2196F3; color: #fff" id="substitution" substitution="' + lesson + '"><div class="row"><div class="col-md-4" style="position: relative; margin: 0;"><p style="font-size: 300%; margin: 0; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);">' + lesson + '</p></div><div class="col-md-8"><h4>' + substitutions_type + '</h4></br><h7>' + text + '</h7></div></div></div>')
+ }else{
+ $("h3").filter("[klasse='" + klasse + "'][day='" + day + "']", "#klasse").after('<div class="card card-block" style="height: 10%; background-color: #2196F3; color: #fff" id="substitution" substitution="' + lesson + '"><div class="row"><div class="col-md-4" style="position: relative; margin: 0;"><p style="font-size: 350%; margin: 0; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);">' + lesson + '</p></div><div class="col-md-8"><h4>' + substitutions_type + '</h4></br><h7>' + text + '</h7></div></div></div>')
+ }
+ }else{
+ if (substitutions_type == "Betreuung") {
if (reg.test(lesson)) {
- $("h3").filter("[klasse='" + klasse + "']", "#klasse").after('<div class="card card-block" style="height: 10%; background-color: #2196F3; color: #fff">' + '<div class="row">' + '<div class="col-md-4" style="position: relative; margin: 0;"><p style="font-size: 300%; margin: 0; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);">' + lesson + '</p></div>' + '<div class="col-md-8"><h4>' + substitutions_type + '</h4></br><h7>' + text + '</h7></div>' + '</div>' + '</div>')
+ $("h3").filter("[klasse='" + klasse + "'][day='" + day + "']", "#klasse").after('<div class="card card-block" style="height: 10%; background-color: #2196F3; color: #fff" id="substitution" substitution="' + lesson + '"><div class="row"><div class="col-md-4" style="position: relative; margin: 0;"><p style="font-size: 300%; margin: 0; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);">' + lesson + '</p></div><div class="col-md-8"><h4>' + substitutions_type + '</h4></br><h7>' + text + '</h7></div></div></div>')
}else{
- $("h3").filter("[klasse='" + klasse + "']", "#klasse").after('<div class="card card-block" style="height: 10%; background-color: #2196F3; color: #fff">' + '<div class="row">' + '<div class="col-md-4" style="position: relative; margin: 0;"><p style="font-size: 350%; margin: 0; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);">' + lesson + '</p></div>' + '<div class="col-md-8"><h4>' + substitutions_type + '</h4></br><h7>' + text + '</h7></div>' + '</div>' + '</div>')
+ $("h3").filter("[klasse='" + klasse + "'][day='" + day + "']", "#klasse").after('<div class="card card-block" style="height: 10%; background-color: #2196F3; color: #fff" id="substitution" substitution="' + lesson + '>' + '<div class="row"><div class="col-md-4" style="position: relative; margin: 0;"><p style="font-size: 350%; margin: 0; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);">' + lesson + '</p></div><div class="col-md-8"><h4>' + substitutions_type + '</h4></br><h7>' + text + '</h7></div></div></div>')
}
}else{
- if (substitutions_type == "Betreuung") {
+ if (substitutions_type == "Unterricht geändert") {
if (reg.test(lesson)) {
- $("h3").filter("[klasse='" + klasse + "']", "#klasse").after('<div class="card card-block" style="height: 10%; background-color: #2196F3; color: #fff">' + '<div class="row">' + '<div class="col-md-4" style="position: relative; margin: 0;"><p style="font-size: 300%; margin: 0; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);">' + lesson + '</p></div>' + '<div class="col-md-8"><h4>' + substitutions_type + '</h4></br><h7>' + text + '</h7></div>' + '</div>' + '</div>')
+ $("h3").filter("[klasse='" + klasse + "'][day='" + day + "']", "#klasse").after('<div class="card card-block" style="height: 10%; background-color: #FFA000; color: #fff" id="substitution" substitution="' + lesson + '"><div class="row"><div class="col-md-4" style="position: relative; margin: 0;"><p style="font-size: 300%; margin: 0; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);">' + lesson + '</p></div><div class="col-md-8"><h4>' + substitutions_type + '</h4></br><h7>' + text + '</h7></div></div></div>')
}else{
- $("h3").filter("[klasse='" + klasse + "']", "#klasse").after('<div class="card card-block" style="height: 10%; background-color: #2196F3; color: #fff">' + '<div class="row">' + '<div class="col-md-4" style="position: relative; margin: 0;"><p style="font-size: 350%; margin: 0; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);">' + lesson + '</p></div>' + '<div class="col-md-8"><h4>' + substitutions_type + '</h4></br><h7>' + text + '</h7></div>' + '</div>' + '</div>')
+ $("h3").filter("[klasse='" + klasse + "'][day='" + day + "']", "#klasse").after('<div class="card card-block" style="height: 10%; background-color: #FFA000; color: #fff" id="substitution" substitution="' + lesson + '"><div class="row">' + '<div class="col-md-4" style="position: relative; margin: 0;"><p style="font-size: 350%; margin: 0; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);">' + lesson + '</p></div><div class="col-md-8"><h4>' + substitutions_type + '</h4></br><h7>' + text + '</h7></div></div></div>')
}
}else{
- if (substitutions_type == "Unterricht geändert") {
+ if (substitutions_type == "Lehrertausch") {
if (reg.test(lesson)) {
- $("h3").filter("[klasse='" + klasse + "']", "#klasse").after('<div class="card card-block" style="height: 10%; background-color: #FFA000; color: #fff">' + '<div class="row">' + '<div class="col-md-4" style="position: relative; margin: 0;"><p style="font-size: 300%; margin: 0; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);">' + lesson + '</p></div>' + '<div class="col-md-8"><h4>' + substitutions_type + '</h4></br><h7>' + text + '</h7></div>' + '</div>' + '</div>')
+ $("h3").filter("[klasse='" + klasse + "'][day='" + day + "']", "#klasse").after('<div class="card card-block" style="height: 10%; background-color: #9C27B0; color: #fff" id="substitution" substitution="' + lesson + '"><div class="row"><div class="col-md-4" style="position: relative; margin: 0;"><p style="font-size: 300%; margin: 0; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);">' + lesson + '</p></div><div class="col-md-8"><h4>' + substitutions_type + '</h4></br><h7>' + text + '</h7></div></div></div>')
}else{
- $("h3").filter("[klasse='" + klasse + "']", "#klasse").after('<div class="card card-block" style="height: 10%; background-color: #FFA000; color: #fff">' + '<div class="row">' + '<div class="col-md-4" style="position: relative; margin: 0;"><p style="font-size: 350%; margin: 0; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);">' + lesson + '</p></div>' + '<div class="col-md-8"><h4>' + substitutions_type + '</h4></br><h7>' + text + '</h7></div>' + '</div>' + '</div>')
+ $("h3").filter("[klasse='" + klasse + "'][day='" + day + "']", "#klasse").after('<div class="card card-block" style="height: 10%; background-color: #9C27B0; color: #fff" id="substitution" substitution="' + lesson + '"><div class="row"><div class="col-md-4" style="position: relative; margin: 0;"><p style="font-size: 350%; margin: 0; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);">' + lesson + '</p></div><div class="col-md-8"><h4>' + substitutions_type + '</h4></br><h7>' + text + '</h7></div></div></div>')
}
}else{
- if (substitutions_type == "Lehrertausch") {
+ if (substitutions_type == "anderer Raum") {
if (reg.test(lesson)) {
- $("h3").filter("[klasse='" + klasse + "']", "#klasse").after('<div class="card card-block" style="height: 10%; background-color: #9C27B0; color: #fff">' + '<div class="row">' + '<div class="col-md-4" style="position: relative; margin: 0;"><p style="font-size: 300%; margin: 0; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);">' + lesson + '</p></div>' + '<div class="col-md-8"><h4>' + substitutions_type + '</h4></br><h7>' + text + '</h7></div>' + '</div>' + '</div>')
+ $("h3").filter("[klasse='" + klasse + "'][day='" + day + "']", "#klasse").after('<div class="card card-block" style="height: 10%; background-color: #9C27B0; color: #fff" id="substitution" substitution="' + lesson + '"><div class="row"><div class="col-md-4" style="position: relative; margin: 0;"><p style="font-size: 300%; margin: 0; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);">' + lesson + '</p></div><div class="col-md-8"><h4>' + substitutions_type + '</h4></br><h7>' + text + '</h7></div></div></div>')
}else{
- $("h3").filter("[klasse='" + klasse + "']", "#klasse").after('<div class="card card-block" style="height: 10%; background-color: #9C27B0; color: #fff">' + '<div class="row">' + '<div class="col-md-4" style="position: relative; margin: 0;"><p style="font-size: 350%; margin: 0; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);">' + lesson + '</p></div>' + '<div class="col-md-8"><h4>' + substitutions_type + '</h4></br><h7>' + text + '</h7></div>' + '</div>' + '</div>')
+ $("h3").filter("[klasse='" + klasse + "'][day='" + day + "']", "#klasse").after('<div class="card card-block" style="height: 10%; background-color: #9C27B0; color: #fff" id="substitution" substitution="' + lesson + '"><div class="row"><div class="col-md-4" style="position: relative; margin: 0;"><p style="font-size: 350%; margin: 0; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);">' + lesson + '</p></div><div class="col-md-8"><h4>' + substitutions_type + '</h4></br><h7>' + text + '</h7></div></div></div>')
}
}else{
- if (substitutions_type == "anderer Raum") {
+ if (substitutions_type == "Aufgaben") {
if (reg.test(lesson)) {
- $("h3").filter("[klasse='" + klasse + "']", "#klasse").after('<div class="card card-block" style="height: 10%; background-color: #9C27B0; color: #fff">' + '<div class="row">' + '<div class="col-md-4" style="position: relative; margin: 0;"><p style="font-size: 300%; margin: 0; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);">' + lesson + '</p></div>' + '<div class="col-md-8"><h4>' + substitutions_type + '</h4></br><h7>' + text + '</h7></div>' + '</div>' + '</div>')
+ $("h3").filter("[klasse='" + klasse + "'][day='" + day + "']", "#klasse").after('<div class="card card-block" style="height: 10%; background-color: #F44336; color: #fff" id="substitution" substitution="' + lesson + '"><div class="row"><div class="col-md-4" style="position: relative; margin: 0;"><p style="font-size: 300%; margin: 0; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);">' + lesson + '</p></div><div class="col-md-8"><h4>' + substitutions_type + '</h4></br><h7>' + text + '</h7></div></div></div>')
}else{
- $("h3").filter("[klasse='" + klasse + "']", "#klasse").after('<div class="card card-block" style="height: 10%; background-color: #9C27B0; color: #fff">' + '<div class="row">' + '<div class="col-md-4" style="position: relative; margin: 0;"><p style="font-size: 350%; margin: 0; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);">' + lesson + '</p></div>' + '<div class="col-md-8"><h4>' + substitutions_type + '</h4></br><h7>' + text + '</h7></div>' + '</div>' + '</div>')
+ $("h3").filter("[klasse='" + klasse + "'][day='" + day + "']", "#klasse").after('<div class="card card-block" style="height: 10%; background-color: #F44336; color: #fff" id="substitution" substitution="' + lesson + '"><div class="row"><div class="col-md-4" style="position: relative; margin: 0;"><p style="font-size: 350%; margin: 0; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);">' + lesson + '</p></div><div class="col-md-8"><h4>' + substitutions_type + '</h4></br><h7>' + text + '</h7></div></div></div>')
+ }
+ }else{
+ if (substitutions_type == "Sondereins.") {
+ if (reg.test(lesson)) {
+ $("h3").filter("[klasse='" + klasse + "'][day='" + day + "']", "#klasse").after('<div class="card card-block" style="height: 10%; background-color: #2196F3; color: #fff" id="substitution" substitution="' + lesson + '"><div class="row"><div class="col-md-4" style="position: relative; margin: 0;"><p style="font-size: 300%; margin: 0; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);">' + lesson + '</p></div><div class="col-md-8"><h4>' + substitutions_type + '</h4></br><h7>' + text + '</h7></div></div></div>')
+ }else{
+ $("h3").filter("[klasse='" + klasse + "'][day='" + day + "']", "#klasse").after('<div class="card card-block" style="height: 10%; background-color: #2196F3; color: #fff" id="substitution" substitution="' + lesson + '"><div class="row"><div class="col-md-4" style="position: relative; margin: 0;"><p style="font-size: 350%; margin: 0; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);">' + lesson + '</p></div><div class="col-md-8"><h4>' + substitutions_type + '</h4></br><h7>' + text + '</h7></div></div></div>')
+ }
}
}
}
@@ -138,21 +146,27 @@
}
}
}
+ $.fn.sortSubstitutions = jQuery.fn.sortSubstitutions = function sortSubstitutions() {
+ $("> div", this[0]).sort(dec_sort).appendTo(this[0]);
+ function dec_sort(a, b){ return ($(b).attr("substitution")) < ($(a).attr("substitution")) ? 1 : -1; }
+ }
+ $('div#klasse[klasse="' + klasse + '"]').sortSubstitutions();
}
}
}
}
}
}
- $.fn.sortDivs = jQuery.fn.sortDivs = function sortDivs() {
+ $.fn.sortClasses = jQuery.fn.sortClasses = function sortClasses() {
$("> div", this[0]).sort(dec_sort).appendTo(this[0]);
function dec_sort(a, b){ return ($(b).attr("klasse")) < ($(a).attr("klasse")) ? 1 : -1; }
}
- $('#vertretungen').sortDivs();
+ $('#days[day="0"]').sortClasses();
+ $('#days[day="1"]').sortClasses();
}else{
- console.log(error)
- $("#Main").append('<p class="bg-danger">Scheinbar geht dein Internet nicht :/</p>')
- }
+ console.log(error)
+ $("#Main").append('<p class="bg-danger">Scheinbar geht dein Internet nicht :/</p>')
+ }
})
$('#Tabs a').click(function (e) {
diff --git a/app/main.js b/app/main.js
@@ -1,4 +1,6 @@
-const {app, BrowserWindow, dialog, autoUpdater, globalShortcut} = require('electron')
+const {app, BrowserWindow, dialog, globalShortcut} = require('electron')
+const autoUpdater = require('electron').autoUpdater
+const os = require("os")
// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
@@ -6,7 +8,8 @@ let win
function update () {
console.warn("Starting Autoupdater")
- var feedUrl = 'https://ls-desktop.herokuapp.com/update/win/' + app.getVersion();
+ console.warn(app.getVersion())
+ var feedUrl = 'https://ls-desktop.herokuapp.com/update/' + os.platform() + '/' + app.getVersion() + '/';
autoUpdater.setFeedURL(feedUrl);
autoUpdater.checkForUpdates()
diff --git a/package.json b/package.json
@@ -40,7 +40,6 @@
"linux": {
"target": [
"deb",
- "AppImage",
"zip",
"rpm"
]