Bundle using webpack.
This commit is contained in:
parent
1929209937
commit
933a3c92f5
29 changed files with 368 additions and 16162 deletions
|
@ -51,11 +51,11 @@ export class Globals {
|
|||
return Globals.themes;
|
||||
}
|
||||
|
||||
static registerLayout(langCode: string, layout: Layout): void {
|
||||
static registerLayout(layout: Layout): void {
|
||||
const available = Globals.layouts.some(element => {
|
||||
if (langCode === element.code) {
|
||||
if (layout.code === element.code) {
|
||||
console.error(
|
||||
`Error: Language code '${langCode}' cannot be registered for layout '${layout.prettyName}'
|
||||
`Error: Language code '${layout.code}' cannot be registered for layout '${layout.prettyName}'
|
||||
because it is already registered for layout '${element.prettyName}'!`
|
||||
);
|
||||
return false;
|
||||
|
@ -64,7 +64,6 @@ export class Globals {
|
|||
}
|
||||
);
|
||||
if (available) {
|
||||
layout.code = langCode;
|
||||
Globals.layouts.push(layout);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,19 +16,19 @@
|
|||
import {Letter} from "./letter";
|
||||
|
||||
export interface Layout {
|
||||
version: number;
|
||||
code: string;
|
||||
prettyName: string;
|
||||
letters: string[];
|
||||
permanent: WordDefinition | WordDefinition[];
|
||||
hours: TimeDefinition;
|
||||
minutes: TimeDefinition;
|
||||
seconds?: TimeDefinition;
|
||||
getHour?: (Date) => number;
|
||||
getDotMinute?: (Date) => number;
|
||||
getCoarseMinute?: (Date) => number;
|
||||
getSeconds?: (Date) => number;
|
||||
readonly code: string;
|
||||
getCoarseMinute?: (time: Date) => number;
|
||||
getDotMinute?: (time: Date) => number;
|
||||
getHour?: (time: Date) => number;
|
||||
getSeconds?: (time: Date) => number;
|
||||
readonly hours: TimeDefinition;
|
||||
readonly letters: string[];
|
||||
readonly minutes: TimeDefinition;
|
||||
parsed?: Letter[][];
|
||||
readonly permanent: WordDefinition | WordDefinition[];
|
||||
readonly prettyName: string;
|
||||
seconds?: TimeDefinition;
|
||||
readonly version: number;
|
||||
}
|
||||
|
||||
export interface WordDefinition {
|
||||
|
@ -40,11 +40,11 @@ export interface TimeDefinition {
|
|||
}
|
||||
|
||||
export const EMPTY_LAYOUT: Layout = {
|
||||
version: 2,
|
||||
code: null,
|
||||
prettyName: null,
|
||||
hours: null,
|
||||
letters: [],
|
||||
permanent: [],
|
||||
minutes: null,
|
||||
hours: null
|
||||
permanent: [],
|
||||
prettyName: null,
|
||||
version: 2
|
||||
};
|
||||
|
|
|
@ -18,10 +18,14 @@ import {autodetectThemes} from "./theme-autodetector";
|
|||
import {Uhr} from "./uhr";
|
||||
import {WidgetPrototype} from "./widget/widget-prototype";
|
||||
import {Layout} from "./domain/layout";
|
||||
import {Layout_de_CH} from "./layout/layout-de_ch";
|
||||
|
||||
// First things first: discover included themes and register them
|
||||
autodetectThemes();
|
||||
|
||||
// Now register some layouts
|
||||
Globals.registerLayout(Layout_de_CH);
|
||||
|
||||
$.widget("fritteli.uhr", {
|
||||
"options": {
|
||||
width: '100%',
|
||||
|
@ -80,6 +84,6 @@ declare namespace $ {
|
|||
}
|
||||
|
||||
interface Uhr {
|
||||
register: (langCode: string, layout: Layout) => void;
|
||||
register: (layout: Layout) => void;
|
||||
}
|
||||
}
|
||||
|
|
72
src/layout/layout-de_ch.ts
Normal file
72
src/layout/layout-de_ch.ts
Normal file
|
@ -0,0 +1,72 @@
|
|||
/*
|
||||
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/>.
|
||||
*/
|
||||
|
||||
import {Layout, WordDefinition} from "../domain/layout";
|
||||
|
||||
const es_isch: WordDefinition = {1: [1, 2, 4, 5, 6, 7]};
|
||||
const ab = {4: [1, 2]};
|
||||
const vor = {3: [9, 10, 11]};
|
||||
const haubi = {4: [4, 5, 6, 7, 8]};
|
||||
const fuef = {1: [9, 10, 11]};
|
||||
const zae = {2: [9, 10, 11]};
|
||||
const viertu = {2: [1, 2, 3, 4, 5, 6]};
|
||||
const zwaenzg = {3: [1, 2, 3, 4, 5, 6]};
|
||||
|
||||
export const Layout_de_CH: Layout = {
|
||||
code: 'de_CH',
|
||||
hours: {
|
||||
'0,12': {10: [1, 2, 3, 4, 5, 6]},
|
||||
'1,13': {5: [1, 2, 3]},
|
||||
'2,14': {5: [4, 5, 6, 7]},
|
||||
'3,15': {5: [9, 10, 11]},
|
||||
'4,16': {6: [1, 2, 3, 4, 5]},
|
||||
'5,17': {6: [6, 7, 8, 9]},
|
||||
'6,18': {7: [1, 2, 3, 4, 5, 6]},
|
||||
'7,19': {7: [7, 8, 9, 10, 11]},
|
||||
'8,20': {8: [1, 2, 3, 4, 5]},
|
||||
'9,21': {8: [6, 7, 8, 9]},
|
||||
'10,22': {9: [1, 2, 3, 4]},
|
||||
'11,23': {9: [8, 9, 10, 11]}
|
||||
},
|
||||
letters: [
|
||||
'ESKISCHAFÜF',
|
||||
'VIERTUBFZÄÄ',
|
||||
'ZWÄNZGSIVOR',
|
||||
'ABOHAUBIEGE',
|
||||
'EISZWÖISDRÜ',
|
||||
'VIERIFÜFIQT',
|
||||
'SÄCHSISIBNI',
|
||||
'ACHTINÜNIEL',
|
||||
'ZÄNIERBEUFI',
|
||||
'ZWÖUFINAUHR'
|
||||
],
|
||||
minutes: {
|
||||
"5,6,7,8,9": [fuef, ab],
|
||||
"10,11,12,13,14": [zae, ab],
|
||||
"15,16,17,18,19": [viertu, ab],
|
||||
"20,21,22,23,24": [zwaenzg, ab],
|
||||
"25,26,27,28,29": [fuef, vor, haubi],
|
||||
"30,31,32,33,34": haubi,
|
||||
"35,36,37,38,39": [fuef, ab, haubi],
|
||||
"40,41,42,43,44": [zwaenzg, vor],
|
||||
"45,46,47,48,49": [viertu, vor],
|
||||
"50,51,52,53,54": [zae, vor],
|
||||
"55,56,57,58,59": [fuef, vor]
|
||||
|
||||
},
|
||||
permanent: es_isch,
|
||||
prettyName: 'Bärndütsch',
|
||||
version: 2
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue