azu Verified

Since Jul 2025 Followers 0

It is what it is, the strong find a way to survive always

About azu

It is what it is, the strong find a way to survive always

On Dirosales since Jul 2025
(function(){ // Follow/Unfollow (requires /api/store-follow.php to be implemented) var btn = document.getElementById('followBtn'); if (btn) { btn.addEventListener('click', function(){ if (btn.disabled) return; // If not logged in, open login modal if exists; else go to /login.php var modal = document.getElementById('loginModal'); if (modal) { var t = document.querySelector('[data-bs-target="#loginModal"]'); if (t) t.click(); else window.location.href = '/login.php'; } else { window.location.href = '/login.php'; } return; var endpoint = btn.getAttribute('data-endpoint') || '/api/store-follow.php'; var storeId = btn.getAttribute('data-store'); var following = /bookmark-check/.test(btn.innerHTML); var action = following ? 'unfollow' : 'follow'; btn.disabled = true; fetch(endpoint, { method: 'POST', headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, body: 'action=' + encodeURIComponent(action) + '&store_id=' + encodeURIComponent(storeId) }) .then(function(r){ return r.ok ? r.json() : Promise.reject(); }) .then(function(json){ if (json && json.success) { // Toggle state following = !following; btn.innerHTML = ' ' + (following ? 'Following' : 'Follow') + ''; } else { alert((json && json.message) || 'Could not update follow.'); } }) .catch(function(){ alert('Network error updating follow.'); }) .finally(function(){ btn.disabled = false; }); }); } // Share var shareBtn = document.getElementById('shareBtn'); var shareBtnTop = document.getElementById('shareBtnTop'); function handleShare(btn){ var shareUrl = window.location.href.split('#')[0]; var title = document.title; if (navigator.share) { navigator.share({ title: title, url: shareUrl }).catch(function(){}); } else if (navigator.clipboard) { navigator.clipboard.writeText(shareUrl).then(function(){ btn.textContent = 'Link copied!'; setTimeout(function(){ btn.innerHTML = ' Share'; }, 1200); }); } } if (shareBtn) { shareBtn.addEventListener('click', function(){ handleShare(shareBtn); }); } if (shareBtnTop) { shareBtnTop.addEventListener('click', function(){ handleShare(shareBtnTop); }); } } else { navigator.clipboard && navigator.clipboard.writeText(shareUrl).then(function(){ shareBtn.textContent = 'Link copied!'; setTimeout(function(){ shareBtn.innerHTML = ' Share'; }, 1200); }); } }); } })();