Skip to content

Commit

Permalink
Release Candidate v0.14.0-beta3 (#91)
Browse files Browse the repository at this point in the history
- Add Team and Event URL links to the card if available from sensor
- Enable URLs to be overwritten in card configuration
- Display more-info on double-click in center area of card

Requires teamtracker v0.14.0-beta or higher.
  • Loading branch information
vasqued2 authored Jul 5, 2024
1 parent 6dc977b commit 11b0456
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 9 deletions.
16 changes: 13 additions & 3 deletions dist/render_in.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export function renderIn(c) {
.left-clickable { text-decoration: none; color: inherit; }
.right-clickable { text-decoration: none; color: inherit; }
.bottom-clickable { text-decoration: none; color: inherit; }
.disabled { pointer-events: none; cursor: default; }
</style>
<ha-card>
<div class="card">
Expand All @@ -63,7 +64,7 @@ export function renderIn(c) {
<img class="opponent-bg" src="${c.logoBG[2]}" />
<div class="card-content">
<div class="team">
<a class="left-clickable" href="${c.url[1]}" target="_blank"; >
<a class="left-clickable ${!c.url[1] ? 'disabled' : ''}" href="${c.url[1] ? c.url[1] : '#'}" target="_blank">
<img class="logo" src="${c.logo[1]}" onerror="this.onerror=null; this.src='${c.logoError[1]}';" />
<div class="circle">${c.initials[1]}</div>
<div class="name"><span class="rank">${c.rank[1]}</span> ${c.name[1]}</div>
Expand All @@ -81,7 +82,7 @@ export function renderIn(c) {
<div class="score">${c.score[2]}</div>
<div class="possession2">&bull;</div>
<div class="team">
<a class="right-clickable" href="${c.url[2]}" target="_blank"; >
<a class="right-clickable ${!c.url[2] ? 'disabled' : ''}" href="${c.url[2] ? c.url[2] : '#'}" target="_blank">
<img class="logo" src="${c.logo[2]}" onerror="this.onerror=null; this.src='${c.logoError[2]}';" />
<div class="circle">${c.initials[2]}</div>
<div class="name"><span class="rank">${c.rank[2]}</span> ${c.name[2]}</div>
Expand All @@ -106,7 +107,7 @@ export function renderIn(c) {
<div class="outs">${c.in0}</div>
<div class="in-series-info">${c.seriesSummary}</div>
<div class="line1"></div>
<a class="bottom-clickable" href="${c.bottomURL}" target="_blank";>
<a class="bottom-clickable ${!c.bottomURL ? 'disabled' : ''}" href="${c.bottomURL ? c.bottomURL : '#'}" target="_blank">
<div class="in-row1">
<div class="venue">${c.venue}</div>
<div class="down-distance">${c.in1}</div>
Expand All @@ -133,6 +134,15 @@ export function renderIn(c) {
</a>
</div>
</ha-card>
<script>
document.addEventListener('DOMContentLoaded', function() {
document.querySelectorAll('a.disabled').forEach(function(link) {
link.addEventListener('click', function(event) {
event.preventDefault();
});
});
});
</script>
`; // Return the HTML template
return htmlTemplate;
}
16 changes: 13 additions & 3 deletions dist/render_post.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export function renderPost(c) {
.left-clickable { text-decoration: none; color: inherit; }
.right-clickable { text-decoration: none; color: inherit; }
.bottom-clickable { text-decoration: none; color: inherit; }
.disabled { pointer-events: none; cursor: default; }
</style>
<ha-card>
<div class="card">
Expand All @@ -34,7 +35,7 @@ export function renderPost(c) {
<img class="opponent-bg" src="${c.logoBG[2]}" />
<div class="card-content">
<div class="team">
<a class="left-clickable" href="${c.url[1]}" target="_blank"; >
<a class="left-clickable ${!c.url[1] ? 'disabled' : ''}" href="${c.url[1] ? c.url[1] : '#'}" target="_blank">
<img class="logo" src="${c.logo[1]}" onerror="this.onerror=null; this.src='${c.logoError[1]}';" />
<div class="circle">${c.initials[1]}</div>
<div class="name"><span class="rank">${c.rank[1]}</span> ${c.name[1]}</div>
Expand All @@ -45,20 +46,29 @@ export function renderPost(c) {
<div class="divider">&nbsp&nbsp&nbsp</div>
<div class="score score2op">${c.score[2]}</div>
<div class="team">
<a class="right-clickable" href="${c.url[2]}" target="_blank"; >
<a class="right-clickable ${!c.url[2] ? 'disabled' : ''}" href="${c.url[2] ? c.url[2] : '#'}" target="_blank">
<img class="logo" src="${c.logo[2]}" onerror="this.onerror=null; this.src='${c.logoError[2]}';" />
<div class="circle">${c.initials[2]}</div>
<div class="name"><span class="rank">${c.rank[2]}</span> ${c.name[2]}</div>
<div class="record">${c.record[2]}</div>
</a>
</div>
</div>
<a class="bottom-clickable" href="${c.bottomURL}" target="_blank";>
<a class="bottom-clickable ${!c.bottomURL ? 'disabled' : ''}" href="${c.bottomURL ? c.bottomURL : '#'}" target="_blank">
<div class="post-row1">${c.finalTerm}</div>
<div class="post-series-info">${c.seriesSummary}</div>
</a>
</div>
</ha-card>
<script>
document.addEventListener('DOMContentLoaded', function() {
document.querySelectorAll('a.disabled').forEach(function(link) {
link.addEventListener('click', function(event) {
event.preventDefault();
});
});
});
</script>
`; // Return the HTML template
return htmlTemplate;
}
16 changes: 13 additions & 3 deletions dist/render_pre.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export function renderPre(c) {
.left-clickable { text-decoration: none; color: inherit; }
.right-clickable { text-decoration: none; color: inherit; }
.bottom-clickable { text-decoration: none; color: inherit; }
.disabled { pointer-events: none; cursor: default; }
</style>
<ha-card>
<div class="card">
Expand All @@ -35,7 +36,7 @@ export function renderPre(c) {
<img class="opponent-bg" src="${c.logoBG[2]}" />
<div class="card-content">
<div class="team">
<a class="left-clickable" href="${c.url[1]}" target="_blank"; >
<a class="left-clickable ${!c.url[1] ? 'disabled' : ''}" href="${c.url[1] ? c.url[1] : '#'}" target="_blank">
<img class="logo" src="${c.logo[1]}" onerror="this.onerror=null; this.src='${c.logoError[1]}';" />
<div class="circle">${c.initials[1]}</div>
<div class="name"><span class="rank">${c.rank[1]}</span> ${c.name[1]}</div>
Expand All @@ -48,7 +49,7 @@ export function renderPre(c) {
<div class="gametime">${c.gameTime}</div>
</div>
<div class="team">
<a class="right-clickable" href="${c.url[2]}" target="_blank"; >
<a class="right-clickable ${!c.url[2] ? 'disabled' : ''}" href="${c.url[2] ? c.url[2] : '#'}" target="_blank">
<img class="logo" src="${c.logo[2]}" onerror="this.onerror=null; this.src='${c.logoError[2]}';" />
<div class="circle">${c.initials[2]}</div>
<div class="name"><span class="rank">${c.rank[2]}</span> ${c.name[2]}</div>
Expand All @@ -58,7 +59,7 @@ export function renderPre(c) {
</div>
<div class="pre-series-info">${c.seriesSummary}</div>
<div class="line"></div>
<a class="bottom-clickable" href="${c.bottomURL}" target="_blank";>
<a class="bottom-clickable ${!c.bottomURL ? 'disabled' : ''}" href="${c.bottomURL ? c.bottomURL : '#'}" target="_blank">
<div class="pre-row1">
<div class="date">${c.startTerm} ${c.startTime}</div>
<div class="odds">${c.pre1}</div>
Expand All @@ -74,6 +75,15 @@ export function renderPre(c) {
</a>
</div>
</ha-card>
<script>
document.addEventListener('DOMContentLoaded', function() {
document.querySelectorAll('a.disabled').forEach(function(link) {
link.addEventListener('click', function(event) {
event.preventDefault();
});
});
});
</script>
`; // Return the HTML template
return htmlTemplate;
}

0 comments on commit 11b0456

Please sign in to comment.