Compare commits

...

4 Commits

Author SHA1 Message Date
Manuel Friedli 46756f6e80 tinker 2017-11-11 00:46:26 +01:00
Manuel Friedli 4f25cdf47b fix yarn.lock 2017-11-10 20:50:55 +01:00
Manuel Friedli d9ad805d81 some tinkering 2017-11-10 20:30:08 +01:00
Manuel Friedli e23cb55543 Move everything to the _old directory and add the angular-cli generated
angular app scaffold.
2017-11-10 17:32:35 +01:00
87 changed files with 7324 additions and 39 deletions

60
.angular-cli.json Normal file
View File

@ -0,0 +1,60 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"project": {
"name": "uhr"
},
"apps": [
{
"root": "src",
"outDir": "dist",
"assets": [
"assets",
"favicon.ico"
],
"index": "index.html",
"main": "main.ts",
"polyfills": "polyfills.ts",
"test": "test.ts",
"tsconfig": "tsconfig.app.json",
"testTsconfig": "tsconfig.spec.json",
"prefix": "app",
"styles": [
"styles.scss"
],
"scripts": [],
"environmentSource": "environments/environment.ts",
"environments": {
"dev": "environments/environment.ts",
"prod": "environments/environment.prod.ts"
}
}
],
"e2e": {
"protractor": {
"config": "./protractor.conf.js"
}
},
"lint": [
{
"project": "src/tsconfig.app.json",
"exclude": "**/node_modules/**"
},
{
"project": "src/tsconfig.spec.json",
"exclude": "**/node_modules/**"
},
{
"project": "e2e/tsconfig.e2e.json",
"exclude": "**/node_modules/**"
}
],
"test": {
"karma": {
"config": "./karma.conf.js"
}
},
"defaults": {
"styleExt": "scss",
"component": {}
}
}

View File

