Skip to content

Commit

Permalink
Tidies up external links
Browse files Browse the repository at this point in the history
  • Loading branch information
stuartbreckenridge committed Sep 16, 2021
1 parent 699df18 commit 02b301e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Promenade.nnwtheme/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
<key>CreatorName</key>
<string>Stuart Breckenridge</string>
<key>Version</key>
<integer>9</integer>
<integer>10</integer>
</dict>
</plist>
6 changes: 6 additions & 0 deletions Promenade.nnwtheme/stylesheet.css
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ body {
padding-bottom: 1em;
}

.svg-inline--fa {
height: 1em;
width: 1em;
vertical-align: middle;
}

a {
text-decoration: none;
font-weight: bold;
Expand Down
15 changes: 12 additions & 3 deletions Promenade.nnwtheme/template.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,19 @@ <h1>[[title]]</h1>
</div>
</article>
<script type="text/javascript">
/*
The arrow-circle-right SVG is provided by Font Awesome under the Creative Commons Attribution 4.0 International License.
For more details view the license here: https://fontawesome.com/license
*/
let externalLinkElement = document.body.getElementsByClassName('externalLink')[0].querySelectorAll('span a')[0];
if (externalLinkElement) {
let host = externalLinkElement.hostname;
externalLinkElement.innerHTML = host;
let edit = document.body.getElementsByClassName('externalLink')[0].querySelectorAll('span')[0];
if (edit) {
edit.innerHTML = edit.innerHTML.replace('Link: ', '');
let aLink = edit.querySelectorAll('a')[0];
if (aLink) {
let host = aLink.hostname;
aLink.innerHTML = host + " " + '<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="arrow-circle-right" class="svg-inline--fa fa-arrow-circle-right fa-w-16" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M256 8c137 0 248 111 248 248S393 504 256 504 8 393 8 256 119 8 256 8zm-28.9 143.6l75.5 72.4H120c-13.3 0-24 10.7-24 24v16c0 13.3 10.7 24 24 24h182.6l-75.5 72.4c-9.7 9.3-9.9 24.8-.4 34.3l11 10.9c9.4 9.4 24.6 9.4 33.9 0L404.3 273c9.4-9.4 9.4-24.6 0-33.9L271.6 106.3c-9.4-9.4-24.6-9.4-33.9 0l-11 10.9c-9.5 9.6-9.3 25.1.4 34.4z"></path></svg>';
}
}
</script>

0 comments on commit 02b301e

Please sign in to comment.