Spaces:
Running
Running
File size: 5,078 Bytes
35ef307 8c2cb5f 35ef307 6cca3b1 35ef307 6cca3b1 35ef307 a8cda3d 35ef307 a8cda3d 35ef307 a8cda3d 35ef307 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 |
(function() {
'use strict';
// Check if badge already exists
if (document.getElementById('deepsite-badge-wrapper')) {
return;
}
// Don't show badge on huggingface.co/deepsite
const hostname = window.location.hostname;
const pathname = window.location.pathname;
if (hostname === 'huggingface.co' && pathname.startsWith('/deepsite')) {
return;
}
// Inject keyframes for gradient rotation
const style = document.createElement('style');
style.textContent = `
@keyframes deepsite-spin {
0% {
transform: translate(-50%, -50%) rotate(0deg);
}
100% {
transform: translate(-50%, -50%) rotate(360deg);
}
}
#deepsite-badge-wrapper i {
pointer-events: none;
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: -1;
padding: 1.5px;
transition-property: all;
transition-timing-function: cubic-bezier(.4, 0, .2, 1);
transition-duration: .2s;
-webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
-webkit-mask-composite: xor;
mask-composite: exclude;
border-radius: inherit;
}
#deepsite-badge-wrapper i::before {
content: "";
position: absolute;
left: 50%;
top: 50%;
display: block;
border-radius: 9999px;
opacity: 0;
background: conic-gradient(from 0deg at 50% 50%, #ec4899, #fbbf24, #3b82f6, #ec4899);
width: calc(100% * 2);
padding-bottom: calc(100% * 2);
transform: translate(-50%, -50%);
z-index: -1;
will-change: transform;
}
#deepsite-badge-wrapper:hover i::before {
opacity: 1;
animation: deepsite-spin 3s linear infinite;
}
`;
document.head.appendChild(style);
// Create badge wrapper (like the button element)
const badgeWrapper = document.createElement('div');
badgeWrapper.id = 'deepsite-badge-wrapper';
// Create inner badge (like the span element)
const badgeInner = document.createElement('span');
badgeInner.id = 'deepsite-badge-inner';
// Create mask element (the i element)
const borderMask = document.createElement('i');
// Create link
const link = document.createElement('a');
link.href = 'https://huggingface.co/deepsite';
link.target = '_blank';
link.rel = 'noopener noreferrer';
// Create icon placeholder
const icon = document.createElement('img');
icon.src = 'https://huggingface.co/deepsite/logo.svg';
icon.alt = 'DeepSite';
icon.style.marginRight = '6px';
icon.style.width = '16px';
icon.style.height = '16px';
icon.style.filter = 'brightness(0) invert(1)';
// Create text
const text = document.createTextNode('Made with DeepSite');
// Apply styles to wrapper (like button element)
Object.assign(badgeWrapper.style, {
position: 'fixed',
bottom: '20px',
left: '20px',
zIndex: '999999',
color: '#ffffff',
borderRadius: '9999px',
background: 'rgba(0, 0, 0, 0.4)',
fontSize: '12px',
fontWeight: '500',
display: 'inline-block',
cursor: 'pointer',
padding: '1.5px',
overflow: 'hidden',
backdropFilter: 'blur(16px) saturate(180%)',
WebkitBackdropFilter: 'blur(16px) saturate(180%)',
});
// Apply styles to inner badge (like span element)
Object.assign(badgeInner.style, {
background: 'rgba(0, 0, 0, 0.6)',
padding: '8px 16px',
display: 'flex',
alignItems: 'center',
borderRadius: '9999px',
boxShadow: '0 8px 32px 0 rgba(0, 0, 0, 0.5)',
transition: 'all 0.3s ease',
border: '1px solid rgba(255, 255, 255, 0.1)'
});
// Apply styles to link
Object.assign(link.style, {
color: '#ffffff',
textDecoration: 'none',
fontWeight: '500',
display: 'flex',
alignItems: 'center',
fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',
textShadow: '0 2px 4px rgba(0, 0, 0, 0.3)'
});
// Add hover effect
badgeWrapper.addEventListener('mouseenter', function() {
badgeInner.style.background = 'rgba(0, 0, 0, 0.75)';
badgeInner.style.boxShadow = '0 8px 32px 0 rgba(0, 0, 0, 0.7)';
});
badgeWrapper.addEventListener('mouseleave', function() {
badgeInner.style.background = 'rgba(0, 0, 0, 0.6)';
badgeInner.style.boxShadow = '0 8px 32px 0 rgba(0, 0, 0, 0.5)';
});
// Append elements
link.appendChild(icon);
link.appendChild(text);
badgeInner.appendChild(link);
badgeWrapper.appendChild(badgeInner);
badgeWrapper.appendChild(borderMask);
// Wait for DOM to be ready
function init() {
if (document.body) {
document.body.appendChild(badgeWrapper);
} else {
document.addEventListener('DOMContentLoaded', function() {
document.body.appendChild(badgeWrapper);
});
}
}
// Initialize
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', init);
} else {
init();
}
})();
|