Skip to content

Commit 77bebc6

Browse files
committed
Publish 2025-07-22
1 parent 8449ae4 commit 77bebc6

File tree

1 file changed

+28
-14
lines changed

1 file changed

+28
-14
lines changed

elements/pay-tiers.js

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,16 @@ function currencyButton(currency, flagCls) {
9999
</label>`;
100100
}
101101

102+
const today = new Date();
103+
const usDate = today.toLocaleDateString('en-US', { month: 'long', day: 'numeric' });
104+
105+
const takeCareMsg = [
106+
`Today is <strong>${usDate}</strong>, and we're kindly asking you to complete the payment to keep Dark Reader going.`,
107+
`For <strong>over 10 years</strong>, Dark Reader has helped millions of people with migraines, photophobia, and light sensitivity.`,
108+
`Please <strong>make a payment now</strong> or soon after trying it.`,
109+
`Take part in spreading dark mode across the internet and help making the web easier on everyone's eyes.`,
110+
].join(' ');
111+
102112
const locales = {
103113
cn: {
104114
heading: '支付 Dark Reader 使用费',
@@ -117,8 +127,6 @@ const locales = {
117127
},
118128
};
119129

120-
const takeCareMsg = 'Dear User, we provide the best dark mode possible. <strong>Please complete the payment now</strong> to support continuous Dark Reader development.';
121-
122130
const htmlText = `
123131
<section class="pr">
124132
<div class="pr-wrapper">
@@ -277,7 +285,9 @@ const cssText = `
277285
display: none;
278286
line-height: 1;
279287
margin: 0.25rem 0 0.5rem 0;
288+
/*
280289
text-align: center;
290+
*/
281291
}
282292
.tiers {
283293
align-items: stretch;
@@ -786,13 +796,14 @@ darkreader-donate-mascot {
786796
}
787797
.payment-wrapper {
788798
margin-left: 8rem;
799+
margin-top: 0.5rem;
789800
position: relative;
790801
}
791802
darkreader-donate-mascot {
792803
display: inline-block;
793804
position: absolute;
794805
right: 100%;
795-
top: 0;
806+
top: -0.5rem;
796807
width: 10rem;
797808
}
798809
}
@@ -873,18 +884,21 @@ class PayTiersElement extends HTMLElement {
873884
feeButton,
874885
corpButton,
875886
});
876-
}
877887

878-
shadowRoot.host.addEventListener('mouseenter', (e) => {
879-
if (e.target === shadowRoot.host) {
880-
shadowRoot.querySelector('darkreader-donate-mascot')?.setAttribute('hover', '');
881-
}
882-
});
883-
shadowRoot.host.addEventListener('mouseleave', (e) => {
884-
if (e.target === shadowRoot.host) {
885-
shadowRoot.querySelector('darkreader-donate-mascot')?.removeAttribute('hover');
886-
}
887-
});
888+
[feeButton, corpButton].forEach((button) => {
889+
if (!button) return;
890+
button.addEventListener('mouseenter', (e) => {
891+
if (e.target === button) {
892+
shadowRoot.querySelector('darkreader-donate-mascot')?.setAttribute('hover', '');
893+
}
894+
});
895+
button.addEventListener('mouseleave', (e) => {
896+
if (e.target === button) {
897+
shadowRoot.querySelector('darkreader-donate-mascot')?.removeAttribute('hover');
898+
}
899+
});
900+
});
901+
}
888902
}
889903
}
890904

0 commit comments

Comments
 (0)