uhr/src/layout/layout-nl.ts

97 lines
2.9 KiB
TypeScript

/*
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 hetIs: WordDefinition = {1: [1, 2, 3, 5, 6]};
const over1: WordDefinition = {3: [1, 2, 3, 4]};
const voor1: WordDefinition = {2: [8, 9, 10, 11]};
const over2: WordDefinition = {4: [8, 9, 10, 11]};
const voor2: WordDefinition = {5: [1, 2, 3, 4]};
const half: WordDefinition = {4: [1, 2, 3, 4]};
const vijf: WordDefinition = {1: [8, 9, 10, 11]};
const tien: WordDefinition = {2: [1, 2, 3, 4]};
const kwart: WordDefinition = {3: [7, 8, 9, 10, 11]};
const uur: WordDefinition = {10: [9, 10, 11]};
export const LayoutNl: Layout = {
code: 'nl',
getHour: (time: Date): number => {
const hour = time.getHours();
if (time.getMinutes() >= 20) {
return (hour + 1) % 24;
}
return hour;
},
hours: {
'0,12': {10: [1, 2, 3, 4, 5, 6]},
'1,13': {5: [8, 9, 10]},
'2,14': {6: [1, 2, 3, 4]},
'3,15': {6: [8, 9, 10, 11]},
'4,16': {7: [1, 2, 3, 4]},
'5,17': {7: [5, 6, 7, 8]},
'6,18': {7: [9, 10, 11]},
'7,19': {8: [1, 2, 3, 4, 5]},
'8,20': {9: [1, 2, 3, 4]},
'9,21': {8: [7, 8, 9, 10, 11]},
'10,22': {9: [5, 6, 7, 8]},
'11,23': {9: [9, 10, 11]}
},
letters: [
'HETKISAVIJF',
'TIENBTZVOOR',
'OVERMEKWART',
'HALFSPWOVER',
'VOORTHGEENS',
'TWEEPVCDRIE',
'VIERVIJFZES',
'ZEVENONEGEN',
'ACHTTIENELF',
'TWAALFBFUUR'
],
minutes: {
'0,1,2,3,4': uur,
'5,6,7,8,9': [vijf, over1],
'10,11,12,13,14': [tien, over1],
'15,16,17,18,19': [kwart, over2],
'20,21,22,23,24': [tien, voor1, half],
'25,26,27,28,29': [vijf, voor1, half],
'30,31,32,33,34': half,
'35,36,37,38,39': [vijf, over1, half],
'40,41,42,43,44': [tien, over1, half],
'45,46,47,48,49': [kwart, voor2],
'50,51,52,53,54': [tien, voor1],
'55,56,57,58,59': [vijf, voor1]
},
permanent: hetIs,
prettyName: 'Nederlands',
version: 2
};
declare namespace Fritteli {
interface Fritteli {
uhr: Uhr;
}
interface Uhr {
register: (layout: Layout) => void;
}
}
declare namespace $ {
const fritteli: Fritteli.Fritteli;
}
$.fritteli.uhr.register(LayoutNl);