commit 93e971148e6dccf8b612a70f2901f37819515701
parent 4d8544c8e40af7aa49d8b167734a45a33460e6f6
Author: Marcel <MTRNord@users.noreply.github.com>
Date: Fri, 2 Sep 2016 23:26:13 +0200
Merge pull request #7 from MTRNord/develop
Add v0.0.3 to master
Diffstat:
9 files changed, 130 insertions(+), 71 deletions(-)
diff --git a/.gitignore b/.gitignore
@@ -25,6 +25,7 @@ build/Release
build
prebuild
cache
+dist
# Dependency directory
node_modules
@@ -33,5 +34,4 @@ node_modules
.npm
# Optional REPL history
-.node_repl_history
-LS.ico
-\ No newline at end of file
+.node_repl_history
+\ No newline at end of file
diff --git a/app/.gitignore b/app/.gitignore
@@ -32,5 +32,4 @@ node_modules
.npm
# Optional REPL history
-.node_repl_history
-LS.ico
-\ No newline at end of file
+.node_repl_history
+\ No newline at end of file
diff --git a/app/LS.ico b/app/LS.ico
Binary files differ.
diff --git a/app/index.html b/app/index.html
@@ -7,6 +7,7 @@
<!-- Material Design fonts -->
<link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700">
<link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/icon?family=Material+Icons">
+ <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.3/css/bootstrap.min.css" integrity="sha384-MIwDKRSSImVFAZCVLtU0LMDdON6KVCrZHyVQQj6e8wIEJkW4tvwqXrbMIya1vriY" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdn.rawgit.com/FezVrasta/bootstrap-material-design/dist/dist/bootstrap-material-design.min.css">
<title>Lornsenschule Vertretungsplan</title>
</head>
@@ -17,13 +18,13 @@
<h1 id="school"></h1></br>
<ul class="nav nav-tabs" id="Tabs">
- <li class="active"><a data-target="#vertretungen" data-toggle="tab">Profile</a></li>
- <li><a data-target="#messages" data-toggle="tab">Messages</a></li>
+ <li class="nav-item"><a class="nav-link active" data-target="#vertretungen" data-toggle="tab">Vertretungen</a></li>
+ <li class="nav-item"><a class="nav-link" data-target="#messages" data-toggle="tab">Messages</a></li>
</ul>
<div class="tab-content">
- <div class="tab-pane active" id="vertretungen"></div>
- <div class="tab-pane" id="messages"></div>
+ <div class="tab-pane fade in active" id="vertretungen"></div>
+ <div class="tab-pane fade" id="messages"></div>
</div>
</div>
@@ -32,11 +33,10 @@
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script>
- /*
- Refresh Button Snippets:
- var remote = require('electron').remote
- remote.getCurrentWindow().reload()
- */
+ function reloadPage() {
+ var remote = require('electron').remote
+ remote.getCurrentWindow().reload()
+ }
window.$ = window.jQuery = require('./js/jquery-3.1.0.min.js');
var request = require('request')
, cachedRequest = require('cached-request')(request)
@@ -53,7 +53,9 @@
json: true,
ttl: 1800000
}, function (error, response, body) {
+ console.log("Response Code: " + response.statusCode)
if (!error && response.statusCode === 200) {
+ console.log("Parsing")
document.all.school.innerHTML = body.schoolId.replace(/_/g, ' ') + ' Vertretungsplan'; // Print the json response
for (var key in body.days) {
if (body.days.hasOwnProperty(key)) {
@@ -65,50 +67,73 @@
// //
//////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////
- if (key == 0) {
+ if (key == 1) {
date = body.days[key].dateString
substitutions = body.days[key].substitutions
- substitutions.sort(function(a, b){
- if (a.classes < b.classes) return -1;
- if (b.classes < a.classes) return 1;
- return 0;
- })
+ 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>')
+ }
+ }
for (var key in substitutions) {
if (substitutions.hasOwnProperty(key)) {
- klasse = substitutions[key].classes
- if ($("#klasse").attr("klasse") != klasse) {
- $("#vertretungen").append('<h3 id="klasse" klasse="' + klasse + '">' + klasse + '</h3>')
- }
- var reg = new RegExp('[-]');
- lesson = substitutions[key].lesson
- substitutions_type = substitutions[key].type
- text = substitutions[key].text
- if (substitutions_type == "Vertretung") {
- if (lesson.match(reg)) {
- $("#vertretungen").append('<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>')
- }else{
- $("#vertretungen").append('<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>')
- }
- }else{
- if (substitutions_type == "Betreuung") {
- if (lesson.match(reg)) {
- $("#vertretungen").append('<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>')
- }else{
- $("#vertretungen").append('<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>')
- }
- }else{
- if (substitutions_type == "Unterricht geändert") {
- if (lesson.match(reg)) {
- $("#vertretungen").append('<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>')
+ 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") {
+ 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>')
}else{
- $("#vertretungen").append('<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 + "']", "#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>')
}
}else{
- if (substitutions_type == "Lehrertausch") {
- if (lesson.match(reg)) {
- $("#vertretungen").append('<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>')
+ 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>')
}else{
- $("#vertretungen").append('<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 + "']", "#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>')
+ }
+ }else{
+ 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: #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>')
+ }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>')
+ }
+ }else{
+ if (substitutions_type == "Lehrertausch") {
+ 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>')
+ }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>')
+ }
+ }else{
+ 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>')
+ }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>')
+ }
+ }
+ }
}
}
}
@@ -119,16 +144,25 @@
}
}
}
+ $.fn.sortDivs = jQuery.fn.sortDivs = function sortDivs() {
+ $("> 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();
}else{
+ console.log(error)
$("#Main").append('<p class="bg-danger">Scheinbar geht dein Internet nicht :/</p>')
}
})
- $('#Tabs a:last').tab('show')
+ $('#Tabs a').click(function (e) {
+ e.preventDefault()
+ $(this).tab('show')
+ })
</script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
- <script src="js/bootstrap/bootstrap.min.js"></script>
- <script src="https://cdn.rawgit.com/HubSpot/tether/v1.3.4/dist/js/tether.min.js"></script>
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.2.0/js/tether.min.js" integrity="sha384-Plbmg8JY28KFelvJVai01l8WyZzrYWG825m+cZ0eDDS1f7d/js6ikvy1+X+guPIB" crossorigin="anonymous"></script>
+ <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.3/js/bootstrap.min.js" integrity="sha384-ux8v3A6CPtOTqOzMKiuo3d/DomGaaClxFYdCu2HPMBEkf6x2xiDyJ7gkXU0MWwaD" crossorigin="anonymous"></script>
<script src="https://cdn.rawgit.com/FezVrasta/bootstrap-material-design/dist/dist/bootstrap-material-design.iife.min.js"></script>
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
<script src="https://maxcdn.bootstrapcdn.com/js/ie10-viewport-bug-workaround.js"></script>
diff --git a/app/main.js b/app/main.js
@@ -28,7 +28,7 @@ function update () {
function createWindow () {
// Create the browser window.
- win = new BrowserWindow({width: 800, height: 600})
+ win = new BrowserWindow({width: 800, height: 600, icon: __dirname + '/LS.ico', title: 'Lornsenschule Vertretungsplan'})
// and load the index.html of the app.
win.loadURL(`file://${__dirname}/index.html`)
diff --git a/app/package.json b/app/package.json
@@ -1,5 +1,6 @@
{
"name": "ls_vertretungsplan_desktop",
+ "productName": "Lornsenschule Vertretungsplan",
"version": "0.0.3",
"description": "Eine Anwendung die den Vertretungsplan auf dem Desktop anzeigt",
"main": "./main.js",
@@ -8,5 +9,6 @@
"dependencies": {
"cached-request": "^1.0.0",
"request": "^2.69.0"
- }
+ },
+ "homepage": "https://github.com/MTRNord/ls-vertretungsplan-desktop"
}
diff --git a/build.cmd b/build.cmd
@@ -1,2 +0,0 @@
-electron-packager app --all --out prebuild/
-node build.js
-\ No newline at end of file
diff --git a/build.js b/build.js
@@ -1,9 +0,0 @@
-var electronInstaller = require('electron-winstaller');
-resultPromise = electronInstaller.createWindowsInstaller({
- appDirectory: 'prebuild/ls_vertretungsplan_desktop-win32-x64',
- outputDirectory: 'build',
- authors: 'Marcel Radzio',
- exe: 'ls_vertretungsplan_desktop.exe'
- });
-
-resultPromise.then(() => console.log("It worked!"), (e) => console.log(`No dice: ${e.message}`));
-\ No newline at end of file
diff --git a/package.json b/package.json
@@ -1,11 +1,48 @@
{
"name": "ls_vertretungsplan_desktop",
- "version": "0.0.2",
+ "version": "0.0.3",
"description": "Eine Anwendung die den Vertretungsplan auf dem Desktop anzeigt",
"author": "Marcel Radzio <info@nordgedanken.de>",
"license": "",
"devDependencies": {
"electron": "^1.3.4",
- "electron-winstaller": "^2.3.4"
+ "electron-builder": "^6.4.0"
+ },
+ "scripts": {
+ "pack": "build --dir",
+ "dist": "build",
+ "release": "build"
+ },
+ "build": {
+ "asar": true,
+ "appId": "de.nordgedanken.ls_vertretungsplan_desktop",
+ "category": "public.app-category.education",
+ "dmg": {
+ "contents": [
+ {
+ "x": 410,
+ "y": 150,
+ "type": "link",
+ "path": "/Applications"
+ },
+ {
+ "x": 130,
+ "y": 150,
+ "type": "file"
+ }
+ ]
+ },
+ "win": {
+ "iconUrl": "https://github.com/MTRNord/ls-vertretungsplan-desktop/tree/master/app/LS.ico?raw=true",
+ "remoteReleases": "https://github.com/MTRNord/ls-vertretungsplan-desktop"
+ },
+ "linux": {
+ "target": [
+ "deb",
+ "AppImage",
+ "zip",
+ "rpm"
+ ]
+ }
}
}