File tree Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Original file line number Diff line number Diff line change 1+ import { siMastodon , siLinkedin , siGithub } from 'simple-icons' ;
2+
3+ const ICONS = {
4+ mastodon : siMastodon ,
5+ linkedin : siLinkedin ,
6+ github : siGithub ,
7+ } ;
8+
9+ async function applyBrandsIcons ( ) {
10+ const elements = document . querySelectorAll ( '[data-simple-icon]' ) ;
11+
12+ elements . forEach ( element => {
13+ const attribute = element . getAttribute ( 'data-simple-icon' ) . toLowerCase ( ) ;
14+ const icon = ICONS [ attribute ] ;
15+
16+ if ( icon ) {
17+ const svgDoc = new DOMParser ( ) . parseFromString ( icon . svg , 'image/svg+xml' ) ;
18+ const svgElement = svgDoc . querySelector ( 'svg' ) ;
19+ const existingClasses = element . getAttribute ( 'class' ) ;
20+
21+ if ( existingClasses ) {
22+ svgElement . setAttribute ( 'class' , existingClasses ) ;
23+ }
24+ svgElement . setAttribute ( 'fill' , 'var(--svgfill)' ) ;
25+ element . replaceWith ( svgElement ) ;
26+ }
27+ } ) ;
28+ }
29+
30+ document . addEventListener ( 'DOMContentLoaded' , applyBrandsIcons ) ;
Original file line number Diff line number Diff line change 7676{{ $languageSwitcherJs := resources.Get "js/languageSwitcher.js" | js.Build }}
7777< script src ="{{ $languageSwitcherJs.RelPermalink }} "> </ script >
7878
79+ {{ $brandsJs := resources.Get "js/brands.js" | js.Build }}
80+ < script src ="{{ $brandsJs.RelPermalink }} "> </ script >
81+
7982{{ $headerJs := resources.Get "js/header.js" | js.Build }}
8083< script src ="{{ $headerJs.RelPermalink }} "> </ script >
8184
You can’t perform that action at this time.
0 commit comments