Update sponsor card styling

This commit is contained in:
Carlos Polop
2026-07-04 20:53:44 +02:00
parent 339eaf5aba
commit 58413bbe99
3 changed files with 576 additions and 104 deletions
+43 -14
View File
@@ -33,6 +33,9 @@
<!-- Fonts -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Chakra+Petch:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;700&display=swap">
{{#if copy_fonts}}
<link rel="stylesheet" href="{{ path_to_root }}fonts/fonts.css">
{{/if}}
@@ -330,15 +333,35 @@
<div class="topsponsor-bsa" aria-hidden="true">
<div id="bsa-zone_1773736844679-9_123456"></div>
</div>
<a class="topsponsor ht-sponsor-card ht-sponsor-card--horizontal" href="" target="_blank" rel="noopener noreferrer">
<span class="ht-sponsor-grid" aria-hidden="true"></span>
<span class="ht-sponsor-scan" aria-hidden="true"></span>
<span class="ht-sponsor-corners" aria-hidden="true"></span>
<span class="ht-sponsor-kicker">Sponsored</span>
<span class="ht-sponsor-media">
<img src="" alt="" srcset="">
</span>
<span class="ht-sponsor-copy">
<span class="topsponsor-title ht-sponsor-title"></span>
<span class="topsponsor-description ht-sponsor-description"></span>
</span>
<span class="topsponsor-cta ht-sponsor-cta"></span>
</a>
{{{ content }}}
<div class="bottomsponsor-wrapper">
<a class="bottomsponsor" href="" target="_blank" rel="noopener noreferrer">
<img src="" alt="" srcset="">
<div class="bottomsponsor-title">
</div>
<div class="bottomsponsor-description">
</div>
<div class="bottomsponsor-cta"></div>
<a class="bottomsponsor ht-sponsor-card ht-sponsor-card--horizontal" href="" target="_blank" rel="noopener noreferrer">
<span class="ht-sponsor-grid" aria-hidden="true"></span>
<span class="ht-sponsor-scan" aria-hidden="true"></span>
<span class="ht-sponsor-corners" aria-hidden="true"></span>
<span class="ht-sponsor-kicker">Sponsored</span>
<span class="ht-sponsor-media">
<img src="" alt="" srcset="">
</span>
<span class="ht-sponsor-copy">
<span class="bottomsponsor-title ht-sponsor-title"></span>
<span class="bottomsponsor-description ht-sponsor-description"></span>
</span>
<span class="bottomsponsor-cta ht-sponsor-cta"></span>
</a>
<div class="bottomsponsor-bsa" aria-hidden="true">
<div id="bsa-zone_1773736987437-6_123456"></div>
@@ -393,13 +416,19 @@
</button>
<div id="sidetoc-wrapper" class="sidetoc-wrapper">
<nav class="pagetoc"></nav>
<a class="sidesponsor" href="" target="_blank" rel="noopener noreferrer">
<img src="" alt="" srcset="">
<div class="sponsor-title">
</div>
<div class="sponsor-description">
</div>
<div class="sponsor-cta"></div>
<a class="sidesponsor ht-sponsor-card ht-sponsor-card--vertical" href="" target="_blank" rel="noopener noreferrer">
<span class="ht-sponsor-grid" aria-hidden="true"></span>
<span class="ht-sponsor-scan" aria-hidden="true"></span>
<span class="ht-sponsor-corners" aria-hidden="true"></span>
<span class="ht-sponsor-kicker">Sponsored</span>
<span class="ht-sponsor-media">
<img src="" alt="" srcset="">
</span>
<span class="ht-sponsor-copy">
<span class="sponsor-title ht-sponsor-title"></span>
<span class="sponsor-description ht-sponsor-description"></span>
</span>
<span class="sponsor-cta ht-sponsor-cta"></span>
</a>
<div class="sidesponsor-bsa" aria-hidden="true">
<div id="bsa-zone_1773737041447-5_123456"></div>
+480 -85
View File
@@ -39,9 +39,6 @@
transition-timing-function: cubic-bezier(.4,0,.2,1);
transition-duration: .3s;
}
/* .bottomsponsor:hover img{
width: 30%;
} */
.bottomsponsor .bottomsponsor-title{
margin-top: 5px;
margin-bottom: 5px;
@@ -62,9 +59,6 @@
transition-timing-function: cubic-bezier(.4,0,.2,1);
transition-duration: .3s;
}
/* .bottomsponsor:hover .bottomsponsor-description{
display:block;
} */
.bottomsponsor .bottomsponsor-cta{
margin-top: auto;
margin-bottom: 10px;
@@ -150,27 +144,6 @@
padding .36s cubic-bezier(.22,1,.36,1),
transform .36s cubic-bezier(.22,1,.36,1);
}
.sidesponsor:hover img{
width: 56px;
padding: 4px;
grid-area: sponsor-image;
align-self: center;
justify-self: center;
}
.sidesponsor:hover {
display: grid !important;
grid-template-columns: minmax(0, 1fr);
grid-template-rows: max-content max-content minmax(0, 1fr) auto;
grid-template-areas:
"sponsor-image"
"sponsor-title"
"sponsor-description"
"sponsor-cta";
row-gap: 3px;
align-items: center;
align-content: start;
overflow: hidden;
}
.sidesponsor .sponsor-title{
margin-top: 3px;
margin-bottom: 3px;
@@ -188,18 +161,6 @@
.sidesponsor .sponsor-title.sponsor-title--long {
line-height: 1.02;
}
.sidesponsor:hover .sponsor-title{
grid-area: sponsor-title;
margin-left: 8px;
margin-right: 8px;
margin-top: 0;
margin-bottom: 0;
font-size: 1.45rem;
line-height: 1.1;
overflow-wrap: anywhere;
align-self: center;
justify-self: center;
}
.sidesponsor .sponsor-description{
display: block;
margin-top: 0;
@@ -218,25 +179,6 @@
transform .44s cubic-bezier(.22,1,.36,1),
visibility 0s linear .44s;
}
.sidesponsor:hover .sponsor-description{
grid-area: sponsor-description;
align-self: start;
min-height: 0;
max-height: 100%;
margin-top: 3px;
margin-bottom: 0;
font-size: calc(1em - 1px);
opacity: 1;
visibility: visible;
transform: translateY(0);
overflow: auto;
overscroll-behavior: contain;
transition:
max-height .44s cubic-bezier(.22,1,.36,1),
opacity .36s ease .08s,
transform .44s cubic-bezier(.22,1,.36,1),
visibility 0s linear 0s;
}
.sidesponsor .sponsor-cta{
margin-top: auto;
margin-bottom: 10px;
@@ -249,33 +191,6 @@
color: var(--bg);
font-weight: 800;
}
.sidesponsor:hover .sponsor-cta{
grid-area: sponsor-cta;
margin-top: 4px;
margin-bottom: 2px;
padding: 11px 18px;
box-sizing: border-box;
max-width: 100%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-size: 1.3rem;
font-weight: 800;
line-height: 1.1;
visibility: hidden;
opacity: 0;
animation: sponsorTextReveal .28s ease .12s forwards;
}
@keyframes sponsorTextReveal {
0% {
opacity: 0;
visibility: hidden;
}
100% {
opacity: 1;
visibility: visible;
}
}
.sidesponsor-bsa {
max-height: 52%;
height: 52%;
@@ -515,3 +430,483 @@
min-height: 250px;
}
}
@keyframes sc-spin {
to {
transform: rotate(360deg);
}
}
@keyframes sc-scan {
0% {
transform: translateY(-100%);
}
100% {
transform: translateY(440px);
}
}
@keyframes sc-blink {
0%, 100% {
opacity: 1;
}
50% {
opacity: 0.25;
}
}
@keyframes sc-arrow {
0%, 100% {
transform: translateX(0);
}
50% {
transform: translateX(4px);
}
}
@keyframes sc-glitch {
0%, 92%, 100% {
clip-path: inset(0 0 0 0);
transform: translate(0);
}
93% {
clip-path: inset(20% 0 40% 0);
transform: translate(-2px, 0);
}
95% {
clip-path: inset(60% 0 5% 0);
transform: translate(2px, 0);
}
97% {
clip-path: inset(10% 0 70% 0);
transform: translate(-1px, 0);
}
}
.ht-sponsor-card,
.ht-sponsor-card * {
box-sizing: border-box;
}
.ht-sponsor-card {
--sponsor-accent: #2f7dff;
--sponsor-accent-2: #ff3b4e;
--sponsor-accent-light: #89c7ff;
--sponsor-rx: 0deg;
--sponsor-ry: 0deg;
--sponsor-lift: 0px;
--sponsor-scale: 1;
position: relative !important;
display: none;
isolation: isolate;
overflow: hidden !important;
border: 0 !important;
border-radius: 14px !important;
padding: 16px !important;
color: #eef4ff !important;
text-decoration: none !important;
cursor: pointer;
font-family: "Chakra Petch", sans-serif;
background: transparent !important;
box-shadow: 0 14px 32px -16px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(120, 150, 255, 0.08) !important;
transform: perspective(900px) rotateX(var(--sponsor-rx)) rotateY(var(--sponsor-ry)) translateY(var(--sponsor-lift)) scale(var(--sponsor-scale)) !important;
transform-style: preserve-3d;
transition: transform 0.18s cubic-bezier(.2, .7, .3, 1) !important;
animation: none !important;
}
.ht-sponsor-card--loaded {
display: grid !important;
}
.ht-sponsor-card::before {
content: "";
position: absolute;
inset: 1px;
z-index: -2;
border-radius: 13px;
background: linear-gradient(162deg, #0a1016, #0c0910);
}
.ht-sponsor-grid {
position: absolute;
inset: -1px;
z-index: -3;
border-radius: 15px;
overflow: hidden;
pointer-events: none;
}
.ht-sponsor-grid::before {
content: "";
position: absolute;
top: 50%;
left: 50%;
width: 640px;
height: 640px;
margin: -320px 0 0 -320px;
background: conic-gradient(from 0deg, transparent 0deg, var(--sponsor-accent) 58deg, transparent 128deg, var(--sponsor-accent-2) 208deg, transparent 300deg);
opacity: 0.5;
animation: sc-spin 5s linear infinite;
}
.ht-sponsor-scan {
position: absolute;
inset: 1px;
z-index: -1;
border-radius: 13px;
overflow: hidden;
pointer-events: none;
opacity: 0.5;
}
.ht-sponsor-scan::before {
content: "";
position: absolute;
left: 0;
right: 0;
height: 100px;
background: linear-gradient(180deg, transparent, rgba(47, 125, 255, 0.13), transparent);
animation: sc-scan 3.7s linear infinite;
}
.ht-sponsor-corners {
position: absolute;
inset: 1px;
z-index: -1;
border-radius: 13px;
pointer-events: none;
background: repeating-linear-gradient(0deg, transparent 0 2px, rgba(0, 0, 0, 0.22) 2px 3px);
mix-blend-mode: overlay;
opacity: 0.4;
}
.ht-sponsor-kicker {
grid-area: kicker;
justify-self: start;
align-self: start;
display: inline-flex;
align-items: center;
gap: 6px;
width: max-content;
max-width: 100%;
padding: 3px 8px;
border: 1px solid rgba(47, 125, 255, 0.34);
border-radius: 3px;
background: rgba(47, 125, 255, 0.06);
color: var(--sponsor-accent);
font-family: "JetBrains Mono", monospace;
font-size: 9px;
letter-spacing: 0.32em;
line-height: 1.2;
text-transform: uppercase;
}
.ht-sponsor-kicker::before {
content: "";
width: 6px;
height: 6px;
flex: 0 0 auto;
border-radius: 50%;
background: var(--sponsor-accent);
box-shadow: 0 0 8px var(--sponsor-accent);
animation: sc-blink 1.6s ease-in-out infinite;
}
.ht-sponsor-media {
position: relative;
display: flex;
flex: 0 0 auto;
align-items: center;
justify-content: center;
overflow: hidden;
border: 1px solid rgba(47, 125, 255, 0.27);
border-radius: 12px;
background: #0a1016;
}
.ht-sponsor-media img {
position: relative;
z-index: 1;
width: 100% !important;
max-width: 100% !important;
height: 100% !important;
max-height: 100% !important;
min-height: 0 !important;
padding: 0 !important;
object-fit: contain;
filter: none;
transform: none;
transition: none !important;
}
.ht-sponsor-copy {
min-width: 0;
display: flex;
flex-direction: column;
}
.ht-sponsor-title {
display: block;
margin: 0 !important;
color: #eef4ff !important;
font-weight: 700 !important;
line-height: 1.18 !important;
overflow-wrap: anywhere;
font-size: 20px !important;
animation: sc-glitch 7s steps(1) infinite;
}
.ht-sponsor-description {
display: block !important;
margin: 6px 0 0 !important;
color: rgba(210, 222, 245, 0.68) !important;
font-size: 15px;
line-height: 1.45;
max-height: none !important;
opacity: 1 !important;
visibility: visible !important;
overflow: visible !important;
transform: none !important;
}
.ht-sponsor-description strong {
color: #cfe0ff;
font-weight: 600;
}
.ht-sponsor-description em {
color: #ffb3bd;
font-style: normal;
}
.ht-sponsor-cta {
display: flex !important;
align-items: center;
justify-content: center;
gap: 9px;
margin: 2px 0 0 !important;
padding: 12px 14px !important;
border: 1px solid rgba(47, 125, 255, 0.34);
border-radius: 9px !important;
background: rgba(47, 125, 255, 0.07) !important;
color: var(--sponsor-accent) !important;
box-shadow: none;
font-family: "JetBrains Mono", monospace;
font-size: 13px;
font-weight: 700 !important;
letter-spacing: 0.14em;
line-height: 1.2;
text-align: center;
text-transform: uppercase;
max-width: 100%;
opacity: 1 !important;
overflow: visible !important;
visibility: visible !important;
white-space: normal;
transition: none !important;
}
.ht-sponsor-cta::after {
content: "->";
display: inline-block;
animation: sc-arrow 1.4s ease-in-out infinite;
}
.topsponsor,
.bottomsponsor,
.sidesponsor {
--sponsor-title-font-size: initial;
}
.topsponsor,
.bottomsponsor {
width: min(100%, 760px) !important;
min-height: 230px;
margin-left: auto !important;
margin-right: auto !important;
grid-template-columns: 168px minmax(0, 1fr);
grid-template-rows: auto minmax(0, 1fr) auto;
grid-template-areas:
"kicker kicker"
"media copy"
"cta cta";
align-items: start;
gap: 13px !important;
}
.topsponsor .ht-sponsor-copy,
.bottomsponsor .ht-sponsor-copy {
grid-area: copy;
flex: 1;
text-align: left;
}
.topsponsor .ht-sponsor-media,
.bottomsponsor .ht-sponsor-media {
grid-area: media;
width: 168px;
height: 136px;
}
.topsponsor .ht-sponsor-title,
.bottomsponsor .ht-sponsor-title {
font-size: var(--sponsor-title-font-size, 20px) !important;
}
.topsponsor .ht-sponsor-description,
.bottomsponsor .ht-sponsor-description {
font-size: 15px;
}
.topsponsor .ht-sponsor-kicker,
.bottomsponsor .ht-sponsor-kicker {
grid-area: kicker;
justify-self: start;
}
.topsponsor .ht-sponsor-cta,
.bottomsponsor .ht-sponsor-cta {
grid-area: cta;
}
.sidesponsor {
width: 100% !important;
min-height: 360px;
max-height: none !important;
height: auto !important;
grid-template-columns: minmax(0, 1fr);
grid-template-areas:
"kicker"
"media"
"copy"
"cta";
grid-template-rows: auto auto auto auto !important;
align-items: stretch !important;
align-content: start !important;
gap: 9px !important;
}
.sidesponsor .ht-sponsor-kicker {
grid-area: kicker;
align-self: flex-start;
justify-self: start;
}
.sidesponsor .ht-sponsor-media {
grid-area: media;
width: 92px;
height: 92px;
align-self: center;
justify-self: center;
margin-top: -2px;
}
.sidesponsor .ht-sponsor-copy {
grid-area: copy;
align-items: flex-start;
text-align: left;
}
.sidesponsor .ht-sponsor-cta {
grid-area: cta;
}
.sidesponsor .ht-sponsor-title {
font-size: var(--sponsor-title-font-size, 20px) !important;
}
.sidesponsor .ht-sponsor-description {
font-size: 15px;
line-height: 1.4;
}
.sidesponsor .ht-sponsor-cta {
padding: 8px 10px !important;
font-size: 11px;
min-height: 0;
}
@media only screen and (max-width: 799px) {
.topsponsor-bsa {
margin-top: 25px;
margin-bottom: 25px;
}
.topsponsor {
display: none;
margin-top: 25px !important;
margin-bottom: 25px !important;
}
.bottomsponsor,
.bottomsponsor-wrapper {
display: none !important;
}
.topsponsor[style*="display: flex"] {
display: grid !important;
}
.topsponsor[style*="display: grid"] {
display: grid !important;
}
.topsponsor,
.bottomsponsor {
grid-template-columns: 132px minmax(0, 1fr);
}
.topsponsor .ht-sponsor-media,
.bottomsponsor .ht-sponsor-media {
width: 132px;
height: 116px;
}
}
@media only screen and (min-width: 800px) {
.topsponsor {
display: none !important;
}
.bottomsponsor-wrapper {
margin-top: 32px !important;
}
.bottomsponsor {
margin-top: 0 !important;
margin-bottom: 0 !important;
}
.bottomsponsor[style*="display: flex"] {
display: grid !important;
}
.bottomsponsor[style*="display: grid"] {
display: grid !important;
}
.sidesponsor[style*="display: flex"] {
display: grid !important;
}
.sidesponsor[style*="display: grid"] {
display: grid !important;
}
.sidesponsor-bsa {
max-height: 52%;
height: 52%;
}
}
@media (prefers-reduced-motion: reduce) {
.ht-sponsor-card,
.ht-sponsor-card *,
.ht-sponsor-card::before,
.ht-sponsor-card::after {
animation-duration: 0.001ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.001ms !important;
}
}
+53 -5
View File
@@ -10,6 +10,15 @@
var crawlerSlot = document.querySelector(".bsa-crawler-slot")
var pageviewsSlot = document.querySelector(".bsa-pageviews-slot")
var topSponsor = document.querySelector(".topsponsor")
var topSponsorImg = topSponsor && topSponsor.querySelector("img")
var topSponsorTitle =
topSponsor && topSponsor.querySelector(".topsponsor-title")
var topSponsorDescription =
topSponsor && topSponsor.querySelector(".topsponsor-description")
var topSponsorCTA =
topSponsor && topSponsor.querySelector(".topsponsor-cta")
var bottomSponsor = document.querySelector(".bottomsponsor")
var bottomSponsorImg = bottomSponsor && bottomSponsor.querySelector("img")
var bottomSponsorTitle =
@@ -22,6 +31,7 @@
if (
!sponsorSide ||
!topSponsor ||
!bottomSponsor ||
!sponsorSideBsa ||
!topSponsorBsa ||
@@ -136,16 +146,42 @@
nodes.description.innerHTML = sponsor.description
container.href = sponsor.link
nodes.cta.textContent = sponsor.cta
container.style.display = "flex"
container.style.display = "grid"
container.classList.add("ht-sponsor-card--loaded")
container.setAttribute("aria-label", sponsor.name)
nodes.title.classList.toggle("sponsor-title--long", sponsor.name.length > 28)
nodes.title.classList.toggle("ht-sponsor-title--long", sponsor.name.length > 28)
nodes.title.style.fontSize = getSponsorTitleFontSize(sponsor.name)
if (sponsor.description.length > 250) {
nodes.description.style.fontSize = "1.4rem"
} else {
nodes.description.style.fontSize = ""
nodes.description.style.fontSize = ""
}
function initSponsorCardMotion(card) {
if (!card) {
return
}
card.addEventListener("mouseenter", function() {
card.style.setProperty("--sponsor-lift", "-5px")
card.style.setProperty("--sponsor-scale", "1.02")
})
card.addEventListener("mouseleave", function() {
card.style.setProperty("--sponsor-rx", "0deg")
card.style.setProperty("--sponsor-ry", "0deg")
card.style.setProperty("--sponsor-lift", "0px")
card.style.setProperty("--sponsor-scale", "1")
})
card.addEventListener("mousemove", function(event) {
var rect = card.getBoundingClientRect()
var x = (event.clientX - rect.left) / rect.width - 0.5
var y = (event.clientY - rect.top) / rect.height - 0.5
card.style.setProperty("--sponsor-rx", (-y * 12).toFixed(2) + "deg")
card.style.setProperty("--sponsor-ry", (x * 12).toFixed(2) + "deg")
})
}
async function fetchLegacySponsor() {
@@ -170,6 +206,15 @@
})
}
function renderLegacyTopSponsor(sponsor) {
setLegacySponsorContent(sponsor, topSponsor, {
img: topSponsorImg,
title: topSponsorTitle,
description: topSponsorDescription,
cta: topSponsorCTA,
})
}
function renderLegacyBottomSponsor(sponsor) {
setLegacySponsorContent(sponsor, bottomSponsor, {
img: bottomSponsorImg,
@@ -182,6 +227,7 @@
async function loadLegacySponsor() {
var sponsor = await fetchLegacySponsor()
renderLegacySideSponsor(sponsor)
renderLegacyTopSponsor(sponsor)
renderLegacyBottomSponsor(sponsor)
}
@@ -215,6 +261,8 @@
}
async function initSponsor() {
;[sponsorSide, topSponsor, bottomSponsor].forEach(initSponsorCardMotion)
try {
var useBsa = shouldUseBsa()
window.__hacktricksAdsProvider = useBsa ? "bsa" : "legacy"