commit 03077033988cf62665b3f4534c624c2ff1fe794c
parent 4f713ead59c2be09e1bf8f1d91dceac17aff497d
Author: Marcel <MTRNord@users.noreply.github.com>
Date: Sun, 4 Sep 2016 15:15:50 +0200
Merge pull request #9 from MTRNord/develop
Update to 0.1.0
Diffstat:
5 files changed, 106 insertions(+), 73 deletions(-)
diff --git a/README.md b/README.md
@@ -1,12 +1,15 @@
# ls-vertretungsplan-desktop
UNOFFICIAL Desktop App for the schedule of Lornsenschule, Schleswig
+#DOWNLOADS
+Downloades can be found here: https://ls-desktop.herokuapp.com/download/
+
# Info about the API
This Desktop App uses an API by @johan12345 that is NOT managed by me. I am allowed to use it and to have it in the Git Source. To see the APP made by @johan12345 take a look at https://ls.vertretungsplan.me
-# How to Build (If you find the URL to the API ^^)
+# How to Build
1. Clone the Repository
2. Run `npm install`
3. If You use Windows run `build.cmd` otherwise go to 4
-4. Everybody else go into the app directory and run `npm install` and now run `node build.js` in the root
+4. Everybody else go into the app directory and run `npm install` and now run `build` in the root
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,19 +1,25 @@
-const {app, BrowserWindow, dialog} = 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.
let win
function update () {
- var feedUrl = 'https://ls-desktop.herokuapp.com/update/win32/' + app.getVersion();
+ console.warn("Starting Autoupdater")
+ console.warn(app.getVersion())
+ var feedUrl = 'https://ls-desktop.herokuapp.com/update/' + os.platform() + '/' + app.getVersion() + '/';
autoUpdater.setFeedURL(feedUrl);
+ autoUpdater.checkForUpdates()
+
autoUpdater.on('update-downloaded', function (event, releaseNotes, releaseName, releaseDate, updateUrl, quitAndUpdate) {
var index = dialog.showMessageBox(mainWindow, {
type: 'info',
- buttons: [i18n.__('Restart'), i18n.__('Later')],
- title: "Typetalk",
+ buttons: ['Restart', 'Later'],
+ title: "Lornsenschule Vertretungsplan",
message: i18n.__('The new version has been downloaded. Please restart the application to apply the updates.'),
detail: releaseName + "\n\n" + releaseNotes
});
@@ -22,7 +28,7 @@ function update () {
return;
}
- quitAndUpdate();
+ autoUpdater.quitAndUpdate();
});
}
@@ -33,7 +39,6 @@ function createWindow () {
// and load the index.html of the app.
win.loadURL(`file://${__dirname}/index.html`)
- // Open the DevTools.
//win.webContents.openDevTools()
// Emitted when the window is closed.
@@ -43,6 +48,7 @@ function createWindow () {
// when you should delete the corresponding element.
win = null
})
+ update()
}
// This method will be called when Electron has finished
@@ -65,7 +71,6 @@ app.on('activate', () => {
if (win === null) {
createWindow()
}
- update();
})
// In this file you can include the rest of your app's specific main process
diff --git a/app/package.json b/app/package.json
@@ -1,10 +1,21 @@
{
"name": "ls_vertretungsplan_desktop",
"productName": "Lornsenschule Vertretungsplan",
- "version": "0.0.4",
+ "version": "0.1.0",
"description": "Eine Anwendung die den Vertretungsplan auf dem Desktop anzeigt",
"main": "./main.js",
- "author": "Lornsenschule Vertretungsplan",
+ "author": {
+ "name" : "Lornsenschule Vertretungsplan",
+ "email" : "ínfo@nordgedanken.de",
+ "url" : "https://github.com/MTRNord/ls-vertretungsplan-desktop"
+ },
+ "contributors": [
+ {
+ "name" : "Marcel Radzio",
+ "email" : "ínfo@nordgedanken.de",
+ "url" : "https://github.com/MTRNord/ls-vertretungsplan-desktop"
+ }
+ ],
"license": "",
"dependencies": {
"cached-request": "^1.0.0",
diff --git a/package.json b/package.json
@@ -1,8 +1,8 @@
{
"name": "ls_vertretungsplan_desktop",
- "version": "0.0.4",
+ "version": "0.1.0",
"description": "Eine Anwendung die den Vertretungsplan auf dem Desktop anzeigt",
- "author": "Marcel Radzio <info@nordgedanken.de>",
+ "author": "Marcel Radzio",
"license": "",
"devDependencies": {
"electron": "^1.3.4",
@@ -34,12 +34,12 @@
},
"win": {
"iconUrl": "https://github.com/MTRNord/ls-vertretungsplan-desktop/tree/master/app/LS.ico?raw=true",
+ "remoteReleases": "http://ls-desktop.herokuapp.com/download/0.0.4/",
"icon": "app/LS.ico"
},
"linux": {
"target": [
"deb",
- "AppImage",
"zip",
"rpm"
]