File tree Expand file tree Collapse file tree 3 files changed +25
-6
lines changed
Expand file tree Collapse file tree 3 files changed +25
-6
lines changed Original file line number Diff line number Diff line change @@ -179,12 +179,7 @@ img {
179179 display : block;
180180 padding : 0 6px ;
181181}
182- .nav-link a svg {
183- height : 20px ;
184- margin : -3px auto;
185- stroke-width : 2 ;
186- width : 20px ;
187- }
182+ .nav-link a svg ,
188183.nav-item a svg {
189184 height : 20px ;
190185 margin : -3px auto;
Original file line number Diff line number Diff line change @@ -38,6 +38,24 @@ function ready() {
3838 // Do the injection
3939 SVGInjector ( svgsToInject ) ;
4040
41+ const observer = new MutationObserver ( ( ) => {
42+ normalizeSvgPaths ( ) ;
43+ } ) ;
44+
45+ observer . observe ( document . body , { childList : true , subtree : true } ) ;
46+
47+ function normalizeSvgPaths ( ) {
48+ document . querySelectorAll ( 'a .svg-inject path' ) . forEach ( path => {
49+ const bbox = path . getBBox ( ) ;
50+ const scaleX = 20 / bbox . width ;
51+ const scaleY = 20 / bbox . height ;
52+ const scale = Math . min ( scaleX , scaleY ) ;
53+
54+ path . setAttribute ( 'transform' , `scale(${ scale } ) translate(${ - bbox . x } , ${ - bbox . y } )` ) ;
55+ path . setAttribute ( 'fill' , 'currentColor' ) ;
56+ } ) ;
57+ }
58+
4159 document . getElementById ( 'hamburger-menu-toggle' ) . addEventListener ( 'click' , ( ) => {
4260 const hamburgerMenu = document . getElementsByClassName ( 'nav-hamburger-list' ) [ 0 ]
4361 const hamburgerMenuToggleTarget = document . getElementById ( "hamburger-menu-toggle-target" )
Original file line number Diff line number Diff line change @@ -92,6 +92,12 @@ title = "Gokarna"
9292 url = " /index.xml"
9393 weight = 7
9494
95+ [[menu .main ]]
96+ identifier = " bluesky"
97+ pre = " <img class='svg-inject' src='https://upload.wikimedia.org/wikipedia/commons/7/7a/Bluesky_Logo.svg' />"
98+ url = " /index.xml"
99+ weight = 8
100+
95101[markup ]
96102 [markup .tableOfContents ]
97103 startLevel = 1
You can’t perform that action at this time.
0 commit comments