@ -1,13 +1,13 @@
# http://editorconfig.org
# Editor configuration, see http://editorconfig.org
root = true
[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true
[*.md]
max_line_length = off
trim_trailing_whitespace = false

48
.gitignore vendored
View File

@ -1,6 +1,44 @@
*~
.idea
*.iml
# See http://help.github.com/ignore-files/ for more about ignoring files.
# compiled output
/dist
/tmp
/out-tsc
# dependencies
/node_modules
# IDEs and editors
/.idea
.project
.classpath
atlassian-ide-plugin.xml
/node_modules/
/bower_components/
.c9/
*.launch
.settings/
*.sublime-workspace
*~
# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
# misc
/.sass-cache
/connect.lock
/coverage
/libpeerconnection.log
npm-debug.log
testem.log
/typings
# e2e
/e2e/*.js
/e2e/*.map
# System Files
.DS_Store
Thumbs.db

View File

View File

@ -29,7 +29,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<link rel="stylesheet" type="text/css" href="dist/uhr-green.min.css" data-class="green" data-name="Grün"/>
<link rel="stylesheet" type="text/css" href="dist/uhr-blue.min.css" data-class="blue" data-name="Blau"/>
<link rel="stylesheet" type="text/css" href="dist/uhr-pink.min.css" data-class="pink" data-name="Pink"/>
<link rel="shortcut icon" type="image/png" href="resources/favicon.png"/>
<link rel="shortcut icon" type="image/png" href="../src/favicon.png"/>
<link rel="apple-touch-icon-precomposed" href="resources/apple-touch-icon-precomposed.png"/>
<script type="text/javascript" src="dist/libs.min.js"></script>
<script type="text/javascript" src="dist/jquery.uhr.complete.min.js"></script>

View File

@ -22,7 +22,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<link rel="stylesheet" type="text/css" href="../dist/uhr-black.min.css" data-class="black"/>
<link rel="stylesheet" type="text/css" href="../dist/uhr-red.min.css" data-class="red"/>
<link rel="stylesheet" type="text/css" href="info.css"/>
<link rel="shortcut icon" type="image/png" href="../resources/favicon.png"/>
<link rel="shortcut icon" type="image/png" href="../../src/favicon.png"/>
<script type="text/javascript" src="../dist/libs.min.js"></script>
<script type="text/javascript" src="../dist/jquery.uhr.base.min.js"></script>
<script type="text/javascript">
@ -289,7 +289,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<p>Der Quellcode ist frei zugänglich unter <a
href="https://gittr.ch/manuel/uhr">https://gittr.ch/manuel/uhr</a>.</p>
<p>Detaillierte Informationen zur Verwendung und Konfiguration findest du in der <a href="../README.md">README.md</a>.
<p>Detaillierte Informationen zur Verwendung und Konfiguration findest du in der <a href="../../README.md">README.md</a>.
</p>
<h2 id="license">Lizenzbestimmungen<a href="#toc" class="toclink">Zum Inhalt</a></h2>

54
_old/package.json Normal file
View File

@ -0,0 +1,54 @@
{
"name": "uhr",
"version": "8.0.4-dev.0",
"description": "jQuery QLOCKTWO plugin",
"keywords": [
"jquery-plugin",
"qlocktwo"
],
"scripts": {
"ng": "ng"
},
"homepage": "http://bärneruhr.ch/",
"author": {
"name": "Manuel Friedli",
"email": "manuel@fritteli.ch",
"url": "http://www.fritteli.ch/"
},
"repository": {
"type": "git",
"url": "https://gittr.ch/manuel/uhr"
},
"licenses": [
{
"type": "GPL-3.0"
}
],
"license": "GPL-3.0",
"dependencies": {
"jquery": "~2.1.3",
"jquery-ui": "github:jquery/jquery-ui#1.11.4",
"jquery.cookie": "~1.4.1"
},
"devDependencies": {
"@angular/cli": "^1.5.0",
"grunt": "~0.4.5",
"grunt-cli": "^0.1.13",
"grunt-contrib-clean": "~0.6.0",
"grunt-contrib-concat": "~0.5.0",
"grunt-contrib-connect": "~0.11.0",
"grunt-contrib-cssmin": "^0.14.0",
"grunt-contrib-jshint": "~0.11.0",
"grunt-contrib-qunit": "~0.7.0",
"grunt-contrib-uglify": "~0.9.2",
"grunt-contrib-watch": "~0.6.1",
"grunt-mocha-phantomjs": "^2.0.0",
"grunt-version": "^1.0.0",
"jshint-stylish": "~2.0.1",
"load-grunt-tasks": "~3.3.0",
"phantomjs": "^1.9.18",
"time-grunt": "~1.2.1",
"mocha": "~2.3.3",
"chai": "~3.3.0"
}
}

View File

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

Before

Width:  |  Height:  |  Size: 407 B

After

Width:  |  Height:  |  Size: 407 B

View File

Before

Width:  |  Height:  |  Size: 435 B

After

Width:  |  Height:  |  Size: 435 B

View File

@ -29,7 +29,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<link rel="stylesheet" type="text/css" href="../dist/uhr-green.min.css" data-class="green" data-name="Grün"/>
<link rel="stylesheet" type="text/css" href="../dist/uhr-blue.min.css" data-class="blue" data-name="Blau"/>
<link rel="stylesheet" type="text/css" href="../dist/uhr-pink.min.css" data-class="pink" data-name="Pink"/>
<link rel="shortcut icon" type="image/png" href="../resources/favicon.png"/>
<link rel="shortcut icon" type="image/png" href="../../src/favicon.png"/>
<link rel="apple-touch-icon-precomposed" href="../resources/apple-touch-icon-precomposed.png"/>
<script type="text/javascript" src="../dist/libs.min.js"></script>
<script type="text/javascript" src="../dist/jquery.uhr.complete.min.js"></script>

14
e2e/app.e2e-spec.ts Normal file
View File

@ -0,0 +1,14 @@
import { AppPage } from './app.po';
describe('uhr App', () => {
let page: AppPage;
beforeEach(() => {
page = new AppPage();
});
it('should display welcome message', () => {
page.navigateTo();
expect(page.getParagraphText()).toEqual('Welcome to app!');
});
});

11
e2e/app.po.ts Normal file
View File

@ -0,0 +1,11 @@
import { browser, by, element } from 'protractor';
export class AppPage {
navigateTo() {
return browser.get('/');
}
getParagraphText() {
return element(by.css('app-root h1')).getText();
}
}

14
e2e/tsconfig.e2e.json Normal file
View File

@ -0,0 +1,14 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/e2e",
"baseUrl": "./",
"module": "commonjs",
"target": "es5",
"types": [
"jasmine",
"jasminewd2",
"node"
]
}
}

33
karma.conf.js Normal file
View File

@ -0,0 +1,33 @@
// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular/cli'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter'),
require('@angular/cli/plugins/karma')
],
client:{
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
coverageIstanbulReporter: {
reports: [ 'html', 'lcovonly' ],
fixWebpackSourcePaths: true
},
angularCli: {
environment: 'dev'
},
reporters: ['progress', 'kjhtml'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false
});
};

View File

@ -1,16 +1,23 @@
{
"name": "uhr",
"version": "8.0.4-dev.0",
"description": "jQuery QLOCKTWO plugin",
"description": "QLOCKTWO as an Angular app",
"keywords": [
"jquery-plugin",
"qlocktwo"
],
"homepage": "http://bärneruhr.ch/",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"homepage": "https://bärneruhr.ch/",
"author": {
"name": "Manuel Friedli",
"email": "manuel@fritteli.ch",
"url": "http://www.fritteli.ch/"
"url": "https://www.fritteli.ch/"
},
"repository": {
"type": "git",
@ -22,29 +29,40 @@
}
],
"license": "GPL-3.0",
"private": true,
"dependencies": {
"jquery": "~2.1.3",
"jquery-ui": "github:jquery/jquery-ui#1.11.4",
"jquery.cookie": "~1.4.1"
"@angular/animations": "^5.0.0",
"@angular/common": "^5.0.0",
"@angular/compiler": "^5.0.0",
"@angular/core": "^5.0.0",
"@angular/forms": "^5.0.0",
"@angular/http": "^5.0.0",
"@angular/platform-browser": "^5.0.0",
"@angular/platform-browser-dynamic": "^5.0.0",
"@angular/router": "^5.0.0",
"core-js": "^2.4.1",
"rxjs": "^5.5.2",
"zone.js": "^0.8.14"
},
"devDependencies": {
"grunt": "~0.4.5",
"grunt-cli": "^0.1.13",
"grunt-contrib-clean": "~0.6.0",
"grunt-contrib-concat": "~0.5.0",
"grunt-contrib-connect": "~0.11.0",
"grunt-contrib-cssmin": "^0.14.0",
"grunt-contrib-jshint": "~0.11.0",
"grunt-contrib-qunit": "~0.7.0",
"grunt-contrib-uglify": "~0.9.2",
"grunt-contrib-watch": "~0.6.1",
"grunt-mocha-phantomjs": "^2.0.0",
"grunt-version": "^1.0.0",
"jshint-stylish": "~2.0.1",
"load-grunt-tasks": "~3.3.0",
"phantomjs": "^1.9.18",
"time-grunt": "~1.2.1",
"mocha": "~2.3.3",
"chai": "~3.3.0"
"@angular/cli": "^1.5.0",
"@angular/compiler-cli": "^5.0.0",
"@angular/language-service": "^5.0.0",
"@types/jasmine": "~2.5.53",
"@types/jasminewd2": "~2.0.2",
"@types/node": "~6.0.60",
"codelyzer": "^4.0.0",
"jasmine-core": "~2.6.2",
"jasmine-spec-reporter": "~4.1.0",
"karma": "~1.7.0",
"karma-chrome-launcher": "~2.1.1",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^1.2.1",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.1.2",
"ts-node": "~3.2.0",
"tslint": "~5.7.0",
"typescript": "~2.4.2"
}
}

28
protractor.conf.js Normal file
View File

@ -0,0 +1,28 @@
// Protractor configuration file, see link for more information
// https://github.com/angular/protractor/blob/master/lib/config.ts
const { SpecReporter } = require('jasmine-spec-reporter');
exports.config = {
allScriptsTimeout: 11000,
specs: [
'./e2e/**/*.e2e-spec.ts'
],
capabilities: {
'browserName': 'chrome'
},
directConnect: true,
baseUrl: 'http://localhost:4200/',
framework: 'jasmine',
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000,
print: function() {}
},
onPrepare() {
require('ts-node').register({
project: 'e2e/tsconfig.e2e.json'
});
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
}
};

