adds libraries
This commit is contained in:
parent
57205dd2cf
commit
d786a09043
171
front/bahnui-front/src/lib/operators.js
Normal file
171
front/bahnui-front/src/lib/operators.js
Normal file
@ -0,0 +1,171 @@
|
|||||||
|
let operatorfunctions = {
|
||||||
|
getOperatorLogo(operator){
|
||||||
|
if (!operator){
|
||||||
|
return (null);
|
||||||
|
} else if (operator.id.startsWith("db-regio") || operator.id === "regionalverkehr-alb-bodensee"){
|
||||||
|
return new URL('../assets/logos/dbregio.svg', import.meta.url);
|
||||||
|
} else if (operator.id.startsWith("db-")){
|
||||||
|
return new URL('../assets/logos/db.svg', import.meta.url);
|
||||||
|
} else if (operator.id === "national-express"){
|
||||||
|
return new URL('../assets/logos/nationalexpress.svg', import.meta.url);
|
||||||
|
} else if (operator.id === "eurobahn"){
|
||||||
|
return new URL('../assets/logos/eurobahn.svg', import.meta.url);
|
||||||
|
} else if (operator.id === "schweizerische-bundesbahnen" || operator.id === "sbb-gmbh"){
|
||||||
|
return new URL('../assets/logos/sbb.svg', import.meta.url);
|
||||||
|
} else if (operator.id === "verkehrsbetriebe-zurich"){
|
||||||
|
return new URL('../assets/logos/vbz.svg', import.meta.url);
|
||||||
|
} else if (operator.id === "thurbo"){
|
||||||
|
return new URL('../assets/logos/thurbo.svg', import.meta.url);
|
||||||
|
} else if (operator.id === "arverio-baden-wurttemberg"){
|
||||||
|
return new URL('../assets/logos/avi-bw.svg', import.meta.url);
|
||||||
|
} else if (operator.id === "arverio-bayern"){
|
||||||
|
return new URL('../assets/logos/avi-by.svg', import.meta.url);
|
||||||
|
} else if (operator.id === "euskotren"){
|
||||||
|
return new URL('../assets/logos/euskotren.svg', import.meta.url);
|
||||||
|
} else if (operator.id.startsWith("arriva")){
|
||||||
|
return new URL('../assets/logos/arriva.svg', import.meta.url);
|
||||||
|
} else if (operator.id.startsWith("abellio")){
|
||||||
|
return new URL('../assets/logos/abellio.png', import.meta.url);
|
||||||
|
} else if (operator.id === "nederlandse-spoorwegen"){
|
||||||
|
return new URL('../assets/logos/ns.svg', import.meta.url);
|
||||||
|
} else if (operator.id === "blauwnet"){
|
||||||
|
return new URL('../assets/logos/blauwnet.png', import.meta.url);
|
||||||
|
} else if (operator.id === "waldbahn-die-landerbahn-gmbh-dlb"){
|
||||||
|
return new URL('../assets/logos/waldbahn.png', import.meta.url);
|
||||||
|
} else if (operator.id === "ostdeutsche-eisenbahn-gmbh"){
|
||||||
|
return new URL('../assets/logos/odeg.svg', import.meta.url);
|
||||||
|
} else if (operator.id === "trenitalia"){
|
||||||
|
return new URL('../assets/logos/trenitalia.svg', import.meta.url);
|
||||||
|
} else if (operator.id === "osterreichische-bundesbahnen"){
|
||||||
|
return new URL('../assets/logos/oebb.svg', import.meta.url);
|
||||||
|
} else if (operator.id === "sj"){
|
||||||
|
return new URL('../assets/logos/sj.svg', import.meta.url);
|
||||||
|
} else if (operator.id === "vy"){
|
||||||
|
return new URL('../assets/logos/vy.svg', import.meta.url);
|
||||||
|
} else if (operator.id === "danische-staatsbahnen"){
|
||||||
|
return new URL('../assets/logos/dsb.png', import.meta.url);
|
||||||
|
} else if (operator.id === "skanetrafiken-oresundstag"){
|
||||||
|
return new URL('../assets/logos/oresundtag.svg', import.meta.url);
|
||||||
|
} else if (operator.id === "schweizerische-sudostbahn-sob"){
|
||||||
|
return new URL('../assets/logos/sob.svg', import.meta.url);
|
||||||
|
} else if (operator.id === "sncf"){
|
||||||
|
return new URL('../assets/logos/sncf.svg', import.meta.url);
|
||||||
|
} else if (operator.id === "mitteldeutsche-regiobahn"){
|
||||||
|
return new URL('../assets/logos/mrb.svg', import.meta.url);
|
||||||
|
} else if (operator.id === "cp"){
|
||||||
|
return new URL('../assets/logos/cp-pt.svg', import.meta.url);
|
||||||
|
} else if (operator.id === "renfe"){
|
||||||
|
return new URL('../assets/logos/renfe.svg', import.meta.url);
|
||||||
|
} else if (operator.id.startsWith("sncf-voyages")){
|
||||||
|
return new URL('../assets/logos/sncf-voyageurs.svg', import.meta.url);
|
||||||
|
} else if (operator.id === "pkp-intercity"){
|
||||||
|
return new URL('../assets/logos/pkp-i.svg', import.meta.url);
|
||||||
|
} else if (operator.id === "bayerische-regiobahn"){
|
||||||
|
return new URL('../assets/logos/brb.svg', import.meta.url);
|
||||||
|
} else if (operator.id === "postauto-schweiz"){
|
||||||
|
return new URL('../assets/logos/postauto.svg', import.meta.url);
|
||||||
|
} else if (operator.id === "lner-london-north-eastern-railway"){
|
||||||
|
return new URL('../assets/logos/lner.svg', import.meta.url);
|
||||||
|
} else if (operator.id === "eurostar"){
|
||||||
|
return new URL('../assets/logos/eurostar.svg', import.meta.url);
|
||||||
|
} else if (operator.id === "european-sleeper"){
|
||||||
|
return new URL('../assets/logos/europesleep.svg', import.meta.url);
|
||||||
|
} else if (operator.id === "ceske-drahy"){
|
||||||
|
return new URL('../assets/logos/cd.svg', import.meta.url);
|
||||||
|
} else if (operator.id === "mav"){
|
||||||
|
return new URL('../assets/logos/mav.svg', import.meta.url);
|
||||||
|
} else if (operator.id === "serbische-eisenbahnen-zeleznice-srbije"){
|
||||||
|
return new URL('../assets/logos/zsrbije.png', import.meta.url);
|
||||||
|
} else if (operator.id === "sncb"){
|
||||||
|
return new URL('../assets/logos/sncb.svg', import.meta.url);
|
||||||
|
} else if (operator.id === "cfl"){
|
||||||
|
return new URL('../assets/logos/cfl.svg', import.meta.url);
|
||||||
|
} else if (operator.id.startsWith("s-bahn-berlin")){
|
||||||
|
return new URL('../assets/logos/sbahnberlin.svg', import.meta.url);
|
||||||
|
} else if (operator.id === "rhatische-bahn"){
|
||||||
|
return new URL('../assets/logos/rhb.svg', import.meta.url);
|
||||||
|
} else if (operator.id === "matterhorn-gotthard-bahn-bvz"){
|
||||||
|
return new URL('../assets/logos/mgb.svg', import.meta.url);
|
||||||
|
} else if (operator.id === "s-bahn-hamburg"){
|
||||||
|
return new URL('../assets/logos/sbahnhamburg.png', import.meta.url);
|
||||||
|
} else if (operator.id === "akn-eisenbahn-gmbh"){
|
||||||
|
return new URL('../assets/logos/akn.svg', import.meta.url);
|
||||||
|
} else if (operator.id === "wurttembergische-eisenbahn-gesellschaft-mbh"){
|
||||||
|
return new URL('../assets/logos/weg.svg', import.meta.url);
|
||||||
|
} else if (operator.id === "wynental-und-suhrental-bahn" || operator.id === "bdwm-transport"){
|
||||||
|
return new URL('../assets/logos/ava.svg', import.meta.url);
|
||||||
|
} else if (operator.id === "appenzeller-bahnen"){
|
||||||
|
return new URL('../assets/logos/ab.svg', import.meta.url);
|
||||||
|
} else if (operator.id === "agilis"){
|
||||||
|
return new URL('../assets/logos/agilis.svg', import.meta.url);
|
||||||
|
} else if (operator.id === "hzpp"){
|
||||||
|
return new URL('../assets/logos/hzpp.png', import.meta.url);
|
||||||
|
} else if (operator.id === "obb-postbus"){
|
||||||
|
return new URL('../assets/logos/oebb-postbus.png', import.meta.url);
|
||||||
|
} else if (operator.id === "snalltaget"){
|
||||||
|
return new URL('../assets/logos/snalltaget.svg', import.meta.url);
|
||||||
|
} else if (operator.id === "schwabische-alb-bahn"){
|
||||||
|
return new URL('../assets/logos/sab.svg', import.meta.url);
|
||||||
|
} else if (operator.id.startsWith("sweg-bahn")){
|
||||||
|
return new URL('../assets/logos/sweg.svg', import.meta.url);
|
||||||
|
} else if (operator.id === "ferrocarils-de-la-generalitat-de-catalunya"){
|
||||||
|
return new URL('../assets/logos/fgc.svg', import.meta.url);
|
||||||
|
} else if (operator.id === "albtal-verkehrs-gesellschaft-mbh"){
|
||||||
|
return new URL('../assets/logos/avg.svg', import.meta.url);
|
||||||
|
} else if (operator.id === "westfalenbahn"){
|
||||||
|
return new URL('../assets/logos/wfb.png', import.meta.url);
|
||||||
|
} else if (operator.id === "coras-iompair-eireann"){
|
||||||
|
return new URL('../assets/logos/cie.svg', import.meta.url);
|
||||||
|
} else if (operator.id === "avanti-west-coast"){
|
||||||
|
return new URL('../assets/logos/avantiwc.svg', import.meta.url);
|
||||||
|
} else if (operator.id === "koleje-dolnoslaskie"){
|
||||||
|
return new URL('../assets/logos/kolejed.svg', import.meta.url);
|
||||||
|
} else if (operator.id === "trilex-express-die-landerbahn-gmbh-dlb"){
|
||||||
|
return new URL('../assets/logos/trilex.png', import.meta.url);
|
||||||
|
} else if (operator.id === "polregio"){
|
||||||
|
return new URL('../assets/logos/polregio.svg', import.meta.url);
|
||||||
|
} else if (operator.id === "bayerische-zugspitzbahn"){
|
||||||
|
return new URL('../assets/logos/zugspitze.svg', import.meta.url);
|
||||||
|
} else if (operator.id === "rigi-bahnen"){
|
||||||
|
return new URL('../assets/logos/rigi.svg', import.meta.url);
|
||||||
|
} else if (operator.id === "regionalverkehr-bern-solothurn"){
|
||||||
|
return new URL('../assets/logos/rbs.svg', import.meta.url);
|
||||||
|
} else if (operator.id === "zentralbahn"){
|
||||||
|
return new URL('../assets/logos/zb.svg', import.meta.url);
|
||||||
|
} else if (operator.id === "bls-ag"){
|
||||||
|
return new URL('../assets/logos/bernmobil.svg', import.meta.url);
|
||||||
|
} else if (operator.id === "westbahn"){
|
||||||
|
return new URL('../assets/logos/westbahn.svg', import.meta.url);
|
||||||
|
} else if (operator.id === "northern"){
|
||||||
|
return new URL('../assets/logos/northern.svg', import.meta.url);
|
||||||
|
} else if (operator.id === "south-eastern"){
|
||||||
|
return new URL('../assets/logos/southeastern.svg', import.meta.url);
|
||||||
|
} else if (operator.id === "hull-trains"){
|
||||||
|
return new URL('../assets/logos/hulltrains.svg', import.meta.url);
|
||||||
|
} else if (operator.id === "schweizerische-bodensee-schiffahrtsgesellschaft"){
|
||||||
|
return new URL('../assets/logos/bodenseech.png', import.meta.url);
|
||||||
|
} else if (operator.id === "bodensee-schiffsbetriebe"){
|
||||||
|
return new URL('../assets/logos/bsb.svg', import.meta.url);
|
||||||
|
} else if (operator.id === "regiojet"){
|
||||||
|
return new URL('../assets/logos/regiojet.svg', import.meta.url);
|
||||||
|
} else if (operator.id === "edzards-reisen"){
|
||||||
|
return new URL('../assets/logos/edzards.svg', import.meta.url);
|
||||||
|
} else if (operator.id === "vlexx"){
|
||||||
|
return new URL('../assets/logos/vlexx.png', import.meta.url);
|
||||||
|
} else if (operator.id === "nordwestbahn"){
|
||||||
|
return new URL('../assets/logos/nordwestbahn.svg', import.meta.url);
|
||||||
|
} else if (operator.id === "caledonian-macbrayne-ferries"){
|
||||||
|
return new URL('../assets/logos/caledonian-macbrayne.svg', import.meta.url);
|
||||||
|
} else if (operator.id === "caledonian-sleeper"){
|
||||||
|
return new URL('../assets/logos/caledonian-sleeper.png', import.meta.url);
|
||||||
|
} else if (operator.id === "mecklenburgische-baderbahn-molli"){
|
||||||
|
return new URL('../assets/logos/molli.svg', import.meta.url);
|
||||||
|
} else if (operator.id === "berliner-verkehrsbetriebe"){
|
||||||
|
return new URL('../assets/logos/bvg_berlin.svg', import.meta.url);
|
||||||
|
} else {
|
||||||
|
console.log(operator.id);
|
||||||
|
return (null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export default operatorfunctions;
|
||||||
22
front/bahnui-front/src/lib/routes.js
Normal file
22
front/bahnui-front/src/lib/routes.js
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
let routefunctions = {
|
||||||
|
getLineColors(line){
|
||||||
|
if (!line){
|
||||||
|
return (['black', 'white']);
|
||||||
|
} else if (line.productName === "STB"){
|
||||||
|
return (['white', 'blue']);
|
||||||
|
} else if (line.productName === "S"){
|
||||||
|
return (['white', 'green']);
|
||||||
|
} else if (line.productName === "RE" || line.productName === "RB"){
|
||||||
|
return (['white', 'red']);
|
||||||
|
} else if (line.productName === "IC" || line.productName === "ICE"){
|
||||||
|
return (['red', 'white']);
|
||||||
|
} else if (line.productName === "EC" || line.productName === "ECE"){
|
||||||
|
return (['blue', 'white']);
|
||||||
|
} else if (line.productName === "MEX"){
|
||||||
|
return (['black', 'yellow']);
|
||||||
|
} else {
|
||||||
|
return (['black', 'white']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export default routefunctions;
|
||||||
55
front/bahnui-front/src/lib/time.js
Normal file
55
front/bahnui-front/src/lib/time.js
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
const timecolors = [
|
||||||
|
{r:147, g:147, b:147, h:0},
|
||||||
|
{r:156, g:151, b:146, h:1},
|
||||||
|
{r:166, g:155, b:145, h:2},
|
||||||
|
{r:175, g:163, b:149, h:3},
|
||||||
|
{r:201, g:177, b:153, h:4},
|
||||||
|
{r:235, g:212, b:165, h:5},
|
||||||
|
{r:249, g:230, b:176, h:6},
|
||||||
|
{r:250, g:249, b:196, h:7},
|
||||||
|
{r:248, g:255, b:208, h:8},
|
||||||
|
{r:237, g:255, b:226, h:9},
|
||||||
|
{r:239, g:255, b:242, h:10},
|
||||||
|
{r:231, g:255, b:251, h:11},
|
||||||
|
{r:220, g:249, b:255, h:12},
|
||||||
|
{r:220, g:236, b:255, h:13},
|
||||||
|
{r:224, g:219, b:254, h:14},
|
||||||
|
{r:243, g:209, b:254, h:15},
|
||||||
|
{r:247, g:190, b:236, h:16},
|
||||||
|
{r:243, g:175, b:203, h:17},
|
||||||
|
{r:234, g:163, b:183, h:18},
|
||||||
|
{r:226, g:163, b:190, h:19},
|
||||||
|
{r:206, g:160, b:200, h:20},
|
||||||
|
{r:178, g:153, b:190, h:21},
|
||||||
|
{r:159, g:152, b:178, h:22},
|
||||||
|
{r:146, g:146, b:167, h:23}]
|
||||||
|
|
||||||
|
let timefunctions = {
|
||||||
|
getTimeColor(string){
|
||||||
|
let date = new Date(string);
|
||||||
|
let color1;
|
||||||
|
let color2;
|
||||||
|
let minutes;
|
||||||
|
|
||||||
|
let i = 0;
|
||||||
|
color1 = timecolors[i];
|
||||||
|
color2 = timecolors[i+1];
|
||||||
|
while (color1.h < date.getHours() && i+1 < timecolors.length){
|
||||||
|
i++;
|
||||||
|
color1 = timecolors[i];
|
||||||
|
if (i+2 < timecolors.length) {
|
||||||
|
color2 = timecolors[i+1];
|
||||||
|
} else {
|
||||||
|
color2 = timecolors[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
minutes = (date.getHours()-color1.h) * 60 + date.getMinutes();
|
||||||
|
let maxMinutes = color2.h == 0 ? (24 - color1.h)*60 : (color2.h - color1.h)*60
|
||||||
|
let r = (color2.r * minutes + color1.r * (maxMinutes-minutes))/maxMinutes;
|
||||||
|
let g = (color2.g * minutes + color1.g * (maxMinutes-minutes))/maxMinutes;
|
||||||
|
let b = (color2.r * minutes + color1.b * (maxMinutes-minutes))/maxMinutes;
|
||||||
|
let color = "rgb("+r+","+g+","+b+")"
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export default timefunctions;
|
||||||
Loading…
Reference in New Issue
Block a user