File tree Expand file tree Collapse file tree 6 files changed +28
-24
lines changed
Expand file tree Collapse file tree 6 files changed +28
-24
lines changed Original file line number Diff line number Diff line change 11/* Fix using if() only for blink */
2- body .blink h2 {
2+ body .blink # title {
33 width : if (
44 /* When viewport is smaller than 400px, apply the fix, else use the normal value */
55 /* Removes the menu button and margin widths a single time to account for longer text */
@@ -9,6 +9,6 @@ body.blink h2 {
99}
1010
1111/* Classic method for browser not supporting if */
12- body .gecko h2 , body .webkit h2 {
12+ body .gecko # title , body .webkit # title {
1313 width : calc (100vw - var (--body-margin ) - var (--menu-icon-container-size ));
1414}
Original file line number Diff line number Diff line change 99 /* Values */
1010 --body-margin : 8px ;
1111 --transition-speed : 300ms ;
12- --defaukt -radius : 8 px ;
12+ --default -radius : 0 px ;
1313}
1414
1515body {
Original file line number Diff line number Diff line change @@ -38,6 +38,7 @@ header.collapsed {
3838 border : none;
3939 outline : solid 2px # F6A6FC ;
4040 transition : var (--transition-speed );
41+ border-radius : var (--default-radius );
4142}
4243
4344# navbar-menu-button .open {
@@ -79,9 +80,12 @@ header.collapsed {
7980}
8081
8182h2 {
82- width : calc (100vw - 2 * var (--body-margin ) - 2 * var (--menu-icon-container-size ));
83- text-align : center;
8483 font : normal 600 1.65em "Onest" ;
84+ text-align : center;
85+ }
86+
87+ # title {
88+ width : calc (100vw - 2 * var (--body-margin ) - 2 * var (--menu-icon-container-size ));
8589}
8690
8791# color-scheme-button {
96100 outline : solid 2px # F6A6FC ;
97101 transition : var (--transition-speed );
98102 position : relative;
103+ border-radius : var (--default-radius );
99104}
100105
101106# color-scheme-button ::before {
108113 height : var (--size );
109114 transition : var (--transition-speed );
110115 background : # F6A6FC75 ;
116+ border-radius : var (--default-radius );
111117}
112118
113119.color-scheme-icon {
Original file line number Diff line number Diff line change 1- function getEngine ( ) { // returns a string of the browser's engine bypassing its userAgent string
1+ const body = document . body ;
2+
3+ // Browser engine handler
4+ function getEngine ( ) { // returns a string of the browser's engine bypassing its userAgent string
25 const docStyle = document . documentElement . style ;
3- if ( window . navigator . userAgentData ) return 'Blink' ; // only present in Chromium
6+ if ( window . navigator . userAgentData ) return 'Blink' ; // only present in Chromium
47 if ( 'MozAppearance' in docStyle || window . netscape ) return 'Gecko' ;
5- if ( 'WebkitAppearance' in docStyle && ! window . chrome ) return 'WebKit' ; // Chromium engine would return true to Webkit test, thus adding not window.chrome
6- return 'Blink' ; // default to Chromium engine
8+ if ( 'WebkitAppearance' in docStyle && ! window . chrome ) return 'WebKit' ; // Chromium engine would return true to Webkit test, thus adding not window.chrome
9+ return 'Blink' ; // default to Chromium engine
710} ;
811
9- document . body . classList . add ( getEngine ( ) . toLowerCase ( ) ) ; // adds as a class the browser engine for easy specific fixes in CSS
12+
13+ body . classList . add ( getEngine ( ) . toLowerCase ( ) ) ; // adds as a class the browser engine for easy specific fixes in CSS
14+
15+ // Color scheme handler
16+ function toggleScheme ( ) { body . classList . toggle ( 'dark' ) ; } ;
17+ const colorSchemeQuery = window . matchMedia ( '(prefers-color-scheme: dark)' ) ;
18+
19+ if ( colorSchemeQuery . matches ) { toggleScheme ( ) ; } ; // Initial toggle
20+ colorSchemeQuery . addEventListener ( 'change' , toggleScheme ) ; // When browser preference changes
21+ document . getElementById ( "color-scheme-button" ) . addEventListener ( 'click' , ( ) => { toggleScheme ( ) ; } ) ; // Handles scheme button clicks
Original file line number Diff line number Diff line change @@ -132,13 +132,6 @@ <h2 id="portfolio">Portfolio</h2>
132132 onerror ="this.onerror=null; this.src='../../assets/images/icons/missing.svg'; this.classList.add('icon-missing') "
133133 alt ="">
134134 </ button >
135-
136- < script > // Toggles nav-lang and nav-links visibility from menu button
137- const schemeButton = document . getElementById ( 'color-scheme-button' ) ;
138- schemeButton . addEventListener ( 'click' , ( ) => {
139- document . body . classList . toggle ( 'dark' ) ;
140- } ) ;
141- </ script >
142135 </ footer >
143136
144137</ body >
Original file line number Diff line number Diff line change @@ -132,13 +132,6 @@ <h2 id="portfolio">Portfolio</h2>
132132 onerror ="this.onerror=null; this.src='../../assets/images/icons/missing.svg'; this.classList.add('icon-missing') "
133133 alt ="">
134134 </ button >
135-
136- < script > // Toggles nav-lang and nav-links visibility from menu button
137- const schemeButton = document . getElementById ( 'color-scheme-button' ) ;
138- schemeButton . addEventListener ( 'click' , ( ) => {
139- document . body . classList . toggle ( 'dark' ) ;
140- } ) ;
141- </ script >
142135 </ footer >
143136
144137</ body >
You can’t perform that action at this time.
0 commit comments