View File

@ -0,0 +1,8 @@
<div #container class="uhr black">
<span class="item dot dot1"></span>
<span class="item dot dot2"></span>
<span class="item dot dot3"></span>
<span class="item dot dot4"></span>
<div class="letterarea"></div>
<div class="reflection"></div>
</div>

261
src/app/app.component.scss Normal file
View File

@ -0,0 +1,261 @@
/*
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@font-face {
font-family: 'Uhrenfont';
src: url('../../_old/resources/uhr.woff') format('woff');
}
:host {
background: hotpink;
}
.uhr {
font-family: 'Uhrenfont', sans-serif;
position: relative;
margin: 0;
transition: background-color 0.5s;
.reflection {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
background: radial-gradient(225em 45em at 160% 0, rgba(255, 255, 255, 0.4) 0, rgba(255, 255, 255, 0.05) 40%, rgba(255, 255, 255, 0) 40%) no-repeat scroll;
display: block;
margin: 0.15em;
}
.letterarea {
display: block;
position: absolute;
top: 12%;
bottom: 12%;
left: 12%;
right: 12%;
overflow: hidden;
font-size: 200%;
}
&.black {
background-color: #111;
.dot:not(.active) {
border-color: rgba(255, 255, 255, 0.1);
box-shadow: 0 0 0.1em rgba(255, 255, 255, 0.1);
}
.letter:not(.active) {
color: rgba(255, 255, 255, 0.1);
text-shadow: 0 0 0.1em rgba(255, 255, 255, 0.1);
}
}
}
.black .onoffswitch-inner:before {
background-color: #111;
}
.item {
transition: box-shadow 0.5s, text-shadow 0.5s, border-color 0.5s, color 0.5s;
}
.dot {
position: absolute;
display: block;
height: 0;
width: 0;
border: 0.2em solid;
border-radius: 1em;
}
.dot.active {
border-color: #eee;
box-shadow: 0 0 0.2em #eee;
}
.dot1 {
top: 3.75%;
left: 3.75%;
}
.dot2 {
top: 3.75%;
right: 3.75%;
}
.dot3 {
bottom: 3.75%;
right: 3.75%;
}
.dot4 {
bottom: 3.75%;
left: 3.75%;
}
.letter {
height: 10%;
width: 9.0909%;
padding: 0;
margin: 0;
display: inline-block;
text-align: center;
line-height: 160%;
}
.letter.active {
color: #eee;
text-shadow: 0 0 0.2em #eee;
}
//.onoffswitch {
// position: relative;
// width: 86px;
// margin: 1em;
// -webkit-user-select: none;
// -moz-user-select: none;
// -ms-user-select: none;
//}
//
//.onoffswitch-checkbox {
// display: none;
//}
//
//.onoffswitch-label {
// display: block;
// overflow: hidden;
// cursor: pointer;
// border: 2px solid #999;
// border-radius: 50px;
//}
//
//.onoffswitch-inner, .modeswitch-inner {
// width: 200%;
// margin-left: -100%;
// -moz-transition: margin 0.3s ease-in 0s;
// -webkit-transition: margin 0.3s ease-in 0s;
// -o-transition: margin 0.3s ease-in 0s;
// transition: margin 0.3s ease-in 0s;
//}
//
//.onoffswitch-inner:before, .onoffswitch-inner:after, .modeswitch-inner:before, .modeswitch-inner:after {
// float: left;
// width: 50%;
// height: 24px;
// padding: 0;
// line-height: 24px;
// font-size: 18px;
// color: white;
// font-weight: bold;
// -moz-box-sizing: border-box;
// -webkit-box-sizing: border-box;
// box-sizing: border-box;
//}
//
//.onoffswitch-inner:before {
// content: "EIN";
// padding-left: 12px;
// color: #eee;
// transition: background-color 0.5s;
//}
//
//.onoffswitch-inner:after {
// content: "AUS";
// padding-right: 12px;
// background-color: #eee;
// color: #999;
// text-align: right;
//}
//
//.onoffswitch-switch {
// width: 30px;
// margin: -3px;
// background: #fff;
// border: 2px solid #999;
// border-radius: 50px;
// position: absolute;
// top: 0;
// bottom: 0;
// right: 58px;
// -moz-transition: all 0.3s ease-in 0s;
// -webkit-transition: all 0.3s ease-in 0s;
// -o-transition: all 0.3s ease-in 0s;
// transition: all 0.3s ease-in 0s;
//}
//
//.onoffswitch-checkbox:checked + .onoffswitch-label .onoffswitch-inner,
//.onoffswitch-checkbox:checked + .onoffswitch-label .modeswitch-inner {
// margin-left: 0;
//}
//
//.onoffswitch-checkbox:checked + .onoffswitch-label .onoffswitch-switch {
// right: 0;
//}
//
//.modeswitch-inner:before {
// content: "MIN";
// padding-left: 12px;
// background-color: #fff;
// color: #000;
//}
//
//.modeswitch-inner:after {
// content: "SEC";
// padding-right: 12px;
// background-color: #fff;
// color: #000;
// text-align: right;
//}
//
//a.uhr-configlink {
// cursor: pointer;
// background: url("../resources/settings.png") no-repeat;
// width: 24px;
// height: 24px;
// display: inline-block;
// margin: 2px;
// vertical-align: top;
//}
//
//.uhr-controlpanel {
// border-radius: 0.5em;
// box-shadow: 0 0 1em black;
// background-color: #fff;
// display: inline-block;
// padding: 0.5em;
// position: sticky;
// bottom: 0;
// margin-left: 1em;
//}
//
//.uhr-controlpanel .content {
// position: relative;
//}
//
//a.uhr-closecontrolpanel {
// cursor: pointer;
// display: inline-block;
// position: absolute;
// right: 0;
// top: -1em;
// width: 24px;
// height: 24px;
// background: url("../resources/close.png") no-repeat;
//}
//
//#disclaimer {
// font-size: 0.5em;
//}
//
//#disclaimer a {
// color: #444;
// text-decoration: underline;
//}

View File

@ -0,0 +1,27 @@
import { TestBed, async } from '@angular/core/testing';
import { AppComponent } from './app.component';
describe('AppComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [
AppComponent
],
}).compileComponents();
}));
it('should create the app', async(() => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
expect(app).toBeTruthy();
}));
it(`should have as title 'app'`, async(() => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
expect(app.title).toEqual('app');
}));
it('should render title in a h1 tag', async(() => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const compiled = fixture.debugElement.nativeElement;
expect(compiled.querySelector('h1').textContent).toContain('Welcome to app!');
}));
});

140
src/app/app.component.ts Normal file
View File

@ -0,0 +1,140 @@
import {AfterViewInit, Component, ElementRef, Input, OnInit, ViewChild} from '@angular/core';
@Component({
selector: '[uhr]',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
})
export class AppComponent implements AfterViewInit, OnInit {
@Input() size: string = '100%';
@Input() autoresize = true;
@ViewChild('container') container: ElementRef;
constructor(private element: ElementRef) {
}
ngOnInit(): void {
window.onresize = this.handleResize.bind(this);
}
ngAfterViewInit(): void {
const realWidthInPx = this.determineSizeInPx(this.size);
this.resizeToPx(realWidthInPx);
}
handleResize(event: UIEvent): boolean {
const parentWidth = AppComponent.getWidth(this.element);
const parentHeight = AppComponent.getHeight(this.element);
const windowWidth = window.innerWidth;
const windowHeight = window.innerHeight;
this.resizeToPx(Math.min(parentWidth, parentHeight, windowWidth, windowHeight));
return true;
}
private determineSizeInPx(size: string): number {
if (this.size === 'fill') {
this.element.nativeElement.style.width = '100%';
this.element.nativeElement.style.height = '100%';
const width: number = AppComponent.getWidth(this.container);
const height: number = AppComponent.getHeight(this.container);
return Math.min(width, height);
} else {
this.container.nativeElement.style.width = size;
return AppComponent.getWidth(this.container);
}
}
private resizeToPx(size: number): void {
this.container.nativeElement.style.width = `${size}px`;
this.container.nativeElement.style.height = `${size}px`;
this.container.nativeElement.style['font-size'] = `${size / 40}px`;
}
private static getWidth(e: ElementRef): number {
console.log('getting width', e);
return e.nativeElement.clientWidth;
}
private static getHeight(e: ElementRef): number {
console.log('getting height', e);
return e.nativeElement.clientHeight;
}
}
// var setWidth = function () {
// };
// var $ = function (p) {
// return {
// append: (a) => ({}),
// on: (a, b) => ({}),
// hide: (a?) => ({})
// };
// };
// var uhrGlobals = {languages: [], themes: []};
// var toggleConfigScreen = function () {
// };
// var setupHTML = function setupHTML() {
// var e = this.element;
// // Base clock area
// e.addClass('uhr');
// e.empty();
// e.append('<span class="item dot dot1"></span>');
// e.append('<span class="item dot dot2"></span>');
// e.append('<span class="item dot dot3"></span>');
// e.append('<span class="item dot dot4"></span>');
// e.append('<div class="letterarea"></div>');
// e.append('<div class="reflection"></div>');
// setWidth.bind(this)(this.options.width);
//
// if (this.options.controls) {
// var controlpanel = $('<div class="uhr-controlpanel" id="uhr-controlpanel' + this.id + '"></div>');
// var content = $('<div class="content"></div>');
// controlpanel.append(content);
// // on/off switch
// var toggleSwitch = $('<div class="onoffswitch" id="uhr-onoffswitch' + this.id + '"></div>');
// toggleSwitch.append('<input type="checkbox" class="onoffswitch-checkbox" id="uhr-onoffswitch-checkbox' + this.id +
// '" checked="checked" />');
// toggleSwitch.append('<label class="onoffswitch-label" for="uhr-onoffswitch-checkbox' + this.id + '">' +
// '<div class="onoffswitch-inner"></div>' + '<div class="onoffswitch-switch"></div>' + '</label>');
// content.append(toggleSwitch);
//
// // time mode switch
// var modeSwitch = $('<div class="onoffswitch" id="uhr-modeswitch' + this.id + '"></div>');
// modeSwitch.append('<input type="checkbox" class="onoffswitch-checkbox" id="uhr-modeswitch-checkbox' + this.id +
// '" checked="checked" />');
// modeSwitch.append('<label class="onoffswitch-label" for="uhr-modeswitch-checkbox' + this.id + '">' +
// '<div class="modeswitch-inner"></div>' + '<div class="onoffswitch-switch"></div>' +
// '</label>');
// content.append(modeSwitch);
// // language chooser
// if (uhrGlobals.languages.length > 1) {
// var languageChooser = $('<select id="uhr-languagechooser' + this.id + '"></select>');
// uhrGlobals.languages.forEach(function (item) {
// languageChooser.append('<option value="' + item.code + '">' + item.language + '</option>');
// });
// content.append(languageChooser);
// }
//
// // theme chooser
// if (uhrGlobals.themes.length > 1) {
// var themeChooser = $('<select id="uhr-themechooser' + this.id + '"></select>');
// uhrGlobals.themes.forEach(function (item) {
// themeChooser.append('<option value="' + item.styleClass + '">' + item.name + '</option>');
// });
// content.append(themeChooser);
// }
// var closebutton = $('<a class="uhr-closecontrolpanel" id="uhr-closecontrolpanel' + this.id + '"></a>');
// closebutton.on('click', function () {
// $('#uhr-controlpanel' + this.id).hide('fast');
// }.bind(this));
// content.append(closebutton);
// e.after(controlpanel);
// controlpanel.hide();
// var configlink = $('<a class="uhr-configlink" id="uhr-configlink' + this.id + '"></a>');
// configlink.on('click', function () {
// toggleConfigScreen.bind(this)();
// }.bind(this));
// e.after(configlink);
// }
// };

18
src/app/app.module.ts Normal file
View File

@ -0,0 +1,18 @@
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }

90
src/app/langs/lang-de.ts Normal file
View File

@ -0,0 +1,90 @@
/*
* Copyright (C) Schweizerische Bundesbahnen SBB, 2017.
*/
let es_ist = {1: [1, 2, 4, 5, 6]};
let uhr = {10: [9, 10, 11]};
let nach = {4: [8, 9, 10, 11]};
let vor = {4: [1, 2, 3]};
let halb = {5: [1, 2, 3, 4]};
let fuenf = {1: [8, 9, 10, 11]};
let zehn = {2: [1, 2, 3, 4]};
let viertel = {3: [5, 6, 7, 8, 9, 10, 11]};
let zwanzig = {2: [5, 6, 7, 8, 9, 10, 11]};
let dreiviertel = {3: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]};
export class LangDe implements Lang {
readonly code = 'de';
readonly version = 2;
readonly name = 'Deutsch';
readonly letterboard = new Letterboard([
'ESKISTAFÜNF',
'ZEHNZWANZIG',
'DREIVIERTEL',
'VORFUNKNACH',
'HALBAELFÜNF',
'EINSXAMZWEI',
'DREIPMJVIER',
'SECHSNLACHT',
'SIEBENZWÖLF',
'ZEHNEUNKUHR'
]);
readonly permanent = es_ist;
readonly minutes = {
'0,1,2,3,4': uhr,
'5,6,7,8,9': [fuenf, nach],
'10,11,12,13,14': [zehn, nach],
'15,16,17,18,19': [viertel, nach],
'20,21,22,23,24': [zwanzig, nach],
'25,26,27,28,29': [fuenf, vor, halb],
'30,31,32,33,34': halb,
'35,36,37,38,39': [fuenf, nach, halb],
'40,41,42,43,44': [zwanzig, vor],
'45,46,47,48,49': dreiviertel,
'50,51,52,53,54': [zehn, vor],
'55,56,57,58,59': [fuenf, vor]
};
readonly hours = {
'0,12': {9: [7, 8, 9, 10, 11]},
'1,13': {6: [1, 2, 3, 4]},
'2,14': {6: [8, 9, 10, 11]},
'3,15': {7: [1, 2, 3, 4]},
'4,16': {7: [8, 9, 10, 11]},
'5,17': {5: [8, 9, 10, 11]},
'6,18': {8: [1, 2, 3, 4, 5]},
'7,19': {9: [1, 2, 3, 4, 5, 6]},
'8,20': {8: [8, 9, 10, 11]},
'9,21': {10: [4, 5, 6, 7]},
'10,22': {10: [1, 2, 3, 4]},
'11,23': {5: [6, 7, 8]}
};
}
interface Lang {
readonly code: string;
readonly version: number;
readonly name: string;
readonly letterboard: Letterboard;
readonly permanent?: Definition;
readonly minutes: Definition;
readonly hours: Definition;
}
declare type Definition = any;
class Letterboard {
public readonly letters: string[];
constructor(letters: string[]) {
if (letters.length !== 10) {
throw new Error(`invalid number of lines: ${letters.length}`);
}
letters.forEach((line, index) => {
if (line.length !== 10) {
throw new Error(`invalid number of letters in line ${index + 1}: ${line.length}`);
}
});
this.letters = letters;
}
}

