Spaces:
Running
Running
🐳 14/04 - 08:20 - Add viral growth mechanics.For each track:- Share button (WhatsApp, Facebook, link copy)- Message preview: “Check out this beat on BeatFridge”Add:- Creator referral system (future
Browse files- app.js +215 -3
- artist.html +3 -3
- discover.html +1 -0
- index.html +3 -0
- track.html +1 -1
app.js
CHANGED
|
@@ -113,6 +113,11 @@ const BF = (() => {
|
|
| 113 |
localStorage.setItem('beatfridge_current_user', JSON.stringify(newUser));
|
| 114 |
localStorage.setItem('isLoggedIn', 'true');
|
| 115 |
localStorage.setItem('currentUserId', newUser.id);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 116 |
return { success: true, user: newUser };
|
| 117 |
} catch (e) {
|
| 118 |
return { success: false, error: 'Sign up failed: ' + e.message };
|
|
@@ -150,12 +155,194 @@ const BF = (() => {
|
|
| 150 |
const getGenres = () => [...genres];
|
| 151 |
|
| 152 |
const getTrendingTracks = () => {
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 156 |
});
|
| 157 |
};
|
| 158 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 159 |
const getFreshUploads = () => {
|
| 160 |
return getAllTracks().filter(t => t.date && (t.date.includes('day') || t.date.includes('hour') || t.date.includes('Just') || t.date.includes('minute')));
|
| 161 |
};
|
|
@@ -276,6 +463,16 @@ const BF = (() => {
|
|
| 276 |
.bf-pay-success h3 { animation-delay: 0.1s; opacity: 0; }
|
| 277 |
.bf-pay-success p { animation-delay: 0.2s; opacity: 0; }
|
| 278 |
.bf-pay-success .bf-success-pulse + div { animation-delay: 0.3s; opacity: 0; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 279 |
`;
|
| 280 |
document.head.appendChild(style);
|
| 281 |
};
|
|
@@ -1398,6 +1595,13 @@ const BF = (() => {
|
|
| 1398 |
updateSuperFanButtons();
|
| 1399 |
if (window.lucide) lucide.createIcons();
|
| 1400 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1401 |
// Re-sync player every 2 seconds
|
| 1402 |
setInterval(syncPlayer, 2000);
|
| 1403 |
};
|
|
@@ -1433,6 +1637,14 @@ const BF = (() => {
|
|
| 1433 |
getCreatorDashboard,
|
| 1434 |
// Download button renderer
|
| 1435 |
renderDL,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1436 |
// Quick amount selector
|
| 1437 |
selectQuickAmount, onCustomAmountInput
|
| 1438 |
};
|
|
|
|
| 113 |
localStorage.setItem('beatfridge_current_user', JSON.stringify(newUser));
|
| 114 |
localStorage.setItem('isLoggedIn', 'true');
|
| 115 |
localStorage.setItem('currentUserId', newUser.id);
|
| 116 |
+
// Record referral if applicable
|
| 117 |
+
try {
|
| 118 |
+
const pendingRef = sessionStorage.getItem('bf_pending_referral');
|
| 119 |
+
if (pendingRef) { recordReferralSignup(pendingRef); sessionStorage.removeItem('bf_pending_referral'); }
|
| 120 |
+
} catch {}
|
| 121 |
return { success: true, user: newUser };
|
| 122 |
} catch (e) {
|
| 123 |
return { success: false, error: 'Sign up failed: ' + e.message };
|
|
|
|
| 155 |
const getGenres = () => [...genres];
|
| 156 |
|
| 157 |
const getTrendingTracks = () => {
|
| 158 |
+
const shareCounts = {};
|
| 159 |
+
try { Object.assign(shareCounts, JSON.parse(localStorage.getItem('bf_track_shares') || '{}')); } catch {}
|
| 160 |
+
const unlockCounts = {};
|
| 161 |
+
try { JSON.parse(localStorage.getItem('bf_download_states') || '[]').forEach(s => { if (s.unlocked) unlockCounts[s.trackId] = (unlockCounts[s.trackId] || 0) + 1; }); } catch {}
|
| 162 |
+
|
| 163 |
+
return getAllTracks().map(t => {
|
| 164 |
+
const p = parseFloat(t.plays || '0');
|
| 165 |
+
const plays = (t.plays || '').includes('K') ? p * 1000 : p;
|
| 166 |
+
const shares = shareCounts[t.id] || 0;
|
| 167 |
+
const unlocks = unlockCounts[t.id] || 0;
|
| 168 |
+
return { ...t, _trendScore: plays + (unlocks * 10) + (shares * 5) };
|
| 169 |
+
}).sort((a, b) => b._trendScore - a._trendScore);
|
| 170 |
+
};
|
| 171 |
+
|
| 172 |
+
// ===== SHARE TRACKING =====
|
| 173 |
+
const trackShare = (trackId) => {
|
| 174 |
+
try {
|
| 175 |
+
let shares = JSON.parse(localStorage.getItem('bf_track_shares') || '{}');
|
| 176 |
+
shares[trackId] = (shares[trackId] || 0) + 1;
|
| 177 |
+
localStorage.setItem('bf_track_shares', JSON.stringify(shares));
|
| 178 |
+
} catch {}
|
| 179 |
+
};
|
| 180 |
+
|
| 181 |
+
const getShareCount = (trackId) => {
|
| 182 |
+
try { return (JSON.parse(localStorage.getItem('bf_track_shares') || '{}'))[trackId] || 0; }
|
| 183 |
+
catch { return 0; }
|
| 184 |
+
};
|
| 185 |
+
|
| 186 |
+
const getUnlockCount = (trackId) => {
|
| 187 |
+
try { return JSON.parse(localStorage.getItem('bf_download_states') || '[]').filter(s => s.trackId === trackId && s.unlocked).length; }
|
| 188 |
+
catch { return 0; }
|
| 189 |
+
};
|
| 190 |
+
|
| 191 |
+
// ===== REFERRAL SYSTEM =====
|
| 192 |
+
const getReferralCode = () => {
|
| 193 |
+
const user = getCurrentUser();
|
| 194 |
+
if (!user) return null;
|
| 195 |
+
try {
|
| 196 |
+
let refs = JSON.parse(localStorage.getItem('bf_referral_codes') || '{}');
|
| 197 |
+
const uid = user.id;
|
| 198 |
+
if (refs[uid]) return refs[uid];
|
| 199 |
+
const prefix = (user.username || 'usr').substring(0, 3).toUpperCase();
|
| 200 |
+
const code = prefix + Math.floor(1000 + Math.random() * 9000);
|
| 201 |
+
refs[uid] = code;
|
| 202 |
+
localStorage.setItem('bf_referral_codes', JSON.stringify(refs));
|
| 203 |
+
return code;
|
| 204 |
+
} catch { return null; }
|
| 205 |
+
};
|
| 206 |
+
|
| 207 |
+
const recordReferralSignup = (referralCode) => {
|
| 208 |
+
if (!referralCode) return;
|
| 209 |
+
try {
|
| 210 |
+
let referrals = JSON.parse(localStorage.getItem('bf_referrals') || '[]');
|
| 211 |
+
referrals.push({ code: referralCode, newUserId: getCurrentUser()?.id, date: new Date().toISOString(), status: 'pending' });
|
| 212 |
+
localStorage.setItem('bf_referrals', JSON.stringify(referrals));
|
| 213 |
+
} catch {}
|
| 214 |
+
};
|
| 215 |
+
|
| 216 |
+
const getReferralStats = () => {
|
| 217 |
+
const user = getCurrentUser();
|
| 218 |
+
if (!user) return { code: null, clicks: 0, signups: 0, earnings: 0 };
|
| 219 |
+
const code = getReferralCode();
|
| 220 |
+
try {
|
| 221 |
+
const referrals = JSON.parse(localStorage.getItem('bf_referrals') || '[]');
|
| 222 |
+
const clicks = JSON.parse(localStorage.getItem('bf_referral_clicks') || '{}');
|
| 223 |
+
const userRefs = referrals.filter(r => r.code === code);
|
| 224 |
+
return { code, clicks: clicks[code] || 0, signups: userRefs.length, earnings: userRefs.filter(r => r.status === 'confirmed').length * 5, pendingEarnings: userRefs.filter(r => r.status === 'pending').length * 5 };
|
| 225 |
+
} catch { return { code, clicks: 0, signups: 0, earnings: 0 }; }
|
| 226 |
+
};
|
| 227 |
+
|
| 228 |
+
const trackReferralClick = (referralCode) => {
|
| 229 |
+
if (!referralCode) return;
|
| 230 |
+
try {
|
| 231 |
+
let clicks = JSON.parse(localStorage.getItem('bf_referral_clicks') || '{}');
|
| 232 |
+
clicks[referralCode] = (clicks[referralCode] || 0) + 1;
|
| 233 |
+
localStorage.setItem('bf_referral_clicks', JSON.stringify(clicks));
|
| 234 |
+
sessionStorage.setItem('bf_pending_referral', referralCode);
|
| 235 |
+
} catch {}
|
| 236 |
+
};
|
| 237 |
+
|
| 238 |
+
// ===== SHARE MODAL =====
|
| 239 |
+
const showShareModal = (trackTitle, artistName, trackId) => {
|
| 240 |
+
if (document.getElementById('bfShareModal')) return;
|
| 241 |
+
const baseUrl = window.location.origin;
|
| 242 |
+
let url = baseUrl + '/track.html?id=' + trackId;
|
| 243 |
+
if (isLoggedIn()) { const rc = getReferralCode(); if (rc) url += '&ref=' + rc; }
|
| 244 |
+
const shareText = 'Check out this beat on BeatFridge: ' + trackTitle + ' by ' + artistName;
|
| 245 |
+
const safeT = String(trackTitle).replace(/'/g, "\\'").replace(/"/g, '"');
|
| 246 |
+
const safeA = String(artistName).replace(/'/g, "\\'").replace(/"/g, '"');
|
| 247 |
+
|
| 248 |
+
const modal = document.createElement('div');
|
| 249 |
+
modal.id = 'bfShareModal';
|
| 250 |
+
modal.innerHTML = `
|
| 251 |
+
<div class="bf-signin-overlay" onclick="BF.closeShareModal()"></div>
|
| 252 |
+
<div class="bf-signin-modal">
|
| 253 |
+
<div class="bf-signin-card" style="max-width:380px">
|
| 254 |
+
<div class="flex items-center justify-between mb-5">
|
| 255 |
+
<h3 class="text-lg font-bold text-white flex items-center gap-2"><i data-lucide="share-2" class="w-5 h-5 text-purple-400"></i>Share This Beat</h3>
|
| 256 |
+
<button onclick="BF.closeShareModal()" class="text-gray-400 hover:text-white transition"><i data-lucide="x" class="w-5 h-5"></i></button>
|
| 257 |
+
</div>
|
| 258 |
+
<div class="flex items-center gap-3 mb-4 p-3 rounded-xl bg-white/5">
|
| 259 |
+
<i data-lucide="music" class="w-5 h-5 text-cyan-400 flex-shrink-0"></i>
|
| 260 |
+
<div class="min-w-0"><p class="text-sm font-medium text-white truncate">${trackTitle}</p><p class="text-xs text-gray-500">${artistName}</p></div>
|
| 261 |
+
</div>
|
| 262 |
+
<p class="text-xs text-gray-500 mb-4 px-1">"${shareText}"</p>
|
| 263 |
+
<div class="space-y-2 mb-4">
|
| 264 |
+
<button onclick="BF.shareViaWhatsApp(${trackId},'${safeT}','${safeA}')" class="bf-share-platform bg-green-500/5 border-green-500/20 hover:bg-green-500/10 hover:border-green-500/40">
|
| 265 |
+
<div class="w-10 h-10 rounded-full bg-green-500/15 flex items-center justify-center flex-shrink-0"><svg viewBox="0 0 24 24" class="w-5 h-5 text-green-400" fill="currentColor"><path d="M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.981.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.88 11.88 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 00-3.48-8.413z"/></svg></div>
|
| 266 |
+
<div><p class="text-sm font-semibold text-green-400">WhatsApp</p><p class="text-xs text-gray-500">Share via WhatsApp</p></div>
|
| 267 |
+
</button>
|
| 268 |
+
<button onclick="BF.shareViaFacebook(${trackId},'${safeT}','${safeA}')" class="bf-share-platform bg-blue-500/5 border-blue-500/20 hover:bg-blue-500/10 hover:border-blue-500/40">
|
| 269 |
+
<div class="w-10 h-10 rounded-full bg-blue-500/15 flex items-center justify-center flex-shrink-0"><i data-lucide="facebook" class="w-5 h-5 text-blue-400"></i></div>
|
| 270 |
+
<div><p class="text-sm font-semibold text-blue-400">Facebook</p><p class="text-xs text-gray-500">Share on your timeline</p></div>
|
| 271 |
+
</button>
|
| 272 |
+
<button onclick="BF.shareViaTwitter(${trackId},'${safeT}','${safeA}')" class="bf-share-platform bg-sky-500/5 border-sky-500/20 hover:bg-sky-500/10 hover:border-sky-500/40">
|
| 273 |
+
<div class="w-10 h-10 rounded-full bg-sky-500/15 flex items-center justify-center flex-shrink-0"><i data-lucide="twitter" class="w-5 h-5 text-sky-400"></i></div>
|
| 274 |
+
<div><p class="text-sm font-semibold text-sky-400">Twitter / X</p><p class="text-xs text-gray-500">Tweet this beat</p></div>
|
| 275 |
+
</button>
|
| 276 |
+
<button onclick="BF.copyTrackLink(${trackId},'${safeT}','${safeA}')" class="bf-share-platform bg-white/[0.03] border-white/10 hover:bg-white/[0.06] hover:border-white/20">
|
| 277 |
+
<div class="w-10 h-10 rounded-full bg-white/10 flex items-center justify-center flex-shrink-0"><i data-lucide="link" class="w-5 h-5 text-gray-400"></i></div>
|
| 278 |
+
<div><p class="text-sm font-semibold text-white">Copy Link</p><p class="text-xs text-gray-500">Copy track URL to clipboard</p></div>
|
| 279 |
+
</button>
|
| 280 |
+
</div>
|
| 281 |
+
${isLoggedIn() ? `<div class="p-3 rounded-xl bg-orange-500/5 border border-orange-500/15"><div class="flex items-center gap-2 mb-1"><i data-lucide="gift" class="w-4 h-4 text-orange-400"></i><p class="text-xs font-semibold text-orange-400">Share & Earn</p></div><p class="text-[11px] text-gray-500">Your link includes your referral code. Earn rewards when new users sign up through your shares.</p></div>` : ''}
|
| 282 |
+
</div>
|
| 283 |
+
</div>
|
| 284 |
+
`;
|
| 285 |
+
document.body.appendChild(modal);
|
| 286 |
+
if (window.lucide) lucide.createIcons();
|
| 287 |
+
};
|
| 288 |
+
|
| 289 |
+
const closeShareModal = () => { document.getElementById('bfShareModal')?.remove(); };
|
| 290 |
+
|
| 291 |
+
const shareViaWhatsApp = (trackId, trackTitle, artistName) => {
|
| 292 |
+
trackShare(trackId);
|
| 293 |
+
let url = window.location.origin + '/track.html?id=' + trackId;
|
| 294 |
+
if (isLoggedIn()) { const rc = getReferralCode(); if (rc) url += '&ref=' + rc; }
|
| 295 |
+
const text = 'Check out this beat on BeatFridge: ' + trackTitle + ' by ' + artistName + ' ' + url;
|
| 296 |
+
window.open('https://wa.me/?text=' + encodeURIComponent(text), '_blank');
|
| 297 |
+
closeShareModal();
|
| 298 |
+
showToast('Shared via WhatsApp 📱');
|
| 299 |
+
};
|
| 300 |
+
|
| 301 |
+
const shareViaFacebook = (trackId, trackTitle, artistName) => {
|
| 302 |
+
trackShare(trackId);
|
| 303 |
+
let url = window.location.origin + '/track.html?id=' + trackId;
|
| 304 |
+
if (isLoggedIn()) { const rc = getReferralCode(); if (rc) url += '&ref=' + rc; }
|
| 305 |
+
window.open('https://www.facebook.com/sharer/sharer.php?u=' + encodeURIComponent(url), '_blank');
|
| 306 |
+
closeShareModal();
|
| 307 |
+
showToast('Shared on Facebook 📘');
|
| 308 |
+
};
|
| 309 |
+
|
| 310 |
+
const shareViaTwitter = (trackId, trackTitle, artistName) => {
|
| 311 |
+
trackShare(trackId);
|
| 312 |
+
let url = window.location.origin + '/track.html?id=' + trackId;
|
| 313 |
+
if (isLoggedIn()) { const rc = getReferralCode(); if (rc) url += '&ref=' + rc; }
|
| 314 |
+
const text = 'Check out this beat on BeatFridge: ' + trackTitle + ' by ' + artistName + ' 🎵 ' + url;
|
| 315 |
+
window.open('https://twitter.com/intent/tweet?text=' + encodeURIComponent(text), '_blank');
|
| 316 |
+
closeShareModal();
|
| 317 |
+
showToast('Shared on Twitter 🐦');
|
| 318 |
+
};
|
| 319 |
+
|
| 320 |
+
const copyTrackLink = (trackId, trackTitle, artistName) => {
|
| 321 |
+
trackShare(trackId);
|
| 322 |
+
let url = window.location.origin + '/track.html?id=' + trackId;
|
| 323 |
+
if (isLoggedIn()) { const rc = getReferralCode(); if (rc) url += '&ref=' + rc; }
|
| 324 |
+
navigator.clipboard.writeText(url).then(() => {
|
| 325 |
+
closeShareModal();
|
| 326 |
+
showToast('Link copied! Share it anywhere 📋');
|
| 327 |
+
}).catch(() => {
|
| 328 |
+
const input = document.createElement('input');
|
| 329 |
+
input.value = url;
|
| 330 |
+
document.body.appendChild(input);
|
| 331 |
+
input.select();
|
| 332 |
+
document.execCommand('copy');
|
| 333 |
+
input.remove();
|
| 334 |
+
closeShareModal();
|
| 335 |
+
showToast('Link copied! 📋');
|
| 336 |
});
|
| 337 |
};
|
| 338 |
|
| 339 |
+
// ===== RENDER SHARE BUTTON =====
|
| 340 |
+
const renderShare = (trackId, trackTitle, artistName) => {
|
| 341 |
+
const safeTitle = String(trackTitle).replace(/'/g, "\\'").replace(/"/g, '"');
|
| 342 |
+
const safeArtist = String(artistName).replace(/'/g, "\\'").replace(/"/g, '"');
|
| 343 |
+
return `<button class="bf-share-btn" onclick="event.stopPropagation(); BF.showShareModal('${safeTitle}', '${safeArtist}', ${trackId})"><i data-lucide="share-2" class="w-3 h-3"></i>Share</button>`;
|
| 344 |
+
};
|
| 345 |
+
|
| 346 |
const getFreshUploads = () => {
|
| 347 |
return getAllTracks().filter(t => t.date && (t.date.includes('day') || t.date.includes('hour') || t.date.includes('Just') || t.date.includes('minute')));
|
| 348 |
};
|
|
|
|
| 463 |
.bf-pay-success h3 { animation-delay: 0.1s; opacity: 0; }
|
| 464 |
.bf-pay-success p { animation-delay: 0.2s; opacity: 0; }
|
| 465 |
.bf-pay-success .bf-success-pulse + div { animation-delay: 0.3s; opacity: 0; }
|
| 466 |
+
.bf-share-btn {
|
| 467 |
+
display: inline-flex; align-items: center; gap: 4px;
|
| 468 |
+
font-size: 11px; font-weight: 500; color: #9ca3af;
|
| 469 |
+
background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
|
| 470 |
+
cursor: pointer; padding: 4px 10px; border-radius: 6px;
|
| 471 |
+
transition: all 0.2s;
|
| 472 |
+
}
|
| 473 |
+
.bf-share-btn:hover { color: #a78bfa; border-color: rgba(167,139,250,0.3); background: rgba(167,139,250,0.08); }
|
| 474 |
+
.bf-share-platform { width: 100%; padding: 12px 16px; border-radius: 12px; display: flex; align-items: center; gap: 12px; cursor: pointer; transition: all 0.2s; border: 1px solid transparent; }
|
| 475 |
+
.bf-share-platform:hover { transform: translateX(2px); }
|
| 476 |
`;
|
| 477 |
document.head.appendChild(style);
|
| 478 |
};
|
|
|
|
| 1595 |
updateSuperFanButtons();
|
| 1596 |
if (window.lucide) lucide.createIcons();
|
| 1597 |
|
| 1598 |
+
// Check for referral parameter in URL
|
| 1599 |
+
try {
|
| 1600 |
+
const urlParams = new URLSearchParams(window.location.search);
|
| 1601 |
+
const refCode = urlParams.get('ref');
|
| 1602 |
+
if (refCode) trackReferralClick(refCode);
|
| 1603 |
+
} catch {}
|
| 1604 |
+
|
| 1605 |
// Re-sync player every 2 seconds
|
| 1606 |
setInterval(syncPlayer, 2000);
|
| 1607 |
};
|
|
|
|
| 1637 |
getCreatorDashboard,
|
| 1638 |
// Download button renderer
|
| 1639 |
renderDL,
|
| 1640 |
+
// Share button renderer
|
| 1641 |
+
renderShare,
|
| 1642 |
+
// Share system
|
| 1643 |
+
showShareModal, closeShareModal,
|
| 1644 |
+
shareViaWhatsApp, shareViaFacebook, shareViaTwitter, copyTrackLink,
|
| 1645 |
+
trackShare, getShareCount, getUnlockCount,
|
| 1646 |
+
// Referral system
|
| 1647 |
+
getReferralCode, recordReferralSignup, getReferralStats, trackReferralClick,
|
| 1648 |
// Quick amount selector
|
| 1649 |
selectQuickAmount, onCustomAmountInput
|
| 1650 |
};
|
artist.html
CHANGED
|
@@ -716,9 +716,9 @@
|
|
| 716 |
<button class="opacity-0 group-hover:opacity-100 transition text-gray-400 hover:text-cyan-400 p-2" onclick="event.stopPropagation(); addToPlaylist(${track.id})">
|
| 717 |
<i data-lucide="list-plus" class="w-5 h-5"></i>
|
| 718 |
</button>
|
| 719 |
-
<span class="opacity-0 group-hover:opacity-100 transition">${BF.renderDL(track.id, track.title, 'Aurora Void')}</span>
|
| 720 |
` : `
|
| 721 |
-
<span>${BF.renderDL(track.id, track.title, 'Aurora Void')}</span>
|
| 722 |
`}
|
| 723 |
</div>
|
| 724 |
`}).join('');
|
|
@@ -898,7 +898,7 @@
|
|
| 898 |
${track.plays}
|
| 899 |
</span>
|
| 900 |
<div class="flex items-center gap-2">
|
| 901 |
-
<span class="opacity-0 group-hover:opacity-100 transition">${BF.renderDL(track.id, track.title, 'Aurora Void')}</span>
|
| 902 |
<button class="opacity-0 group-hover:opacity-100 transition hover:text-cyan-400" onclick="event.stopPropagation(); addToPlaylist(${track.id})">
|
| 903 |
<i data-lucide="list-plus" class="w-4 h-4"></i>
|
| 904 |
</button>
|
|
|
|
| 716 |
<button class="opacity-0 group-hover:opacity-100 transition text-gray-400 hover:text-cyan-400 p-2" onclick="event.stopPropagation(); addToPlaylist(${track.id})">
|
| 717 |
<i data-lucide="list-plus" class="w-5 h-5"></i>
|
| 718 |
</button>
|
| 719 |
+
<span class="opacity-0 group-hover:opacity-100 transition">${BF.renderDL(track.id, track.title, 'Aurora Void')} ${BF.renderShare(track.id, track.title, 'Aurora Void')}</span>
|
| 720 |
` : `
|
| 721 |
+
<span>${BF.renderDL(track.id, track.title, 'Aurora Void')} ${BF.renderShare(track.id, track.title, 'Aurora Void')}</span>
|
| 722 |
`}
|
| 723 |
</div>
|
| 724 |
`}).join('');
|
|
|
|
| 898 |
${track.plays}
|
| 899 |
</span>
|
| 900 |
<div class="flex items-center gap-2">
|
| 901 |
+
<span class="opacity-0 group-hover:opacity-100 transition">${BF.renderDL(track.id, track.title, 'Aurora Void')} ${BF.renderShare(track.id, track.title, 'Aurora Void')}</span>
|
| 902 |
<button class="opacity-0 group-hover:opacity-100 transition hover:text-cyan-400" onclick="event.stopPropagation(); addToPlaylist(${track.id})">
|
| 903 |
<i data-lucide="list-plus" class="w-4 h-4"></i>
|
| 904 |
</button>
|
discover.html
CHANGED
|
@@ -407,6 +407,7 @@
|
|
| 407 |
</div>
|
| 408 |
<span class="text-xs text-gray-500">${track.duration}</span>
|
| 409 |
${BF.renderDL(track.id, track.title, track.artist)}
|
|
|
|
| 410 |
<button class="w-8 h-8 rounded-full bg-white/10 flex items-center justify-center opacity-0 group-hover:opacity-100 transition hover:bg-cyan-500/20 hover:text-cyan-400">
|
| 411 |
<i data-lucide="play" class="w-4 h-4"></i>
|
| 412 |
</button>
|
|
|
|
| 407 |
</div>
|
| 408 |
<span class="text-xs text-gray-500">${track.duration}</span>
|
| 409 |
${BF.renderDL(track.id, track.title, track.artist)}
|
| 410 |
+
${BF.renderShare(track.id, track.title, track.artist)}
|
| 411 |
<button class="w-8 h-8 rounded-full bg-white/10 flex items-center justify-center opacity-0 group-hover:opacity-100 transition hover:bg-cyan-500/20 hover:text-cyan-400">
|
| 412 |
<i data-lucide="play" class="w-4 h-4"></i>
|
| 413 |
</button>
|
index.html
CHANGED
|
@@ -313,6 +313,7 @@
|
|
| 313 |
<h3 class="text-sm font-semibold text-white truncate group-hover:text-cyan-400 transition ${locked ? 'opacity-60' : ''}">${track.title}</h3>
|
| 314 |
<p class="text-xs text-gray-500 truncate ${locked ? 'opacity-60' : ''}">${track.artist}</p>
|
| 315 |
${BF.renderDL(track.id, track.title, track.artist)}
|
|
|
|
| 316 |
</div>
|
| 317 |
`}).join('');
|
| 318 |
|
|
@@ -435,6 +436,7 @@
|
|
| 435 |
}
|
| 436 |
|
| 437 |
let actionBtn = '';
|
|
|
|
| 438 |
if (isLocked && !isSF) {
|
| 439 |
actionBtn = '<button class="feed-action-btn feed-action-unlock" onclick="event.stopPropagation();BF.showDownloadModal(\'' + safeTitle + '\',\'' + safeArtist + '\',' + track.id + ')"><i data-lucide="lock" class="w-4 h-4"></i>Unlock ·
|
| 440 |
</body>
|
|
@@ -480,6 +482,7 @@
|
|
| 480 |
'<p class="text-sm text-gray-400 truncate">' + track.artist + '</p>' +
|
| 481 |
'</div>' +
|
| 482 |
'<div class="flex-shrink-0">' + actionBtn + '</div>' +
|
|
|
|
| 483 |
'</div>' +
|
| 484 |
'</div>' +
|
| 485 |
'</div>';
|
|
|
|
| 313 |
<h3 class="text-sm font-semibold text-white truncate group-hover:text-cyan-400 transition ${locked ? 'opacity-60' : ''}">${track.title}</h3>
|
| 314 |
<p class="text-xs text-gray-500 truncate ${locked ? 'opacity-60' : ''}">${track.artist}</p>
|
| 315 |
${BF.renderDL(track.id, track.title, track.artist)}
|
| 316 |
+
${BF.renderShare(track.id, track.title, track.artist)}
|
| 317 |
</div>
|
| 318 |
`}).join('');
|
| 319 |
|
|
|
|
| 436 |
}
|
| 437 |
|
| 438 |
let actionBtn = '';
|
| 439 |
+
let shareBtnHtml = '<button class="feed-action-btn" style="background:rgba(167,139,250,0.08);border:1px solid rgba(167,139,250,0.3);color:#a78bfa" onclick="event.stopPropagation();BF.showShareModal(\'' + safeTitle + '\',\'' + safeArtist + '\',' + track.id + ')"><i data-lucide="share-2" class="w-4 h-4"></i>Share</button>';
|
| 440 |
if (isLocked && !isSF) {
|
| 441 |
actionBtn = '<button class="feed-action-btn feed-action-unlock" onclick="event.stopPropagation();BF.showDownloadModal(\'' + safeTitle + '\',\'' + safeArtist + '\',' + track.id + ')"><i data-lucide="lock" class="w-4 h-4"></i>Unlock ·
|
| 442 |
</body>
|
|
|
|
| 482 |
'<p class="text-sm text-gray-400 truncate">' + track.artist + '</p>' +
|
| 483 |
'</div>' +
|
| 484 |
'<div class="flex-shrink-0">' + actionBtn + '</div>' +
|
| 485 |
+
'<div class="flex-shrink-0 flex items-center gap-2">' + actionBtn + shareBtnHtml + '</div>' +
|
| 486 |
'</div>' +
|
| 487 |
'</div>' +
|
| 488 |
'</div>';
|
track.html
CHANGED
|
@@ -299,7 +299,7 @@
|
|
| 299 |
<i data-lucide="repeat" class="w-5 h-5"></i>
|
| 300 |
<span class="text-sm">847</span>
|
| 301 |
</button>
|
| 302 |
-
<button class="flex items-center gap-2 text-gray-400 hover:text-
|
| 303 |
<i data-lucide="share-2" class="w-5 h-5"></i>
|
| 304 |
<span class="text-sm hidden sm:inline">Share</span>
|
| 305 |
</button>
|
|
|
|
| 299 |
<i data-lucide="repeat" class="w-5 h-5"></i>
|
| 300 |
<span class="text-sm">847</span>
|
| 301 |
</button>
|
| 302 |
+
<button class="flex items-center gap-2 text-gray-400 hover:text-purple-400 transition" onclick="BF.showShareModal('Midnight Synthesis', 'Aurora Void', 5)">
|
| 303 |
<i data-lucide="share-2" class="w-5 h-5"></i>
|
| 304 |
<span class="text-sm hidden sm:inline">Share</span>
|
| 305 |
</button>
|