Skip to content

Commit bd28dd0

Browse files
committed
fix(menu): custom-logo links are broken for doc deployments with a path
fix #1203
1 parent 06dad8c commit bd28dd0

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/resources/js/menu.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,16 @@ document.addEventListener('DOMContentLoaded', function () {
7777
processMenuLinks(entityLinks);
7878
var indexLinks = document.querySelectorAll('[data-type="index-link"]');
7979
processMenuLinks(indexLinks, true);
80-
var entityLogos = document.querySelectorAll('[data-type="compodoc-logo"]');
81-
var processLogos = function (entityLogo) {
80+
var compodocLogos = document.querySelectorAll('[data-type="compodoc-logo"]');
81+
var customLogo = document.querySelectorAll('[data-type="custom-logo"]');
82+
var processLogos = function (entityLogos) {
8283
for (var i = 0; i < entityLogos.length; i++) {
8384
var entityLogo = entityLogos[i];
8485
if (entityLogo) {
8586
var url = entityLogo.getAttribute('data-src');
8687
// Dark mode + logo
8788
let isDarkMode = window.matchMedia('(prefers-color-scheme: dark)').matches;
88-
if (isDarkMode) {
89+
if (isDarkMode && url.indexOf('compodoc') !== -1) {
8990
url = 'images/compodoc-vectorise-inverted.png';
9091
}
9192
if (url.charAt(0) !== '.') {
@@ -115,7 +116,8 @@ document.addEventListener('DOMContentLoaded', function () {
115116
}
116117
}
117118
};
118-
processLogos(entityLogos);
119+
processLogos(compodocLogos);
120+
processLogos(customLogo);
119121

120122
setTimeout(function () {
121123
document.getElementById('btn-menu').addEventListener('click', function () {

src/templates/partials/menu.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ customElements.define('compodoc-menu', class extends HTMLElement {
1717
<li class="title">
1818
{{#if customLogo}}
1919
<a href="index.html" data-type="index-link">
20-
<img alt="" class="img-responsive" data-type="custom-logo" src={{strip-url "/images/" customLogo}}>
20+
<img alt="" class="img-responsive" data-type="custom-logo" data-src="{{strip-url "images/" customLogo}}">
2121
</a>
2222
{{else}}
2323
<a href="index.html" data-type="index-link">{{documentationMainName}}</a>

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy