|
721 | 721 | return; |
722 | 722 | } |
723 | 723 |
|
| 724 | + function addFlagOverlay(tweet, countryCode) { |
| 725 | + if (!countryCode) return; |
| 726 | + const flag = countryCodeToFlag(countryCode); |
| 727 | + if (!flag) return; |
| 728 | + const existingId = tweet.dataset.xcbOverlayId; |
| 729 | + if (existingId) { |
| 730 | + const existing = document.getElementById(existingId); |
| 731 | + if (existing) existing.remove(); |
| 732 | + delete tweet.dataset.xcbOverlayId; |
| 733 | + } |
| 734 | + const overlay = document.createElement("div"); |
| 735 | + const id = `xcb-overlay-${Math.random().toString(36).slice(2, 9)}`; |
| 736 | + overlay.id = id; |
| 737 | + overlay.textContent = flag; |
| 738 | + overlay.style = |
| 739 | + "position:absolute;inset:0;display:flex;align-items:center;justify-content:center;font-size:96px;opacity:0.08;pointer-events:none;user-select:none;filter:saturate(0.9);z-index:1;"; |
| 740 | + tweet.appendChild(overlay); |
| 741 | + tweet.dataset.xcbOverlayId = id; |
| 742 | + } |
| 743 | + |
724 | 744 | function renderFooterInfo(tweet, countryCode, usernameChanges) { |
725 | 745 | const rowId = tweet.dataset.xcbFooterId; |
726 | 746 | const hasCountry = Boolean(countryCode); |
|
800 | 820 | tweet.style.position = tweet.dataset.xcbPrevPosition; |
801 | 821 | delete tweet.dataset.xcbPrevPosition; |
802 | 822 | } |
| 823 | + const overlayId = tweet.dataset.xcbOverlayId; |
| 824 | + if (overlayId) { |
| 825 | + const overlayEl = document.getElementById(overlayId); |
| 826 | + if (overlayEl) overlayEl.remove(); |
| 827 | + delete tweet.dataset.xcbOverlayId; |
| 828 | + } |
803 | 829 | tweet.style.removeProperty("outline"); |
804 | 830 | tweet.style.removeProperty("outline-offset"); |
805 | 831 | tweet.style.removeProperty("box-shadow"); |
|
857 | 883 | "position:absolute;top:-10px;left:-10px;background:#ff4d4f;color:#fff;padding:6px 10px;border-radius:10px;font-size:12px;font-weight:bold;box-shadow:0 4px 12px rgba(0,0,0,0.25);z-index:2;"; |
858 | 884 | tweet.appendChild(badge); |
859 | 885 | tweet.dataset.xcbBadgeId = badgeId; |
| 886 | + addFlagOverlay(tweet, countryCode); |
860 | 887 | } |
861 | 888 |
|
862 | 889 | function markRegionOnlyHighlight(tweet, regionName) { |
|
0 commit comments