Fix login link — open via window.open with popup-blocker fallback, preventDefault on anchor
This commit is contained in:
+10
-2
@@ -97,8 +97,16 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
// Login button — opens Telegram bot deep-link, then locks itself
|
||||
const loginBtn = document.getElementById('login-btn');
|
||||
if (loginBtn) {
|
||||
loginBtn.addEventListener('click', () => {
|
||||
// No modal: swap label, drop the link, make the button unclickable
|
||||
loginBtn.addEventListener('click', (e) => {
|
||||
e.preventDefault();
|
||||
const url = loginBtn.href;
|
||||
// Open the link programmatically (reliable than relying on href after DOM changes)
|
||||
const w = window.open(url, '_blank');
|
||||
if (!w || w.closed) {
|
||||
// Popup blocked — fallback: navigate same window
|
||||
window.location.href = url;
|
||||
}
|
||||
// Then swap label and lock
|
||||
loginBtn.innerHTML = 'Approve in Telegram';
|
||||
loginBtn.removeAttribute('href');
|
||||
loginBtn.classList.add('btn-locked');
|
||||
|
||||
Reference in New Issue
Block a user