0
src/assets/.gitkeep Normal file
View File

View File

@ -0,0 +1,3 @@
export const environment = {
production: true
};

View File

@ -0,0 +1,8 @@
// The file contents for the current environment will overwrite these during build.
// The build system defaults to the dev environment which uses `environment.ts`, but if you do
// `ng build --env=prod` then `environment.prod.ts` will be used instead.
// The list of which env maps to which file can be found in `.angular-cli.json`.
export const environment = {
production: false
};

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

13
src/index.html Normal file
View File

@ -0,0 +1,13 @@
<!doctype html>
<html lang="en" style="height: 100%;">
<head>
<meta charset="utf-8">
<title>Uhr</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.png">
</head>
<body uhr [autoresize]="true">
</body>
</html>

12
src/main.ts Normal file
View File

@ -0,0 +1,12 @@
import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app/app.module';
import { environment } from './environments/environment';
if (environment.production) {
enableProdMode();
}
platformBrowserDynamic().bootstrapModule(AppModule)
.catch(err => console.log(err));

76
src/polyfills.ts Normal file
View File

@ -0,0 +1,76 @@
/**
* This file includes polyfills needed by Angular and is loaded before the app.
* You can add your own extra polyfills to this file.
*
* This file is divided into 2 sections:
* 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
* 2. Application imports. Files imported after ZoneJS that should be loaded before your main
* file.
*
* The current setup is for so-called "evergreen" browsers; the last versions of browsers that
* automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
* Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.
*
* Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html
*/
/***************************************************************************************************
* BROWSER POLYFILLS
*/
/** IE9, IE10 and IE11 requires all of the following polyfills. **/
// import 'core-js/es6/symbol';
// import 'core-js/es6/object';
// import 'core-js/es6/function';
// import 'core-js/es6/parse-int';
// import 'core-js/es6/parse-float';
// import 'core-js/es6/number';
// import 'core-js/es6/math';
// import 'core-js/es6/string';
// import 'core-js/es6/date';
// import 'core-js/es6/array';
// import 'core-js/es6/regexp';
// import 'core-js/es6/map';
// import 'core-js/es6/weak-map';
// import 'core-js/es6/set';
/** IE10 and IE11 requires the following for NgClass support on SVG elements */
// import 'classlist.js'; // Run `npm install --save classlist.js`.
/** IE10 and IE11 requires the following for the Reflect API. */
// import 'core-js/es6/reflect';
/** Evergreen browsers require these. **/
// Used for reflect-metadata in JIT. If you use AOT (and only Angular decorators), you can remove.
import 'core-js/es7/reflect';
/**
* Required to support Web Animations `@angular/platform-browser/animations`.
* Needed for: All but Chrome, Firefox and Opera. http://caniuse.com/#feat=web-animation
**/
// import 'web-animations-js'; // Run `npm install --save web-animations-js`.
/***************************************************************************************************
* Zone JS is required by Angular itself.
*/
import 'zone.js/dist/zone'; // Included with Angular CLI.
/***************************************************************************************************
* APPLICATION IMPORTS
*/
/**
* Date, currency, decimal and percent pipes.
* Needed for: All but Chrome, Firefox, Edge, IE11 and Safari 10
*/
// import 'intl'; // Run `npm install --save intl`.
/**
* Need to import at least one locale-data with intl.
*/
// import 'intl/locale-data/jsonp/en';

