From d5a620cf09b835db2bccd99556525c90b458719f Mon Sep 17 00:00:00 2001 From: Minteck Date: Thu, 5 Aug 2021 17:21:23 +0200 Subject: i18n for 21.08 --- views/common/blur.css | 4 +- views/common/compatibilityMode.css | 14 +- views/common/fonts.css | 44 +- views/common/index.css | 56 +- views/credits.html | 415 +++++------ views/game.css | 302 ++++---- views/game.html | 328 ++++----- views/intro.html | 88 +-- views/load.html | 104 +-- views/loader.html | 92 +-- views/loader.svg | 256 +++---- views/menu.css | 494 +++++++------- views/menu.html | 240 +++---- views/online.html | 86 +-- views/rain/snow.js | 1330 ++++++++++++++++++------------------ views/script/core_compatlayer.js | 178 ++--- views/script/core_crash.js | 40 +- views/script/core_notification.js | 24 +- views/script/core_stats.js | 100 +-- views/script/game_debug.js | 524 +++++++------- views/script/global_compatlayer.js | 178 ++--- views/script/global_levelsapi.js | 92 +-- views/script/loader_global.js | 254 +++---- views/script/menu_copyright.js | 8 +- views/script/menu_global.js | 252 +++---- views/script/menu_login.js | 449 ++++++------ views/script/settings_global.js | 254 +++---- views/script/settings_load.js | 50 +- views/settings.html | 140 ++-- views/stats.html | 140 ++-- views/win.html | 88 +-- 31 files changed, 3333 insertions(+), 3291 deletions(-) (limited to 'views') diff --git a/views/common/blur.css b/views/common/blur.css index f904c12..1b0dbfc 100644 --- a/views/common/blur.css +++ b/views/common/blur.css @@ -1,3 +1,3 @@ -#intro, #laps-inner-car0, #laps-inner-car1, #paused, #credits, #gpuinfo, #warning { - backdrop-filter: blur(10px); +#intro, #laps-inner-car0, #laps-inner-car1, #paused, #credits, #gpuinfo, #warning { + backdrop-filter: blur(10px); } \ No newline at end of file diff --git a/views/common/compatibilityMode.css b/views/common/compatibilityMode.css index 60c28a2..39fb642 100644 --- a/views/common/compatibilityMode.css +++ b/views/common/compatibilityMode.css @@ -1,8 +1,8 @@ -*:not(#gpuinfo-outer):not(#gpuinfo-inner) { - backdrop-filter: none !important; - opacity: 1 !important; -} - -.rain { - display: none !important; +*:not(#gpuinfo-outer):not(#gpuinfo-inner) { + backdrop-filter: none !important; + opacity: 1 !important; +} + +.rain { + display: none !important; } \ No newline at end of file diff --git a/views/common/fonts.css b/views/common/fonts.css index 5aa99e0..a7d81d5 100644 --- a/views/common/fonts.css +++ b/views/common/fonts.css @@ -1,23 +1,23 @@ -@font-face { - font-family: "Comfortaa"; - src: url("regular.ttf"); - font-weight: normal; -} - -@font-face { - font-family: "Comfortaa"; - src: url("bold.ttf"); - font-weight: bold; -} - -*, body, html, div { - font-family: "Comfortaa", -apple-system, sans-serif; -} - -#gpuinfo-inner, #gpuinfo-inner * { - font-family: monospace !important; -} - -body, * { - cursor: default !important; +@font-face { + font-family: "Comfortaa"; + src: url("regular.ttf"); + font-weight: normal; +} + +@font-face { + font-family: "Comfortaa"; + src: url("bold.ttf"); + font-weight: bold; +} + +*, body, html, div { + font-family: "Comfortaa", -apple-system, sans-serif; +} + +#gpuinfo-inner, #gpuinfo-inner * { + font-family: monospace !important; +} + +body, * { + cursor: default !important; } \ No newline at end of file diff --git a/views/common/index.css b/views/common/index.css index f9ff24e..71bc233 100644 --- a/views/common/index.css +++ b/views/common/index.css @@ -1,29 +1,29 @@ -#titlebar-minimize, #titlebar-close { - background-color: transparent; - transition: background-color 200ms; - border-radius: 10px; -} - -#titlebar-minimize:hover { - background-color: rgba(99, 99, 99, .5); -} - -#titlebar-minimize:focus, #titlebar-minimize:active { - background-color: rgba(99, 99, 99, .75); -} - -#titlebar-close:hover { - background-color: rgba(255, 0, 0, .5); -} - -#titlebar-close:focus, #titlebar-close:active { - background-color: rgba(255, 0, 0, .75); -} - -*::selection { - background-color: transparent; -} - -*::inactive-selection { - background-color: transparent; +#titlebar-minimize, #titlebar-close { + background-color: transparent; + transition: background-color 200ms; + border-radius: 10px; +} + +#titlebar-minimize:hover { + background-color: rgba(99, 99, 99, .5); +} + +#titlebar-minimize:focus, #titlebar-minimize:active { + background-color: rgba(99, 99, 99, .75); +} + +#titlebar-close:hover { + background-color: rgba(255, 0, 0, .5); +} + +#titlebar-close:focus, #titlebar-close:active { + background-color: rgba(255, 0, 0, .75); +} + +*::selection { + background-color: transparent; +} + +*::inactive-selection { + background-color: transparent; } \ No newline at end of file diff --git a/views/credits.html b/views/credits.html index 80c1fe4..017f9a8 100644 --- a/views/credits.html +++ b/views/credits.html @@ -1,203 +1,212 @@ - - - - - - - - - - - Kartik - - - - - - - - - - - -
- - - -

Kartik, a 2D car racing game

-

© Minteck/Cutefox Studios. All assets are licensed under their original license rather than Kartik's license.

-

- - made by
- - -

Lead

-

Minteck

- -

Base Assets

-

Minteck

- -

Narrator Character

-

Averi by fiddle (@fiddleafox on Twitter)

- -

Sound Effects, Music and Additional Assets

-
-
Prosta4okua
-
Felix Corvus
-
Vanguard
-
Timmeey86
-
Epowerj
-
Baltazár Radics
-
Dexapnow
-
Milinai
-
키에르
-
skybldev
-
Leone25
-
Gureumi
-
VizardAlpha
-
LQ
-
Commodore64x
-
iczero
-
Krzysztof Skrzętnicki
-
Baramos666
-
theshadowknight
-
elmenda452
-
Predator127
-
Sonnicon
-
CinExPL
-
toushangyouxiang
-
xgamezs
-
William So
-
beito
-
BeefEX
-
Lorex
-
老滑稽
-
Spico The Spirit Guy
-
TunacanGamer
-
kemalinanc13
-
Zachary
-
Fenr1r
-
Jaiun Lee
-
Gab_351
-
Carter Gale
-
Jan Polák
-
JustYanns
-
BasedUser
-
BLucky-gh
-
DinoWattz
-
Jae
-
angelickite
-
ScriptHosT12
-
Senventise
-
SkeptiC
-
Deyvid67
-
Damlon
-
DaGamerFiles
-
Trigg
-
Uriel
-
VXF
-
Valen. H
-
Valentin Sonin
-
Clarence "Sparr" Risher
-
bei2
-
AceEllysium
-
Cedric L'homme
-
Michał “Neoqueto”
-
indielm
-
Ameb
-
player20033
-
Ignacy
-
J-VdS
-
Kenny
-
Franciszek Zaranowicz
-
Andreas Heiskanen
-
Doyoung Gwak
-
MMG
-
Math2128
-
Michael Plotke
-
Niko
-
Paul T
-
Dominik
-
Arkanic
-
Potion
-
Markus G
-
itskatt
-
Agent-Laevain
-
AzariasB
-
amrsoll
-
ねらひかだ
-
Draco
-
Quezler
-
killall -q
-
Alicila
-
Daniel Dusek
-
DeltaNedas
-
GioIacca9
-
SnakkiZXZ
-
sk7725
-
The Slaylord
-
ThePlayerA
-
YellOw139
-
NgLamVN
-
JINODK
-
PetrGasparik
-
LeoDog896
-
Summet
-
MEEP of Faith
-
jalastram (freesound.org)
-
newlocknew (freesound.org)
-
dsmolenaers (freesound.org)
-
Headphaze (freesound.org)
-
Nikolass
-
VolasYouKnow
-
Quick-Korx
-
Ángel Rodríguez Aguilera
-
Catchears
-
younggam
-
simba-fs
-
RedRadiation
-
Marko Zajc
-
CPX MC
-
Phinner
-
BTA_Susideur
-
nilq
-
AsgerHB
-
AzCraft
-
foo
-
Skat
-
WilloIzCitron
-
- -

Testing

-

Minteck
Romain
Oxymillion

- -

Libraries

-
- - - -
- - - - - - - + + + + + + + + + + + Kartik + + + + + + + + + + + +
+ + + +

Kartik, a 2D car racing game

+

© Minteck. All assets are licensed under their original license rather than Kartik's license.

+

+ + made by
+ + +

Project Lead

+

Minteck

+ +

Base Assets

+

Minteck
redman 054

+ +

Narrator Character

+

Averi by fiddle (@fiddleafox on Twitter)

+ +

Music

+

Anuke
YonKaGor

+ +

Sound Effects and Additional Assets

+
+
Prosta4okua
+
Felix Corvus
+
Vanguard
+
Timmeey86
+
Epowerj
+
Baltazár Radics
+
Dexapnow
+
Milinai
+
키에르
+
skybldev
+
Leone25
+
Gureumi
+
VizardAlpha
+
LQ
+
Commodore64x
+
iczero
+
Krzysztof Skrzętnicki
+
Baramos666
+
theshadowknight
+
elmenda452
+
Predator127
+
Sonnicon
+
CinExPL
+
toushangyouxiang
+
xgamezs
+
William So
+
beito
+
BeefEX
+
Lorex
+
老滑稽
+
Spico The Spirit Guy
+
TunacanGamer
+
kemalinanc13
+
Zachary
+
Fenr1r
+
Jaiun Lee
+
Gab_351
+
Carter Gale
+
Jan Polák
+
JustYanns
+
BasedUser
+
BLucky-gh
+
DinoWattz
+
Jae
+
angelickite
+
ScriptHosT12
+
Senventise
+
SkeptiC
+
Deyvid67
+
Damlon
+
DaGamerFiles
+
Trigg
+
Uriel
+
VXF
+
Valen. H
+
Valentin Sonin
+
Clarence "Sparr" Risher
+
bei2
+
AceEllysium
+
Cedric L'homme
+
Michał “Neoqueto”
+
indielm
+
Ameb
+
player20033
+
Ignacy
+
J-VdS
+
Kenny
+
Franciszek Zaranowicz
+
Andreas Heiskanen
+
Doyoung Gwak
+
MMG
+
Math2128
+
Michael Plotke
+
Niko
+
Paul T
+
Dominik
+
Arkanic
+
Potion
+
Markus G
+
itskatt
+
Agent-Laevain
+
AzariasB
+
amrsoll
+
ねらひかだ
+
Draco
+
Quezler
+
killall -q
+
Alicila
+
Daniel Dusek
+
DeltaNedas
+
GioIacca9
+
SnakkiZXZ
+
sk7725
+
The Slaylord
+
ThePlayerA
+
YellOw139
+
NgLamVN
+
JINODK
+
PetrGasparik
+
LeoDog896
+
Summet
+
MEEP of Faith
+
jalastram (freesound.org)
+
newlocknew (freesound.org)
+
dsmolenaers (freesound.org)
+
Headphaze (freesound.org)
+
Nikolass
+
VolasYouKnow
+
Quick-Korx
+
Ángel Rodríguez Aguilera
+
Catchears
+
younggam
+
simba-fs
+
RedRadiation
+
Marko Zajc
+
CPX MC
+
Phinner
+
BTA_Susideur
+
nilq
+
AsgerHB
+
AzCraft
+
foo
+
Skat
+
WilloIzCitron
+
Nintendo
+
Unsplash
+
Google
+
+ +

Testing

+

Minteck
Romain
Oxymillion

+ +

Early Access Testing

+

Ayann
Retsuno
Amirus66

+ +

Libraries

+
+ + + +
+ + + + + + + diff --git a/views/game.css b/views/game.css index e72a786..87c0e2a 100644 --- a/views/game.css +++ b/views/game.css @@ -1,152 +1,152 @@ -#paused { - z-index: 5; - position: fixed; - inset: 0; - display: flex; - align-items: center; - justify-content: center; -} - -#paused > div { - background: #262626; - border-radius: 10px; - padding: 20px; - box-shadow: 1px 1px 12px rgba(0, 0, 0, 0.25); -} - -#paused * { - color: white; -} - -.services li { - padding: 10px; - font-size: 28px; - width: 256px; - list-style: none; - color: transparent; - margin-top: 10px; - margin-bottom: 10px; - border-radius: 10px; -} - -.services li a { - color: white !important; - text-decoration: none; - transition: color 200ms; -} - -.services li.selected a { - color: black !important; - text-decoration: none; -} - -.services li.selected { - background-color: #00ff99; -} - -.services li { - background-color: #383838; - transition: margin-left 200ms, background-color 200ms; -} - -#circuit.hitboxes, #circuit.hitboxes * { - outline: 1px dashed blue; -} - -#car0, #car1 { - transition: top 600ms, bottom 600ms, left 600ms, right 600ms, transform 500ms; -} - -#box.paused { - opacity: .5; -} - -circuit { - display: none; -} - -#credits-inner { - position: fixed; - z-index: 9; - background: #171717; - color: white; - padding: 20px; - display: grid; - font-size: 11px; - top: 200px; - left: 0; - right: 0; -} - -#credits .big { - font-size: 15px; - font-weight: bold; -} - -#credits #race, #credits #musicb { - display: grid; - grid-template-columns: 48px 1fr; -} - -#credits-inner > * > * { - vertical-align: middle; -} - -#credits img { - filter: invert(100%); -} - -#credits .cbox { - width: max-content; -} - -#laps-inner-car0 { - background: rgba(0, 0, 0, .5); - position: fixed; - bottom: 20px; - left: 20px; - z-index: 9; - border-radius: 9999px; - width: 40px; - height: 43px; - text-align: center; - color: white; - padding: 7px 10px 10px; -} - -#laps-inner-car1 { - background: rgba(0, 0, 0, .5); - position: fixed; - bottom: 20px; - right: 20px; - z-index: 9; - border-radius: 9999px; - width: 40px; - height: 43px; - text-align: center; - color: white; - padding: 7px 10px 10px; -} - -.laps-inner-sep { - margin: 5px; - border: none; - border-top: 2px solid white; -} - -#oil img { - position: fixed; - width: 32px; - z-index: 5; - opacity: .9; -} - -#credits { - background: rgba(0, 0, 0, .5); - position: fixed; - top: 0; - left: 0; - right: 0; - bottom: 0; - z-index: 9999; +#paused { + z-index: 5; + position: fixed; + inset: 0; + display: flex; + align-items: center; + justify-content: center; +} + +#paused > div { + background: #262626; + border-radius: 10px; + padding: 20px; + box-shadow: 1px 1px 12px rgba(0, 0, 0, 0.25); +} + +#paused * { + color: white; +} + +.services li { + padding: 10px; + font-size: 28px; + width: 256px; + list-style: none; + color: transparent; + margin-top: 10px; + margin-bottom: 10px; + border-radius: 10px; +} + +.services li a { + color: white !important; + text-decoration: none; + transition: color 200ms; +} + +.services li.selected a { + color: black !important; + text-decoration: none; +} + +.services li.selected { + background-color: #00ff99; +} + +.services li { + background-color: #383838; + transition: margin-left 200ms, background-color 200ms; +} + +#circuit.hitboxes, #circuit.hitboxes * { + outline: 1px dashed blue; +} + +#car0, #car1 { + transition: top 600ms, bottom 600ms, left 600ms, right 600ms, transform 500ms; +} + +#box.paused { + opacity: .5; +} + +circuit { + display: none; +} + +#credits-inner { + position: fixed; + z-index: 9; + background: #171717; + color: white; + padding: 20px; + display: grid; + font-size: 11px; + top: 200px; + left: 0; + right: 0; +} + +#credits .big { + font-size: 15px; + font-weight: bold; +} + +#credits #race, #credits #musicb { + display: grid; + grid-template-columns: 48px 1fr; +} + +#credits-inner > * > * { + vertical-align: middle; +} + +#credits img { + filter: invert(100%); +} + +#credits .cbox { + width: max-content; +} + +#laps-inner-car0 { + background: rgba(0, 0, 0, .5); + position: fixed; + bottom: 20px; + left: 20px; + z-index: 9; + border-radius: 9999px; + width: 40px; + height: 43px; + text-align: center; + color: white; + padding: 7px 10px 10px; +} + +#laps-inner-car1 { + background: rgba(0, 0, 0, .5); + position: fixed; + bottom: 20px; + right: 20px; + z-index: 9; + border-radius: 9999px; + width: 40px; + height: 43px; + text-align: center; + color: white; + padding: 7px 10px 10px; +} + +.laps-inner-sep { + margin: 5px; + border: none; + border-top: 2px solid white; +} + +#oil img { + position: fixed; + width: 32px; + z-index: 5; + opacity: .9; +} + +#credits { + background: rgba(0, 0, 0, .5); + position: fixed; + top: 0; + left: 0; + right: 0; + bottom: 0; + z-index: 9999; } \ No newline at end of file diff --git a/views/game.html b/views/game.html index 6de20ef..91a3173 100644 --- a/views/game.html +++ b/views/game.html @@ -1,164 +1,164 @@ - - - - - - - - - - - Kartik - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + Kartik + + + + + + + + + + + + + + + + + + + + + + diff --git a/views/intro.html b/views/intro.html index 1962b94..1dba9a1 100644 --- a/views/intro.html +++ b/views/intro.html @@ -1,44 +1,44 @@ - - - - - - - - Kartik - - - - - - - - - - - - - - - - - - - - + + + + + + + + Kartik + + + + + + + + + + + + + + + + + + + + diff --git a/views/load.html b/views/load.html index 473c1ac..c08f55e 100644 --- a/views/load.html +++ b/views/load.html @@ -1,52 +1,52 @@ - - - - - Kartik - - - - - -
-
-
- - + + + + + Kartik + + + + + +
+
+
+ + diff --git a/views/loader.html b/views/loader.html index 3dbaf4d..25124bb 100644 --- a/views/loader.html +++ b/views/loader.html @@ -1,46 +1,46 @@ - - - - - - - - - Kartik - - - - - - - - - -

- - - - - - - + + + + + + + + + Kartik + + + + + + + + + +

+ + + + + + + diff --git a/views/loader.svg b/views/loader.svg index 042b338..a088172 100644 --- a/views/loader.svg +++ b/views/loader.svg @@ -1,128 +1,128 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Kartik -%version% - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Kartik +%version% + + + + + + + diff --git a/views/menu.css b/views/menu.css index f9697a7..dea591c 100644 --- a/views/menu.css +++ b/views/menu.css @@ -1,248 +1,248 @@ -.services li .item { - padding: 4px; - font-size: 20px; - width: 300px; - border-color: transparent; - margin-right: auto !important; - display: block; - text-align: left; - border-left-width: 3px; - border-left-style: solid; - border-color: transparent; -} - -.services { - position: fixed; - left: 0; - bottom: 0; - right: 0; - top: 150px; - padding-top: 50px; -} - -.services li { - color: transparent; - margin-top: 5px; - margin-bottom: 5px; -} - -.services li .item a { - color: white !important; - text-decoration: none; - transition: color 200ms; -} - -.services li.selected .item a { - text-decoration: none; -} - -.services:not(.services-settings) li.selected .item { - background-color: rgba(0, 255, 153, 0.25); - backdrop-filter: blur(10px); - border-radius: 10px; - animation-direction: alternate-reverse; - position: relative; - z-index: 9999999999; - animation-duration: 3s; - animation-name: border-overlay; - animation-fill-mode: both; - animation-iteration-count: infinite; -} - -.services.services-settings li.selected .item { - border-color: #00ff99; - background-color: rgba(0, 255, 153, 0.25); - animation-direction: alternate-reverse; - animation-duration: 3s; - animation-name: border-overlay2; - animation-fill-mode: both; - animation-iteration-count: infinite; - border-top-right-radius: 10px; - border-bottom-right-radius: 10px; -} - -@keyframes border-overlay { - 0% { - background-color: rgba(0, 255, 102, 0.25); - } - 100% { - background-color: rgba(0, 204, 255, 0.25); - } -} - -@keyframes border-overlay2 { - 0% { - border-color: #00ff66; - background-color: rgba(0, 255, 102, 0.25); - } - 100% { - border-color: #00ccff; - background-color: rgba(0, 204, 255, 0.25); - } -} - -.services li .item { - margin-left: 12.5px; - transition: margin-left 200ms, background-color 200ms, border 200ms; -} - -.services li .help { - color: white; - margin-left: 5px; - display: inline-block; - font-size: 12px; - position: relative; - top: -2.5px; - opacity: 0; - transition: opacity 200ms; -} - -.services li .help.exit { - color: #ff6969; -} - -.services li.selected .help { - opacity: 1; -} - -#copyright { - color: rgba(255, 255, 255, .5); - position: fixed; - bottom: 30px; - right: 30px; - text-align: right; - font-size: 12px; -} - -.setting-status { - float: right; -} - -#notice { - color: white; - position: fixed; - top: 20px; - right: 20px; - width: 180px; - text-align: right; - font-size: 14px; -} - -#scroll { - display: block; - text-align: center; - color: white; - padding-top: 100vh; - padding-bottom: 100vh; -} - -.cred-title { - color: yellow; -} - -.cred-content { - color: white; -} - -.technical { - color: cyan; -} - -.item-icon { - filter: invert(1); - vertical-align: middle; - display: inline-block; - margin-top: 3px; - margin-bottom: -1px; -} - -div.services.home { - top: 115px; - padding: 0; - display: flex; - align-items: center; - bottom: 70px; - z-index: 9999; -} - -div.services.home > div.items > ul > li > span.item { - width: 216px; - border-radius: 0; -} - -div.services.home > div.items > ul > li > span.item > a { - margin-left: 10px; - margin-right: 10px; - width: 100%; - display: inline-block; - text-overflow: ellipsis; - white-space: nowrap; - overflow: hidden; -} - -div.services.home > div.items { - width: 256px; -} - -div.services.home > div.items > ul { - padding: 0; -} - -div.services.home > div.items > ul > li { - list-style: none; -} - -div.services.home > div.items > ul > li > span.item { - margin-left: 10vw; - transition: none; -} - -img[alt="full-logo"] { - margin-left: calc(10vw + 37.5px) !important; - margin-top: 55px !important; - height: 56px !important; - z-index: 99999; - position: fixed; -} - -span#copyright { - bottom: 46px; - left: 10vw; - z-index: 9999; - color: rgba(255, 255, 255, 0.75); - right: unset; - width: 227px; - text-align: center; -} - -#services-background { - position: fixed; - top: 0; - bottom: 0; - width: 227px; - z-index: 9; - backdrop-filter: blur(10px); - background: rgba(0, 0, 0, 0.5); - left: 10vw; -} - -.item-text { - vertical-align: middle; - margin-top: 8px; - display: inline-block; -} - -@media (max-height: 600px) { - img[alt="full-logo"][src="../logo/full.png"].full-logo { - margin-top: 16px !important; - } - - span#copyright.copyright { - bottom: 14px !important; - } -} - -body { - height: calc(100vh / 1.2); - overflow: hidden; +.services li .item { + padding: 4px; + font-size: 20px; + width: 300px; + border-color: transparent; + margin-right: auto !important; + display: block; + text-align: left; + border-left-width: 3px; + border-left-style: solid; + border-color: transparent; +} + +.services { + position: fixed; + left: 0; + bottom: 0; + right: 0; + top: 150px; + padding-top: 50px; +} + +.services li { + color: transparent; + margin-top: 5px; + margin-bottom: 5px; +} + +.services li .item a { + color: white !important; + text-decoration: none; + transition: color 200ms; +} + +.services li.selected .item a { + text-decoration: none; +} + +.services:not(.services-settings) li.selected .item { + background-color: rgba(0, 255, 153, 0.25); + backdrop-filter: blur(10px); + border-radius: 10px; + animation-direction: alternate-reverse; + position: relative; + z-index: 9999999999; + animation-duration: 3s; + animation-name: border-overlay; + animation-fill-mode: both; + animation-iteration-count: infinite; +} + +.services.services-settings li.selected .item { + border-color: #00ff99; + background-color: rgba(0, 255, 153, 0.25); + animation-direction: alternate-reverse; + animation-duration: 3s; + animation-name: border-overlay2; + animation-fill-mode: both; + animation-iteration-count: infinite; + border-top-right-radius: 10px; + border-bottom-right-radius: 10px; +} + +@keyframes border-overlay { + 0% { + background-color: rgba(0, 255, 102, 0.25); + } + 100% { + background-color: rgba(0, 204, 255, 0.25); + } +} + +@keyframes border-overlay2 { + 0% { + border-color: #00ff66; + background-color: rgba(0, 255, 102, 0.25); + } + 100% { + border-color: #00ccff; + background-color: rgba(0, 204, 255, 0.25); + } +} + +.services li .item { + margin-left: 12.5px; + transition: margin-left 200ms, background-color 200ms, border 200ms; +} + +.services li .help { + color: white; + margin-left: 5px; + display: inline-block; + font-size: 12px; + position: relative; + top: -2.5px; + opacity: 0; + transition: opacity 200ms; +} + +.services li .help.exit { + color: #ff6969; +} + +.services li.selected .help { + opacity: 1; +} + +#copyright { + color: rgba(255, 255, 255, .5); + position: fixed; + bottom: 30px; + right: 30px; + text-align: right; + font-size: 12px; +} + +.setting-status { + float: right; +} + +#notice { + color: white; + position: fixed; + top: 20px; + right: 20px; + width: 180px; + text-align: right; + font-size: 14px; +} + +#scroll { + display: block; + text-align: center; + color: white; + padding-top: 100vh; + padding-bottom: 100vh; +} + +.cred-title { + color: yellow; +} + +.cred-content { + color: white; +} + +.technical { + color: cyan; +} + +.item-icon { + filter: invert(1); + vertical-align: middle; + display: inline-block; + margin-top: 3px; + margin-bottom: -1px; +} + +div.services.home { + top: 115px; + padding: 0; + display: flex; + align-items: center; + bottom: 70px; + z-index: 9999; +} + +div.services.home > div.items > ul > li > span.item { + width: 216px; + border-radius: 0; +} + +div.services.home > div.items > ul > li > span.item > a { + margin-left: 10px; + margin-right: 10px; + width: 100%; + display: inline-block; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; +} + +div.services.home > div.items { + width: 256px; +} + +div.services.home > div.items > ul { + padding: 0; +} + +div.services.home > div.items > ul > li { + list-style: none; +} + +div.services.home > div.items > ul > li > span.item { + margin-left: 10vw; + transition: none; +} + +img[alt="full-logo"] { + margin-left: calc(10vw + 37.5px) !important; + margin-top: 55px !important; + height: 56px !important; + z-index: 99999; + position: fixed; +} + +span#copyright { + bottom: 46px; + left: 10vw; + z-index: 9999; + color: rgba(255, 255, 255, 0.75); + right: unset; + width: 227px; + text-align: center; +} + +#services-background { + position: fixed; + top: 0; + bottom: 0; + width: 227px; + z-index: 9; + backdrop-filter: blur(10px); + background: rgba(0, 0, 0, 0.5); + left: 10vw; +} + +.item-text { + vertical-align: middle; + margin-top: 8px; + display: inline-block; +} + +@media (max-height: 600px) { + img[alt="full-logo"][src="../logo/full.png"].full-logo { + margin-top: 16px !important; + } + + span#copyright.copyright { + bottom: 14px !important; + } +} + +body { + height: calc(100vh / 1.2); + overflow: hidden; } \ No newline at end of file diff --git a/views/menu.html b/views/menu.html index d06eba6..59171d4 100644 --- a/views/menu.html +++ b/views/menu.html @@ -1,120 +1,120 @@ - - - - - - - - - - - Kartik - - - - - - - - - - - - - - - - + + + + + + + + + + + Kartik + + + + + + + + + + + + + + + + diff --git a/views/online.html b/views/online.html index f1c20c1..8d79994 100644 --- a/views/online.html +++ b/views/online.html @@ -1,43 +1,43 @@ - - - - - - - - Kartik - - - - - - - - - - - - - - - - - - + + + + + + + + Kartik + + + + + + + + + + + + + + + + + + diff --git a/views/rain/snow.js b/views/rain/snow.js index 014dad0..26b13da 100644 --- a/views/rain/snow.js +++ b/views/rain/snow.js @@ -1,666 +1,666 @@ -/** @license - * DHTML Snowstorm! JavaScript-based snow for web pages - * Making it snow on the internets since 2003. You're welcome. - * ----------------------------------------------------------- - * Version 1.44.20131208 (Previous rev: 1.44.20131125) - * Copyright (c) 2007, Scott Schiller. All rights reserved. - * Code provided under the BSD License - * http://schillmania.com/projects/snowstorm/license.txt - */ - -/*jslint nomen: true, plusplus: true, sloppy: true, vars: true, white: true */ -/*global window, document, navigator, clearInterval, setInterval */ - -var snowStorm = (function(window, document) { - - // --- common properties --- - - this.autoStart = true; // Whether the snow should start automatically or not. - this.excludeMobile = true; // Snow is likely to be bad news for mobile phones' CPUs (and batteries.) Enable at your own risk. - this.flakesMax = 128; // Limit total amount of snow made (falling + sticking) - this.flakesMaxActive = 64; // Limit amount of snow falling at once (less = lower CPU use) - this.animationInterval = 33; // Theoretical "miliseconds per frame" measurement. 20 = fast + smooth, but high CPU use. 50 = more conservative, but slower - this.useGPU = true; // Enable transform-based hardware acceleration, reduce CPU load. - this.className = null; // CSS class name for further customization on snow elements - this.excludeMobile = true; // Snow is likely to be bad news for mobile phones' CPUs (and batteries.) By default, be nice. - this.flakeBottom = null; // Integer for Y axis snow limit, 0 or null for "full-screen" snow effect - this.followMouse = true; // Snow movement can respond to the user's mouse - this.snowColor = '#fff'; // Don't eat (or use?) yellow snow. - this.snowCharacter = '•'; // • = bullet, · is square on some systems etc. - this.snowStick = true; // Whether or not snow should "stick" at the bottom. When off, will never collect. - this.targetElement = null; // element which snow will be appended to (null = document.body) - can be an element ID eg. 'myDiv', or a DOM node reference - this.useMeltEffect = true; // When recycling fallen snow (or rarely, when falling), have it "melt" and fade out if browser supports it - this.useTwinkleEffect = false; // Allow snow to randomly "flicker" in and out of view while falling - this.usePositionFixed = false; // true = snow does not shift vertically when scrolling. May increase CPU load, disabled by default - if enabled, used only where supported - this.usePixelPosition = false; // Whether to use pixel values for snow top/left vs. percentages. Auto-enabled if body is position:relative or targetElement is specified. - - // --- less-used bits --- - - this.freezeOnBlur = true; // Only snow when the window is in focus (foreground.) Saves CPU. - this.flakeLeftOffset = 0; // Left margin/gutter space on edge of container (eg. browser window.) Bump up these values if seeing horizontal scrollbars. - this.flakeRightOffset = 0; // Right margin/gutter space on edge of container - this.flakeWidth = 8; // Max pixel width reserved for snow element - this.flakeHeight = 8; // Max pixel height reserved for snow element - this.vMaxX = 5; // Maximum X velocity range for snow - this.vMaxY = 4; // Maximum Y velocity range for snow - this.zIndex = 0; // CSS stacking order applied to each snowflake - - // --- "No user-serviceable parts inside" past this point, yadda yadda --- - - var storm = this, - features, - // UA sniffing and backCompat rendering mode checks for fixed position, etc. - isIE = navigator.userAgent.match(/msie/i), - isIE6 = navigator.userAgent.match(/msie 6/i), - isMobile = navigator.userAgent.match(/mobile|opera m(ob|in)/i), - isBackCompatIE = (isIE && document.compatMode === 'BackCompat'), - noFixed = (isBackCompatIE || isIE6), - screenX = null, screenX2 = null, screenY = null, scrollY = null, docHeight = null, vRndX = null, vRndY = null, - windOffset = 1, - windMultiplier = 2, - flakeTypes = 6, - fixedForEverything = false, - targetElementIsRelative = false, - opacitySupported = (function(){ - try { - document.createElement('div').style.opacity = '0.5'; - } catch(e) { - return false; - } - return true; - }()), - didInit = false, - docFrag = document.createDocumentFragment(); - - features = (function() { - - var getAnimationFrame; - - /** - * hat tip: paul irish - * http://paulirish.com/2011/requestanimationframe-for-smart-animating/ - * https://gist.github.com/838785 - */ - - function timeoutShim(callback) { - window.setTimeout(callback, 1000/(storm.animationInterval || 20)); - } - - var _animationFrame = (window.requestAnimationFrame || - window.webkitRequestAnimationFrame || - window.mozRequestAnimationFrame || - window.oRequestAnimationFrame || - window.msRequestAnimationFrame || - timeoutShim); - - // apply to window, avoid "illegal invocation" errors in Chrome - getAnimationFrame = _animationFrame ? function() { - return _animationFrame.apply(window, arguments); - } : null; - - var testDiv; - - testDiv = document.createElement('div'); - - function has(prop) { - - // test for feature support - var result = testDiv.style[prop]; - return (result !== undefined ? prop : null); - - } - - // note local scope. - var localFeatures = { - - transform: { - ie: has('-ms-transform'), - moz: has('MozTransform'), - opera: has('OTransform'), - webkit: has('webkitTransform'), - w3: has('transform'), - prop: null // the normalized property value - }, - - getAnimationFrame: getAnimationFrame - - }; - - localFeatures.transform.prop = ( - localFeatures.transform.w3 || - localFeatures.transform.moz || - localFeatures.transform.webkit || - localFeatures.transform.ie || - localFeatures.transform.opera - ); - - testDiv = null; - - return localFeatures; - - }()); - - this.timer = null; - this.flakes = []; - this.disabled = false; - this.active = false; - this.meltFrameCount = 20; - this.meltFrames = []; - - this.setXY = function(o, x, y) { - - if (!o) { - return false; - } - - if (storm.usePixelPosition || targetElementIsRelative) { - - o.style.left = (x - storm.flakeWidth) + 'px'; - o.style.top = (y - storm.flakeHeight) + 'px'; - - } else if (noFixed) { - - o.style.right = (100-(x/screenX*100)) + '%'; - // avoid creating vertical scrollbars - o.style.top = (Math.min(y, docHeight-storm.flakeHeight)) + 'px'; - - } else { - - if (!storm.flakeBottom) { - - // if not using a fixed bottom coordinate... - o.style.right = (100-(x/screenX*100)) + '%'; - o.style.bottom = (100-(y/screenY*100)) + '%'; - - } else { - - // absolute top. - o.style.right = (100-(x/screenX*100)) + '%'; - o.style.top = (Math.min(y, docHeight-storm.flakeHeight)) + 'px'; - - } - - } - - }; - - this.events = (function() { - - var old = (!window.addEventListener && window.attachEvent), slice = Array.prototype.slice, - evt = { - add: (old?'attachEvent':'addEventListener'), - remove: (old?'detachEvent':'removeEventListener') - }; - - function getArgs(oArgs) { - var args = slice.call(oArgs), len = args.length; - if (old) { - args[1] = 'on' + args[1]; // prefix - if (len > 3) { - args.pop(); // no capture - } - } else if (len === 3) { - args.push(false); - } - return args; - } - - function apply(args, sType) { - var element = args.shift(), - method = [evt[sType]]; - if (old) { - element[method](args[0], args[1]); - } else { - element[method].apply(element, args); - } - } - - function addEvent() { - apply(getArgs(arguments), 'add'); - } - - function removeEvent() { - apply(getArgs(arguments), 'remove'); - } - - return { - add: addEvent, - remove: removeEvent - }; - - }()); - - function rnd(n,min) { - if (isNaN(min)) { - min = 0; - } - return (Math.random()*n)+min; - } - - function plusMinus(n) { - return (parseInt(rnd(2),10)===1?n*-1:n); - } - - this.randomizeWind = function() { - var i; - vRndX = plusMinus(rnd(storm.vMaxX,0.2)); - vRndY = rnd(storm.vMaxY,0.2); - if (this.flakes) { - for (i=0; i=0 && s.vX<0.2) { - s.vX = 0.2; - } else if (s.vX<0 && s.vX>-0.2) { - s.vX = -0.2; - } - if (s.vY>=0 && s.vY<0.2) { - s.vY = 0.2; - } - }; - - this.move = function() { - var vX = s.vX*windOffset, yDiff; - s.x += vX; - s.y += (s.vY*s.vAmp); - if (s.x >= screenX || screenX-s.x < storm.flakeWidth) { // X-axis scroll check - s.x = 0; - } else if (vX < 0 && s.x-storm.flakeLeftOffset < -storm.flakeWidth) { - s.x = screenX-storm.flakeWidth-1; // flakeWidth; - } - s.refresh(); - yDiff = screenY+scrollY-s.y+storm.flakeHeight; - if (yDiff0.998) { - // ~1/1000 chance of melting mid-air, with each frame - s.melting = true; - s.melt(); - // only incrementally melt one frame - // s.melting = false; - } - if (storm.useTwinkleEffect) { - if (s.twinkleFrame < 0) { - if (Math.random() > 0.97) { - s.twinkleFrame = parseInt(Math.random() * 8, 10); - } - } else { - s.twinkleFrame--; - if (!opacitySupported) { - s.o.style.visibility = (s.twinkleFrame && s.twinkleFrame % 2 === 0 ? 'hidden' : 'visible'); - } else { - s.o.style.opacity = (s.twinkleFrame && s.twinkleFrame % 2 === 0 ? 0 : 1); - } - } - } - } - }; - - this.animate = function() { - // main animation loop - // move, check status, die etc. - s.move(); - }; - - this.setVelocities = function() { - s.vX = vRndX+rnd(storm.vMaxX*0.12,0.1); - s.vY = vRndY+rnd(storm.vMaxY*0.12,0.1); - }; - - this.setOpacity = function(o,opacity) { - if (!opacitySupported) { - return false; - } - o.style.opacity = opacity; - }; - - this.melt = function() { - if (!storm.useMeltEffect || !s.melting) { - s.recycle(); - } else { - if (s.meltFrame < s.meltFrameCount) { - s.setOpacity(s.o,s.meltFrames[s.meltFrame]); - s.o.style.fontSize = s.fontSize-(s.fontSize*(s.meltFrame/s.meltFrameCount))+'px'; - s.o.style.lineHeight = storm.flakeHeight+2+(storm.flakeHeight*0.75*(s.meltFrame/s.meltFrameCount))+'px'; - s.meltFrame++; - } else { - s.recycle(); - } - } - }; - - this.recycle = function() { - s.o.style.display = 'none'; - s.o.style.position = (fixedForEverything?'fixed':'absolute'); - s.o.style.bottom = 'auto'; - s.setVelocities(); - s.vCheck(); - s.meltFrame = 0; - s.melting = false; - s.setOpacity(s.o,1); - s.o.style.padding = '0px'; - s.o.style.margin = '0px'; - s.o.style.fontSize = s.fontSize+'px'; - s.o.style.lineHeight = (storm.flakeHeight+2)+'px'; - s.o.style.textAlign = 'center'; - s.o.style.verticalAlign = 'baseline'; - s.x = parseInt(rnd(screenX-storm.flakeWidth-20),10); - s.y = parseInt(rnd(screenY)*-1,10)-storm.flakeHeight; - s.refresh(); - s.o.style.display = 'block'; - s.active = 1; - }; - - this.recycle(); // set up x/y coords etc. - this.refresh(); - - }; - - this.snow = function() { - var active = 0, flake = null, i, j; - for (i=0, j=storm.flakes.length; istorm.flakesMaxActive) { - storm.flakes[storm.flakes.length-1].active = -1; - } - } - storm.targetElement.appendChild(docFrag); - }; - - this.timerInit = function() { - storm.timer = true; - storm.snow(); - }; - - this.init = function() { - var i; - for (i=0; i 3) { + args.pop(); // no capture + } + } else if (len === 3) { + args.push(false); + } + return args; + } + + function apply(args, sType) { + var element = args.shift(), + method = [evt[sType]]; + if (old) { + element[method](args[0], args[1]); + } else { + element[method].apply(element, args); + } + } + + function addEvent() { + apply(getArgs(arguments), 'add'); + } + + function removeEvent() { + apply(getArgs(arguments), 'remove'); + } + + return { + add: addEvent, + remove: removeEvent + }; + + }()); + + function rnd(n,min) { + if (isNaN(min)) { + min = 0; + } + return (Math.random()*n)+min; + } + + function plusMinus(n) { + return (parseInt(rnd(2),10)===1?n*-1:n); + } + + this.randomizeWind = function() { + var i; + vRndX = plusMinus(rnd(storm.vMaxX,0.2)); + vRndY = rnd(storm.vMaxY,0.2); + if (this.flakes) { + for (i=0; i=0 && s.vX<0.2) { + s.vX = 0.2; + } else if (s.vX<0 && s.vX>-0.2) { + s.vX = -0.2; + } + if (s.vY>=0 && s.vY<0.2) { + s.vY = 0.2; + } + }; + + this.move = function() { + var vX = s.vX*windOffset, yDiff; + s.x += vX; + s.y += (s.vY*s.vAmp); + if (s.x >= screenX || screenX-s.x < storm.flakeWidth) { // X-axis scroll check + s.x = 0; + } else if (vX < 0 && s.x-storm.flakeLeftOffset < -storm.flakeWidth) { + s.x = screenX-storm.flakeWidth-1; // flakeWidth; + } + s.refresh(); + yDiff = screenY+scrollY-s.y+storm.flakeHeight; + if (yDiff0.998) { + // ~1/1000 chance of melting mid-air, with each frame + s.melting = true; + s.melt(); + // only incrementally melt one frame + // s.melting = false; + } + if (storm.useTwinkleEffect) { + if (s.twinkleFrame < 0) { + if (Math.random() > 0.97) { + s.twinkleFrame = parseInt(Math.random() * 8, 10); + } + } else { + s.twinkleFrame--; + if (!opacitySupported) { + s.o.style.visibility = (s.twinkleFrame && s.twinkleFrame % 2 === 0 ? 'hidden' : 'visible'); + } else { + s.o.style.opacity = (s.twinkleFrame && s.twinkleFrame % 2 === 0 ? 0 : 1); + } + } + } + } + }; + + this.animate = function() { + // main animation loop + // move, check status, die etc. + s.move(); + }; + + this.setVelocities = function() { + s.vX = vRndX+rnd(storm.vMaxX*0.12,0.1); + s.vY = vRndY+rnd(storm.vMaxY*0.12,0.1); + }; + + this.setOpacity = function(o,opacity) { + if (!opacitySupported) { + return false; + } + o.style.opacity = opacity; + }; + + this.melt = function() { + if (!storm.useMeltEffect || !s.melting) { + s.recycle(); + } else { + if (s.meltFrame < s.meltFrameCount) { + s.setOpacity(s.o,s.meltFrames[s.meltFrame]); + s.o.style.fontSize = s.fontSize-(s.fontSize*(s.meltFrame/s.meltFrameCount))+'px'; + s.o.style.lineHeight = storm.flakeHeight+2+(storm.flakeHeight*0.75*(s.meltFrame/s.meltFrameCount))+'px'; + s.meltFrame++; + } else { + s.recycle(); + } + } + }; + + this.recycle = function() { + s.o.style.display = 'none'; + s.o.style.position = (fixedForEverything?'fixed':'absolute'); + s.o.style.bottom = 'auto'; + s.setVelocities(); + s.vCheck(); + s.meltFrame = 0; + s.melting = false; + s.setOpacity(s.o,1); + s.o.style.padding = '0px'; + s.o.style.margin = '0px'; + s.o.style.fontSize = s.fontSize+'px'; + s.o.style.lineHeight = (storm.flakeHeight+2)+'px'; + s.o.style.textAlign = 'center'; + s.o.style.verticalAlign = 'baseline'; + s.x = parseInt(rnd(screenX-storm.flakeWidth-20),10); + s.y = parseInt(rnd(screenY)*-1,10)-storm.flakeHeight; + s.refresh(); + s.o.style.display = 'block'; + s.active = 1; + }; + + this.recycle(); // set up x/y coords etc. + this.refresh(); + + }; + + this.snow = function() { + var active = 0, flake = null, i, j; + for (i=0, j=storm.flakes.length; istorm.flakesMaxActive) { + storm.flakes[storm.flakes.length-1].active = -1; + } + } + storm.targetElement.appendChild(docFrag); + }; + + this.timerInit = function() { + storm.timer = true; + storm.snow(); + }; + + this.init = function() { + var i; + for (i=0; i { - if (require('os').platform !== "darwin") { - gpuinfo = require('@electron/remote').app.getGPUFeatureStatus(); - gpuscore = 0; - maxscore = 10; - if (gpuinfo['2d_canvas'].startsWith("enabled")) { - if (gpuinfo['2d_canvas'] === "enabled") { - gpuscore++; - } else { - gpuscore += 0.5; - } - } - if (gpuinfo['gpu_compositing'].startsWith("enabled")) { - if (gpuinfo['gpu_compositing'] === "enabled") { - gpuscore++; - } else { - gpuscore += 0.5; - } - } - if (gpuinfo['video_decode'].startsWith("enabled")) { - if (gpuinfo['video_decode'] === "enabled") { - gpuscore++; - } else { - gpuscore += 0.5; - } - } - if (gpuinfo['multiple_raster_threads'].startsWith("enabled")) { - if (gpuinfo['multiple_raster_threads'] === "enabled") { - gpuscore++; - } else { - gpuscore += 0.5; - } - } - if (gpuinfo['oop_rasterization'].startsWith("enabled")) { - if (gpuinfo['oop_rasterization'] === "enabled") { - gpuscore++; - } else { - gpuscore += 0.5; - } - } - if (gpuinfo['rasterization'].startsWith("enabled")) { - if (gpuinfo['rasterization'] === "enabled") { - gpuscore++; - } else { - gpuscore += 0.5; - } - } - if (gpuinfo['opengl'].startsWith("enabled")) { - if (gpuinfo['opengl'] === "enabled") { - gpuscore++; - } else { - gpuscore += 0.5; - } - } - if (gpuinfo['skia_renderer'].startsWith("enabled")) { - if (gpuinfo['skia_renderer'] === "enabled") { - gpuscore++; - } else { - gpuscore += 0.5; - } - } - if (gpuinfo['vulkan'].startsWith("enabled")) { - if (gpuinfo['vulkan'] === "enabled") { - gpuscore++; - } else { - gpuscore += 0.5; - } - } - if (gpuinfo['webgl'].startsWith("enabled")) { - if (gpuinfo['webgl'] === "enabled") { - gpuscore++; - } else { - gpuscore += 0.5; - } - } - - gpuperct = (gpuscore / maxscore) * 100; - - if (gpuperct < 30) { - console.warn("Bad GPU support, disabling GPU-accelerated content"); - var head = document.getElementsByTagName('HEAD')[0]; - var link = document.createElement('link'); - link.rel = 'stylesheet'; - link.type = 'text/css'; - link.href = './views/common/compatibilityMode.css'; - head.appendChild(link); - } - } -}) +window.addEventListener("load", () => { + if (require('os').platform !== "darwin") { + gpuinfo = require('@electron/remote').app.getGPUFeatureStatus(); + gpuscore = 0; + maxscore = 10; + if (gpuinfo['2d_canvas'].startsWith("enabled")) { + if (gpuinfo['2d_canvas'] === "enabled") { + gpuscore++; + } else { + gpuscore += 0.5; + } + } + if (gpuinfo['gpu_compositing'].startsWith("enabled")) { + if (gpuinfo['gpu_compositing'] === "enabled") { + gpuscore++; + } else { + gpuscore += 0.5; + } + } + if (gpuinfo['video_decode'].startsWith("enabled")) { + if (gpuinfo['video_decode'] === "enabled") { + gpuscore++; + } else { + gpuscore += 0.5; + } + } + if (gpuinfo['multiple_raster_threads'].startsWith("enabled")) { + if (gpuinfo['multiple_raster_threads'] === "enabled") { + gpuscore++; + } else { + gpuscore += 0.5; + } + } + if (gpuinfo['oop_rasterization'].startsWith("enabled")) { + if (gpuinfo['oop_rasterization'] === "enabled") { + gpuscore++; + } else { + gpuscore += 0.5; + } + } + if (gpuinfo['rasterization'].startsWith("enabled")) { + if (gpuinfo['rasterization'] === "enabled") { + gpuscore++; + } else { + gpuscore += 0.5; + } + } + if (gpuinfo['opengl'].startsWith("enabled")) { + if (gpuinfo['opengl'] === "enabled") { + gpuscore++; + } else { + gpuscore += 0.5; + } + } + if (gpuinfo['skia_renderer'].startsWith("enabled")) { + if (gpuinfo['skia_renderer'] === "enabled") { + gpuscore++; + } else { + gpuscore += 0.5; + } + } + if (gpuinfo['vulkan'].startsWith("enabled")) { + if (gpuinfo['vulkan'] === "enabled") { + gpuscore++; + } else { + gpuscore += 0.5; + } + } + if (gpuinfo['webgl'].startsWith("enabled")) { + if (gpuinfo['webgl'] === "enabled") { + gpuscore++; + } else { + gpuscore += 0.5; + } + } + + gpuperct = (gpuscore / maxscore) * 100; + + if (gpuperct < 30) { + console.warn("Bad GPU support, disabling GPU-accelerated content"); + var head = document.getElementsByTagName('HEAD')[0]; + var link = document.createElement('link'); + link.rel = 'stylesheet'; + link.type = 'text/css'; + link.href = './views/common/compatibilityMode.css'; + head.appendChild(link); + } + } +}) diff --git a/views/script/core_crash.js b/views/script/core_crash.js index d24ec2d..1a12230 100644 --- a/views/script/core_crash.js +++ b/views/script/core_crash.js @@ -1,21 +1,21 @@ -global.gameCrashed = false; -crashSound = new Audio("./sfx/gamecrash.wav"); - -function destroy() { - global.gameCrashed = true; - crashSound.play(); - require('@electron/remote').webContents.fromId(webview.getWebContentsId()).forcefullyCrashRenderer(); - try { musicElement.pause(); } catch (e) {} -} - -function spawnError(crashReport) { - document.getElementById("error-outer").style.display = "flex"; - document.getElementById("crash-dump").value = crashReport; - destroy(); -} - -const crashHandler = require('electron').ipcRenderer; - -crashHandler.on('crashreport', (event, args) => { - spawnError(args); +global.gameCrashed = false; +crashSound = new Audio("./sfx/gamecrash.wav"); + +function destroy() { + global.gameCrashed = true; + crashSound.play(); + require('@electron/remote').webContents.fromId(webview.getWebContentsId()).forcefullyCrashRenderer(); + try { musicElement.pause(); } catch (e) {} +} + +function spawnError(crashReport) { + document.getElementById("error-outer").style.display = "flex"; + document.getElementById("crash-dump").value = crashReport; + destroy(); +} + +const crashHandler = require('electron').ipcRenderer; + +crashHandler.on('crashreport', (event, args) => { + spawnError(args); }) \ No newline at end of file diff --git a/views/script/core_notification.js b/views/script/core_notification.js index 118d19d..676b2d0 100644 --- a/views/script/core_notification.js +++ b/views/script/core_notification.js @@ -1,13 +1,13 @@ -var ipcRenderer = require('electron').ipcRenderer; -ipcRenderer.on('notification', function (event, data) { - document.getElementById("notification-title").innerText = data.title; - document.getElementById("notification-message").innerText = data.message; - document.getElementById("notification").style.right = "20px"; - document.getElementById("notification").style.opacity = "1"; - new Audio("./sfx/notification.mp3").play(); - - setTimeout(() => { - document.getElementById("notification").style.right = "-300px"; - document.getElementById("notification").style.opacity = "0"; - }, 5000) +var ipcRenderer = require('electron').ipcRenderer; +ipcRenderer.on('notification', function (event, data) { + document.getElementById("notification-title").innerText = data.title; + document.getElementById("notification-message").innerText = data.message; + document.getElementById("notification").style.right = "20px"; + document.getElementById("notification").style.opacity = "1"; + new Audio("./sfx/notification.mp3").play(); + + setTimeout(() => { + document.getElementById("notification").style.right = "-300px"; + document.getElementById("notification").style.opacity = "0"; + }, 5000) }); \ No newline at end of file diff --git a/views/script/core_stats.js b/views/script/core_stats.js index 930c776..124f5fe 100644 --- a/views/script/core_stats.js +++ b/views/script/core_stats.js @@ -1,51 +1,51 @@ -const fs = require('fs'); -const homedir = require('@electron/remote').getCurrentWindow().homedir; - -session = null; -timer = null; -current = null; - -webview.addEventListener('dom-ready', () => { - try { - if (webview.getURL() !== current) { - if (session !== null) { - require('electron').ipcRenderer.send('addstats', { catalog: "times", key: session, add: Math.floor((new Date() - timer)/1000) }); - - session = null; - timer = null; - current = null; - } - } - - if (webview.getURL().endsWith("game.html")) { // Local - session = "local"; - timer = new Date(); - current = webview.getURL(); - } - if (webview.getURL().endsWith("game.html?sp")) { // Singleplayer - session = "single"; - timer = new Date(); - current = webview.getURL(); - } - if (webview.getURL().endsWith("game.html?online")) { // Online - session = "online"; - timer = new Date(); - current = webview.getURL(); - } - } catch (e) {} -}) - -window.addEventListener("beforeunload", function(e){ - try { - if (session !== null) { - require('electron').ipcRenderer.send('addstatsandclose', { catalog: "times", key: session, add: Math.floor((new Date() - timer)/1000) }); - - session = null; - timer = null; - current = null; - - e.preventDefault(); - return false; - } - } catch (e) {} +const fs = require('fs'); +const homedir = require('@electron/remote').getCurrentWindow().homedir; + +session = null; +timer = null; +current = null; + +webview.addEventListener('dom-ready', () => { + try { + if (webview.getURL() !== current) { + if (session !== null) { + require('electron').ipcRenderer.send('addstats', { catalog: "times", key: session, add: Math.floor((new Date() - timer)/1000) }); + + session = null; + timer = null; + current = null; + } + } + + if (webview.getURL().endsWith("game.html")) { // Local + session = "local"; + timer = new Date(); + current = webview.getURL(); + } + if (webview.getURL().endsWith("game.html?sp")) { // Singleplayer + session = "single"; + timer = new Date(); + current = webview.getURL(); + } + if (webview.getURL().endsWith("game.html?online")) { // Online + session = "online"; + timer = new Date(); + current = webview.getURL(); + } + } catch (e) {} +}) + +window.addEventListener("beforeunload", function(e){ + try { + if (session !== null) { + require('electron').ipcRenderer.send('addstatsandclose', { catalog: "times", key: session, add: Math.floor((new Date() - timer)/1000) }); + + session = null; + timer = null; + current = null; + + e.preventDefault(); + return false; + } + } catch (e) {} }, false); \ No newline at end of file diff --git a/views/script/game_debug.js b/views/script/game_debug.js index 1fb2639..dee421b 100644 --- a/views/script/game_debug.js +++ b/views/script/game_debug.js @@ -1,263 +1,263 @@ -global.debugshow = false; - -function oil(id) { - return "\nO" + id +": " + document.getElementById('oil' + id + '').style.left.split("px")[0] + " " + document.getElementById('oil' + id + '').style.top.split("px")[0] + " / " + document.getElementById('oil' + id + '').style.transform.split("rotate(")[1].split("deg)")[0]; -} - -$(document).keydown((e) => { - if (e.keyCode === 114) { // F3 - if (debugshow) { - global.debugshow = false; - document.getElementById("debug").style.display = "none"; - } else { - global.debugshow = true; - document.getElementById("debug").style.display = ""; - } - } -}) - -if (require('os').platform() !== "darwin") { - gpuinfo = require('@electron/remote').app.getGPUFeatureStatus(); - gpuscore = 0; - maxscore = 10; - if (gpuinfo['2d_canvas'].startsWith("enabled")) { - if (gpuinfo['2d_canvas'] === "enabled") { - gpuscore++; - } else { - gpuscore += 0.5; - } - } - if (gpuinfo['gpu_compositing'].startsWith("enabled")) { - if (gpuinfo['gpu_compositing'] === "enabled") { - gpuscore++; - } else { - gpuscore += 0.5; - } - } - if (gpuinfo['video_decode'].startsWith("enabled")) { - if (gpuinfo['video_decode'] === "enabled") { - gpuscore++; - } else { - gpuscore += 0.5; - } - } - if (gpuinfo['multiple_raster_threads'].startsWith("enabled")) { - if (gpuinfo['multiple_raster_threads'] === "enabled") { - gpuscore++; - } else { - gpuscore += 0.5; - } - } - if (gpuinfo['oop_rasterization'].startsWith("enabled")) { - if (gpuinfo['oop_rasterization'] === "enabled") { - gpuscore++; - } else { - gpuscore += 0.5; - } - } - if (gpuinfo['rasterization'].startsWith("enabled")) { - if (gpuinfo['rasterization'] === "enabled") { - gpuscore++; - } else { - gpuscore += 0.5; - } - } - if (gpuinfo['opengl'].startsWith("enabled")) { - if (gpuinfo['opengl'] === "enabled") { - gpuscore++; - } else { - gpuscore += 0.5; - } - } - if (gpuinfo['skia_renderer'].startsWith("enabled")) { - if (gpuinfo['skia_renderer'] === "enabled") { - gpuscore++; - } else { - gpuscore += 0.5; - } - } - if (gpuinfo['vulkan'].startsWith("enabled")) { - if (gpuinfo['vulkan'] === "enabled") { - gpuscore++; - } else { - gpuscore += 0.5; - } - } - if (gpuinfo['webgl'].startsWith("enabled")) { - if (gpuinfo['webgl'] === "enabled") { - gpuscore++; - } else { - gpuscore += 0.5; - } - } - - gpuperct = (gpuscore/maxscore)*100; -} else { - gpuperct = 100; -} - -pubver = require('../package.json').version; -pvpart = pubver.split("."); -if (pvpart.length === 3) { - intver = pvpart[0] + "." + pvpart[1]; -} else { - intver = "unknown"; -} - -if (require('@electron/remote').getCurrentWindow().mods.length > 0) { - release = "mods+" + require('@electron/remote').getCurrentWindow().mods.length; -} else { - release = "official"; -} - -if (gpuperct < 25) { - perf = "fast"; -} else if (gpuperct < 50) { - perf = "fancy"; -} else { - perf = "fabulous"; -} - -if (location.search === "") { - game = "Local multiplayer game"; -} else if (location.search === "?sp") { - game = "Singleplayer game"; -} else if (location.search === "?online") { - game = require("../online/server.json").hostname + ":" + require("../online/server.json").port; -} - -tps = -1; -cping = -1; -changedDataLeft = "playing: %false%" -changedDataRight = "" -immutableDataLeft = "Kartik " + pubver + " (" + intver + "/" + require('../package.json').channel + "+" + release + ")\n%tps% tps T:" + perf + ";vsync\n" + game + " @ %ping% ms ticks"; -immutableDataRight = "Electron: " + process.versions.electron + " " + process.arch; - -credits = "Debug: start runtime with debug argument\nFor help: https://kartik.hopto.org" - -setInterval(() => { - if (!debugshow) { return; } - - - leftparts = (immutableDataLeft + "\n" + changedDataLeft + "\n\n" + credits).split("\n"); - lefttext = "" + leftparts.join("
") + ""; - - rightparts = (immutableDataRight + "\n" + changedDataRight).split("\n"); - righttext = "" + rightparts.join("
") + ""; - - document.getElementById("debug-left").innerHTML = lefttext.replaceAll("%tps%", tps).replaceAll("%ping%", cping).replaceAll("%false%", "false").replaceAll("%true%", "true"); - document.getElementById("debug-right").innerHTML = righttext; -}, 100) - -var filterStrength = 20; -var frameTime = 0, lastLoop = new Date, thisLoop; - -setInterval(() => { - if (!debugshow) { return; } - - var thisFrameTime = (thisLoop=new Date) - lastLoop; - frameTime+= (thisFrameTime - frameTime) / filterStrength; - lastLoop = thisLoop; -}, 50) - -require('systeminformation').graphics().then((data) => { - global.gpudata = data; -}); - -setInterval(() => { - if (!debugshow) { return; } - - tps = (1000/frameTime).toFixed(1); - - if (typeof ping === "number") { - cping = ping; - } else { - cping = 0; - } - - if (started) { - changedDataLeft = "playing: %true%"; - changedDataLeft += "\n\n0$: XY: " + document.getElementById('car0').style.left.split("px")[0] + " / " + document.getElementById('car0').style.top.split("px")[0] - - c0rotate = document.getElementById('car0').style.transform.split("rotate(")[1].split("deg)")[0]; - if (c0rotate === "90") { - changedDataLeft += "\n0$: Facing: south (Towards negative Y)"; - } else if (c0rotate === "-90") { - changedDataLeft += "\n0$: Facing: north (Towards negative Y)"; - } else if (c0rotate === "0") { - changedDataLeft += "\n0$: Facing: east (Towards positive X)"; - } else if (c0rotate === "180") { - changedDataLeft += "\n0$: Facing: west (Towards negative X)"; - } - - changedDataLeft += "\n0$: Speed: A: " + car0cspeed.toFixed(2) + " R: " + (car0speed - car0cspeed).toFixed(2) + " M: " + car0speed.toFixed(2); - - changedDataLeft += "\n0$: Laps: " + document.getElementById('laps-car0').innerText + "/5"; - changedDataLeft += "\n0$: Model: " + selectedModel0; - changedDataLeft += "\n0$: Collision: " + (car0collisionon ? "%true%" : "%false%"); - - changedDataLeft += "\n\n1$: XY: " + document.getElementById('car1').style.left.split("px")[0] + " / " + document.getElementById('car1').style.top.split("px")[0] - - c0rotate = document.getElementById('car1').style.transform.split("rotate(")[1].split("deg)")[0]; - if (c0rotate === "90") { - changedDataLeft += "\n1$: Facing: south (Towards negative Y)"; - } else if (c0rotate === "-90") { - changedDataLeft += "\n1$: Facing: north (Towards negative Y)"; - } else if (c0rotate === "0") { - changedDataLeft += "\n1$: Facing: east (Towards positive X)"; - } else if (c0rotate === "180") { - changedDataLeft += "\n1$: Facing: west (Towards negative X)"; - } - - changedDataLeft += "\n1$: Speed: A: " + car1cspeed.toFixed(2) + " R: " + (car1speed - car1cspeed).toFixed(2) + " M: " + car1speed.toFixed(2); - - changedDataLeft += "\n1$: Laps: " + document.getElementById('laps-car1').innerText + "/5"; - changedDataLeft += "\n1$: Model: " + selectedModel1; - changedDataLeft += "\n1$: Collision: " + (car1collisionon ? "%true%" : "%false%"); - changedDataLeft += "\n" + oil(0) + oil(1) + oil(2) + oil(3) + oil(4); - changedDataLeft += "\n\nMusic: " + i; - changedDataLeft += "\nCircuit: " + rand; - - } else { - changedDataLeft = "playing: %false%" - } - - usedMem = (process.memoryUsage().heapUsed / 1000000).toFixed(2); - totalMem = (process.memoryUsage().heapTotal / 1000000).toFixed(2); - percMem = Math.round((process.memoryUsage().heapUsed / process.memoryUsage().heapTotal)*100); - allocateMem = (process.memoryUsage().rss / 1000000).toFixed(2); - - changedDataRight = "Mem: " + percMem + "% " + usedMem + "/" + totalMem + "MB" - changedDataRight += "\nAllocated: " + allocateMem + "MB" - changedDataRight += "\n\nCPU: (" + process.getCPUUsage().percentCPUUsage.toFixed(2) + "%) " + require('os').cpus().length + "x " + require('os').cpus()[0].model.trim() + " @ " + (require('os').cpus()[0].speed/1000).toFixed(2) + "GHz" - - try { - changedDataRight += "\n\nDisplay: " + window.innerWidth + "x" + window.innerHeight + " (" + gpudata.controllers[0].vendor + ")"; - changedDataRight += "\n" + gpudata.controllers[0].model; - - try { - if (gpudriverdata.gpuDevice[0].driverVendor !== undefined) { - dvendor = gpudriverdata.gpuDevice[0].driverVendor; - } else { - dvendor = "<Unknown>"; - } - if (gpudriverdata.gpuDevice[0].driverVersion !== undefined) { - dversion = gpudriverdata.gpuDevice[0].driverVersion; - } else { - dversion = "<Unknown>"; - } - } catch (e) { - dvendor = "<Unknown>"; - dversion = "<Unknown>"; - } - changedDataRight += "\n" + dvendor + " - " + dversion; - } catch (e) { - console.error(e); - } -},100); - -window.addEventListener("load", () => { - require('@electron/remote').app.getGPUInfo('complete').then((data) => { - global.gpudriverdata = data; - }); +global.debugshow = false; + +function oil(id) { + return "\nO" + id +": " + document.getElementById('oil' + id + '').style.left.split("px")[0] + " " + document.getElementById('oil' + id + '').style.top.split("px")[0] + " / " + document.getElementById('oil' + id + '').style.transform.split("rotate(")[1].split("deg)")[0]; +} + +$(document).keydown((e) => { + if (e.keyCode === 114) { // F3 + if (debugshow) { + global.debugshow = false; + document.getElementById("debug").style.display = "none"; + } else { + global.debugshow = true; + document.getElementById("debug").style.display = ""; + } + } +}) + +if (require('os').platform() !== "darwin") { + gpuinfo = require('@electron/remote').app.getGPUFeatureStatus(); + gpuscore = 0; + maxscore = 10; + if (gpuinfo['2d_canvas'].startsWith("enabled")) { + if (gpuinfo['2d_canvas'] === "enabled") { + gpuscore++; + } else { + gpuscore += 0.5; + } + } + if (gpuinfo['gpu_compositing'].startsWith("enabled")) { + if (gpuinfo['gpu_compositing'] === "enabled") { + gpuscore++; + } else { + gpuscore += 0.5; + } + } + if (gpuinfo['video_decode'].startsWith("enabled")) { + if (gpuinfo['video_decode'] === "enabled") { + gpuscore++; + } else { + gpuscore += 0.5; + } + } + if (gpuinfo['multiple_raster_threads'].startsWith("enabled")) { + if (gpuinfo['multiple_raster_threads'] === "enabled") { + gpuscore++; + } else { + gpuscore += 0.5; + } + } + if (gpuinfo['oop_rasterization'].startsWith("enabled")) { + if (gpuinfo['oop_rasterization'] === "enabled") { + gpuscore++; + } else { + gpuscore += 0.5; + } + } + if (gpuinfo['rasterization'].startsWith("enabled")) { + if (gpuinfo['rasterization'] === "enabled") { + gpuscore++; + } else { + gpuscore += 0.5; + } + } + if (gpuinfo['opengl'].startsWith("enabled")) { + if (gpuinfo['opengl'] === "enabled") { + gpuscore++; + } else { + gpuscore += 0.5; + } + } + if (gpuinfo['skia_renderer'].startsWith("enabled")) { + if (gpuinfo['skia_renderer'] === "enabled") { + gpuscore++; + } else { + gpuscore += 0.5; + } + } + if (gpuinfo['vulkan'].startsWith("enabled")) { + if (gpuinfo['vulkan'] === "enabled") { + gpuscore++; + } else { + gpuscore += 0.5; + } + } + if (gpuinfo['webgl'].startsWith("enabled")) { + if (gpuinfo['webgl'] === "enabled") { + gpuscore++; + } else { + gpuscore += 0.5; + } + } + + gpuperct = (gpuscore/maxscore)*100; +} else { + gpuperct = 100; +} + +pubver = require('../package.json').version; +pvpart = pubver.split("."); +if (pvpart.length === 3) { + intver = pvpart[0] + "." + pvpart[1]; +} else { + intver = "unknown"; +} + +if (require('@electron/remote').getCurrentWindow().mods.length > 0) { + release = "mods+" + require('@electron/remote').getCurrentWindow().mods.length; +} else { + release = "official"; +} + +if (gpuperct < 25) { + perf = "fast"; +} else if (gpuperct < 50) { + perf = "fancy"; +} else { + perf = "fabulous"; +} + +if (location.search === "") { + game = "Local multiplayer game"; +} else if (location.search === "?sp") { + game = "Singleplayer game"; +} else if (location.search === "?online") { + game = require("../online/server.json").hostname + ":" + require("../online/server.json").port; +} + +tps = -1; +cping = -1; +changedDataLeft = "playing: %false%" +changedDataRight = "" +immutableDataLeft = "Kartik " + pubver + " (" + intver + "/" + require('../package.json').channel + "+" + release + ")\n%tps% tps T:" + perf + ";vsync\n" + game + " @ %ping% ms ticks"; +immutableDataRight = "Electron: " + process.versions.electron + " " + process.arch; + +credits = "Debug: start runtime with debug argument\nFor help: https://kartik.hopto.org" + +setInterval(() => { + if (!debugshow) { return; } + + + leftparts = (immutableDataLeft + "\n" + changedDataLeft + "\n\n" + credits).split("\n"); + lefttext = "" + leftparts.join("
") + ""; + + rightparts = (immutableDataRight + "\n" + changedDataRight).split("\n"); + righttext = "" + rightparts.join("
") + ""; + + document.getElementById("debug-left").innerHTML = lefttext.replaceAll("%tps%", tps).replaceAll("%ping%", cping).replaceAll("%false%", "false").replaceAll("%true%", "true"); + document.getElementById("debug-right").innerHTML = righttext; +}, 100) + +var filterStrength = 20; +var frameTime = 0, lastLoop = new Date, thisLoop; + +setInterval(() => { + if (!debugshow) { return; } + + var thisFrameTime = (thisLoop=new Date) - lastLoop; + frameTime+= (thisFrameTime - frameTime) / filterStrength; + lastLoop = thisLoop; +}, 50) + +require('systeminformation').graphics().then((data) => { + global.gpudata = data; +}); + +setInterval(() => { + if (!debugshow) { return; } + + tps = (1000/frameTime).toFixed(1); + + if (typeof ping === "number") { + cping = ping; + } else { + cping = 0; + } + + if (started) { + changedDataLeft = "playing: %true%"; + changedDataLeft += "\n\n0$: XY: " + document.getElementById('car0').style.left.split("px")[0] + " / " + document.getElementById('car0').style.top.split("px")[0] + + c0rotate = document.getElementById('car0').style.transform.split("rotate(")[1].split("deg)")[0]; + if (c0rotate === "90") { + changedDataLeft += "\n0$: Facing: south (Towards negative Y)"; + } else if (c0rotate === "-90") { + changedDataLeft += "\n0$: Facing: north (Towards negative Y)"; + } else if (c0rotate === "0") { + changedDataLeft += "\n0$: Facing: east (Towards positive X)"; + } else if (c0rotate === "180") { + changedDataLeft += "\n0$: Facing: west (Towards negative X)"; + } + + changedDataLeft += "\n0$: Speed: A: " + car0cspeed.toFixed(2) + " R: " + (car0speed - car0cspeed).toFixed(2) + " M: " + car0speed.toFixed(2); + + changedDataLeft += "\n0$: Laps: " + document.getElementById('laps-car0').innerText + "/5"; + changedDataLeft += "\n0$: Model: " + selectedModel0; + changedDataLeft += "\n0$: Collision: " + (car0collisionon ? "%true%" : "%false%"); + + changedDataLeft += "\n\n1$: XY: " + document.getElementById('car1').style.left.split("px")[0] + " / " + document.getElementById('car1').style.top.split("px")[0] + + c0rotate = document.getElementById('car1').style.transform.split("rotate(")[1].split("deg)")[0]; + if (c0rotate === "90") { + changedDataLeft += "\n1$: Facing: south (Towards negative Y)"; + } else if (c0rotate === "-90") { + changedDataLeft += "\n1$: Facing: north (Towards negative Y)"; + } else if (c0rotate === "0") { + changedDataLeft += "\n1$: Facing: east (Towards positive X)"; + } else if (c0rotate === "180") { + changedDataLeft += "\n1$: Facing: west (Towards negative X)"; + } + + changedDataLeft += "\n1$: Speed: A: " + car1cspeed.toFixed(2) + " R: " + (car1speed - car1cspeed).toFixed(2) + " M: " + car1speed.toFixed(2); + + changedDataLeft += "\n1$: Laps: " + document.getElementById('laps-car1').innerText + "/5"; + changedDataLeft += "\n1$: Model: " + selectedModel1; + changedDataLeft += "\n1$: Collision: " + (car1collisionon ? "%true%" : "%false%"); + changedDataLeft += "\n" + oil(0) + oil(1) + oil(2) + oil(3) + oil(4); + changedDataLeft += "\n\nMusic: " + i; + changedDataLeft += "\nCircuit: " + rand; + + } else { + changedDataLeft = "playing: %false%" + } + + usedMem = (process.memoryUsage().heapUsed / 1000000).toFixed(2); + totalMem = (process.memoryUsage().heapTotal / 1000000).toFixed(2); + percMem = Math.round((process.memoryUsage().heapUsed / process.memoryUsage().heapTotal)*100); + allocateMem = (process.memoryUsage().rss / 1000000).toFixed(2); + + changedDataRight = "Mem: " + percMem + "% " + usedMem + "/" + totalMem + "MB" + changedDataRight += "\nAllocated: " + allocateMem + "MB" + changedDataRight += "\n\nCPU: (" + process.getCPUUsage().percentCPUUsage.toFixed(2) + "%) " + require('os').cpus().length + "x " + require('os').cpus()[0].model.trim() + " @ " + (require('os').cpus()[0].speed/1000).toFixed(2) + "GHz" + + try { + changedDataRight += "\n\nDisplay: " + window.innerWidth + "x" + window.innerHeight + " (" + gpudata.controllers[0].vendor + ")"; + changedDataRight += "\n" + gpudata.controllers[0].model; + + try { + if (gpudriverdata.gpuDevice[0].driverVendor !== undefined) { + dvendor = gpudriverdata.gpuDevice[0].driverVendor; + } else { + dvendor = "<Unknown>"; + } + if (gpudriverdata.gpuDevice[0].driverVersion !== undefined) { + dversion = gpudriverdata.gpuDevice[0].driverVersion; + } else { + dversion = "<Unknown>"; + } + } catch (e) { + dvendor = "<Unknown>"; + dversion = "<Unknown>"; + } + changedDataRight += "\n" + dvendor + " - " + dversion; + } catch (e) { + console.error(e); + } +},100); + +window.addEventListener("load", () => { + require('@electron/remote').app.getGPUInfo('complete').then((data) => { + global.gpudriverdata = data; + }); }) \ No newline at end of file diff --git a/views/script/global_compatlayer.js b/views/script/global_compatlayer.js index 7431cea..9ef86ed 100644 --- a/views/script/global_compatlayer.js +++ b/views/script/global_compatlayer.js @@ -1,89 +1,89 @@ -window.addEventListener("load", () => { - if (require('os').platform !== "darwin") { - gpuinfo = require('@electron/remote').app.getGPUFeatureStatus(); - gpuscore = 0; - maxscore = 10; - if (gpuinfo['2d_canvas'].startsWith("enabled")) { - if (gpuinfo['2d_canvas'] === "enabled") { - gpuscore++; - } else { - gpuscore += 0.5; - } - } - if (gpuinfo['gpu_compositing'].startsWith("enabled")) { - if (gpuinfo['gpu_compositing'] === "enabled") { - gpuscore++; - } else { - gpuscore += 0.5; - } - } - if (gpuinfo['video_decode'].startsWith("enabled")) { - if (gpuinfo['video_decode'] === "enabled") { - gpuscore++; - } else { - gpuscore += 0.5; - } - } - if (gpuinfo['multiple_raster_threads'].startsWith("enabled")) { - if (gpuinfo['multiple_raster_threads'] === "enabled") { - gpuscore++; - } else { - gpuscore += 0.5; - } - } - if (gpuinfo['oop_rasterization'].startsWith("enabled")) { - if (gpuinfo['oop_rasterization'] === "enabled") { - gpuscore++; - } else { - gpuscore += 0.5; - } - } - if (gpuinfo['rasterization'].startsWith("enabled")) { - if (gpuinfo['rasterization'] === "enabled") { - gpuscore++; - } else { - gpuscore += 0.5; - } - } - if (gpuinfo['opengl'].startsWith("enabled")) { - if (gpuinfo['opengl'] === "enabled") { - gpuscore++; - } else { - gpuscore += 0.5; - } - } - if (gpuinfo['skia_renderer'].startsWith("enabled")) { - if (gpuinfo['skia_renderer'] === "enabled") { - gpuscore++; - } else { - gpuscore += 0.5; - } - } - if (gpuinfo['vulkan'].startsWith("enabled")) { - if (gpuinfo['vulkan'] === "enabled") { - gpuscore++; - } else { - gpuscore += 0.5; - } - } - if (gpuinfo['webgl'].startsWith("enabled")) { - if (gpuinfo['webgl'] === "enabled") { - gpuscore++; - } else { - gpuscore += 0.5; - } - } - - gpuperct = (gpuscore / maxscore) * 100; - - if (gpuperct < 30) { - console.warn("Bad GPU support, disabling GPU-accelerated content"); - var head = document.getElementsByTagName('HEAD')[0]; - var link = document.createElement('link'); - link.rel = 'stylesheet'; - link.type = 'text/css'; - link.href = './common/compatibilityMode.css'; - head.appendChild(link); - } - } -}) +window.addEventListener("load", () => { + if (require('os').platform !== "darwin") { + gpuinfo = require('@electron/remote').app.getGPUFeatureStatus(); + gpuscore = 0; + maxscore = 10; + if (gpuinfo['2d_canvas'].startsWith("enabled")) { + if (gpuinfo['2d_canvas'] === "enabled") { + gpuscore++; + } else { + gpuscore += 0.5; + } + } + if (gpuinfo['gpu_compositing'].startsWith("enabled")) { + if (gpuinfo['gpu_compositing'] === "enabled") { + gpuscore++; + } else { + gpuscore += 0.5; + } + } + if (gpuinfo['video_decode'].startsWith("enabled")) { + if (gpuinfo['video_decode'] === "enabled") { + gpuscore++; + } else { + gpuscore += 0.5; + } + } + if (gpuinfo['multiple_raster_threads'].startsWith("enabled")) { + if (gpuinfo['multiple_raster_threads'] === "enabled") { + gpuscore++; + } else { + gpuscore += 0.5; + } + } + if (gpuinfo['oop_rasterization'].startsWith("enabled")) { + if (gpuinfo['oop_rasterization'] === "enabled") { + gpuscore++; + } else { + gpuscore += 0.5; + } + } + if (gpuinfo['rasterization'].startsWith("enabled")) { + if (gpuinfo['rasterization'] === "enabled") { + gpuscore++; + } else { + gpuscore += 0.5; + } + } + if (gpuinfo['opengl'].startsWith("enabled")) { + if (gpuinfo['opengl'] === "enabled") { + gpuscore++; + } else { + gpuscore += 0.5; + } + } + if (gpuinfo['skia_renderer'].startsWith("enabled")) { + if (gpuinfo['skia_renderer'] === "enabled") { + gpuscore++; + } else { + gpuscore += 0.5; + } + } + if (gpuinfo['vulkan'].startsWith("enabled")) { + if (gpuinfo['vulkan'] === "enabled") { + gpuscore++; + } else { + gpuscore += 0.5; + } + } + if (gpuinfo['webgl'].startsWith("enabled")) { + if (gpuinfo['webgl'] === "enabled") { + gpuscore++; + } else { + gpuscore += 0.5; + } + } + + gpuperct = (gpuscore / maxscore) * 100; + + if (gpuperct < 30) { + console.warn("Bad GPU support, disabling GPU-accelerated content"); + var head = document.getElementsByTagName('HEAD')[0]; + var link = document.createElement('link'); + link.rel = 'stylesheet'; + link.type = 'text/css'; + link.href = './common/compatibilityMode.css'; + head.appendChild(link); + } + } +}) diff --git a/views/script/global_levelsapi.js b/views/script/global_levelsapi.js index ebd969d..45a74d2 100644 --- a/views/script/global_levelsapi.js +++ b/views/script/global_levelsapi.js @@ -1,47 +1,47 @@ -module.exports = class LevelsAPI { - - associates; - - constructor() { - - let assocs_raw; - let assocs_lines; - let assocs_base; - let assocs; - let score; - let cline; - let line; - let clvl; - - assocs_raw = require('fs').readFileSync("./online/levels.txt"); - assocs_lines = assocs_raw.toString().split("\n"); - assocs_base = {}; - - for (line of assocs_lines) { - cline = line.split(":"); - assocs_base[cline[1].trim()] = cline[0].trim() - 1 + 1; - } - - assocs = {}; - - clvl = 0; - for (let c = 0; c <= 5051; c++) { - if (assocs_base[c.toString()] !== undefined) { - clvl = assocs_base[c.toString()]; - } - assocs[c.toString()] = clvl.toString() - } - - this.associates = assocs; - - } - - correspond(score, god) { - if (score <= 5051) { - return this.associates[score].toString(); - } else { - return god; - } - } - +module.exports = class LevelsAPI { + + associates; + + constructor() { + + let assocs_raw; + let assocs_lines; + let assocs_base; + let assocs; + let score; + let cline; + let line; + let clvl; + + assocs_raw = require('fs').readFileSync("./online/levels.txt"); + assocs_lines = assocs_raw.toString().split("\n"); + assocs_base = {}; + + for (line of assocs_lines) { + cline = line.split(":"); + assocs_base[cline[1].trim()] = cline[0].trim() - 1 + 1; + } + + assocs = {}; + + clvl = 0; + for (let c = 0; c <= 5051; c++) { + if (assocs_base[c.toString()] !== undefined) { + clvl = assocs_base[c.toString()]; + } + assocs[c.toString()] = clvl.toString() + } + + this.associates = assocs; + + } + + correspond(score, god) { + if (score <= 5051) { + return this.associates[score].toString(); + } else { + return god; + } + } + } \ No newline at end of file diff --git a/views/script/loader_global.js b/views/script/loader_global.js index 7543268..3a35d54 100644 --- a/views/script/loader_global.js +++ b/views/script/loader_global.js @@ -1,127 +1,127 @@ -window.addEventListener('load', () => { - setTimeout(() => { - if (native) { - setTimeout(() => { - setTimeout(() => { - - $("#progress").fadeOut(500); - setTimeout(() => { - window.fetch("https://kartik.hopto.org/latest.php?v=" + require('@electron/remote').getCurrentWindow().update).then((data) => { - data.blob().then((a) => { - a.text().then((b) => { - if (require('@electron/remote').getCurrentWindow().update === "git") { - document.getElementById('updates').style.backgroundColor = "lightsalmon"; - document.getElementById('updates').innerText = lang.updates.git; - } else { - console.log(b); - console.log(require('../package.json').version); - if (b === require('../package.json').version) { - document.getElementById('updates').style.backgroundColor = "lightgreen"; - document.getElementById('updates').innerText = lang.updates.ok; - } else { - require('@electron/remote').getCurrentWindow().webContents.send("notification", {title: lang.updates.warn[0], message: lang.updates.warn[1]}); - document.getElementById('updates').style.backgroundColor = "lightyellow"; - document.getElementById('updates').innerText = lang.updates.available; - } - } - setTimeout(() => { - $("#banner-outer").fadeOut(200); - $("#intro-video").fadeIn(200); - setTimeout(() => { - introsfx = document.getElementById("intro-video"); - introsfx.play() - introsfx.onended = () => { - $("body").fadeOut(500); - setTimeout(() => { - info("LoadWindow", "Switching control to MenuWindow"); - location.href = "intro.html"; - }, 1000) - } - }, 200) - }, 2000) - }).catch((e) => { - console.warn(e); - document.getElementById('updates').style.backgroundColor = "lightcoral"; - document.getElementById('updates').innerText = lang.updates.error; - require('@electron/remote').getCurrentWindow().webContents.send("notification", {title: lang.polymer.updateError[0], message: lang.polymer.updateError[1]}); - setTimeout(() => { - $("#banner-outer").fadeOut(200); - $("#intro-video").fadeIn(200); - setTimeout(() => { - introsfx = document.getElementById("intro-video"); - introsfx.play() - introsfx.onended = () => { - $("body").fadeOut(500); - setTimeout(() => { - info("LoadWindow", "Switching control to MenuWindow"); - location.href = "intro.html"; - }, 1000) - } - }, 200) - }, 2000) - }); - }).catch((e) => { - console.warn(e); - document.getElementById('updates').style.backgroundColor = "lightcoral"; - document.getElementById('updates').innerText = lang.updates.error; - require('@electron/remote').getCurrentWindow().webContents.send("notification", {title: lang.polymer.updateError[0], message: lang.polymer.updateError[1]}); - setTimeout(() => { - $("#banner-outer").fadeOut(200); - $("#intro-video").fadeIn(200); - setTimeout(() => { - introsfx = document.getElementById("intro-video"); - introsfx.play() - introsfx.onended = () => { - $("body").fadeOut(500); - setTimeout(() => { - info("LoadWindow", "Switching control to MenuWindow"); - location.href = "intro.html"; - }, 1000) - } - }, 200) - }, 2000) - }); - }).catch((e) => { - console.warn(e); - document.getElementById('updates').style.backgroundColor = "lightcoral"; - document.getElementById('updates').innerText = lang.updates.error; - require('@electron/remote').getCurrentWindow().webContents.send("notification", {title: lang.polymer.updateError[0], message: lang.polymer.updateError[1]}); - setTimeout(() => { - $("#banner-outer").fadeOut(200); - $("#intro-video").fadeIn(200); - setTimeout(() => { - introsfx = document.getElementById("intro-video"); - introsfx.play() - introsfx.onended = () => { - $("body").fadeOut(500); - setTimeout(() => { - info("LoadWindow", "Switching control to MenuWindow"); - location.href = "intro.html"; - }, 1000) - } - }, 200) - }, 2000) - }); - }, 2000) - }, 3000) - }, 1000) - } else { - - setTimeout(() => { - $("#banner-outer").fadeOut(200); - $("#intro-video").fadeIn(200); - setTimeout(() => { - introsfx = document.getElementById("intro-video"); - introsfx.play() - introsfx.onended = () => { - $("body").fadeOut(500); - setTimeout(() => { - info("LoadWindow", "Switching control to MenuWindow"); - location.href = "intro.html"; - }, 1000) - } - }, 200) - }, 5000) - } - }, 2000) -}) +window.addEventListener('load', () => { + setTimeout(() => { + if (native) { + setTimeout(() => { + setTimeout(() => { + + $("#progress").fadeOut(500); + setTimeout(() => { + window.fetch("https://kartik.hopto.org/latest.php?v=" + require('@electron/remote').getCurrentWindow().update).then((data) => { + data.blob().then((a) => { + a.text().then((b) => { + if (require('@electron/remote').getCurrentWindow().update === "git") { + document.getElementById('updates').style.backgroundColor = "lightsalmon"; + document.getElementById('updates').innerText = lang.updates.git; + } else { + console.log(b); + console.log(require('../package.json').version); + if (b === require('../package.json').version) { + document.getElementById('updates').style.backgroundColor = "lightgreen"; + document.getElementById('updates').innerText = lang.updates.ok; + } else { + require('@electron/remote').getCurrentWindow().webContents.send("notification", {title: lang.updates.warn[0], message: lang.updates.warn[1]}); + document.getElementById('updates').style.backgroundColor = "lightyellow"; + document.getElementById('updates').innerText = lang.updates.available; + } + } + setTimeout(() => { + $("#banner-outer").fadeOut(200); + $("#intro-video").fadeIn(200); + setTimeout(() => { + introsfx = document.getElementById("intro-video"); + introsfx.play() + introsfx.onended = () => { + $("body").fadeOut(500); + setTimeout(() => { + info("LoadWindow", "Switching control to MenuWindow"); + location.href = "intro.html"; + }, 1000) + } + }, 200) + }, 2000) + }).catch((e) => { + console.warn(e); + document.getElementById('updates').style.backgroundColor = "lightcoral"; + document.getElementById('updates').innerText = lang.updates.error; + require('@electron/remote').getCurrentWindow().webContents.send("notification", {title: lang.polymer.updateError[0], message: lang.polymer.updateError[1]}); + setTimeout(() => { + $("#banner-outer").fadeOut(200); + $("#intro-video").fadeIn(200); + setTimeout(() => { + introsfx = document.getElementById("intro-video"); + introsfx.play() + introsfx.onended = () => { + $("body").fadeOut(500); + setTimeout(() => { + info("LoadWindow", "Switching control to MenuWindow"); + location.href = "intro.html"; + }, 1000) + } + }, 200) + }, 2000) + }); + }).catch((e) => { + console.warn(e); + document.getElementById('updates').style.backgroundColor = "lightcoral"; + document.getElementById('updates').innerText = lang.updates.error; + require('@electron/remote').getCurrentWindow().webContents.send("notification", {title: lang.polymer.updateError[0], message: lang.polymer.updateError[1]}); + setTimeout(() => { + $("#banner-outer").fadeOut(200); + $("#intro-video").fadeIn(200); + setTimeout(() => { + introsfx = document.getElementById("intro-video"); + introsfx.play() + introsfx.onended = () => { + $("body").fadeOut(500); + setTimeout(() => { + info("LoadWindow", "Switching control to MenuWindow"); + location.href = "intro.html"; + }, 1000) + } + }, 200) + }, 2000) + }); + }).catch((e) => { + console.warn(e); + document.getElementById('updates').style.backgroundColor = "lightcoral"; + document.getElementById('updates').innerText = lang.updates.error; + require('@electron/remote').getCurrentWindow().webContents.send("notification", {title: lang.polymer.updateError[0], message: lang.polymer.updateError[1]}); + setTimeout(() => { + $("#banner-outer").fadeOut(200); + $("#intro-video").fadeIn(200); + setTimeout(() => { + introsfx = document.getElementById("intro-video"); + introsfx.play() + introsfx.onended = () => { + $("body").fadeOut(500); + setTimeout(() => { + info("LoadWindow", "Switching control to MenuWindow"); + location.href = "intro.html"; + }, 1000) + } + }, 200) + }, 2000) + }); + }, 2000) + }, 3000) + }, 1000) + } else { + + setTimeout(() => { + $("#banner-outer").fadeOut(200); + $("#intro-video").fadeIn(200); + setTimeout(() => { + introsfx = document.getElementById("intro-video"); + introsfx.play() + introsfx.onended = () => { + $("body").fadeOut(500); + setTimeout(() => { + info("LoadWindow", "Switching control to MenuWindow"); + location.href = "intro.html"; + }, 1000) + } + }, 200) + }, 5000) + } + }, 2000) +}) diff --git a/views/script/menu_copyright.js b/views/script/menu_copyright.js index 2b38844..49ed8a5 100644 --- a/views/script/menu_copyright.js +++ b/views/script/menu_copyright.js @@ -1,5 +1,5 @@ -if (new Date().getFullYear() === 2021) { - document.write(new Date().getFullYear() + " Minteck"); -} else { - document.write("2021-" + new Date().getFullYear() + " Minteck"); +if (new Date().getFullYear() === 2021) { + document.write(new Date().getFullYear() + " Minteck"); +} else { + document.write("2021-" + new Date().getFullYear() + " Minteck"); } \ No newline at end of file diff --git a/views/script/menu_global.js b/views/script/menu_global.js index 14a924f..a16d3d1 100644 --- a/views/script/menu_global.js +++ b/views/script/menu_global.js @@ -1,127 +1,127 @@ -let menuOpen = true; - -if (native) {global.$ = require('jquery');} else {var script = document.createElement('script');script.src = '../webinit/jquery.js';script.type = 'text/javascript';document.getElementsByTagName('head')[0].appendChild(script);} -$("#box").fadeOut(0); -window.addEventListener('load', () => { - setTimeout(() => { - $("#box").fadeIn(500); - }, 1000) -}) - -$("body").focus(); -keysEnabled = true; -$(document).keydown(function(e) { - if (loggingIn) { return; } - - if (keysEnabled) { - if (e.ctrlKey && e.keyCode === 13) { // ctrl+enter - throw new RangeError("Manually initiated crash"); - } - if (e.keyCode === 13 || e.keyCode === 88 || e.keyCode === 32) { // enter - if ($(".services").is(":visible")) { - selectOption(); - } else { - $(".services").show(); - } - menuOpen = !menuOpen; - } - if (e.keyCode === 38 || e.keyCode === 90) { // up - Sound.menu(); - var selected = $(".selected"); - $(".services li").removeClass("selected"); - if (selected.prev().length === 0) { - selected.siblings().last().addClass("selected"); - } else { - selected.prev().addClass("selected"); - } - } - if (e.keyCode === 40 || e.keyCode === 83) { // down - Sound.menu(); - var selected = $(".selected"); - $(".services li").removeClass("selected"); - if (selected.next().length === 0) { - selected.siblings().first().addClass("selected"); - } else { - selected.next().addClass("selected"); - } - } - if (e.keyCode === 27 || e.keyCode === 8) { // esc - keysEnabled = false; - Sound.click(); - setTimeout(() => { - require('@electron/remote').getCurrentWindow().close(); - }, 250) - } - } -}); - -function selectOption() { - item = document.querySelector(".selected a").id; - Sound.click(); - - switch (item) { - case 'single': - scenar("start", "happy"); - keysEnabled = false; - require('electron').ipcRenderer.send('prefademusic', ""); - $("#box").fadeOut(500); - setTimeout(() => { - info("MenuWindow", "Switching control to GameWindow"); - location.href = "game.html?sp"; - }, 1000) - break; - case 'online': - keysEnabled = false; - require('electron').ipcRenderer.send('prefademusic', ""); - $("#box").fadeOut(500); - setTimeout(() => { - info("MenuWindow", "Switching control to GameWindow"); - location.href = "game.html?online"; - }, 1000) - break; - case 'play': - keysEnabled = false; - require('electron').ipcRenderer.send('prefademusic', ""); - $("#box").fadeOut(500); - setTimeout(() => { - info("MenuWindow", "Switching control to GameWindow"); - location.href = "game.html"; - }, 1000) - break; - case 'settings': - keysEnabled = false; - $("#box").fadeOut(500); - setTimeout(() => { - info("MenuWindow", "Switching control to OptnWindow"); - location.href = "settings.html"; - }, 1000) - break; - case 'stats': - keysEnabled = false; - require('electron').ipcRenderer.send('prefademusic', ""); - $("#box").fadeOut(500); - setTimeout(() => { - info("MenuWindow", "Switching control to OptnWindow"); - location.href = "stats.html"; - }, 1000) - break; - case 'credits': - keysEnabled = false; - require('electron').ipcRenderer.send('prefademusic', ""); - $("#box").fadeOut(500); - setTimeout(() => { - info("MenuWindow", "Switching control to OptnWindow"); - location.href = "credits.html"; - }, 1000) - break; - case 'quit': - keysEnabled = false; - require('electron').ipcRenderer.send('prefademusic', ""); - info("MenuWindow", "Quitting game"); - Sound.click(); - setTimeout(() => { - require('@electron/remote').getCurrentWindow().close(); - }, 250) - break; - } +let menuOpen = true; + +if (native) {global.$ = require('jquery');} else {var script = document.createElement('script');script.src = '../webinit/jquery.js';script.type = 'text/javascript';document.getElementsByTagName('head')[0].appendChild(script);} +$("#box").fadeOut(0); +window.addEventListener('load', () => { + setTimeout(() => { + $("#box").fadeIn(500); + }, 1000) +}) + +$("body").focus(); +keysEnabled = true; +$(document).keydown(function(e) { + if (loggingIn) { return; } + + if (keysEnabled) { + if (e.ctrlKey && e.keyCode === 13) { // ctrl+enter + throw new RangeError("Manually initiated crash"); + } + if (e.keyCode === 13 || e.keyCode === 88 || e.keyCode === 32) { // enter + if ($(".services").is(":visible")) { + selectOption(); + } else { + $(".services").show(); + } + menuOpen = !menuOpen; + } + if (e.keyCode === 38 || e.keyCode === 90) { // up + Sound.menu(); + var selected = $(".selected"); + $(".services li").removeClass("selected"); + if (selected.prev().length === 0) { + selected.siblings().last().addClass("selected"); + } else { + selected.prev().addClass("selected"); + } + } + if (e.keyCode === 40 || e.keyCode === 83) { // down + Sound.menu(); + var selected = $(".selected"); + $(".services li").removeClass("selected"); + if (selected.next().length === 0) { + selected.siblings().first().addClass("selected"); + } else { + selected.next().addClass("selected"); + } + } + if (e.keyCode === 27 || e.keyCode === 8) { // esc + keysEnabled = false; + Sound.click(); + setTimeout(() => { + require('@electron/remote').getCurrentWindow().close(); + }, 250) + } + } +}); + +function selectOption() { + item = document.querySelector(".selected a").id; + Sound.click(); + + switch (item) { + case 'single': + scenar("start", "happy"); + keysEnabled = false; + require('electron').ipcRenderer.send('prefademusic', ""); + $("#box").fadeOut(500); + setTimeout(() => { + info("MenuWindow", "Switching control to GameWindow"); + location.href = "game.html?sp"; + }, 1000) + break; + case 'online': + keysEnabled = false; + require('electron').ipcRenderer.send('prefademusic', ""); + $("#box").fadeOut(500); + setTimeout(() => { + info("MenuWindow", "Switching control to GameWindow"); + location.href = "game.html?online"; + }, 1000) + break; + case 'play': + keysEnabled = false; + require('electron').ipcRenderer.send('prefademusic', ""); + $("#box").fadeOut(500); + setTimeout(() => { + info("MenuWindow", "Switching control to GameWindow"); + location.href = "game.html"; + }, 1000) + break; + case 'settings': + keysEnabled = false; + $("#box").fadeOut(500); + setTimeout(() => { + info("MenuWindow", "Switching control to OptnWindow"); + location.href = "settings.html"; + }, 1000) + break; + case 'stats': + keysEnabled = false; + require('electron').ipcRenderer.send('prefademusic', ""); + $("#box").fadeOut(500); + setTimeout(() => { + info("MenuWindow", "Switching control to OptnWindow"); + location.href = "stats.html"; + }, 1000) + break; + case 'credits': + keysEnabled = false; + require('electron').ipcRenderer.send('prefademusic', ""); + $("#box").fadeOut(500); + setTimeout(() => { + info("MenuWindow", "Switching control to OptnWindow"); + location.href = "credits.html"; + }, 1000) + break; + case 'quit': + keysEnabled = false; + require('electron').ipcRenderer.send('prefademusic', ""); + info("MenuWindow", "Quitting game"); + Sound.click(); + setTimeout(() => { + require('@electron/remote').getCurrentWindow().close(); + }, 250) + break; + } } \ No newline at end of file diff --git a/views/script/menu_login.js b/views/script/menu_login.js index 2af88b2..f2d7c7e 100644 --- a/views/script/menu_login.js +++ b/views/script/menu_login.js @@ -1,209 +1,242 @@ -global.loggingIn = false; -homedir = require('@electron/remote').getCurrentWindow().homedir; - -function startLogin() { - loggingIn = true; - - document.getElementById('loggingIn').style.display = "flex"; - var http = require('http'); - - reqid = 0; - - var server = http.createServer(function (req, res) { - - const queryObject = require('querystring').parse(req.url,true); - token = queryObject[Object.keys(queryObject)[0]]; - res.end(lang.polymer.loginClose); - reqid++; - - if (reqid === 1) { - document.getElementById("loggingIn").innerText = lang.polymer.gatheringLogin - require('@electron/remote').getCurrentWindow().focus(); - server.close(); - - playerData = { - "picture": null, - "name": null, - "level": -1, - "token": token - }; - - playerData.picture = $.ajax({ - type: "GET", - url: 'https://kartik.hopto.org/online/ingame/api/profile.picture.php?kartik_online_token=' + token, - async: false, - error: (e) => { throw e; } - }).responseText.trim(); - - playerData.name = $.ajax({ - type: "GET", - url: 'https://kartik.hopto.org/online/ingame/api/profile.name.php?kartik_online_token=' + token, - async: false, - error: (e) => { throw e; } - }).responseText.trim(); - - playerData.level = $.ajax({ - type: "GET", - url: 'https://kartik.hopto.org/online/ingame/api/profile.level.php?kartik_online_token=' + token, - async: false, - error: (e) => { throw e; } - }).responseText.trim() - 1 + 1; - - if (playerData.level >= 0 && playerData.name !== null && playerData.picture !== null) { - console.log(playerData); - loggingIn = false; - document.getElementById('loggingIn').style.display = "none"; - currentNest.auth = playerData; - Nest.export(homedir + "/.kartik/current.kfn", currentNest);require('electron').ipcRenderer.send("reloadNest") - keysEnabled = false; - require('electron').ipcRenderer.send('prefademusic', ""); - $("#box").fadeOut(500); - setTimeout(() => { - location.href = "menu.html"; - }, 1000) - } else { - throw new Error("Incomplete information received"); - } - } - - }); - - server.listen(14552); - - console.log('Waiting for login requests on port 14552') - require('open')("https://kartik.hopto.org/online/ingame"); -} - -window.addEventListener('load', () => { - onlineMode = false; - - window.fetch("https://kartik.hopto.org/latest.php?v=" + require('@electron/remote').getCurrentWindow().update).then((data) => { - data.blob().then((a) => { - a.text().then((b) => { - onlineMode = true; - postOnlineMode(); - }).catch((e) => { - require('@electron/remote').getCurrentWindow().webContents.send("notification", {title: lang.polymer.error[0], message: lang.polymer.error[1]}); - console.error(e); - onlineMode = false; - postOnlineMode(); - document.getElementById("loginIntro").innerText = lang.polymer.error[2]; - document.getElementById("online").parentElement.parentElement.outerHTML = ""; - }) - }).catch((e) => { - require('@electron/remote').getCurrentWindow().webContents.send("notification", {title: lang.polymer.error[0], message: lang.polymer.error[1]}); - console.error(e); - onlineMode = false; - postOnlineMode(); - document.getElementById("loginIntro").innerText = lang.polymer.error[2]; - document.getElementById("online").parentElement.parentElement.outerHTML = ""; - }) - }).catch((e) => { - require('@electron/remote').getCurrentWindow().webContents.send("notification", {title: lang.polymer.error[0], message: lang.polymer.error[1]}); - console.error(e); - onlineMode = false; - postOnlineMode(); - document.getElementById("loginIntro").innerText = lang.polymer.error[2]; - document.getElementById("online").parentElement.parentElement.outerHTML = ""; - }) -}) - -function postOnlineMode() { - try { - if (currentNest.auth === null || !onlineMode) { - $(document).keydown(function(e) { - if (e.keyCode === 76 && !loggingIn && onlineMode) { - startLogin(); - } - }) - } else { - authData = currentNest.auth; - - document.getElementById('loginIntro').style.display = "none"; - document.getElementById('loginUser').style.display = "grid"; - - olevel = $.ajax({ - type: "GET", - url: 'https://kartik.hopto.org/online/ingame/api/profile.level.php?kartik_online_token=' + authData.token, - async: false, - error: (e) => { throw e; } - }).responseText.trim() - 1 + 1; - - if (authData.level > olevel) { - $.ajax({ - type: "GET", - url: 'https://kartik.hopto.org/online/ingame/api/set.level.php?kartik_online_token=' + authData.token + "&level=" + authData.level, - async: false, - error: (e) => { throw e; } - }); - } else if (authData.level < olevel) { - authData.level = $.ajax({ - type: "GET", - url: 'https://kartik.hopto.org/online/ingame/api/profile.level.php?kartik_online_token=' + authData.token, - async: false, - error: (e) => { throw e; } - }).responseText.trim() - 1 + 1; - currentNest.auth = authData; - Nest.export(homedir + "/.kartik/current.kfn", currentNest);require('electron').ipcRenderer.send("reloadNest") - } - - ostats = JSON.parse($.ajax({ - type: "GET", - url: 'https://kartik.hopto.org/online/ingame/api/profile.stats.php?kartik_online_token=' + authData.token, - async: false, - error: (e) => { throw e; } - }).responseText.trim()) - - if (ostats === null) { - cstats = currentNest.stats; - } else { - cstats = {}; - - for (group in currentNest.stats) { - cstats[group] = {}; - - for (item in currentNest.stats[group]) { - if (ostats[group][item]) { - if (ostats[group][item] > currentNest.stats[group][item]) { - cstats[group][item] = ostats[group][item]; - } else { - cstats[group][item] = currentNest.stats[group][item]; - } - } else { - cstats[group][item] = currentNest.stats[group][item]; - } - } - } - } - - $.ajax({ - type: "GET", - url: 'https://kartik.hopto.org/online/ingame/api/set.stats.php?kartik_online_token=' + authData.token + "&stats=" + Buffer.from(JSON.stringify(cstats)).toString("base64"), - async: false, - error: (e) => { throw e; } - }); - - currentNest.stats = JSON.parse($.ajax({ - type: "GET", - url: 'https://kartik.hopto.org/online/ingame/api/profile.stats.php?kartik_online_token=' + authData.token, - async: false, - error: (e) => { throw e; } - }).responseText.trim()); - Nest.export(homedir + "/.kartik/current.kfn", currentNest);require('electron').ipcRenderer.send("reloadNest") - - document.getElementById('kto-picture').src = authData.picture; - document.getElementById('kto-username').innerText = authData.name; - if (authData.level < 200) { - document.getElementById('kto-level').innerText = authData.level; - } else { - document.getElementById('kto-level').innerText = lang.polymer.ktoMaxLevel; - } - } - } catch (e) { - require('@electron/remote').getCurrentWindow().webContents.send("notification", {title: lang.polymer.error[0], message: lang.polymer.error[1]}); - console.error(e); - onlineMode = false; - document.getElementById("loginIntro").innerText = lang.polymer.error[2]; - document.getElementById("online").parentElement.parentElement.outerHTML = ""; - } +global.loggingIn = false; +homedir = require('@electron/remote').getCurrentWindow().homedir; + +function startLogin() { + loggingIn = true; + + document.getElementById('loggingIn').style.display = "flex"; + var http = require('http'); + + reqid = 0; + + var server = http.createServer(function (req, res) { + + const queryObject = require('querystring').parse(req.url,true); + token = queryObject[Object.keys(queryObject)[0]]; + res.end(lang.polymer.loginClose); + reqid++; + + if (reqid === 1) { + document.getElementById("loggingIn").innerText = lang.polymer.gatheringLogin + require('@electron/remote').getCurrentWindow().focus(); + server.close(); + + playerData = { + "picture": null, + "name": null, + "level": -1, + "token": token + }; + + playerData.picture = $.ajax({ + type: "GET", + url: 'https://kartik.hopto.org/online/ingame/api/profile.picture.php?kartik_online_token=' + token, + async: false, + error: (e) => { throw e; } + }).responseText.trim(); + + playerData.name = $.ajax({ + type: "GET", + url: 'https://kartik.hopto.org/online/ingame/api/profile.name.php?kartik_online_token=' + token, + async: false, + error: (e) => { throw e; } + }).responseText.trim(); + + playerData.level = $.ajax({ + type: "GET", + url: 'https://kartik.hopto.org/online/ingame/api/profile.level.php?kartik_online_token=' + token, + async: false, + error: (e) => { throw e; } + }).responseText.trim() - 1 + 1; + + if (playerData.level >= 0 && playerData.name !== null && playerData.picture !== null) { + console.log(playerData); + loggingIn = false; + document.getElementById('loggingIn').style.display = "none"; + currentNest.auth = playerData; + Nest.export(homedir + "/.kartik/current.kfn", currentNest);require('electron').ipcRenderer.send("reloadNest") + keysEnabled = false; + require('electron').ipcRenderer.send('prefademusic', ""); + $("#box").fadeOut(500); + setTimeout(() => { + location.href = "menu.html"; + }, 1000) + } else { + throw new Error("Incomplete information received"); + } + } + + }); + + server.listen(14552); + + console.log('Waiting for login requests on port 14552') + require('open')("https://kartik.hopto.org/online/ingame"); +} + +window.addEventListener('load', () => { + onlineMode = false; + + window.fetch("https://kartik.hopto.org/latest.php?v=" + require('@electron/remote').getCurrentWindow().update).then((data) => { + data.blob().then((a) => { + a.text().then((b) => { + onlineMode = true; + postOnlineMode(); + }).catch((e) => { + require('@electron/remote').getCurrentWindow().webContents.send("notification", {title: lang.polymer.error[0], message: lang.polymer.error[1]}); + console.error(e); + onlineMode = false; + postOnlineMode(); + document.getElementById("loginIntro").innerText = lang.polymer.error[2]; + document.getElementById("online").parentElement.parentElement.outerHTML = ""; + }) + }).catch((e) => { + require('@electron/remote').getCurrentWindow().webContents.send("notification", {title: lang.polymer.error[0], message: lang.polymer.error[1]}); + console.error(e); + onlineMode = false; + postOnlineMode(); + document.getElementById("loginIntro").innerText = lang.polymer.error[2]; + document.getElementById("online").parentElement.parentElement.outerHTML = ""; + }) + }).catch((e) => { + require('@electron/remote').getCurrentWindow().webContents.send("notification", {title: lang.polymer.error[0], message: lang.polymer.error[1]}); + console.error(e); + onlineMode = false; + postOnlineMode(); + document.getElementById("loginIntro").innerText = lang.polymer.error[2]; + document.getElementById("online").parentElement.parentElement.outerHTML = ""; + }) +}) + +function logout() { + $.ajax({ + type: "GET", + url: 'https://kartik.hopto.org/online/ingame/api/profile.logout.php?kartik_online_token=' + currentNest.auth.token, + async: false, + error: (e) => { throw e; } + }).responseText.trim(); + currentNest.auth = null; + Nest.export(homedir + "/.kartik/current.kfn", currentNest);require('electron').ipcRenderer.send("reloadNest") +} + +function postOnlineMode() { + try { + if (currentNest.auth !== null) { + console.log(currentNest.auth); + tokenvalidity = $.ajax({ + type: "GET", + url: 'https://kartik.hopto.org/online/ingame/api/profile.token.php?kartik_online_token=' + currentNest.auth.token, + async: false, + error: (e) => { throw e; } + }).responseText.trim(); + + if (tokenvalidity !== "true") { + require('@electron/remote').getCurrentWindow().webContents.send("notification", {title: lang.polymer.token[0], message: lang.polymer.token[1]}); + logout(); + } + } + + if (currentNest.auth === null || !onlineMode) { + $(document).keydown(function(e) { + if (e.keyCode === 76 && !loggingIn && onlineMode) { + startLogin(); + } + }) + } else { + $(document).keydown(function(e) { + if (e.keyCode === 76 && !loggingIn && onlineMode) { + logout(); + location.reload(); + } + }) + + authData = currentNest.auth; + + document.getElementById('loginIntro').style.display = "none"; + document.getElementById('loginUser').style.display = "grid"; + + olevel = $.ajax({ + type: "GET", + url: 'https://kartik.hopto.org/online/ingame/api/profile.level.php?kartik_online_token=' + authData.token, + async: false, + error: (e) => { throw e; } + }).responseText.trim() - 1 + 1; + + if (authData.level > olevel) { + $.ajax({ + type: "GET", + url: 'https://kartik.hopto.org/online/ingame/api/set.level.php?kartik_online_token=' + authData.token + "&level=" + authData.level, + async: false, + error: (e) => { throw e; } + }); + } else if (authData.level < olevel) { + authData.level = $.ajax({ + type: "GET", + url: 'https://kartik.hopto.org/online/ingame/api/profile.level.php?kartik_online_token=' + authData.token, + async: false, + error: (e) => { throw e; } + }).responseText.trim() - 1 + 1; + currentNest.auth = authData; + Nest.export(homedir + "/.kartik/current.kfn", currentNest);require('electron').ipcRenderer.send("reloadNest") + } + + ostats = JSON.parse($.ajax({ + type: "GET", + url: 'https://kartik.hopto.org/online/ingame/api/profile.stats.php?kartik_online_token=' + authData.token, + async: false, + error: (e) => { throw e; } + }).responseText.trim()) + + if (ostats === null) { + cstats = currentNest.stats; + } else { + cstats = {}; + + for (group in currentNest.stats) { + cstats[group] = {}; + + for (item in currentNest.stats[group]) { + if (ostats[group][item]) { + if (ostats[group][item] > currentNest.stats[group][item]) { + cstats[group][item] = ostats[group][item]; + } else { + cstats[group][item] = currentNest.stats[group][item]; + } + } else { + cstats[group][item] = currentNest.stats[group][item]; + } + } + } + } + + $.ajax({ + type: "GET", + url: 'https://kartik.hopto.org/online/ingame/api/set.stats.php?kartik_online_token=' + authData.token + "&stats=" + Buffer.from(JSON.stringify(cstats)).toString("base64"), + async: false, + error: (e) => { throw e; } + }); + + currentNest.stats = JSON.parse($.ajax({ + type: "GET", + url: 'https://kartik.hopto.org/online/ingame/api/profile.stats.php?kartik_online_token=' + authData.token, + async: false, + error: (e) => { throw e; } + }).responseText.trim()); + Nest.export(homedir + "/.kartik/current.kfn", currentNest);require('electron').ipcRenderer.send("reloadNest") + + document.getElementById('kto-picture').src = authData.picture; + document.getElementById('kto-username').innerText = authData.name; + if (authData.level < 200) { + document.getElementById('kto-level').innerText = authData.level; + } else { + document.getElementById('kto-level').innerText = lang.polymer.ktoMaxLevel; + } + } + } catch (e) { + require('@electron/remote').getCurrentWindow().webContents.send("notification", {title: lang.polymer.error[0], message: lang.polymer.error[1]}); + console.error(e); + onlineMode = false; + document.getElementById("loginIntro").innerText = lang.polymer.error[2]; + document.getElementById("online").parentElement.parentElement.outerHTML = ""; + } } \ No newline at end of file diff --git a/views/script/settings_global.js b/views/script/settings_global.js index 90f1f6e..047967a 100644 --- a/views/script/settings_global.js +++ b/views/script/settings_global.js @@ -1,127 +1,127 @@ -let menuOpen = true; - -if (native) {global.$ = require('jquery');} else {var script = document.createElement('script');script.src = '../webinit/jquery.js';script.type = 'text/javascript';document.getElementsByTagName('head')[0].appendChild(script);} -$("#box").fadeOut(0); -setTimeout(() => { - $("#box").fadeIn(500); -}, 200) - -$("body").focus(); -keysEnabled = true; -$(document).keydown(function(e) { - if (keysEnabled) { - if (e.keyCode === 13 || e.keyCode === 88 || e.keyCode === 32) { // enter - if ($(".services").is(":visible")) { - selectOption(); - } else { - $(".services").show(); - } - } - if (e.keyCode === 38 || e.keyCode === 90) { // up - Sound.menu(); - var selected = $(".selected"); - $(".services li").removeClass("selected"); - if (selected.prev().length === 0) { - selected.siblings().last().addClass("selected"); - } else { - selected.prev().addClass("selected"); - } - } - if (e.keyCode === 40 || e.keyCode === 83) { // down - Sound.menu(); - var selected = $(".selected"); - $(".services li").removeClass("selected"); - if (selected.next().length === 0) { - selected.siblings().first().addClass("selected"); - } else { - selected.next().addClass("selected"); - } - } - if (e.keyCode === 68 || e.keyCode === 39 || e.keyCode === 81 || e.keyCode === 37) { // right/left - Sound.menu(); - var selected = $(".selected"); - var id = $(".selected")[0].children[0].children[0].id; - - if (id === "musicb") { - if (document.getElementById("setting-music").innerText === "1") { - document.getElementById("setting-music").innerText = "0"; - currentNest.config.music = false; - Nest.export(homedir + "/.kartik/current.kfn", currentNest);require('electron').ipcRenderer.send("reloadNest") - } else { - document.getElementById("setting-music").innerText = "1"; - currentNest.config.music = true; - Nest.export(homedir + "/.kartik/current.kfn", currentNest);require('electron').ipcRenderer.send("reloadNest") - } - } - if (id === "voice") { - if (document.getElementById("setting-voice").innerText === "1") { - document.getElementById("setting-voice").innerText = "0"; - currentNest.config.music = false; - Nest.export(homedir + "/.kartik/current.kfn", currentNest);require('electron').ipcRenderer.send("reloadNest") - } else { - document.getElementById("setting-voice").innerText = "1"; - currentNest.config.music = true; - Nest.export(homedir + "/.kartik/current.kfn", currentNest);require('electron').ipcRenderer.send("reloadNest") - } - } - if (id === "lang") { - lang = document.getElementById("setting-lang").innerText; - slng = require('../lang/languages.json'); - slst = Object.keys(slng); - maxl = slst.length - 1; - - ci = -1; - ni = -1; - slst.forEach((key, index) => { - if (slng[key] === lang) { - ci = index; - if (index + 1 > maxl) { - ni = 0; - } else { - ni = index + 1; - } - } - }) - - if (ci !== -1 && ni !== -1) { - document.getElementById("setting-lang").innerText = slng[slst[ni]]; - currentNest.config.lang = slst[ni]; - Nest.export(homedir + "/.kartik/current.kfn", currentNest);require('electron').ipcRenderer.send("reloadNest") - require('@electron/remote').getCurrentWindow().lp = slst[ni]; - } - } - } - if (e.keyCode === 27 || e.keyCode === 8) { // esc - keysEnabled = false; - Sound.click(); - $("#box").fadeOut(500); - setTimeout(() => { - info("OptnWindow", "Switching control to MenuWindow"); - location.href = "menu.html"; - }, 1000) - } - } -}); - -function selectOption() { - item = document.querySelector(".selected a").id; - Sound.click(); - - switch (item) { - case 'back': - $("#box").fadeOut(500); - setTimeout(() => { - info("OptnWindow", "Switching control to MenuWindow"); - location.href = "menu.html?noreset"; - }, 1000) - break; - case 'credits': - require('electron').ipcRenderer.send('prefademusic', ""); - $("#box").fadeOut(500); - setTimeout(() => { - info("OptnWindow", "Switching control to MenuWindow"); - location.href = "credits.html"; - }, 1000) - break; - } -} +let menuOpen = true; + +if (native) {global.$ = require('jquery');} else {var script = document.createElement('script');script.src = '../webinit/jquery.js';script.type = 'text/javascript';document.getElementsByTagName('head')[0].appendChild(script);} +$("#box").fadeOut(0); +setTimeout(() => { + $("#box").fadeIn(500); +}, 200) + +$("body").focus(); +keysEnabled = true; +$(document).keydown(function(e) { + if (keysEnabled) { + if (e.keyCode === 13 || e.keyCode === 88 || e.keyCode === 32) { // enter + if ($(".services").is(":visible")) { + selectOption(); + } else { + $(".services").show(); + } + } + if (e.keyCode === 38 || e.keyCode === 90) { // up + Sound.menu(); + var selected = $(".selected"); + $(".services li").removeClass("selected"); + if (selected.prev().length === 0) { + selected.siblings().last().addClass("selected"); + } else { + selected.prev().addClass("selected"); + } + } + if (e.keyCode === 40 || e.keyCode === 83) { // down + Sound.menu(); + var selected = $(".selected"); + $(".services li").removeClass("selected"); + if (selected.next().length === 0) { + selected.siblings().first().addClass("selected"); + } else { + selected.next().addClass("selected"); + } + } + if (e.keyCode === 68 || e.keyCode === 39 || e.keyCode === 81 || e.keyCode === 37) { // right/left + Sound.menu(); + var selected = $(".selected"); + var id = $(".selected")[0].children[0].children[0].id; + + if (id === "musicb") { + if (document.getElementById("setting-music").innerText === "1") { + document.getElementById("setting-music").innerText = "0"; + currentNest.config.music = false; + Nest.export(homedir + "/.kartik/current.kfn", currentNest);require('electron').ipcRenderer.send("reloadNest") + } else { + document.getElementById("setting-music").innerText = "1"; + currentNest.config.music = true; + Nest.export(homedir + "/.kartik/current.kfn", currentNest);require('electron').ipcRenderer.send("reloadNest") + } + } + if (id === "voice") { + if (document.getElementById("setting-voice").innerText === "1") { + document.getElementById("setting-voice").innerText = "0"; + currentNest.config.music = false; + Nest.export(homedir + "/.kartik/current.kfn", currentNest);require('electron').ipcRenderer.send("reloadNest") + } else { + document.getElementById("setting-voice").innerText = "1"; + currentNest.config.music = true; + Nest.export(homedir + "/.kartik/current.kfn", currentNest);require('electron').ipcRenderer.send("reloadNest") + } + } + if (id === "lang") { + lang = document.getElementById("setting-lang").innerText; + slng = require('../lang/languages.json'); + slst = Object.keys(slng); + maxl = slst.length - 1; + + ci = -1; + ni = -1; + slst.forEach((key, index) => { + if (slng[key] === lang) { + ci = index; + if (index + 1 > maxl) { + ni = 0; + } else { + ni = index + 1; + } + } + }) + + if (ci !== -1 && ni !== -1) { + document.getElementById("setting-lang").innerText = slng[slst[ni]]; + currentNest.config.lang = slst[ni]; + Nest.export(homedir + "/.kartik/current.kfn", currentNest);require('electron').ipcRenderer.send("reloadNest") + require('@electron/remote').getCurrentWindow().lp = slst[ni]; + } + } + } + if (e.keyCode === 27 || e.keyCode === 8) { // esc + keysEnabled = false; + Sound.click(); + $("#box").fadeOut(500); + setTimeout(() => { + info("OptnWindow", "Switching control to MenuWindow"); + location.href = "menu.html"; + }, 1000) + } + } +}); + +function selectOption() { + item = document.querySelector(".selected a").id; + Sound.click(); + + switch (item) { + case 'back': + $("#box").fadeOut(500); + setTimeout(() => { + info("OptnWindow", "Switching control to MenuWindow"); + location.href = "menu.html?noreset"; + }, 1000) + break; + case 'credits': + require('electron').ipcRenderer.send('prefademusic', ""); + $("#box").fadeOut(500); + setTimeout(() => { + info("OptnWindow", "Switching control to MenuWindow"); + location.href = "credits.html"; + }, 1000) + break; + } +} diff --git a/views/script/settings_load.js b/views/script/settings_load.js index b15b125..e2bad80 100644 --- a/views/script/settings_load.js +++ b/views/script/settings_load.js @@ -1,25 +1,25 @@ -info("OptnWindow", "Restoring settings..."); - -if (require('@electron/remote').getCurrentWindow().music) { - if (location.search === "?credits") { - require('electron').ipcRenderer.send('newmusic', kresources.music['title'].file); - } - document.getElementById("setting-music").innerText = "1"; -} else { - document.getElementById("setting-music").innerText = "0"; -} - -if (currentNest.config.voice === true) { - document.getElementById("setting-voice").innerText = "1"; -} else { - document.getElementById("setting-voice").innerText = "0"; -} - -slang = require('@electron/remote').getCurrentWindow().lp; -langs = require('../lang/languages.json'); - -if (Object.keys(langs).includes(slang)) { - document.getElementById("setting-lang").innerText = langs[slang]; -} else { - document.getElementById("setting-lang").innerText = slang; -} +info("OptnWindow", "Restoring settings..."); + +if (require('@electron/remote').getCurrentWindow().music) { + if (location.search === "?credits") { + require('electron').ipcRenderer.send('newmusic', kresources.music['title'].file); + } + document.getElementById("setting-music").innerText = "1"; +} else { + document.getElementById("setting-music").innerText = "0"; +} + +if (currentNest.config.voice === true) { + document.getElementById("setting-voice").innerText = "1"; +} else { + document.getElementById("setting-voice").innerText = "0"; +} + +slang = require('@electron/remote').getCurrentWindow().lp; +langs = require('../lang/languages.json'); + +if (Object.keys(langs).includes(slang)) { + document.getElementById("setting-lang").innerText = langs[slang]; +} else { + document.getElementById("setting-lang").innerText = slang; +} diff --git a/views/settings.html b/views/settings.html index 0addaf3..9fa0b5a 100644 --- a/views/settings.html +++ b/views/settings.html @@ -1,70 +1,70 @@ - - - - - - - - - - - Kartik - - - - - - - - - - - - - - - - + + + + + + + + + + + Kartik + + + + + + + + + + + + + + + + diff --git a/views/stats.html b/views/stats.html index 3b23571..c80004d 100644 --- a/views/stats.html +++ b/views/stats.html @@ -1,70 +1,70 @@ - - - - - - - - Kartik - - - - - - - - - - - - - - - - - - + + + + + + + + Kartik + + + + + + + + + + + + + + + + + + diff --git a/views/win.html b/views/win.html index c9892e7..f09f598 100644 --- a/views/win.html +++ b/views/win.html @@ -1,44 +1,44 @@ - - - - - - - - Kartik - - - - - - - - - - - - - - - - - - + + + + + + + + Kartik + + + + + + + + + + + + + + + + + + -- cgit