Skip to content

Commit

Permalink
Fix external links
Browse files Browse the repository at this point in the history
  • Loading branch information
ahzf committed Apr 16, 2024
1 parent c6d124e commit 2aadc97
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
<div id="openSourceLibs">

<div class="lib">
<div class="name">Chargy WebApp<span id="chargyVersion"></span></div>
<div class="name">Chargy WebApp <span id="chargyVersion"></span></div>
<div class="license"><button class="linkButton" href="https://github.com/OpenChargingCloud/ChargyWebApp/blob/master/LICENSE">Copyright &copy; 2018-2024 GraphDefined GmbH<br />AGPL v3 License</button></div>
</div>
<div class="lib">
Expand Down Expand Up @@ -220,7 +220,7 @@
<a href="https://www.thueringen.de/th6/tmwwdg/')">Thuringian Ministry for Economic Affairs, Science and Digital Society</a>-->
<div id="logos">
<a id="TMWWDG" href="https://www.thueringen.de/th6/tmwwdg/"><img src="images/TMWWDG.svg" alt="Thüringer Ministerium für Wirtschaft, Wissenschaft und Digitale Gesellschaft"></a>
<a id="ITnet" href="https://www.itnet.de" ><img src="images/ITnet_Thueringen_small.png" alt="ITnet Thüringen e.V."></a>
<a id="ITnet" href="https://www.itnet-th.de" ><img src="images/ITnet_Thueringen_small.png" alt="ITnet Thüringen e.V."></a>
</div>
</div>

Expand Down
11 changes: 6 additions & 5 deletions src/ts/chargyApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -506,21 +506,22 @@ export class ChargyApp {

//#region Modify external links to be opened in the external web browser

//const shell = require('electron').shell;
const linkButtons = document.getElementsByClassName('linkButton') as HTMLCollectionOf<HTMLButtonElement>;

for (let i = 0; i < linkButtons.length; i++) {

const linkButton = linkButtons[i];

if (linkButton != null)
if (linkButton)
{
linkButton.onclick = function (this: GlobalEventHandlers, ev: MouseEvent) {

ev.preventDefault();
const link = linkButton.getAttribute("href");
if (link && (link.startsWith("http://") || link.startsWith("https://"))) {
//shell.openExternal(link);
}

if (link && (link.startsWith("http://") || link.startsWith("https://")))
window.open(link, '_blank');

}
}

Expand Down

0 comments on commit 2aadc97

Please sign in to comment.