5
src/styles.scss Normal file
View File

@ -0,0 +1,5 @@
/* You can add global styles to this file, and also import other style files */
body {
padding: 0;
margin: 0;
}

32
src/test.ts Normal file
View File

@ -0,0 +1,32 @@
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
import 'zone.js/dist/long-stack-trace-zone';
import 'zone.js/dist/proxy.js';
import 'zone.js/dist/sync-test';
import 'zone.js/dist/jasmine-patch';
import 'zone.js/dist/async-test';
import 'zone.js/dist/fake-async-test';
import { getTestBed } from '@angular/core/testing';
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting
} from '@angular/platform-browser-dynamic/testing';
// Unfortunately there's no typing for the `__karma__` variable. Just declare it as any.
declare const __karma__: any;
declare const require: any;
// Prevent Karma from running prematurely.
__karma__.loaded = function () {};
// First, initialize the Angular testing environment.
getTestBed().initTestEnvironment(
BrowserDynamicTestingModule,
platformBrowserDynamicTesting()
);
// Then we find all the tests.
const context = require.context('./', true, /\.spec\.ts$/);
// And load the modules.
context.keys().map(context);
// Finally, start Karma to run the tests.
__karma__.start();

13
src/tsconfig.app.json Normal file
View File

@ -0,0 +1,13 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/app",
"baseUrl": "./",
"module": "es2015",
"types": []
},
"exclude": [
"test.ts",
"**/*.spec.ts"
]
}

20
src/tsconfig.spec.json Normal file
View File

@ -0,0 +1,20 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/spec",
"baseUrl": "./",
"module": "commonjs",
"target": "es5",
"types": [
"jasmine",
"node"
]
},
"files": [
"test.ts"
],
"include": [
"**/*.spec.ts",
"**/*.d.ts"
]
}

5
src/typings.d.ts vendored Normal file
View File

@ -0,0 +1,5 @@
/* SystemJS module definition */
declare var module: NodeModule;
interface NodeModule {
id: string;
}

19
tsconfig.json Normal file
View File

@ -0,0 +1,19 @@
{
"compileOnSave": false,
"compilerOptions": {
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es5",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2017",
"dom"
]
}
}

141
tslint.json Normal file
View File

@ -0,0 +1,141 @@
{
"rulesDirectory": [
"node_modules/codelyzer"
],
"rules": {
"arrow-return-shorthand": true,
"callable-types": true,
"class-name": true,
"comment-format": [
true,
"check-space"
],
"curly": true,
"eofline": true,
"forin": true,
"import-blacklist": [
true,
"rxjs",
"rxjs/Rx"
],
"import-spacing": true,
"indent": [
true,
"spaces"
],
"interface-over-type-literal": true,
"label-position": true,
"max-line-length": [
true,
140
],
"member-access": false,
"member-ordering": [
true,
{
"order": [
"static-field",
"instance-field",
"static-method",
"instance-method"
]
}
],
"no-arg": true,
"no-bitwise": true,
"no-console": [
true,
"debug",
"info",
"time",
"timeEnd",
"trace"
],
"no-construct": true,
"no-debugger": true,
"no-duplicate-super": true,
"no-empty": false,
"no-empty-interface": true,
"no-eval": true,
"no-inferrable-types": [
true,
"ignore-params"
],
"no-misused-new": true,
"no-non-null-assertion": true,
"no-shadowed-variable": true,
"no-string-literal": false,
"no-string-throw": true,
"no-switch-case-fall-through": true,
"no-trailing-whitespace": true,
"no-unnecessary-initializer": true,
"no-unused-expression": true,
"no-use-before-declare": true,
"no-var-keyword": true,
"object-literal-sort-keys": false,
"one-line": [
true,
"check-open-brace",
"check-catch",
"check-else",
"check-whitespace"
],
"prefer-const": true,
"quotemark": [
true,
"single"
],
"radix": true,
"semicolon": [
true,
"always"
],
"triple-equals": [
true,
"allow-null-check"
],
"typedef-whitespace": [
true,
{
"call-signature": "nospace",
"index-signature": "nospace",
"parameter": "nospace",
"property-declaration": "nospace",
"variable-declaration": "nospace"
}
],
"typeof-compare": true,
"unified-signatures": true,
"variable-name": false,
"whitespace": [
true,
"check-branch",
"check-decl",
"check-operator",
"check-separator",
"check-type"
],
"directive-selector": [
true,
"attribute",
"app",
"camelCase"
],
"component-selector": [
true,
"element",
"app",
"kebab-case"
],
"use-input-property-decorator": true,
"use-output-property-decorator": true,
"use-host-property-decorator": true,
"no-input-rename": true,
"no-output-rename": true,
"use-life-cycle-interface": true,
"use-pipe-transform-interface": true,
"component-class-suffix": true,
"directive-class-suffix": true,
"invoke-injectable": true
}
}

6124
yarn.lock Normal file

File diff suppressed because it is too large Load Diff